/* ---------- Tokens ---------- */
:root {
  --ground: #121212;      /* page background: neutral near-black */
  --raise: #1c1c1c;       /* placeholders, lightbox chrome */
  --line: #2b2a28;        /* hairlines */
  --ink: #ebe7e0;         /* main text: warm off-white */
  --ink-2: #a7a29a;       /* secondary text, captions */
  --ink-3: #6f6b65;       /* tertiary: counters */
  --focus: #d8b779;       /* keyboard focus only */

  --sans: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  --bar-h: 64px;
  --pad: clamp(16px, 4vw, 48px);
  --measure: 62ch;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
main:focus { outline: none; }

.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--ink); color: var(--ground); padding: 8px 12px;
}
.skip:focus { left: 8px; }

/* Condensed display type */
.display {
  font-family: var(--sans);
  font-stretch: 68%;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 0.95;
}

/* ---------- Top bar ---------- */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--pad) 0;
  display: flex; align-items: center; justify-content: space-between;
  transition: transform .35s ease, background-color .35s ease;
  background: linear-gradient(to bottom, rgba(18,18,18,.75), rgba(18,18,18,0));
}
.bar.solid { background: rgba(18,18,18,.94); }
.bar.hidden { transform: translateY(-100%); }

.logo {
  font-family: var(--sans);
  font-stretch: 75%;
  font-weight: 700;
  font-size: 1.35rem;
  text-decoration: none;
  letter-spacing: .01em;
  display: flex; flex-direction: column; line-height: 1;
}
.logo-tag {
  font-weight: 400;
  font-stretch: 100%;
  font-size: .62rem;
  letter-spacing: .34em;
  color: var(--ink-2);
  margin-top: 5px;
}
.logo-tag:empty { display: none; }
/* Over a photo (bar not yet solid): brighter, with a soft shadow, so it stays readable */
.bar:not(.solid) .logo-tag { color: var(--ink); text-shadow: 0 1px 3px rgba(0,0,0,.7), 0 0 8px rgba(0,0,0,.45); }
.nav { display: flex; gap: clamp(20px, 3vw, 40px); }
.nav a {
  font-family: var(--sans);
  font-stretch: 85%;
  font-weight: 500;
  font-size: 1rem;
  text-decoration: none;
  color: var(--ink-2);
  padding: 6px 0;
  border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.menu-toggle { display: none; font-family: var(--sans); font-stretch: 85%; font-size: 1rem; }

@media (max-width: 640px) {
  .menu-toggle { display: block; }
  .nav {
    position: fixed; inset: calc(var(--bar-h) + env(safe-area-inset-top, 0px)) 0 auto 0;
    flex-direction: column; gap: 0;
    background: var(--ground);
    padding: 8px var(--pad) 24px;
    border-bottom: 1px solid var(--line);
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { font-size: 1.6rem; font-stretch: 70%; padding: 10px 0; border: 0; }
}

/* ---------- Home ---------- */
.hero {
  position: relative;
  height: 100vh; height: 100svh;
  overflow: hidden;
  background: #000;
}
.hero .slide {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity 1.8s ease;
}
.hero .slide.on { opacity: 1; }
.hero .slide img { width: 100%; height: 100%; object-fit: cover; }
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,.6) 0%, rgba(0,0,0,0) 38%);
}
.hero-caption {
  position: absolute; z-index: 2;
  left: var(--pad); right: var(--pad);
  bottom: calc(clamp(24px, 6vh, 64px) + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: end; justify-content: space-between; gap: 24px;
}
.hero-caption a { text-decoration: none; display: block; max-width: 70ch; }
.hero-title { font-size: clamp(2.2rem, 6vw, 4.5rem); margin: 0; }
.hero-place { font-style: italic; color: var(--ink-2); margin: 10px 0 0; }
.hero-caption a:hover .hero-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.hero-dots { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 2px; flex: none; max-width: min(40vw, 480px); }
.hero-dots button { width: 18px; height: 18px; position: relative; }
@media (max-width: 640px) { .hero-dots { display: none; } }
.hero-dots button::after {
  content: ""; position: absolute; left: 3px; right: 3px; top: 8px; height: 2px;
  background: rgba(235,231,224,.35);
}
.hero-dots button[aria-current="true"]::after { background: var(--ink); }

/* ---------- Section heads ---------- */
.section { padding: clamp(56px, 10vh, 120px) var(--pad) 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 24px;
  margin-bottom: 28px;
}
.section-head h2 { font-size: clamp(2rem, 4vw, 3.2rem); margin: 0; }
.section-head a { color: var(--ink-2); font-family: var(--sans); font-stretch: 85%; }
.page-top { padding-top: calc(var(--bar-h) + clamp(32px, 7vh, 80px)); }
.page-title { font-size: clamp(3rem, 9vw, 7rem); margin: 0 0 32px; }

/* ---------- Story grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: clamp(28px, 3vw, 44px) clamp(16px, 2vw, 28px);
  list-style: none; margin: 0; padding: 0;
}
.tile a { text-decoration: none; display: block; }
.tile .frame { aspect-ratio: 3 / 2; background: var(--raise); overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: opacity .3s ease; }
.tile a:hover img { opacity: .82; }
.tile h3 { font-size: 1.75rem; margin: 14px 0 4px; }
.tile p { margin: 0; color: var(--ink-2); font-style: italic; font-size: .98rem; }
.grid.compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.grid.compact h3 { font-size: 1.35rem; }

.filters { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 0 40px; padding: 0; list-style: none; }
.filters button {
  font-family: var(--sans); font-stretch: 85%; font-size: 1.05rem;
  color: var(--ink-2); padding: 4px 0; border-bottom: 1px solid transparent;
}
.filters button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.filters button:hover { color: var(--ink); }
.archive-head { margin-top: clamp(64px, 10vh, 120px); }
.empty { color: var(--ink-2); font-style: italic; }

/* ---------- Story page ---------- */
.cover {
  position: relative;
  height: 100vh; height: 100svh;
  overflow: hidden; background: #000;
}
.cover img, .cover video { width: 100%; height: 100%; object-fit: cover; }
.cover::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,.72) 0%, rgba(0,0,0,.15) 45%, rgba(0,0,0,0) 70%);
}
.cover-text {
  position: absolute; z-index: 2;
  left: var(--pad); right: var(--pad);
  bottom: calc(clamp(40px, 9vh, 96px) + env(safe-area-inset-bottom, 0px));
}
.cover-title { font-size: clamp(3.5rem, 13vw, 11rem); margin: 0; max-width: 12ch; }
.cover-dateline { font-style: italic; font-size: clamp(1.05rem, 1.6vw, 1.3rem); color: var(--ink); margin: 18px 0 0; }
.cover-hook { max-width: 46ch; margin: 10px 0 0; color: var(--ink-2); font-size: clamp(1rem, 1.4vw, 1.15rem); }
.scroll-cue {
  position: absolute; z-index: 2; right: var(--pad);
  bottom: calc(clamp(40px, 9vh, 96px) + env(safe-area-inset-bottom, 0px));
  font-family: var(--sans); font-stretch: 85%; color: var(--ink-2);
  text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.scroll-cue::after { content: ""; width: 1px; height: 48px; background: var(--ink-2); animation: cue 2.4s ease-in-out infinite; transform-origin: top; }
@keyframes cue { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

.intro {
  max-width: var(--measure);
  margin: clamp(64px, 12vh, 140px) auto;
  padding: 0 var(--pad);
  font-size: clamp(1.1rem, 1.5vw, 1.25rem);
  line-height: 1.7;
}
.intro p { margin: 0 0 1.1em; }
.intro p:first-child::first-line { font-variant: small-caps; letter-spacing: .03em; }

.sequence { padding: 0 var(--pad); }
.shot {
  display: table;               /* caption width follows the photo's width */
  margin: 0 auto clamp(72px, 14vh, 160px);
}
.shot img {
  max-height: 88vh; max-height: 88svh;
  max-width: calc(100vw - 2 * var(--pad));
  width: auto; height: auto;
  cursor: zoom-in;
  background: var(--raise);
}
.shot figcaption {
  display: table-caption; caption-side: bottom;
  padding-top: 14px;
  color: var(--ink-2); font-size: .95rem; line-height: 1.55;
}
.shot .count { font-family: var(--sans); font-stretch: 85%; color: var(--ink-3); margin-right: 10px; }
.shot .text { max-width: var(--measure); display: inline; }
.shot.video { display: block; max-width: 1400px; }
.shot.video video, .shot.video iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; background: #000; }

.next-story { border-top: 1px solid var(--line); margin: 0 var(--pad); padding: clamp(48px, 9vh, 100px) 0; }
.next-story a { text-decoration: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: clamp(20px, 4vw, 56px); align-items: center; }
.next-story .label { color: var(--ink-2); font-style: italic; margin: 0 0 8px; }
.next-story h2 { font-size: clamp(2.4rem, 6vw, 5rem); margin: 0; }
.next-story .frame { aspect-ratio: 3 / 2; overflow: hidden; background: var(--raise); }
.next-story img { width: 100%; height: 100%; object-fit: cover; }
.next-story a:hover h2 { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 8px; }
@media (max-width: 640px) { .next-story a { grid-template-columns: 1fr; } }

/* ---------- Info ---------- */
.info { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.info .portrait { aspect-ratio: 4 / 5; background: var(--raise); overflow: hidden; }
.info .portrait img { width: 100%; height: 100%; object-fit: cover; }
.info .bio { max-width: var(--measure); font-size: clamp(1.1rem, 1.5vw, 1.25rem); line-height: 1.7; }
.info .bio p { margin: 0 0 1.1em; }
.contact { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.contact h2 { font-size: 2rem; margin: 0 0 12px; }
.contact p { margin: 0 0 6px; }
.note { color: var(--ink-3); font-style: italic; font-size: .95rem; }
@media (max-width: 800px) { .info { grid-template-columns: 1fr; } .info .portrait { max-width: 420px; } }

/* ---------- Talks (on the Info page) ---------- */
.talks { scroll-margin-top: var(--bar-h); }
.talks-intro { max-width: var(--measure); font-size: clamp(1.1rem, 1.5vw, 1.25rem); line-height: 1.7; margin: 0 0 clamp(36px, 6vh, 64px); }
.talks-intro p { margin: 0 0 1em; }
.talk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(56px, 9vh, 104px); }
.talk { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(20px, 4vw, 56px); align-items: start; }
.talk .frame { display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--raise); }
.talk .frame img { width: 100%; height: 100%; object-fit: cover; transition: opacity .3s ease; }
.talk .frame:hover img { opacity: .82; }
.talk h3 { font-size: clamp(1.8rem, 3vw, 2.6rem); margin: 0 0 8px; }
.talk .text { max-width: var(--measure); line-height: 1.7; }
.talk .text p { margin: 0 0 1em; }
.talk .text .talk-meta, .talk-meta { color: var(--ink-2); font-style: italic; }
.talk .text .talk-meta { margin: 0 0 16px; }
.more-talks { margin-top: clamp(56px, 9vh, 104px); padding-top: 28px; border-top: 1px solid var(--line); }
.more-talks h3 { font-size: 2rem; margin: 0 0 12px; }
.more-talks ul { list-style: none; margin: 0; padding: 0; max-width: 80ch; }
.more-talks li { padding: 12px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 800px) { .talk { grid-template-columns: 1fr; } }

/* ---------- Built site (build.py) ---------- */
[hidden] { display: none !important; }
.spacer { height: clamp(64px, 12vh, 140px); }
/* Story photos: as large as fits (88% of the screen height, full width), never larger than the original */
.shot img[style*="--ar"] {
  width: min(calc(100vw - 2 * var(--pad)), calc(88vh * var(--ar)), var(--w));
  width: min(calc(100vw - 2 * var(--pad)), calc(88svh * var(--ar)), var(--w));
  height: auto; max-width: none;
}
.about-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: clamp(32px, 5vw, 72px); border-top: 1px solid var(--line); padding-top: 28px; }
.about-block h3 { font-size: 2rem; margin: 0 0 12px; }
.about-block ul { list-style: none; margin: 0; padding: 0; }
.about-block li { padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); font-size: .98rem; line-height: 1.5; }

/* ---------- Footer ---------- */
.foot {
  margin-top: clamp(80px, 14vh, 160px);
  padding: 28px var(--pad) calc(28px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: space-between;
  color: var(--ink-3); font-size: .92rem;
}
.foot a { color: var(--ink-2); }
.foot .links { display: flex; gap: 22px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(8,8,8,.97);
  display: grid; grid-template-columns: 64px 1fr 64px; align-items: center;
}
.lightbox[hidden] { display: none; }
.lb-figure { margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; padding: 56px 0 24px; }
.lb-figure img { max-height: calc(100vh - 140px); max-width: 100%; object-fit: contain; }
.lb-figure figcaption { color: var(--ink-2); max-width: var(--measure); font-size: .92rem; margin-top: 12px; text-align: center; }
.lb-prev, .lb-next { font-size: 2.6rem; height: 100%; color: var(--ink-2); }
.lb-prev:hover, .lb-next:hover { color: var(--ink); }
.lb-close { position: absolute; top: 16px; right: var(--pad); font-family: var(--sans); font-stretch: 85%; color: var(--ink-2); }

/* ---------- States ---------- */
.status { padding: calc(var(--bar-h) + 80px) var(--pad); max-width: 70ch; }
.status h1 { font-size: 2.6rem; margin: 0 0 16px; }
.status code { font-size: .92em; background: var(--raise); padding: 2px 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
