/* ==========================================================
   Images of War — The Danish Resistance
   Design tokens
   ========================================================== */
:root {
  --ink: #0e0e0d;          /* page background */
  --ink-2: #171715;        /* raised surfaces */
  --ink-3: #22221f;        /* borders, wells */
  --bone: #ece8df;         /* primary text */
  --ash: #a39e93;          /* secondary text (7:1 on --ink) */
  --ash-2: #7d786e;        /* tertiary, large text only */
  --red: #c8102e;          /* Dannebrog red — rules and marks only */
  --red-text: #e8596a;     /* red when used as text (5.3:1 on --ink) */
  --focus: #f4d35e;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --measure: 66ch;
  --max: 1320px;

  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --t-fast: 160ms;
  --t-med: 320ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { text-decoration-color: var(--red); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; }

.skip-link {
  position: absolute; left: var(--gutter); top: -100px; z-index: 100;
  background: var(--bone); color: var(--ink); padding: .5rem 1rem;
  font-family: var(--mono); font-size: .875rem;
}
.skip-link:focus { top: 12px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Small caps / labels ---------- */
.label {
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ash);
}
.label--red { color: var(--red-text); }

/* ==========================================================
   Header / tabs
   ========================================================== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ink-3);
}
.site-header__inner {
  max-width: var(--max); margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 64px;
}
.wordmark {
  display: flex; align-items: center; gap: .75rem;
  text-decoration: none;
  font-family: var(--mono); font-size: .8125rem; letter-spacing: .16em; text-transform: uppercase;
}
.wordmark__flag {
  width: 22px; height: 16px; flex: none;
  background:
    linear-gradient(var(--bone), var(--bone)) 7px 0 / 3px 100% no-repeat,
    linear-gradient(var(--bone), var(--bone)) 0 6.5px / 100% 3px no-repeat,
    var(--red);
}
.wordmark__sub { color: var(--ash); }

.tabs { display: flex; gap: .25rem; }
.tab {
  display: inline-flex; align-items: center;
  min-height: 44px; padding: 0 1rem;
  font-family: var(--mono); font-size: .8125rem; letter-spacing: .08em; text-transform: lowercase;
  text-decoration: none; color: var(--ash);
  border-bottom: 2px solid transparent;
  transition: color var(--t-fast) ease, border-color var(--t-fast) ease;
}
.tab:hover { color: var(--bone); }
.tab[aria-current="page"] { color: var(--bone); border-bottom-color: var(--red); }

.wordmark, .tab { white-space: nowrap; }
@media (max-width: 900px) { .wordmark__sub { display: none; } }
@media (max-width: 560px) {
  .tab { padding: 0 .55rem; font-size: .75rem; }
  .wordmark { font-size: .75rem; letter-spacing: .12em; gap: .5rem; }
}
@media (max-width: 400px) {
  .wordmark > span:last-child { display: none; }
}

/* ==========================================================
   Hero
   ========================================================== */
.hero {
  position: relative;
  min-height: min(92vh, 900px);
  display: grid; align-items: end;
  overflow: hidden;
  isolation: isolate;
}
.hero__img {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 55%;
  filter: grayscale(1) contrast(1.05);
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(14,14,13,.55) 0%, rgba(14,14,13,0) 30%),
    linear-gradient(0deg, var(--ink) 0%, rgba(14,14,13,.85) 30%, rgba(14,14,13,0) 70%);
}
.hero__content {
  width: 100%; max-width: var(--max); margin: 0 auto;
  padding: 0 var(--gutter) clamp(3rem, 8vw, 6rem);
}
.hero__kicker { margin: 0 0 1.25rem; }
.hero h1 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(2.5rem, 8vw, 6.75rem);
  line-height: .98;
  letter-spacing: -.02em;
  max-width: 14ch;
}
.hero h1 em { font-style: italic; color: #d9d4c9; display: block; margin-top: .08em; font-size: .72em; }
.hero .label { text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.hero .hero__kicker { color: #f07b89; }
.hero__lede {
  margin: 1.75rem 0 0;
  max-width: 46ch;
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  color: var(--bone);
}
/* Full-screen quote title (same treatment as the opening) */
.hero--quote { min-height: 100vh; min-height: 100svh; }
.hero--quote .hero__img { transform: scale(1.08); object-position: 50% 50%; }
.hero--quote h2 {
  margin: 0;
  font-weight: 400; font-style: italic;
  font-size: clamp(2.25rem, 6.5vw, 5.5rem);
  line-height: 1.02;
  letter-spacing: -.015em;
  max-width: 16ch;
}
.hero--quote .hero__meta { display: block; max-width: 52ch; line-height: 1.7; color: var(--bone); }

.hero__meta {
  margin-top: 2rem;
  display: flex; flex-wrap: wrap; gap: .5rem 2rem;
}

/* ==========================================================
   Layout
   ========================================================== */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: clamp(4rem, 10vw, 8rem) 0; }
.section + .section { border-top: 1px solid var(--ink-3); }

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.25em; }
.prose p:last-child { margin-bottom: 0; }
.prose .dropcap::first-letter {
  float: left; font-size: 4.2em; line-height: .82; padding: .06em .1em 0 0; color: var(--bone);
}

.chapter-head {
  display: grid; gap: 1.5rem;
  grid-template-columns: 1fr;
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
}
@media (min-width: 900px) {
  .chapter-head { grid-template-columns: 220px 1fr; gap: 3rem; }
}
.chapter-head__num {
  font-family: var(--mono); font-size: .8125rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ash);
  border-top: 2px solid var(--red); padding-top: .75rem; align-self: start;
}
.chapter-head h2 {
  margin: 0 0 .5rem;
  font-weight: 400;
  font-size: clamp(2.25rem, 6vw, 4.5rem);
  line-height: 1;
  letter-spacing: -.015em;
}
.chapter-head .subtitle {
  margin: 0; font-style: italic; color: var(--ash);
  font-size: clamp(1.125rem, 2vw, 1.375rem);
}

.split {
  display: grid; gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .split { grid-template-columns: 220px 1fr; gap: 3rem; }
  .split--wide { grid-template-columns: 1fr 1fr; align-items: start; }
}

@media (max-width: 899px) { .split__spacer { display: none; } }

/* Full-screen pinned photo with overlaid text.
   The section is two screens tall: the photo sticks to the viewport while the
   text panel scrolls up and away, then the photo is shown on its own. */
.pin-photo { position: relative; height: 240vh; height: 240svh; }
.pin-photo__media {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
}
.pin-photo__media img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%;
  filter: grayscale(1);
  transform: scale(1.08); /* crop away the black film-scan border */
}
.pin-photo__caption {
  position: absolute; left: var(--gutter); bottom: 1.25rem;
  display: flex; gap: .6rem; align-items: baseline;
  color: var(--bone); background: rgba(14,14,13,.8); padding: .4rem .7rem;
}
.pin-photo__caption .frame { color: var(--ash); }
.pin-photo__text {
  position: absolute; inset: 0 0 auto 0;
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  padding-block: 96px 64px;
}
.pin-photo__text .wrap { width: 100%; }
.pin-photo__panel {
  max-width: 36rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: rgba(14, 14, 13, .8);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-left: 2px solid var(--red);
}
.pin-photo__panel p { font-size: clamp(1.0625rem, 1.6vw, 1.25rem); }
.pin-photo__panel h2 { font-weight: 400; font-size: clamp(2.25rem, 6vw, 4rem); line-height: 1; margin: .25rem 0 1.25rem; }
/* Colour (digital) photos: no film-border crop, no greyscale */
.pin-photo--colour .pin-photo__media img { filter: none; transform: none; }
/* Long text: the text sits in the flow over the pinned photo, then a full
   screen of photo follows once the text has scrolled away. */
.pin-photo--long { height: auto; }
.pin-photo--long .pin-photo__text {
  position: relative;
  margin-top: -100vh; margin-top: -100svh;
  padding-bottom: 170vh; padding-bottom: 170svh; /* text clears, then ~0.7 screen of photo alone */
  min-height: 0;
}
.pin-photo--long .pin-photo__panel { max-width: 44rem; }
/* Slide: the text sits over the pinned photo, then slides off to the left
   (driven by site.js), leaving the photo on its own. */
.pin-photo--slide { height: 280vh; height: 280svh; }
.pin-photo__overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center;
  padding: 88px 0 64px;
  will-change: transform;
}
.pin-photo__overlay .wrap { width: 100%; }
.pin-photo--slide .pin-photo__panel { max-width: 40rem; }
.section--continued { border-top: 0; }

/* ---------- Work at the camp: text beside photos, alternating sides ---------- */
.work__title {
  font-weight: 400; font-size: clamp(1.75rem, 3.6vw, 2.5rem); line-height: 1.1;
  margin: 0 0 clamp(1.5rem, 3vw, 2.25rem);
  padding-top: .75rem; border-top: 1px solid var(--ink-3);
}
.work__row {
  display: grid; gap: clamp(1.5rem, 4vw, 3rem);
  grid-template-columns: 1fr;
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
}
.work__row .prose { max-width: none; }
.work__sub {
  font-family: var(--mono); font-weight: 500; font-size: .8125rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--red-text);
  margin: 0 0 1rem;
}
.work__title:not(:first-child) { margin-top: clamp(1rem, 3vw, 2rem); }
.work__row .prose p { margin: 0; }
.work__fig .figure__btn img { height: auto; }
.work__fig.ratio-34 { max-width: 460px; }
@media (min-width: 900px) {
  .work__row { grid-template-columns: 1fr 1fr; align-items: center; gap: 4rem; }
  .work__row--flip .work__fig { order: -1; }
  .work__fig.ratio-34 { justify-self: center; width: 100%; }
}


/* ---------- Sideways-scrolling pinned section (Daily Life) ----------
   Default (phones, reduced motion, no JS): text, then the two photos, stacked.
   With .is-active (set by site.js on wide screens) the stage pins and the track
   slides left as you scroll, moving from photo 29 to photo 22. */
.hscroll { position: relative; }
.hscroll__slide { position: relative; }
.hscroll__img { display: block; width: 100%; height: auto; }
.hscroll__caption {
  position: absolute; left: var(--gutter); bottom: 1.25rem;
  color: var(--bone); background: rgba(14,14,13,.8); padding: .4rem .7rem;
}
.hscroll__caption .frame { color: var(--bone); }
.hscroll__slide--text { display: flex; flex-direction: column-reverse; }
.hscroll__text { padding: clamp(3rem, 8vw, 5rem) var(--gutter) 2rem; }
.hscroll__panel h2 { font-size: clamp(2.25rem, 6vw, 4rem); margin: .25rem 0 1.25rem; }
.hscroll__cols p { font-size: clamp(1.0625rem, 1.3vw, 1.1875rem); }

.hscroll.is-active { height: 450vh; height: 450svh; }
.hscroll.is-active .hscroll__stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
}
.hscroll.is-active .hscroll__track { display: flex; height: 100%; will-change: transform; }
.hscroll.is-active .hscroll__slide { flex: 0 0 100%; height: 100%; overflow: hidden; }
.hscroll.is-active .hscroll__slide--text { display: block; }
.hscroll.is-active .hscroll__img { height: 100%; object-fit: cover; }
.hscroll.is-active .hscroll__text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 88px var(--gutter) 64px;
}
.hscroll.is-active .hscroll__panel {
  max-width: 68rem;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  background: rgba(14, 14, 13, .82);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-left: 2px solid var(--red);
}
.hscroll.is-active .hscroll__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; max-width: none; }
.hscroll.is-active .hscroll__cols p { margin: 0; }


/* Map */
.map-figure { max-width: 1000px; margin: clamp(3rem, 7vw, 5rem) auto 0; }
.map {
  position: relative; z-index: 0; isolation: isolate; /* keep Leaflet layers below the sticky header */
  height: clamp(320px, 50vw, 480px);
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
}
.map .leaflet-tile-pane { filter: grayscale(1) invert(.92) contrast(.85) brightness(.95); }
.map .leaflet-container, .map.leaflet-container { background: var(--ink-2); font-family: var(--mono); }
.map .leaflet-control-attribution {
  background: rgba(14,14,13,.8); color: var(--ash); font-size: 11px;
}
.map .leaflet-control-attribution a { color: var(--bone); }
.map .leaflet-bar a {
  background: var(--ink-2); color: var(--bone); border-color: var(--ink-3);
  width: 36px; height: 36px; line-height: 36px;
}
.map .leaflet-bar a:hover { background: var(--ink-3); }
.map-arrow { overflow: visible; }
.map-arrow svg { display: block; filter: drop-shadow(0 1px 3px rgba(0,0,0,.7)); }
.map-arrow__label {
  position: absolute; left: 58px; top: -22px; white-space: nowrap;
  background: var(--red); color: #fff;
  font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 8px;
}
.map-ref span {
  white-space: nowrap; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--bone); text-shadow: 0 1px 3px #000, 0 0 6px #000;
}
.map__fallback { margin: 0; padding: 2rem; color: var(--ash); }
.map-figure figcaption {
  display: flex; gap: 1rem; align-items: baseline; flex-wrap: wrap;
  padding-top: .75rem; font-size: .9375rem; color: var(--ash);
}

/* Text sized to run the full height of the photo beside it.
   Both columns scale with the viewport, so a vw-based size keeps them matched. */
@media (min-width: 900px) {
  /* Sized from the text column's own width (cqi). The column and the photo are
     always equal widths, so text height tracks photo height at every screen size. */
  .prose--match { max-width: none; container-type: inline-size; }
  .prose--match p { font-size: 5.27cqi; line-height: 1.6; }
}

/* Sidebar facts */
.facts { margin: 0; padding: 0; list-style: none; display: grid; gap: 1.25rem; }
.facts dt { font-family: var(--mono); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ash); }
.facts dd { margin: .2rem 0 0; font-size: 1.5rem; line-height: 1.15; }

/* Pull quote */
.pull {
  margin: clamp(3rem, 7vw, 5rem) 0;
  padding-left: clamp(1rem, 3vw, 2rem);
  border-left: 2px solid var(--red);
  max-width: 34ch;
}
.pull p {
  margin: 0; font-size: clamp(1.5rem, 3.4vw, 2.375rem); line-height: 1.2; font-style: italic;
}
.pull footer { margin-top: 1rem; }

/* ==========================================================
   Timeline
   ========================================================== */
.timeline {
  list-style: none; margin: clamp(3rem, 6vw, 4rem) 0 0; padding: 0;
  display: grid; gap: 0;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--ink-3);
}
@media (min-width: 760px) { .timeline { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .timeline { grid-template-columns: repeat(6, 1fr); } }
.timeline li {
  padding: 1.25rem 1.25rem 1.5rem 0;
  border-bottom: 1px solid var(--ink-3);
  position: relative;
}
@media (min-width: 760px) {
  .timeline li { padding-right: 1.5rem; }
  .timeline li::before {
    content: ""; position: absolute; top: -4px; left: 0; width: 7px; height: 7px; background: var(--red);
  }
}
.timeline time { display: block; font-family: var(--mono); font-size: .8125rem; letter-spacing: .06em; color: var(--red-text); margin-bottom: .4rem; }
.timeline p { margin: 0; font-size: 1rem; line-height: 1.45; color: var(--bone); }

/* ==========================================================
   Figures
   ========================================================== */
.figure { margin: 0; }
.figure__btn {
  display: block; width: 100%; padding: 0; border: 0; background: var(--ink-2);
  position: relative; overflow: hidden;
}
.figure__btn img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 700ms var(--ease-out), filter var(--t-med) ease;
}
.figure__btn:hover img { transform: scale(1.025); }
.figure__btn::after {
  content: ""; position: absolute; right: 12px; top: 12px; width: 36px; height: 36px;
  background: rgba(14,14,13,.7) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ece8df' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7'/%3E%3C/svg%3E") center / 18px no-repeat;
  opacity: 0; transition: opacity var(--t-fast) ease;
}
.figure__btn:hover::after, .figure__btn:focus-visible::after { opacity: 1; }
.figure figcaption {
  display: flex; gap: .75rem; align-items: baseline;
  padding-top: .75rem;
  font-size: .9375rem; line-height: 1.45; color: var(--ash);
}
.figure figcaption .frame {
  font-family: var(--mono); font-size: .75rem; letter-spacing: .08em; color: var(--ash-2);
  flex: none;
}
.figure figcaption strong { color: var(--bone); font-weight: 500; }

/* Editorial photo grids on the home page */
.photo-grid {
  display: grid; gap: clamp(1rem, 2.5vw, 2rem);
  grid-template-columns: repeat(12, 1fr);
  margin: clamp(3rem, 7vw, 5rem) 0;
}
.photo-grid > * { grid-column: 1 / -1; }
@media (min-width: 760px) {
  .span-12 { grid-column: span 12; }
  .span-8  { grid-column: span 8; }
  .span-7  { grid-column: span 7; }
  .span-6  { grid-column: span 6; }
  .col-center.span-4 { grid-column: 5 / span 4; }
  .span-5  { grid-column: span 5; }
  .span-4  { grid-column: span 4; }
  .offset-1 { grid-column-start: 2; }
  .align-end { align-self: end; }
}
[class*="ratio-"] .figure__btn img { position: absolute; inset: 0; }
.ratio-32 .figure__btn { aspect-ratio: 3 / 2; }
.ratio-43 .figure__btn { aspect-ratio: 4 / 3; }
.ratio-34 .figure__btn { aspect-ratio: 3 / 4; }
.ratio-pair .figure__btn { aspect-ratio: 18 / 25; } /* portrait that matches a span-8 3:2 neighbour */
.ratio-wide .figure__btn { aspect-ratio: 21 / 9; }

/* Interlude: full-bleed band */
.band {
  position: relative; min-height: 70vh; display: grid; place-items: center;
  overflow: hidden; isolation: isolate; text-align: center;
}
.band img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.band::after { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(14,14,13,.55); }
.band blockquote { margin: 0; padding: 0 var(--gutter); max-width: 960px; }
.band blockquote p { margin: 0; font-size: clamp(1.5rem, 3.6vw, 3rem); line-height: 1.25; font-style: italic; }
.band blockquote footer { margin-top: 1.25rem; color: var(--bone); text-shadow: 0 1px 6px rgba(0,0,0,.8); }

/* Comparison strip */
.diptych-note {
  display: grid; gap: clamp(2rem, 5vw, 4rem); grid-template-columns: 1fr;
}
@media (min-width: 900px) { .diptych-note { grid-template-columns: 1fr 1fr; } }
.diptych-note h3 {
  margin: 0 0 .75rem; font-weight: 400; font-size: 1.75rem; line-height: 1.15;
}
.diptych-note p { margin: 0; color: var(--ash); }

/* CTA to library */
.cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem;
  padding: clamp(2rem, 5vw, 3rem); background: var(--ink-2); border: 1px solid var(--ink-3);
}
.cta h2 { margin: 0; font-weight: 400; font-size: clamp(1.75rem, 4vw, 2.75rem); line-height: 1.1; }
.cta p { margin: .5rem 0 0; color: var(--ash); }
.btn {
  display: inline-flex; align-items: center; gap: .6rem;
  min-height: 48px; padding: 0 1.4rem;
  font-family: var(--mono); font-size: .875rem; letter-spacing: .06em;
  text-decoration: none; color: var(--ink); background: var(--bone);
  border: 1px solid var(--bone);
  transition: background var(--t-fast) ease, color var(--t-fast) ease;
}
.btn:hover { background: transparent; color: var(--bone); }
.btn svg { width: 18px; height: 18px; }

/* ==========================================================
   Footer
   ========================================================== */
.site-footer {
  border-top: 1px solid var(--ink-3);
  padding: 3rem 0 4rem;
  color: var(--ash); font-size: .9375rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 3rem; }
.site-footer p { margin: 0; max-width: 60ch; }

/* ==========================================================
   Photo library
   ========================================================== */
.lib-head { padding: clamp(3rem, 8vw, 6rem) 0 clamp(2rem, 4vw, 3rem); }
.lib-head h1 {
  margin: .75rem 0 1rem; font-weight: 400;
  font-size: clamp(2.75rem, 8vw, 6rem); line-height: .95; letter-spacing: -.02em;
}
.lib-head p { margin: 0; max-width: 58ch; color: var(--ash); }

.filters {
  position: sticky; top: 64px; z-index: 40;
  background: color-mix(in srgb, var(--ink) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-block: 1px solid var(--ink-3);
}
.filters .wrap {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding-block: .75rem;
}
.chip {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 44px; padding: 0 1rem;
  background: transparent; border: 1px solid var(--ink-3); border-radius: 999px;
  font-family: var(--mono); font-size: .8125rem; letter-spacing: .03em; color: var(--ash);
  white-space: nowrap;
  transition: border-color var(--t-fast) ease, color var(--t-fast) ease, background var(--t-fast) ease;
}
.chip:hover { color: var(--bone); border-color: var(--ash-2); }
.chip[aria-pressed="true"] { color: var(--ink); background: var(--bone); border-color: var(--bone); }
.chip .count { opacity: .7; }
.filters__status { margin-left: auto; }
@media (max-width: 700px) {
  .filters .wrap { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .filters .wrap::-webkit-scrollbar { display: none; }
  .filters__status { display: none; }
}

/* Contact-sheet grid: frames read left-to-right in order, never cropped */
.masonry {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: clamp(1.25rem, 2.5vw, 2rem) clamp(.75rem, 2vw, 1.5rem);
  padding: clamp(2rem, 4vw, 3rem) 0 clamp(4rem, 8vw, 6rem);
}
.masonry .figure__btn { aspect-ratio: 4 / 3; }
.masonry .figure__btn img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.masonry .figure[hidden] { display: none; }

.lib-group-title {
  grid-column: 1 / -1;
  display: flex; align-items: baseline; gap: 1rem;
  margin: 1rem 0 1.5rem; padding-top: 1rem; border-top: 2px solid var(--red);
}
.lib-group-title:first-child { margin-top: 0; }
.lib-group-title h2 { margin: 0; font-weight: 400; font-size: clamp(1.5rem, 3vw, 2.25rem); line-height: 1.1; }
.lib-group-title[hidden] { display: none; }

/* ==========================================================
   Lightbox (native <dialog>)
   ========================================================== */
.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: rgba(8,8,7,.97); color: var(--bone);
}
.lightbox::backdrop { background: rgba(8,8,7,.9); }
.lightbox[open] { display: grid; grid-template-rows: auto 1fr auto; }
.lightbox__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem var(--gutter);
}
.lightbox__stage {
  position: relative; min-height: 0;
  display: grid; place-items: center;
  padding: 0 clamp(8px, 7vw, 96px);
}
.lightbox__stage img {
  position: absolute; inset: 0 clamp(8px, 7vw, 96px);
  width: calc(100% - 2 * clamp(8px, 7vw, 96px)); height: 100%; object-fit: contain;
  opacity: 0; transition: opacity 240ms ease;
}
.lightbox__stage img.is-loaded { opacity: 1; }
.lightbox__caption {
  padding: 1rem var(--gutter) 1.5rem;
  display: grid; gap: .35rem; max-width: 80ch; margin: 0 auto; text-align: center;
}
.lightbox__caption h2 { margin: 0; font-weight: 400; font-size: 1.375rem; }
.lightbox__caption p { margin: 0; color: var(--ash); font-size: 1rem; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 48px; height: 48px; padding: 0;
  background: transparent; border: 1px solid var(--ink-3); border-radius: 999px;
  transition: border-color var(--t-fast) ease, background var(--t-fast) ease;
}
.icon-btn:hover { border-color: var(--ash); background: var(--ink-2); }
.icon-btn svg { width: 22px; height: 22px; }
.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(14,14,13,.6);
}
.lightbox__nav--prev { left: clamp(8px, 2vw, 24px); }
.lightbox__nav--next { right: clamp(8px, 2vw, 24px); }
.lightbox__actions { display: flex; align-items: center; gap: .5rem; }
.lightbox__actions a.icon-btn { color: var(--bone); }

/* ==========================================================
   Motion
   ========================================================== */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out); }
.reveal.is-in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
  .reveal { opacity: 1; transform: none; }
  .figure__btn:hover img { transform: none; }
}
