/* ---------- tokens: the whole design lives here ---------- */
:root {
  --bg: #f4f0e7;            /* warm bone */
  --ink: #211e19;           /* soft near-black */
  --muted: #7c7364;         /* captions, meta */
  --accent: #a4593a;        /* clay — links, small marks */
  --rule: #ddd5c4;          /* hairlines */

  /* Two voices: the serif is for reading, the mono is for everything the
     site says about itself — brand, nav, captions, footer. */
  --serif: "EB Garamond", "Garamond Fallback", Georgia, serif;
  --sans: "DM Mono", "Mono Fallback", ui-monospace, Menlo, monospace;

  --step-statement: clamp(1.7rem, 1rem + 3.2vw, 2.6rem);
  --step-title: clamp(1.4rem, 1rem + 1.8vw, 2rem);
  --step-body: 1.0625rem;
  --step-caption: 0.75rem;   /* mono runs wide — smaller than a sans would be */

  --space: clamp(1.25rem, 4vw, 2.5rem);   /* base rhythm unit */
  --measure: 34rem;                        /* reading column */
  --page-max: 72rem;
}

/* ---------- base ---------- */
* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 var(--step-body)/1.7 var(--serif);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- layout ---------- */
.wrap { max-width: var(--page-max); margin-inline: auto; padding-inline: var(--space); }
.prose { max-width: var(--measure); }

header.site {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: var(--space); max-width: var(--page-max); margin-inline: auto;
  font-family: var(--sans); font-size: 0.8125rem; letter-spacing: -0.01em;
  word-spacing: -0.35ch;   /* matches the footer — names sit together */
}
header.site .brand { text-decoration: none; font-weight: 500; }
header.site nav { display: flex; gap: 1.5rem; }
header.site nav a { text-decoration: none; color: var(--muted); }
header.site nav a[aria-current="page"], header.site nav a:hover { color: var(--ink); }

footer.site {
  max-width: var(--page-max); margin: calc(var(--space) * 3) auto 0;
  padding: var(--space); border-top: 1px solid var(--rule);
  font-family: var(--sans); font-size: var(--step-caption); color: var(--muted);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  word-spacing: -0.35ch;   /* mono word-spaces run a full cell wide — tuck names together */
}

/* the eyebrow: a quiet mono label above a heading */
.eyebrow {
  font-family: var(--sans); font-size: 0.75rem;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); margin-bottom: calc(var(--space) * 0.75);
}

/* ---------- type ----------
   Everything you read is the serif (EB Garamond). The mono (DM Mono)
   is chrome only: brand, nav, captions, footer. */
.statement { font-size: var(--step-statement); line-height: 1.15; font-weight: 400; max-width: var(--measure); text-wrap: balance; }
.statement em { font-style: italic; color: var(--accent); }
h2 { font-size: var(--step-title); font-weight: 400; margin-block: calc(var(--space) * 2) var(--space); }
.passage { max-width: var(--measure); margin-block: var(--space); }
.caption, figcaption { font-family: var(--sans); font-size: var(--step-caption); color: var(--muted); margin-top: 0.5rem; }
figcaption.credit { text-align: right; }

/* ---------- photo layouts ---------- */
.photo-run { display: grid; gap: var(--space); grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-block: calc(var(--space) * 2); }
.photo-run figure.wide { grid-column: 1 / -1; }

/* the gallery: one continuous masonry flow, nothing cropped */
.gallery { columns: 3 260px; column-gap: var(--space); margin-block: calc(var(--space) * 2); }
.gallery figure { break-inside: avoid; margin-bottom: var(--space); }

.video { aspect-ratio: 16 / 9; width: 100%; border: 0; margin-block: calc(var(--space) * 2); }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; background: rgb(24 22 18 / 0.96); display: none; place-items: center; z-index: 10; }
.lightbox.open { display: grid; }
.lightbox img { max-width: min(92vw, 1600px); max-height: 88vh; width: auto; }
.lightbox button { position: absolute; background: none; border: 0; color: #f4f0e7; font: 400 2rem/1 var(--sans); cursor: pointer; padding: 1rem; }
.lightbox .close { top: 0.5rem; right: 0.75rem; }
.lightbox .prev { left: 0.25rem; top: 50%; translate: 0 -50%; }
.lightbox .next { right: 0.25rem; top: 50%; translate: 0 -50%; }
.lightbox figcaption { position: absolute; bottom: 1rem; left: 50%; translate: -50% 0; color: #cfc7b6; }

@media (prefers-reduced-motion: no-preference) {
  .lightbox { animation: fade 0.18s ease; }
  @keyframes fade { from { opacity: 0; } }
}

/* ---------- about ---------- */
.about-layout { display: grid; gap: calc(var(--space) * 1.5); grid-template-columns: minmax(0, 20rem) minmax(0, var(--measure)); align-items: start; margin-block: calc(var(--space) * 2); }
.about-layout .portrait { margin: 0; }
@media (max-width: 46rem) {
  .about-layout { grid-template-columns: 1fr; }
  .about-layout .portrait { max-width: 20rem; }
}

/* ---------- work entries (video page) ---------- */
.work { margin-block: calc(var(--space) * 2.5); max-width: 56rem; }
.work h2 { margin-block: 0 var(--space); }
.portrait { max-width: 26rem; margin-block: var(--space) 0; }

/* ---------- home: text beside portrait, like the composition it replaces ---------- */
.duo {
  display: grid; align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
  gap: calc(var(--space) * 2);
  margin-block: calc(var(--space) * 1.5);
  min-height: 62vh;
}
.duo .portrait { max-width: none; margin: 0; }
.duo h2 { margin-block: calc(var(--space) * 1.5) var(--space); }
@media (max-width: 52rem) {
  .duo { grid-template-columns: 1fr; min-height: 0; }
  .duo .portrait { max-width: 24rem; }
}

/* ---------- contact form ---------- */
.form {
  display: grid; gap: calc(var(--space) * 0.75);
  max-width: var(--measure); margin-block: calc(var(--space) * 1.5);
}
.field { display: grid; gap: 0.4rem; }
.field label {
  font-family: var(--sans); font-size: var(--step-caption);
  letter-spacing: 0.04em; text-transform: lowercase; color: var(--muted);
}
.field .req { color: var(--accent); }
.field input,
.field textarea {
  font: 400 var(--step-body)/1.6 var(--serif);
  color: var(--ink); background: transparent;
  border: 1px solid var(--rule); border-radius: 0;
  padding: 0.6rem 0.75rem; width: 100%;
  transition: border-color 0.15s ease;
}
.field textarea { resize: vertical; min-height: 9rem; }
.field input:hover,
.field textarea:hover { border-color: var(--muted); }
.field input:focus-visible,
.field textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] { border-color: var(--accent); }
.field .error {
  font-family: var(--sans); font-size: var(--step-caption); color: var(--accent);
  min-height: 1em;
}

/* honeypot — hidden from people, visible to bots */
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form button {
  justify-self: start;
  font-family: var(--sans); font-size: var(--step-caption); letter-spacing: 0.04em;
  color: var(--bg); background: var(--accent);
  border: 1px solid var(--accent); border-radius: 0;
  padding: 0.7rem 1.6rem; cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.form button:hover { background: var(--ink); border-color: var(--ink); }
.form button[disabled] { opacity: 0.55; cursor: default; }
.form button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.form-status {
  font-family: var(--sans); font-size: var(--step-caption); line-height: 1.6;
  border-left: 2px solid var(--rule); padding: 0.6rem 0 0.6rem 1rem;
  color: var(--muted);
}
.form-status:empty { display: none; }
.form-status[data-state="ok"] { border-color: var(--accent); color: var(--ink); }
.form-status[data-state="error"] { border-color: var(--accent); color: var(--accent); }

/* ---------- image loading: the develop ----------
   Each photo sits in a .ph frame that carries a tiny preview of itself
   (--lqip) and its exact aspect ratio. The preview shows the instant the
   page renders; the real photograph then develops into focus over it —
   soft and slightly breathed-in, easing to sharpness. The frame wraps only
   the image, so captions stay on the page, never on the photo. */
.ph {
  background: var(--lqip) center / cover no-repeat;
  overflow: hidden;
  position: relative;
}

/* 8-bit spinner: a pixel ring in clay, turning in chunky 45° steps.
   Appears only if a photo is genuinely slow (0.7s grace), gone on load. */
html.js .ph::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 4px; height: 4px;
  margin: -2px 0 0 -2px;
  background: transparent;
  box-shadow:
    0 -8px 0 rgb(164 89 58 / 1),
    6px -6px 0 rgb(164 89 58 / 0.8),
    8px 0 0 rgb(164 89 58 / 0.65),
    6px 6px 0 rgb(164 89 58 / 0.5),
    0 8px 0 rgb(164 89 58 / 0.35),
    -6px 6px 0 rgb(164 89 58 / 0.25),
    -8px 0 0 rgb(164 89 58 / 0.15),
    -6px -6px 0 rgb(164 89 58 / 0.1);
  animation:
    px-arrive 0.8s ease both,
    px-spin 0.9s steps(8) infinite;
}
.ph.done::after { display: none; }
@keyframes px-arrive { 0%, 85% { opacity: 0; } 100% { opacity: 1; } }
@keyframes px-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  html.js .ph::after { animation: px-arrive 0.8s ease both; }
}
.ph > img {
  opacity: 0;
  filter: blur(14px) saturate(0.85);
  transform: scale(1.03);
  transition:
    opacity 0.5s ease,
    filter 1.1s cubic-bezier(0.22, 1, 0.36, 1),
    transform 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
.ph > img.is-loaded {
  opacity: 1;
  filter: none;
  transform: none;
}

/* gallery cadence: each photo drifts up as it enters the viewport.
   Gated on html.js (set by lightbox.js) so nothing hides without JS. */
html.js .gallery figure {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--stagger, 0s);
}
html.js .gallery figure.in-view { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .ph > img { transition: opacity 0.3s ease; filter: none; transform: none; }
  html.js .gallery figure { opacity: 1; transform: none; transition: none; }
}

/* the hero portrait holds still — no scale settle above the fold */
.duo .ph > img { transform: none; }
