/* Jessica Close — book-style site
   Grid: 12 columns, 24px gutter. Rhythm: 8px unit, 24px baseline. */

@font-face {
  font-family: "Louize";
  src: url("../fonts/louize-display-medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Palette: brand green, off-white, black, white. Everything else is a tint of these. */
  --green: #2d3f2d;
  --paper: #fcfbf8;
  --black: #111111;
  --white: #ffffff;
  --ink: var(--black);
  --ink-soft: rgb(17 17 17 / .58);
  --rule: rgb(17 17 17 / .12);
  --plate: rgb(17 17 17 / .05);

  --u: 8px;
  --line: 24px;
  --gutter: 24px;
  --margin: clamp(16px, 7vw, 120px);
  --page-max: 1440px;

  --display: "Louize", "Libre Baskerville", Georgia, serif;
  --serif: "Libre Baskerville", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/var(--line) var(--serif);
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 var(--line); }

/* ---------- Grid ---------- */
.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--margin);
}
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
}

/* A "leaf" is one book page: generous vertical white space */
.leaf {
  padding-block: calc(var(--u) * 20);
  position: relative;
}
.leaf--full { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; }
.folio {
  text-align: center;
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--ink-soft);
  margin-top: calc(var(--u) * 12);
}

/* ---------- Type ---------- */
.smallcaps, .caption, .nav a, .label {
  font-family: var(--serif);
  font-size: 10.5px;
  line-height: 16px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.display {
  font-family: var(--display);
  font-weight: 500;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: .04em;
  line-height: 1.08;
  margin: 0;
}
.display--xl { font-size: clamp(40px, 7.2vw, 104px); }
.display--l  { font-size: clamp(30px, 4.4vw, 60px); }
.display--m  { font-size: clamp(22px, 2.4vw, 32px); }
.italic { font-style: italic; text-transform: none; letter-spacing: 0; }
.center { text-align: center; }
.muted { color: var(--ink-soft); }

.caption {
  text-align: center;
  color: var(--ink);
  margin-top: calc(var(--u) * 2);
  max-width: 64ch;
  margin-left: auto;
  margin-right: auto;
}
.caption em { font-style: italic; }

/* Justified book column with small-caps lead-in */
.column {
  grid-column: 4 / span 6;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}
.column p + p { text-indent: 2em; margin-top: calc(var(--line) * -1); }
.leadin { font-variant: small-caps; letter-spacing: .06em; text-transform: lowercase; }

/* ---------- Header ---------- */
.masthead {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px);
  transition: transform .4s ease, opacity .4s ease;
}
.masthead__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: calc(var(--u) * 9);
}
.masthead__mark img { height: 11px; width: auto; }
.masthead__mark { opacity: 0; transition: opacity .4s ease; }
.is-scrolled .masthead__mark, .masthead--solid .masthead__mark { opacity: 1; }
.nav { display: flex; gap: calc(var(--u) * 4); }
.nav a { color: var(--ink); padding: var(--u) 0; border-bottom: 1px solid transparent; }
.nav a:hover { border-color: currentColor; }
.nav a.nav__cta { color: var(--green); border-color: var(--green); }

/* ---------- Title page ---------- */
.title {
  text-align: center;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  padding-block: calc(var(--u) * 12) calc(var(--u) * 6);
}
.title__mark { grid-row: 2; }
.title__mark img { width: min(760px, 78vw); margin: 0 auto; }
.title__sub { margin-top: calc(var(--u) * 4); color: var(--green); }
.title__foot { grid-row: 3; align-self: end; color: var(--ink-soft); }

/* ---------- Plates ---------- */
.plate { margin: 0; }
.plate__frame { position: relative; background: var(--plate); overflow: hidden; }
.plate__frame img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.2s ease; }
.plate__frame img.is-loaded { opacity: 1; }
.plate--empty .plate__frame::after {
  content: attr(data-note);
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font: 10.5px/16px var(--serif); letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-soft);
}
.ratio-land { aspect-ratio: 3 / 2; }
.ratio-port { aspect-ratio: 2 / 3; }
.ratio-sq   { aspect-ratio: 4 / 5; }

/* Plate layouts — the rhythm of a book */
.spread { row-gap: calc(var(--u) * 16); }
.p-wide    { grid-column: 2 / span 10; }
.p-centre  { grid-column: 4 / span 6; }
.p-single  { grid-column: 5 / span 4; }
.p-pair-l  { grid-column: 2 / span 5; }
.p-pair-r  { grid-column: 7 / span 5; margin-top: calc(var(--u) * 16); }
.p-left    { grid-column: 2 / span 6; }
.p-right   { grid-column: 7 / span 5; }
.p-text-r  { grid-column: 9 / span 3; align-self: end; }
.p-trio    { grid-column: span 4; }

/* ---------- Folio grid: 12 columns inside the page, plus an edge column each side so plates can bleed ---------- */
.folio-grid {
  --edge: max(var(--margin), calc((100% - var(--page-max)) / 2 + var(--margin)));
  display: grid;
  grid-template-columns: [full-start] calc(var(--edge) - var(--gutter)) repeat(12, minmax(0, 1fr)) calc(var(--edge) - var(--gutter)) [full-end];
  column-gap: var(--gutter);
  row-gap: calc(var(--u) * 18);
  padding-block: calc(var(--u) * 6) calc(var(--u) * 12);
}
/* lines: 1 = viewport edge, 2 = content col 1, 14 = content end, 15 = viewport edge */
.lay-bleed   { grid-column: 1 / -1; }
.lay-edge-l  { grid-column: 1 / 11; }
.lay-edge-r  { grid-column: 5 / -1; }
.lay-wide    { grid-column: 3 / 13; }
.lay-big-l   { grid-column: 1 / 8; }
.lay-big-r   { grid-column: 8 / -1; }
.lay-pair-a  { grid-column: 3 / 8; }
.lay-pair-b  { grid-column: 9 / 14; margin-top: calc(var(--u) * 20); }
.lay-centre  { grid-column: 5 / 11; }
.lay-detail-r     { grid-column: 10 / 13; }
.lay-detail-l     { grid-column: 3 / 6; }
.lay-detail-end   { grid-column: 10 / 13; align-self: end; }
.lay-detail-start { grid-column: 3 / 6; align-self: start; margin-top: calc(var(--u) * 12); }

.lay-bleed .plate__frame, .lay-edge-l .plate__frame, .lay-edge-r .plate__frame { max-height: 92svh; }
.lay-big-l .plate__frame, .lay-big-r .plate__frame { max-height: 110svh; }

/* Captions sit against the inner edge of plates that bleed */
.lay .caption { max-width: 44ch; }
.lay-edge-l .caption, .lay-big-l .caption { margin-right: 0; text-align: right; }
.lay-edge-r .caption, .lay-big-r .caption { margin-left: 0; text-align: left; }
.lay-detail-r .caption, .lay-detail-end .caption, .lay-detail-l .caption, .lay-detail-start .caption { text-align: left; margin-left: 0; }

@media (max-width: 640px) {
  .folio-grid { grid-template-columns: [full-start] calc(var(--margin) - var(--gutter)) minmax(0, 1fr) calc(var(--margin) - var(--gutter)) [full-end]; row-gap: calc(var(--u) * 10); }
  .lay { grid-column: 2 / 3 !important; margin-top: 0 !important; }
  .lay-bleed, .lay-edge-l, .lay-edge-r, .lay-big-l, .lay-big-r { grid-column: 1 / -1 !important; }
  .lay-detail-r, .lay-detail-end { width: 66%; justify-self: end; }
  .lay-detail-l, .lay-detail-start { width: 66%; justify-self: start; }
  .lay .caption { padding-inline: var(--margin); text-align: center !important; margin-inline: auto !important; }
  .lay-detail-r .caption, .lay-detail-end .caption, .lay-detail-l .caption, .lay-detail-start .caption { padding-inline: 0; }
}

/* ---------- Contents ---------- */
.contents { list-style: none; margin: 0; padding: 0; text-align: center; }
.contents li { margin-bottom: calc(var(--u) * 3); }
.contents a { display: inline-block; padding: 2px 0; }
.contents .num { display: block; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.contents .name { font-size: 15px; }
.contents .where { display: block; color: var(--ink-soft); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; margin-top: 2px; }
.contents a:hover .name { color: var(--green); font-style: italic; }
.contents .private .name { color: var(--ink-soft); }
.tag {
  display: inline-block; margin-left: 6px; vertical-align: 1px;
  font-size: 9px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--green); border: 1px solid var(--rule); padding: 0 6px;
}

/* Contents hover preview */
.contents-wrap { position: relative; }
.cpreview {
  position: absolute; top: 0;
  left: calc(50% + 320px);
  width: min(280px, calc(50% - 340px));
  aspect-ratio: 4 / 5;
  background: var(--plate);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s ease, top .6s cubic-bezier(.2, .7, .2, 1);
}
.cpreview img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .5s ease; }
.cpreview img.is-loaded { opacity: 1; }
.cpreview:not(:has(img[src]))::after {
  content: attr(data-note);
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 10px/16px var(--serif); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft);
}
.cpreview-rule {
  position: absolute; height: 1px; background: var(--green);
  transform: scaleX(0); transform-origin: left center;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1), top .6s cubic-bezier(.2, .7, .2, 1);
  pointer-events: none;
}
.contents-wrap.is-active .cpreview { opacity: 1; }
.contents-wrap.is-active .cpreview-rule { transform: scaleX(1); }
@media not ((hover: hover) and (min-width: 1100px)) {
  .cpreview, .cpreview-rule { display: none; }
}

/* ---------- Credits / press ---------- */
.credits { grid-column: 3 / span 8; columns: 2; column-gap: calc(var(--gutter) * 3); }
.credits div { break-inside: avoid; margin-bottom: var(--line); text-align: center; }
.credits .pub { font-style: italic; }
.credits .when { display: block; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }

/* ---------- Correspondence ---------- */
.correspondence { text-align: center; }
.mail {
  display: inline-block;
  font-family: var(--display);
  color: var(--green);
  font-size: clamp(22px, 3.4vw, 44px);
  letter-spacing: .02em;
  border-bottom: 1px solid var(--green);
  padding-bottom: 4px;
  margin: calc(var(--u) * 5) 0;
}
.mail:hover { font-style: italic; }
.contact-lines { display: flex; justify-content: center; flex-wrap: wrap; gap: calc(var(--u) * 6); }

/* ---------- Project title page ---------- */
.ptitle { text-align: center; }
.ptitle .italic { font-family: var(--serif); font-size: clamp(18px, 1.8vw, 24px); color: var(--ink); margin-top: calc(var(--u) * 3); display: block; }
.byline { margin-top: calc(var(--u) * 8); color: var(--ink-soft); }
.byline div + div { margin-top: var(--u); }

.private-note {
  grid-column: 4 / span 6; text-align: center;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: calc(var(--u) * 6) 0;
}

.next { text-align: center; border-top: 1px solid var(--rule); }
.btn {
  display: inline-block; margin-top: calc(var(--u) * 4);
  font: 10.5px/16px var(--serif); letter-spacing: .16em; text-transform: uppercase;
  color: var(--paper); background: var(--green);
  padding: calc(var(--u) * 2) calc(var(--u) * 4);
}
.btn:hover { background: var(--ink); }
.btn--ghost { background: transparent; color: var(--green); border: 1px solid var(--green); }
.btn--ghost:hover { background: var(--green); color: var(--paper); }

/* ---------- Motion ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 1s ease, transform 1s ease; }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal, .plate__frame img { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Footer ---------- */
.colophon { border-top: 1px solid var(--rule); padding: calc(var(--u) * 5) 0; color: var(--ink-soft); }
.colophon .page { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--u); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .column { grid-column: 2 / span 10; }
  .credits { grid-column: 1 / -1; }
  .p-single { grid-column: 4 / span 6; }
  .p-text-r { grid-column: 2 / span 10; }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  body { font-size: 14.5px; }
  .leaf { padding-block: calc(var(--u) * 12); }
  .column, .credits, .private-note,
  .p-wide, .p-centre, .p-single, .p-pair-l, .p-pair-r, .p-left, .p-right, .p-text-r, .p-trio { grid-column: 1 / -1; }
  .p-pair-r { margin-top: 0; }
  .spread { row-gap: calc(var(--u) * 8); }
  .credits { columns: 1; }
  .column { text-align: left; hyphens: manual; }
  .nav { gap: calc(var(--u) * 2); }
  .nav a:not(.nav__cta):not(.nav__keep) { display: none; }
  .folio { margin-top: calc(var(--u) * 8); }
}
