/* =========================================================================
   Corporal Nels J. Bandy Memorial — 535th AAA AW Battalion
   Restrained, archival, contemplative. Paper/ivory, ink, one navy accent.
   ========================================================================= */

:root {
  /* Palette */
  --paper:       #f4f1ea;   /* ivory ground */
  --paper-2:     #ece7db;   /* recessed panel */
  --paper-3:     #e4ddcb;   /* deeper panel */
  --ink:         #1a1a1a;   /* body text */
  --ink-soft:    #514c43;   /* secondary text */
  --ink-faint:   #837b6d;   /* metadata */
  --navy:        #1f3b5c;   /* single accent */
  --navy-deep:   #16293f;
  --rule:        #c9c2b4;   /* borders (from discharge doc) */
  --rule-light:  #e0dacc;
  --gold:        #8a6d3b;   /* medals / faint highlight */

  /* Type */
  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --mono:  "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Rhythm */
  --measure: 34rem;         /* reading measure ~66ch */
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --chapter-gap: clamp(4.5rem, 12vw, 9rem);

  --shadow-plate: 0 1px 0 rgba(0,0,0,0.04), 0 18px 40px -28px rgba(22,41,63,0.5);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.05rem, 0.55vw + 0.95rem, 1.2rem);
  line-height: 1.72;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--navy); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--navy-deep); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0; }

/* Subtle paper grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

/* ---------- Skip link ---------- */
.skip {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--navy); color: #fff; padding: 0.6rem 1rem;
  font-family: var(--mono); font-size: 0.8rem;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- Mono utility ---------- */
.kicker, .meta, .credit, .nav a, .eyebrow, .tl-date, .medal-meta {
  font-family: var(--mono);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* =========================================================================
   Top navigation
   ========================================================================= */
.nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.7rem var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(120%) blur(8px);
  border-bottom: 1px solid var(--rule-light);
}
.nav__brand {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-soft); text-decoration: none;
  line-height: 1.25; white-space: nowrap;
}
.nav__brand b { color: var(--navy); font-weight: 600; }
.nav__links {
  display: flex; gap: 1.25rem; margin-left: auto; align-items: center;
}
.nav a {
  font-size: 0.7rem; letter-spacing: 0.09em; color: var(--ink-soft);
  text-decoration: none; padding: 0.2rem 0; border-bottom: 1px solid transparent;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--navy); }
.nav__toggle {
  display: none; margin-left: auto; background: none; border: 1px solid var(--rule);
  color: var(--ink); font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 0.4rem 0.7rem; cursor: pointer; border-radius: 2px;
}

/* Scroll progress bar */
.progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: var(--navy); z-index: 50; transition: width 0.1s linear;
}

@media (max-width: 820px) {
  .nav__toggle { display: inline-block; }
  .nav__links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--rule);
    padding: 0.5rem var(--gutter) 1rem;
    display: none;
  }
  .nav__links.open { display: flex; }
  .nav__links a { padding: 0.6rem 0; width: 100%; font-size: 0.8rem; border-bottom: 1px solid var(--rule-light); }
}

/* =========================================================================
   Layout helpers
   ========================================================================= */
main { position: relative; z-index: 1; }
.wrap { max-width: var(--measure); margin-inline: auto; padding-inline: var(--gutter); }
.wrap--wide { max-width: 60rem; }
.wrap--full { max-width: 74rem; }

.chapter { padding-block: var(--chapter-gap); position: relative; }
.chapter + .chapter { border-top: 1px solid var(--rule-light); }

.chapter p { max-width: var(--measure); }
.chapter .wrap > p { margin-inline: auto; }

/* Chapter header */
.chead { margin-bottom: 2.2rem; }
.kicker {
  display: flex; align-items: baseline; gap: 0.8rem;
  font-size: 0.72rem; color: var(--navy); margin-bottom: 0.9rem;
}
.kicker .num { color: var(--ink-faint); }
.kicker .dot { flex: 1; height: 1px; background: var(--rule); align-self: center; }
.kicker .when { color: var(--ink-faint); }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.12; letter-spacing: -0.012em; color: var(--ink); }
h2 { font-size: clamp(1.9rem, 3.5vw, 2.9rem); margin: 0 0 0.4rem; }
h3 { font-size: clamp(1.25rem, 2vw, 1.55rem); margin: 2.4rem 0 0.6rem; font-weight: 500; }
.lede { font-size: 1.18em; color: var(--ink-soft); font-weight: 400; }

/* Drop-cap for chapter openings */
.dropcap::first-letter {
  font-size: 3.4em; line-height: 0.8; float: left;
  padding: 0.06em 0.12em 0 0; color: var(--navy);
  font-weight: 600;
}

/* =========================================================================
   Hero
   ========================================================================= */
.hero {
  position: relative;
  min-height: min(92vh, 780px);
  display: flex; flex-direction: column; justify-content: center;
  padding: 6rem var(--gutter) 4rem;
  text-align: center;
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}
.hero__inner { max-width: 46rem; margin-inline: auto; position: relative; z-index: 2; }
.hero__eyebrow {
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--navy); margin-bottom: 1.8rem;
}
.hero h1 {
  font-size: clamp(2.6rem, 8vw, 5.4rem);
  font-weight: 600; letter-spacing: -0.02em; margin: 0;
}
.hero__dates {
  font-family: var(--mono); font-size: clamp(0.85rem, 2vw, 1.05rem);
  letter-spacing: 0.3em; color: var(--ink-soft); margin: 1.2rem 0 2rem;
}
.hero__sub {
  font-size: clamp(1.15rem, 2.4vw, 1.5rem); font-style: italic;
  color: var(--ink-soft); font-weight: 300; max-width: 34rem; margin: 0 auto 2.4rem;
  line-height: 1.5;
}
.hero__campaigns {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-faint);
  display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; justify-content: center;
}
.hero__campaigns span::after { content: "•"; margin-left: 1rem; color: var(--rule); }
.hero__campaigns span:last-child::after { content: ""; }
.hero__scroll {
  margin-top: 3rem; font-family: var(--mono); font-size: 0.7rem;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-faint);
}
.hero__scroll::after { content: ""; display: block; width: 1px; height: 2.4rem; margin: 0.8rem auto 0; background: var(--rule); }

/* Faint route motif behind hero */
.hero__motif { position: absolute; inset: 0; z-index: 1; opacity: 0.4; pointer-events: none; }
.hero__motif path { fill: none; stroke: var(--rule); stroke-width: 1; }

/* =========================================================================
   Figures / archival plates
   ========================================================================= */
figure { margin: 2.8rem 0; }
figure img { width: 100%; height: auto; border: 1px solid var(--rule); background: var(--paper-2); }

.fig--bleed { margin-inline: calc(50% - 50vw); max-width: 100vw; }
.fig--bleed img { border-left: 0; border-right: 0; }
.fig--wide { margin-inline: auto; max-width: 60rem; }
.fig--portrait { margin-inline: auto; max-width: 23rem; }
.fig--portrait figcaption { text-align: center; }

figcaption {
  margin-top: 0.7rem; font-family: var(--mono); font-size: 0.72rem;
  line-height: 1.55; color: var(--ink-faint); letter-spacing: 0.02em;
  text-transform: none; max-width: var(--measure);
}
.fig--bleed figcaption, .fig--wide figcaption { margin-inline: auto; padding-inline: var(--gutter); }
figcaption .credit { display: block; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.66rem; color: var(--ink-faint); margin-top: 0.3rem; }
figcaption b { color: var(--ink-soft); font-weight: 500; }

/* Placeholder plate — shown until a real archival scan is dropped in */
.plate {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; gap: 0.9rem;
  aspect-ratio: 3 / 2;
  background:
    repeating-linear-gradient(45deg, transparent 0 12px, rgba(31,59,92,0.03) 12px 13px),
    var(--paper-2);
  border: 1px solid var(--rule);
  color: var(--ink-faint);
  padding: 2rem;
}
.plate__mark {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--navy); opacity: 0.7;
}
.plate__desc { font-family: var(--serif); font-style: italic; color: var(--ink-soft); max-width: 30rem; font-size: 0.98rem; line-height: 1.5; }
.plate__src { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.plate--tall { aspect-ratio: 4 / 5; }

/* =========================================================================
   Pull quote
   ========================================================================= */
.pull {
  margin: var(--chapter-gap) auto; max-width: 44rem; text-align: center;
  padding-inline: var(--gutter);
}
.pull blockquote {
  margin: 0; font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.35; color: var(--navy);
  letter-spacing: -0.01em;
}
.pull cite {
  display: block; margin-top: 1.4rem; font-family: var(--mono); font-style: normal;
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint);
}

/* =========================================================================
   Fact table (service record)
   ========================================================================= */
.facts {
  border: 1px solid var(--rule); border-collapse: collapse; width: 100%;
  margin: 2.4rem 0; font-size: 0.98rem; background: var(--paper);
}
.facts th, .facts td { text-align: left; padding: 0.72rem 1rem; border-bottom: 1px solid var(--rule-light); vertical-align: top; }
.facts tr:last-child th, .facts tr:last-child td { border-bottom: 0; }
.facts th {
  font-family: var(--mono); font-weight: 500; font-size: 0.68rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--navy); background: var(--paper-2);
  width: 34%; white-space: nowrap;
}
.facts td { color: var(--ink); }

/* Open-question callout */
.callout {
  border-left: 3px solid var(--gold); background: var(--paper-2);
  padding: 1.1rem 1.4rem; margin: 2.4rem 0; font-size: 0.96rem; color: var(--ink-soft);
}
.callout b { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); display: block; margin-bottom: 0.4rem; }

/* =========================================================================
   Route map
   ========================================================================= */
.route { background: var(--navy-deep); color: var(--paper); border-block: 1px solid var(--navy); }
.route .chead h2 { color: var(--paper); }
.route .kicker { color: #9db4cf; }
.route .kicker .num, .route .kicker .when { color: #6f8bab; }
.route .kicker .dot { background: #3a5573; }
.route .lede { color: #c3d1e0; }
.route__map { margin: 2.5rem 0 1rem; position: relative; }
.route__map svg { width: 100%; height: auto; display: block; }
.route__legend {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.4rem 1.5rem; margin-top: 1.5rem;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.04em; color: #9db4cf;
}
.route__legend li { list-style: none; padding: 0.35rem 0; border-top: 1px solid #2c4864; }
.route__legend b { color: var(--paper); font-weight: 500; }
.route__legend span { color: #6f8bab; }
.route ul { padding: 0; margin: 0; }

/* Route SVG element styling */
.rt-land { fill: #24425f; stroke: #34506e; stroke-width: 0.7; stroke-linejoin: round; }
.rt-inset-land { fill: #23405d; }
.rt-arc { fill: none; stroke: #6f8bab; stroke-width: 1.5; stroke-dasharray: 2 6; stroke-linecap: round; }
.rt-path { fill: none; stroke: #d8b26a; stroke-width: 2; stroke-linejoin: round; }
.rt-node { fill: var(--paper); stroke: #d8b26a; stroke-width: 2; }
.rt-node--start { fill: #d8b26a; }
.rt-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; fill: var(--paper); text-transform: uppercase; }
.rt-date { font-family: var(--mono); font-size: 8.5px; fill: #9db4cf; }
.rt-sea { font-family: var(--serif); font-style: italic; font-size: 13px; fill: #47648a; }

/* Real-map theater: waypoint labels, US locator inset, draw-on-scroll */
.rt-water { fill: #16293f; }
.rt-graticule { fill: none; stroke: #24425f; stroke-width: 0.6; opacity: 0.5; }
.rt-inset-frame { fill: #14243a; stroke: #3a5573; stroke-width: 1; }
.rt-inset-title { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.14em; text-transform: uppercase; fill: #6f8bab; }
.rt-textlabel { font-family: var(--mono); font-size: 10px; letter-spacing: 0.03em; fill: var(--paper); }
.rt-textdate { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.02em; fill: #9db4cf; }
.rt-tiny { font-size: 8px; }
.rt-lead { stroke: #d8b26a; stroke-width: 0.75; opacity: 0.55; }
.rt-node--dday { r: 7.5; stroke-width: 2.5; }
.rt-compass-ring { fill: none; stroke: #3a5573; stroke-width: 1; }
.rt-compass-n { fill: #d8b26a; }
.rt-compass-lbl { font-family: var(--mono); font-size: 8px; letter-spacing: 0.1em; fill: #6f8bab; }

/* Interactive waypoints */
.rt-node[data-pop-title] { cursor: pointer; transition: stroke-width 0.12s ease, r 0.12s ease; }
.rt-node[data-pop-title]:hover, .rt-node[data-pop-title]:focus-visible { stroke-width: 3.5; }
.rt-node[data-pop-title]:focus { outline: none; }
.rt-node[data-pop-title]:focus-visible { outline: 2px solid #d8b26a; outline-offset: 2px; }

/* Waypoint popover */
.rt-pop {
  position: absolute; z-index: 6; left: 0; top: 0;
  width: max-content; max-width: 240px;
  transform: translate(-50%, calc(-100% - 10px));
  background: #0e1f31; border: 1px solid #34506e; border-radius: 4px;
  padding: 0.6rem 0.72rem 0.66rem;
  box-shadow: 0 12px 34px rgba(0,0,0,0.5);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.16s ease;
}
.rt-pop.show { opacity: 1; visibility: visible; }
.rt-pop.below { transform: translate(-50%, 10px); }
.rt-pop::after {
  content: ""; position: absolute; left: var(--arrow, 50%); top: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #0e1f31;
}
.rt-pop.below::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: #34506e; }
.rt-pop__title { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--paper); margin: 0 0 0.16rem; }
.rt-pop__meta { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.03em; color: #d8b26a; margin: 0 0 0.42rem; }
.rt-pop__body { font-family: var(--serif); font-size: 0.86rem; line-height: 1.42; color: #c9d6e4; margin: 0; }
@media (prefers-reduced-motion: reduce) { .rt-pop { transition: none; } }

/* Draw-on-scroll (guarded by .js so no-JS shows the full route) */
.js .route__map .rt-draw { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .route.is-drawn .rt-draw { stroke-dashoffset: 0; transition: stroke-dashoffset 2.4s ease-in-out; }
.js .route.is-drawn .rt-arc--main { transition-duration: 1.9s; }
.js .route__map .rt-node,
.js .route__map .rt-textlabel,
.js .route__map .rt-textdate { opacity: 0; }
.js .route.is-drawn .rt-node { opacity: 1; transition: opacity 0.5s ease 0.4s; }
.js .route.is-drawn .rt-textlabel,
.js .route.is-drawn .rt-textdate { opacity: 1; transition: opacity 0.6s ease 1s; }
@media (prefers-reduced-motion: reduce) {
  .js .route__map .rt-draw { stroke-dashoffset: 0; transition: none; }
  .js .route__map .rt-node,
  .js .route__map .rt-textlabel,
  .js .route__map .rt-textdate { opacity: 1; transition: none; }
}
@media (max-width: 720px) {
  .rt-textlabel, .rt-textdate, .rt-inset-labels { display: none; }
}

/* =========================================================================
   Decorations grid
   ========================================================================= */
.medals { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.4rem; margin: 2.6rem 0; }
.medal { border: 1px solid var(--rule); background: var(--paper); padding: 1.5rem; position: relative; }
.medal__ribbon { height: 6px; width: 100%; margin-bottom: 1.1rem; border-radius: 1px; }
.medal h3 { margin: 0 0 0.5rem; font-size: 1.12rem; }
.medal p { font-size: 0.92rem; color: var(--ink-soft); margin: 0; max-width: none; }
.medal--star { outline: 1px solid var(--gold); outline-offset: 3px; }
.medal__meta { display: block; margin-top: 0.8rem; font-size: 0.64rem; color: var(--gold); }

/* Ribbon color blocks (approximate, illustrative) */
.rb-amcampaign { background: linear-gradient(90deg,#3a4a9e 0 20%,#c8102e 20% 30%,#fff 30% 33%,#1a1a1a 33% 40%,#fff 40% 43%,#c8102e 43% 53%,#3a4a9e 53% 100%); }
.rb-eame { background: linear-gradient(90deg,#4a7a2a 0 12%,#5b7abf 12% 20%,#e2c34a 20% 30%,#c8102e 30% 34%,#e2c34a 34% 44%,#8b8b8b 44% 56%,#e2c34a 56% 66%,#c8102e 66% 70%,#e2c34a 70% 80%,#5b7abf 80% 88%,#4a7a2a 88% 100%); }
.rb-goodconduct { background: repeating-linear-gradient(90deg,#8a1a1a 0 8px,#c8102e 8px 16px); }
.rb-victory { background: linear-gradient(90deg,#c8102e,#e2c34a,#3a4a9e,#e2c34a,#c8102e); }
.rb-arrowhead { background: var(--navy); position: relative; }

/* =========================================================================
   Timeline rail (scroll-synced, desktop only)
   ========================================================================= */
.tl {
  position: fixed; top: 50%; right: 1.1rem; transform: translateY(-50%);
  z-index: 30; display: none; flex-direction: column; gap: 0.1rem;
}
.tl__item { display: flex; align-items: center; gap: 0.6rem; justify-content: flex-end; text-decoration: none; }
.tl__label {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-faint); opacity: 0; transform: translateX(6px);
  transition: opacity 0.2s, transform 0.2s, color 0.2s; white-space: nowrap;
}
.tl__tick { width: 14px; height: 1px; background: var(--rule); transition: all 0.2s; flex: none; }
.tl__item:hover .tl__label, .tl__item.active .tl__label { opacity: 1; transform: translateX(0); }
.tl__item.active .tl__tick { width: 26px; background: var(--navy); height: 2px; }
.tl__item.active .tl__label { color: var(--navy); }
.tl__item:hover .tl__tick { background: var(--navy); }
@media (min-width: 1180px) { .tl { display: flex; } }

/* =========================================================================
   Photo archive (grid + lightbox)
   ========================================================================= */
.archive-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.2rem; margin: 2.5rem 0;
}
.tile {
  border: 1px solid var(--rule); background: var(--paper-2); cursor: pointer;
  padding: 0; text-align: left; font: inherit; color: inherit; position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-plate); }
.tile:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.tile .plate { border: 0; aspect-ratio: 4/3; }
.tile img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.tile figcaption { padding: 0.7rem 0.85rem 0.9rem; margin: 0; }

.lightbox {
  position: fixed; inset: 0; z-index: 90; display: none;
  background: rgba(16,25,38,0.94); padding: clamp(1rem,4vw,3rem);
  flex-direction: column; align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox__stage { max-width: min(92vw, 60rem); max-height: 78vh; display: flex; }
.lightbox__stage img { max-height: 78vh; width: auto; border: 1px solid #33475f; }
.lightbox .plate { width: min(90vw, 44rem); aspect-ratio: 3/2; }
.lightbox__cap { color: #c3d1e0; font-family: var(--mono); font-size: 0.74rem; line-height: 1.6; max-width: 46rem; margin-top: 1.2rem; text-align: center; }
.lightbox__cap .credit { display: block; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.64rem; color: #7f96b0; margin-top: 0.35rem; }
.lightbox__close, .lightbox__nav {
  position: absolute; background: none; border: 1px solid #4a607d; color: #c3d1e0;
  font-family: var(--mono); cursor: pointer; border-radius: 3px; padding: 0.5rem 0.8rem;
}
.lightbox__close { top: 1.2rem; right: 1.2rem; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; }
.lightbox__nav { top: 50%; transform: translateY(-50%); font-size: 1.3rem; width: 3rem; height: 3rem; }
.lightbox__nav--prev { left: 1rem; }
.lightbox__nav--next { right: 1rem; }
.lightbox__close:hover, .lightbox__nav:hover { border-color: #c3d1e0; color: #fff; }

/* =========================================================================
   Generic content page (sources / families)
   ========================================================================= */
.page-head { padding: 5rem var(--gutter) 2.5rem; border-bottom: 1px solid var(--rule); text-align: center; }
.page-head .kicker { justify-content: center; color: var(--navy); }
.page-head h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); font-weight: 600; }
.page-head p { max-width: 40rem; margin: 1rem auto 0; color: var(--ink-soft); }

.prose h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-top: 3rem; }
.prose h3 { font-size: 1.2rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin: 0.5rem 0; }
.prose a { word-break: break-word; }

.reslist { list-style: none; padding: 0; margin: 2rem 0; }
.reslist li { border-top: 1px solid var(--rule-light); padding: 1.1rem 0; }
.reslist li:last-child { border-bottom: 1px solid var(--rule-light); }
.reslist h3 { margin: 0 0 0.3rem; font-size: 1.1rem; }
.reslist .meta { font-size: 0.66rem; color: var(--ink-faint); letter-spacing: 0.08em; }
.reslist p { margin: 0.35rem 0 0; font-size: 0.95rem; color: var(--ink-soft); max-width: 46rem; }

/* Step cards for "For Families" */
.steps { counter-reset: step; margin: 2.5rem 0; }
.step { position: relative; padding: 1.3rem 0 1.3rem 3.4rem; border-top: 1px solid var(--rule-light); }
.step:last-child { border-bottom: 1px solid var(--rule-light); }
.step::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: 1.35rem;
  font-family: var(--mono); font-size: 0.8rem; color: var(--navy); font-weight: 500;
  border: 1px solid var(--rule); width: 2.3rem; height: 2.3rem; display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.step h3 { margin: 0 0 0.4rem; font-size: 1.15rem; }
.step p { margin: 0; color: var(--ink-soft); font-size: 0.97rem; }

/* =========================================================================
   Footer
   ========================================================================= */
.foot {
  border-top: 1px solid var(--rule); background: var(--paper-2);
  padding: 3.5rem var(--gutter); margin-top: var(--chapter-gap);
  position: relative; z-index: 1;
}
.foot__inner { max-width: 60rem; margin-inline: auto; display: grid; grid-template-columns: 1.4fr 1fr; gap: 2.5rem; }
.foot h4 { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--navy); margin: 0 0 0.9rem; font-weight: 600; }
.foot p, .foot li { font-size: 0.9rem; color: var(--ink-soft); }
.foot ul { list-style: none; padding: 0; margin: 0; }
.foot li { padding: 0.28rem 0; }
.foot a { text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot__epitaph { font-style: italic; font-size: 1.05rem; color: var(--ink); max-width: 30rem; }
.foot__fine { grid-column: 1 / -1; border-top: 1px solid var(--rule); padding-top: 1.5rem; font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.05em; color: var(--ink-faint); line-height: 1.7; }
@media (max-width: 640px) { .foot__inner { grid-template-columns: 1fr; } }

/* =========================================================================
   Misc
   ========================================================================= */
.center { text-align: center; }
.mt-lg { margin-top: 2.5rem; }
.btn {
  display: inline-block; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em;
  text-transform: uppercase; text-decoration: none; color: var(--navy);
  border: 1px solid var(--navy); padding: 0.7rem 1.3rem; border-radius: 2px;
  transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--navy); color: var(--paper); }
.btn--ghost { color: var(--ink-soft); border-color: var(--rule); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

/* =========================================================================
   Immersion: scroll reveals, duotone dividers, slow zoom, video hero
   ========================================================================= */

/* Scroll reveals — guarded by .js so content is visible without JS */
.js [data-reveal] {
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.js [data-reveal].in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* Ken-Burns slow zoom */
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.09); } }
.kenburns { animation: kenburns 26s ease-out both; transform-origin: 50% 45%; }
@media (prefers-reduced-motion: reduce) { .kenburns { animation: none; } }

/* Full-bleed duotone chapter divider */
.divider {
  position: relative; margin-inline: calc(50% - 50vw); width: 100vw;
  height: clamp(320px, 62vh, 640px); overflow: hidden;
  background: var(--navy-deep); border-block: 1px solid var(--navy);
  display: flex; align-items: flex-end;
}
.divider__media { position: absolute; inset: 0; overflow: hidden; }
.divider__media img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); }
/* navy tone layer */
.divider__media::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: var(--navy); mix-blend-mode: color; opacity: 0.6; pointer-events: none;
}
/* legibility scrim */
.divider__scrim {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, rgba(16,25,38,0.15) 0%, rgba(16,25,38,0.35) 45%, rgba(16,25,38,0.82) 100%);
}
.divider__caption {
  position: relative; z-index: 3; width: 100%;
  max-width: 60rem; margin-inline: auto; padding: 2rem var(--gutter) 2.2rem;
  color: var(--paper);
}
.divider__title { font-family: var(--serif); font-size: clamp(1.4rem, 3vw, 2.1rem); font-weight: 500; margin: 0 0 0.4rem; color: var(--paper); max-width: 40rem; }
.divider__meta { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: #9db4cf; margin: 0; }
/* Placeholder divider (no scan yet) — toned hatch panel */
.divider--empty { background:
  repeating-linear-gradient(45deg, transparent 0 14px, rgba(157,180,207,0.05) 14px 15px), var(--navy-deep); }
.divider--empty .divider__mark {
  position: absolute; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 3;
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: #6f8bab;
}

/* Hero background video (muted, looping) — very faint motion behind the title */
.hero__video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 0; opacity: 0.5;
  filter: grayscale(1) contrast(1.05);
}
.hero__video-scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, color-mix(in srgb, var(--paper) 60%, transparent) 0%, color-mix(in srgb, var(--paper) 80%, transparent) 60%, var(--paper) 100%);
}
@media (prefers-reduced-motion: reduce) { .hero__video { display: none; } }

/* ---------- Contribute / upload form (families page) ---------- */
.contribute { margin: 3.5rem 0 1rem; padding-top: 2.2rem; border-top: 1px solid var(--rule); }
.contribute > p { color: var(--ink-soft); max-width: var(--measure); }
.upload { display: grid; gap: 1.1rem; max-width: var(--measure); margin-top: 1.6rem; }
.upload .field { display: grid; gap: 0.35rem; }
.upload label { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.upload .opt { text-transform: none; letter-spacing: 0; color: var(--ink-faint); }
.upload input[type="text"],
.upload textarea {
  font-family: var(--serif); font-size: 1rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule); border-radius: 3px;
  padding: 0.6rem 0.7rem; width: 100%;
}
.upload input[type="text"]:focus,
.upload textarea:focus,
.upload input[type="file"]:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.upload textarea { resize: vertical; line-height: 1.5; }
.upload input[type="file"] { font-family: var(--mono); font-size: 0.82rem; color: var(--ink-soft); }
.upload .field__hint { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-faint); margin: 0.1rem 0 0; }
.upload__status { font-family: var(--mono); font-size: 0.82rem; line-height: 1.5; margin: 0.3rem 0 0; min-height: 1.2em; }
.upload__status.is-ok { color: #3f6f4d; }
.upload__status.is-err { color: #9e3b2a; }
.upload button[disabled] { opacity: 0.55; cursor: default; }
