:root {
  --bg: #f4f3f0;
  --ink: #111111;
  --muted: #6e6c68;
  --line: #dcdad5;
  --gap: clamp(8px, 1.2vw, 16px);
  --pad: clamp(16px, 4vw, 56px);
  --header-h: 64px;
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e0e;
    --ink: #ecebe8;
    --muted: #8d8b87;
    --line: #262626;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Small uppercase labels */
.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
/* Exposure settings — mono but never uppercased (ƒ, mm and s must stay lowercase) */
.spec {
  display: inline-flex; flex-wrap: wrap; gap: 4px 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* Fade photos in over their average colour */
.tile img, .hero-img img, .card-cover img, .frame-img img {
  opacity: 0;
  transition: opacity .6s ease, transform .8s cubic-bezier(.2, .7, .2, 1);
}
.tile img.loaded, .hero-img img.loaded, .card-cover img.loaded, .frame-img img.loaded { opacity: 1; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  min-height: var(--header-h);
  padding: 8px var(--pad);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.wordmark { font-weight: 600; letter-spacing: -.01em; }
.nav { display: flex; gap: clamp(16px, 3vw, 32px); font-size: 15px; }
.nav a { color: var(--muted); transition: color .2s; }
.nav a:hover { color: var(--ink); }

/* Hero — a spread: who and what on the left page, the featured photograph filling the right page
   from the header to the bottom of the screen. Narrow screens stack it: words first, then the photo. */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  grid-template-rows: 1fr auto auto;
  grid-template-areas: "text photo" "index photo" "caption photo";
  /* Screen height under the header, or less for a landscape photo (60vw = the photo column) */
  min-height: min(calc(100vh - var(--header-h)), calc(60vw / var(--split-ratio, 1)));
  min-height: min(calc(100svh - var(--header-h)), calc(60vw / var(--split-ratio, 1)));
  margin-bottom: clamp(56px, 8vw, 112px);
}
.hero:not(.has-photo) { grid-template: "text" "index" / minmax(0, 1fr); min-height: 0; }
.hero-text, .hero-index, .hero-caption { padding: 0 clamp(32px, 4vw, 72px) 0 var(--pad); }
.hero-text {
  grid-area: text;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding-top: clamp(24px, 4vh, 48px);
  padding-bottom: clamp(24px, 4vh, 48px);
}
.hero-kicker { margin: 0 0 auto; padding-bottom: 32px; }
h1 {
  margin: 0;
  font-weight: 500;
  font-size: clamp(40px, 7.5vw, 112px);
  line-height: .95;
  letter-spacing: -.04em;
}
.hero h1 { font-size: clamp(40px, min(4.7vw, 8.8vh), 128px); }
.lede {
  margin: clamp(16px, 3vh, 28px) 0 0; max-width: 32em;
  color: var(--muted); font-size: clamp(17px, 1.25vw, 22px); text-wrap: pretty;
}

.hero-index { grid-area: index; }
.subjects { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.subjects a {
  display: flex; align-items: baseline; gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: clamp(17px, 1.35vw, 22px); letter-spacing: -.01em;
}
.subjects .mono { margin-left: auto; font-variant-numeric: tabular-nums; }
.subjects a::after { content: "→"; color: var(--muted); transition: transform .3s ease, color .2s; }
.subjects a:hover::after { color: var(--ink); transform: translateX(4px); }
.hero-more { display: inline-block; margin-top: 16px; transition: color .2s; }
.hero-more:hover { color: var(--ink); }

.hero-caption {
  grid-area: caption;
  margin: 0;
  padding-top: clamp(24px, 4vh, 48px);
  padding-bottom: 20px;
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  font-size: 14px; color: var(--muted);
}
.hero-figure { grid-area: photo; position: relative; margin: 0; }
.hero-img { position: absolute; inset: 0; overflow: hidden; cursor: zoom-in; }
.hero-img img { width: 100%; height: 100%; object-fit: cover; }

/* Gentle entrance for the words; the photo fades in over its average colour like every other photo */
.hero-text > *, .hero-index { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; }
.hero-text > :nth-child(2) { animation-delay: 60ms; }
.hero-text > :nth-child(3) { animation-delay: 120ms; }
.hero-index { animation-delay: 180ms; }

@media (max-width: 959px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: "text" "photo" "caption" "index";
    min-height: 0;
  }
  .hero-text, .hero-index, .hero-caption { padding: 0 var(--pad); }
  .hero-text { padding-top: clamp(20px, 5vw, 48px); padding-bottom: clamp(24px, 6vw, 48px); }
  .hero-kicker { padding-bottom: 14px; }
  .hero h1 { font-size: clamp(40px, 8.4vw, 80px); }
  .hero-img { position: relative; display: block; width: 100%; aspect-ratio: var(--stack-ratio, 4 / 5); }
  .hero-img img { position: absolute; inset: 0; }
  .hero-caption { padding-top: 10px; padding-bottom: 0; justify-content: space-between; }
  .hero-index { padding-top: clamp(32px, 7vw, 56px); }
}

/* Sections */
.block { padding: 0 var(--pad) clamp(64px, 10vw, 140px); }
.section-head {
  display: flex; align-items: baseline; gap: 24px; flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding: 20px 0 28px;
}
.section-label { margin: 0; min-width: 120px; font-size: 14px; font-weight: 700; color: var(--ink); }
.filters { display: flex; gap: 22px; }
.filters button { color: var(--muted); font-size: 15px; padding-bottom: 2px; border-bottom: 1px solid transparent; transition: color .2s, border-color .2s; }
.filters button:hover { color: var(--ink); }
.filters button[aria-selected="true"] { color: var(--ink); border-color: var(--ink); }
.count { margin-left: auto; }
.empty { color: var(--muted); margin: 0; }

/* Work grid */
/* Tiles are positioned by layout() in main.js; column-gap is read from here as the gap size */
.grid { position: relative; column-gap: var(--gap); }
.tile {
  display: block;
  position: absolute;
  overflow: hidden;
  cursor: zoom-in;
  animation: rise .5s ease both;
}
.tile img { width: 100%; height: auto; }
.tile:hover img { transform: scale(1.025); }
.tile-info {
  position: absolute; inset: auto 0 0 0;
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 32px 14px 12px;
  font-size: 14px; color: #fff; text-align: left;
  background: linear-gradient(transparent, rgba(0, 0, 0, .6));
  opacity: 0; transition: opacity .3s;
}
.tile-info .spec { color: rgba(255, 255, 255, .8); font-size: 11.5px; white-space: nowrap; }
.tile:hover .tile-info, .tile:focus-visible .tile-info { opacity: 1; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* Series cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
  gap: clamp(32px, 4vw, 56px) var(--gap);
}
.card { display: block; }
.card-cover { display: block; aspect-ratio: 3 / 2; overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card:hover .card-cover img { transform: scale(1.025); }
.card h3 { margin: 16px 0 4px; font-weight: 500; font-size: clamp(20px, 1.8vw, 26px); letter-spacing: -.02em; line-height: 1.2; }

/* About & contact */
.about, .contact {
  display: grid; grid-template-columns: 144px 1fr; gap: 24px;
  border-top: 1px solid var(--line);
  margin: 0 var(--pad);
  padding: 20px 0 clamp(64px, 10vw, 140px);
}
.about-body { max-width: 720px; }
.about-body p { margin: 0 0 1em; color: var(--muted); }
.about-body .about-lead {
  color: var(--ink);
  font-size: clamp(22px, 2.6vw, 34px);
  line-height: 1.2; letter-spacing: -.02em;
  margin-bottom: 1.2em;
}
.facts { margin: 40px 0 0; display: grid; }
.facts div { display: grid; grid-template-columns: 160px 1fr; padding: 12px 0; border-top: 1px solid var(--line); }
.facts dt { padding-top: 3px; }
.facts dd { margin: 0; }
.contact-link {
  grid-column: 2;
  font-size: min(34px, 7vw); /* shrinks only so it fits on phones */
  letter-spacing: -.03em; line-height: 1.1;
  width: fit-content;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .4s ease;
}
.contact-link:hover { background-size: 100% 1px; }
.contact-note { grid-column: 2; margin: 0; color: var(--muted); }

.site-footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 24px var(--pad) 32px;
  border-top: 1px solid var(--line);
}

/* Series page */
.series-head { padding: clamp(32px, 6vw, 88px) var(--pad) clamp(56px, 9vw, 128px); }
.back { display: inline-block; margin-bottom: clamp(40px, 7vw, 96px); transition: color .2s; }
.back:hover { color: var(--ink); }
.series-head h1 { max-width: 14ch; }
.series-meta { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 28px 0 0; }
.series-text { max-width: 620px; margin: 28px 0 0; color: var(--muted); font-size: clamp(17px, 1.5vw, 20px); }

.sequence {
  display: grid;
  gap: clamp(72px, 14vh, 180px);
  padding: 0 var(--pad) clamp(80px, 12vw, 160px);
}
.frame { margin: 0; justify-self: center; container-type: inline-size; }
.frame-img { display: block; width: 100%; overflow: hidden; cursor: zoom-in; }
.frame-img img { width: 100%; height: auto; }
.frame figcaption {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 6px 24px;
  margin-top: 14px; font-size: 14px;
}
.frame-n { padding-top: 2px; white-space: nowrap; }
.frame-about, .frame-tech { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.frame-title { color: var(--ink); }
.frame-caption { color: var(--muted); max-width: 60ch; }
.frame-when { margin-top: 4px; }
.frame-tech { align-items: flex-end; text-align: right; }
.frame-gear { color: var(--ink); }
.frame-tech .spec { justify-content: flex-end; }
@container (max-width: 640px) {
  .frame figcaption { grid-template-columns: auto 1fr; gap: 6px 20px; }
  .frame-tech { grid-column: 2; align-items: flex-start; text-align: left; margin-top: 6px; }
  .frame-tech .spec { justify-content: flex-start; }
}

.series-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  margin: 0 var(--pad);
  padding: 24px 0 clamp(64px, 10vw, 120px);
  border-top: 1px solid var(--line);
}
.series-link { display: flex; flex-direction: column; gap: 6px; }
.series-link.next { text-align: right; align-items: flex-end; }
.series-link-title { font-size: clamp(22px, 2.6vw, 34px); letter-spacing: -.02em; line-height: 1.15; transition: color .2s; }
.series-link:hover .series-link-title { color: var(--muted); }

/* Lightbox — always dark, photo first, shooting data underneath */
.lightbox {
  position: fixed; inset: 0;
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: #0a0a0a; color: #ededed;
  overflow: hidden;
}
.lightbox[open] {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  grid-template-rows: minmax(0, 1fr) auto;
  animation: fade .25s ease;
}
.lightbox::backdrop { background: #0a0a0a; }
.lb-stage {
  grid-column: 2; grid-row: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 0; padding: 60px 0 8px;
}
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-prev, .lb-next { grid-row: 1; font-size: 22px; color: #777; transition: color .2s; }
.lb-prev { grid-column: 1; }
.lb-next { grid-column: 3; }
.lb-prev:hover, .lb-next:hover, .lb-close:hover { color: #fff; }
.single .lb-prev, .single .lb-next, .single .lb-count { visibility: hidden; }
.lb-close { position: absolute; top: 18px; right: 24px; font-size: 14px; color: #aaa; z-index: 1; }
.lb-count { position: absolute; top: 21px; left: 24px; color: #777; }
.lb-info {
  grid-column: 1 / -1; grid-row: 2;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 40px;
  padding: 16px 24px 22px;
  font-size: 14px;
}
.lb-about, .lb-tech { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lb-caption { color: #9a9a9a; max-width: 70ch; }
.lb-caption:empty, .lb-title:empty, .lb-gear:empty { display: none; }
.lb-when { color: #777; margin-top: 3px; }
.lb-tech { align-items: flex-end; text-align: right; }
.lb-settings { color: #ededed; justify-content: flex-end; gap: 4px 20px; font-size: 13px; }
@keyframes fade { from { opacity: 0; } }

@media (max-width: 700px) {
  .about, .contact { grid-template-columns: 1fr; gap: 16px; }
  .contact-link, .contact-note { grid-column: 1; }
  .facts div { grid-template-columns: 1fr; gap: 2px; }
  .count { display: none; }
  .tile-info { opacity: 1; }
  .lightbox[open] { grid-template-columns: 0 minmax(0, 1fr) 0; }
  .lb-prev, .lb-next { display: none; }
  .lb-info { flex-direction: column; align-items: flex-start; padding: 12px 16px 18px; }
  .lb-tech { align-items: flex-start; text-align: left; }
  .lb-settings { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
