/* Fonts are loaded in index.html. Redaction grades encode record integrity;
   IBM Plex Mono carries measurements, coordinates, and controls. */

/* ===========================================
   BASE RESET & VARIABLES
   =========================================== */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --font-display: 'Redaction', Georgia, 'Times New Roman', serif;
  --font-record: 'Redaction 35', 'Redaction', Georgia, 'Times New Roman', serif;
  --font-degraded: 'Redaction 20', 'Redaction 35', Georgia, 'Times New Roman', serif;
  --font-data: 'IBM Plex Mono', ui-monospace, monospace;

  /* Palette — pure black/grey silhouette field; the only colour is human red. */
  --bg: #080808;
  --surface: #121212;
  --border: #1a1a1a;
  --text: #c0c0c0;
  --text-dim: #404040;
  /* Text tiers (2026-10 legibility pass): --text-dim stays for rules and inactive marks; text uses these, measured on
     the dark ground: quiet ~6:1 for labels, keys, axis and sources; faint ~4.7:1 for lines that recede on purpose. */
  --text-quiet: #8a9099;
  --text-faint: #767b83;
  --accent: #e0e0e0;
  --bird: #c0c0c0;
  --bird-head: #e0e0e0;
  --human: #8b1a1a;
  --human-bright: #c0392b;
  --human-text: #e2574b;      /* the same red, light enough for small text on the dark ground (~4.6:1) */
  --sea-base: #060a18;
  --map-bg: #0a0a14;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ===========================================
   HERO THRESHOLD
   =========================================== */

#hero-intro {
  position: fixed;
  inset: 0;
  z-index: 70;
  overflow: hidden;
  background: var(--bg);
  opacity: 1;
  transition: opacity 1.2s ease;
}

#hero-intro[hidden] { display: none; }
#hero-intro.is-leaving { opacity: 0; pointer-events: none; }

.hero-intro-media,
.hero-intro-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-intro-media img {
  object-fit: cover;
  object-position: center;
  opacity: 0.9;
  transform: scale(1.018);
  transition: transform 12s cubic-bezier(0.22, 0.61, 0.36, 1);
}

#hero-intro.is-ready .hero-intro-media img { transform: scale(1); }

.hero-intro-copy {
  position: absolute;
  z-index: 2;
  left: 7vw;
  top: 50%;
  width: min(540px, 39vw);
  transform: translateY(-50%);
  text-shadow: 0 2px 18px var(--bg), 0 0 42px var(--bg);
}

.hero-intro-kicker,
.hero-intro-meta,
.hero-intro-index,
#hero-intro-enter {
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-intro-kicker {
  margin-bottom: 18px;
  color: var(--human-text);
}

#hero-intro h1 {
  max-width: 5.5em;
  margin: 0;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 96px;
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: 0;
}

#hero-intro h1 span { display: block; }

#hero-intro-thesis {
  max-width: 28em;
  margin-top: 28px;
  color: var(--text);
  font-family: var(--font-record);
  font-size: 20px;
  font-style: italic;
  line-height: 1.45;
}

.hero-intro-meta {
  margin-top: 30px;
  color: var(--text-quiet);
}

#hero-intro-enter {
  display: inline-flex;
  align-items: center;
  gap: 28px;
  min-height: 42px;
  margin-top: 34px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid rgba(192, 57, 43, 0.72);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

#hero-intro-enter:hover,
#hero-intro-enter:focus-visible {
  color: var(--accent);
  border-color: var(--human-bright);
  outline: none;
}

#hero-intro-enter:disabled { cursor: default; }

/* What the opening says while the map loads, or when it cannot (js/hero.js) */
#hero-intro-status {
  min-height: 1.6em;
  max-width: 32em;
  margin-top: 16px;
  font-family: var(--font-data);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-quiet);
}
#hero-intro-status a { color: var(--text); text-decoration: underline; text-underline-offset: 0.2em; }
#hero-intro.is-unavailable #hero-intro-enter { display: none; }

/* Who made it, and the way back to the portfolio */
.hero-intro-byline {
  position: absolute;
  z-index: 2;
  left: 34px;
  top: 28px;
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-quiet);
  text-decoration: none;
}
.hero-intro-byline:hover, .hero-intro-byline:focus-visible { color: var(--accent); }

.hero-intro-index {
  position: absolute;
  z-index: 2;
  right: 34px;
  bottom: 28px;
  padding-right: 13px;
  border-right: 1px solid var(--human-bright);
  color: var(--text-quiet);
}

.hero-intro-continuation {
  position: absolute;
  z-index: 2;
  left: 7vw;
  bottom: 0;
  width: 1px;
  height: 9vh;
  background: rgba(192, 57, 43, 0.7);
}

@media (max-width: 760px) {
  .hero-intro-media img {
    object-position: 58% center;
    opacity: 0.72;
  }

  .hero-intro-copy {
    left: 22px;
    top: 108px;
    width: calc(100vw - 44px);
    transform: none;
  }

  #hero-intro h1 {
    max-width: 5.2em;
    font-size: 58px;
  }

  #hero-intro-thesis {
    max-width: 19em;
    margin-top: 20px;
    font-size: 16px;
  }

  .hero-intro-meta {
    margin-top: 22px;
    font-size: 10px;
  }

  #hero-intro-enter { margin-top: 24px; }

  .hero-intro-index {
    right: 22px;
    bottom: 22px;
    max-width: 60vw;
    font-size: 10px;
    text-align: right;
  }

  .hero-intro-continuation { left: 22px; }
}

/* ===========================================
   LAYER 0: MAP
   =========================================== */

#map {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  opacity: 0;
  transition: opacity 2s ease;
}
#map.visible { opacity: 1; }

/* ── Grain / paper texture overlay (direction A) ──
   feTurbulence noise as a data-URI, tiled and held still over the whole field.
   soft-light keeps it as texture (not a grey wash); very low opacity. Above the
   map (z 5), below all narrative text. Disabled under reduced-motion-agnostic —
   it doesn't move, so it stays. */
#grain {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* Hide Mapbox branding */
/* Map credits: Mapbox requires its wordmark and attribution on a public map. They stay, small and dark, in the top-left
   corner, which the story leaves empty; the compact attribution opens on its (i). */
.mapboxgl-ctrl-top-left { margin: 14px 0 0 14px; opacity: 0.72; transition: opacity 0.3s ease; }
.mapboxgl-ctrl-top-left:hover, .mapboxgl-ctrl-top-left:focus-within { opacity: 1; }
.mapboxgl-ctrl-attrib.mapboxgl-compact { background: rgba(8, 8, 8, 0.78); }
.mapboxgl-ctrl-attrib, .mapboxgl-ctrl-attrib a { color: var(--text-quiet) !important; font-family: var(--font-data); font-size: 11px; }
.mapboxgl-ctrl-attrib-button { filter: invert(1) brightness(0.8); }

/* ===========================================
   LAYER 1: PARTICLE CONTAINER
   =========================================== */

#particle-container {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
#particle-container.hidden { display: none; }

/* ===========================================
   LAYER 2: OPENING TEXT
   =========================================== */

#opening-text {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: none;
}

.opening-inner {
  max-width: 600px;
  padding: 40px;
  text-align: center;
}

.opening-line {
  display: block;
  font-family: var(--font-record);
  font-weight: 400;
  color: var(--accent);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1.2s ease, transform 1.2s ease;
  margin-bottom: 6px;
  line-height: 1.45;
}

.opening-line.visible {
  opacity: 1;
  transform: translateY(0);
}

.opening-line.l1, .opening-line.l2 {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.18;
}
.opening-line.l2 { margin-bottom: 28px; }
.opening-line.l3, .opening-line.l4 { font-size: 19px; color: var(--text); }
.opening-line.l4 { margin-bottom: 28px; }
.opening-line.l5, .opening-line.l6, .opening-line.l7 { font-size: 15px; color: var(--text-faint); }

/* The thematic peak: number-as-evidence, then a damaged record voice. */
.opening-line.l6 {
  font-family: var(--font-record);
  font-weight: 600;
  color: var(--human-bright);
  letter-spacing: 0.01em;
}
.opening-line.l7 {
  font-family: var(--font-degraded);
  color: var(--text-quiet);
  opacity: 0;
}
.opening-line.l7.visible { opacity: 0.78; }

/* ===========================================
   LAYER 3: BIRD LABEL
   =========================================== */

#bird-label {
  position: fixed;
  bottom: 48px;
  left: 48px;
  z-index: 40;
  opacity: 0;
  transition: opacity 1s ease;
  padding: 4px 0 4px 16px;
  border-left: 1px solid var(--border);
}
#bird-label.visible { opacity: 1; }

.label-tag {
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--text-quiet);
  margin-bottom: 7px;
}
/* a filed record opens with its catalogue mark */
.label-tag::before { content: '▸ '; color: var(--bird); opacity: 0.6; }

.label-name {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.01em;
  color: var(--bird);
  margin-bottom: 5px;
}

.label-sub {
  font-family: var(--font-data);
  font-size: 11px;
  color: var(--text-quiet);
  letter-spacing: 0.05em;
}

#bird-date {
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--bird);
  opacity: 0;
  margin-top: 10px;
  transition: opacity 0.8s ease;
  font-variant-numeric: tabular-nums;
}
#bird-date.visible { opacity: 0.85; }

/* ===========================================
   LAYER 4: PROGRESS BAR
   =========================================== */

#progress-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  height: 1px;
  width: 0%;
  background: var(--bird);
  z-index: 40;
  opacity: 0;
  transition: opacity 1s ease, width 1.8s ease;
}
#progress-bar.visible { opacity: 0.5; }

body.scroll-scene-active #progress-bar {
  transition: opacity 1s ease;
}

/* ===========================================
   STORY STEP CAPTION
   =========================================== */

#story-step-caption {
  position: fixed;
  top: 26vh;
  right: 48px;
  z-index: 45;
  width: min(340px, calc(100vw - 96px));
  padding: 0 0 0 18px;
  border-left: 1px solid rgba(192, 192, 192, 0.18);
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  text-shadow: 0 1px 8px var(--bg), 0 0 18px var(--bg);
}
#story-step-caption.visible {
  opacity: 1;
  transform: translateY(0);
}
#story-step-caption.near-complete {
  opacity: 0.42;
}

.story-step-progress {
  position: absolute;
  left: -1px;
  top: 0;
  width: 1px;
  height: var(--scene-progress, 0%);
  max-height: 100%;
  background: var(--human-bright);
}

.story-step-eyebrow {
  margin-bottom: 11px;
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.28em;
  line-height: 1.7;
  text-transform: uppercase;
  color: var(--text-quiet);
}

.story-step-title {
  margin-bottom: 12px;
  font-family: var(--font-record);
  font-size: 24px;
  line-height: 1.15;
  color: var(--accent);
}

.story-step-body {
  font-family: var(--font-data);
  font-size: 11px;
  line-height: 1.8;
  color: rgba(192, 192, 192, 0.74);
}

/* ===========================================
   NARRATIVE BRIDGE
   =========================================== */

#narrative-bridge {
  position: fixed;
  left: clamp(28px, 8vw, 120px);
  bottom: 18vh;
  z-index: 58;
  width: min(560px, calc(100vw - 56px));
  padding-left: 26px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
#narrative-bridge.visible {
  opacity: 1;
  transform: translateY(0);
}
#narrative-bridge.leaving {
  opacity: 0;
  transform: translateY(-8px);
}

.narrative-bridge-rule {
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 2px;
  width: 1px;
  background: linear-gradient(180deg, var(--human-bright), rgba(192, 192, 192, 0.1));
}

.narrative-bridge-eyebrow {
  margin-bottom: 12px;
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.34em;
  line-height: 1.8;
  text-transform: uppercase;
  color: var(--text-quiet);
}

.narrative-bridge-title {
  max-width: 14em;
  margin-bottom: 12px;
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 52px);
  line-height: 0.98;
  color: var(--accent);
}

.narrative-bridge-body {
  max-width: 38em;
  font-family: var(--font-data);
  font-size: 11px;
  line-height: 1.9;
  color: rgba(192, 192, 192, 0.74);
}

/* ===========================================
   LAYER 5: CLICK HINT
   =========================================== */

#click-hint {
  position: fixed;
  bottom: 48px;
  right: 48px;
  z-index: 40;
  opacity: 0;
  transition: opacity 1s ease;
  cursor: pointer;
  pointer-events: none;
  text-align: center;
}
#click-hint.visible {
  opacity: 1;
  pointer-events: all;
}

.hint-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--human-bright);
  margin: 0 auto 10px;
  animation: pulse-dot 2s ease-in-out infinite;
}

.hint-dot.scroll-arrow {
  width: 0;
  height: 0;
  border-radius: 0;
  background: transparent;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 10px solid var(--human-bright);
  margin: 0 auto 10px;
  animation: bounce-arrow 1.6s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.5); }
}

@keyframes bounce-arrow {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50%       { opacity: 1;   transform: translateY(8px); }
}

.hint-text {
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-quiet);
  line-height: 1.6;
}

/* ===========================================
   LAYER 6: TIME AXIS
   =========================================== */

#time-axis {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: min(600px, 80vw);
  z-index: 40;
  opacity: 0;
  transition: opacity 1s ease;
  pointer-events: none;
}
#time-axis.visible {
  opacity: 1;
  pointer-events: all;
}

.axis-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-quiet);
}

#time-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 1px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
#time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--human-bright);
  cursor: pointer;
  transition: transform 0.1s ease;
}
#time-slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

#axis-year-label {
  text-align: center;
  margin-top: 10px;
  font-family: var(--font-data);
  font-size: 11px;
  color: var(--text-quiet);
  letter-spacing: 0.12em;
}

#location-evidence-key {
  position: fixed;
  left: 48px;
  bottom: 42px;
  z-index: 40;
  width: 220px;
  padding-left: 16px;
  border-left: 1px solid rgba(192, 57, 43, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.8s ease, visibility 0s linear 0.8s;
}

#location-evidence-key.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.8s ease;
}

.evidence-key-title {
  margin-bottom: 12px;
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-quiet);
}

.evidence-key-method {
  max-width: 24em;
  margin-top: 10px;
  font-family: var(--font-data);
  font-size: 10px;
  line-height: 1.55;
  color: rgba(192, 192, 192, 0.74);
}

.evidence-key-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 19px;
  font-family: var(--font-data);
  font-size: 11px;
  color: rgba(192, 192, 192, 0.74);
}

.evidence-key-mark {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--human-bright);
}

.evidence-key-mark.locality {
  opacity: 0.68;
  filter: blur(0.35px);
}

.evidence-key-mark.broad {
  width: 13px;
  height: 13px;
  margin-left: -4px;
  border: 1px solid rgba(192, 57, 43, 0.46);
  background: rgba(192, 57, 43, 0.12);
  filter: blur(0.45px);
}

.evidence-key-mark.unspecified {
  width: 15px;
  height: 1px;
  margin-left: -5px;
  border-radius: 0;
  background: repeating-linear-gradient(90deg, rgba(192, 57, 43, 0.6) 0 2px, transparent 2px 4px);
}

#incident-size-key {
  position: fixed;
  right: 48px;
  bottom: 42px;
  z-index: 40;
  width: 204px;
  padding-right: 16px;
  border-right: 1px solid rgba(192, 57, 43, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.8s ease, visibility 0s linear 0.8s;
}

#incident-size-key.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.8s ease;
}

.incident-size-title {
  margin-bottom: 10px;
  font-family: var(--font-data);
  font-size: 11px;
  line-height: 1.5;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--text-quiet);
}

.incident-size-scale {
  display: grid;
  grid-template-columns: repeat(4, 42px);
  justify-content: end;
  gap: 4px;
}

.incident-size-item {
  display: grid;
  grid-template-rows: 42px 16px;
  justify-items: center;
  align-items: end;
  font-family: var(--font-data);
  font-size: 10px;
  color: rgba(192, 192, 192, 0.74);
}

.incident-size-field {
  position: relative;
  display: block;
  width: 42px;
  height: 42px;
}

.incident-size-circle {
  position: absolute;
  left: 50%;
  bottom: 0;
  display: block;
  border-radius: 50%;
  background: rgba(139, 26, 26, 0.78);
  box-shadow: 0 0 0 1px rgba(192, 57, 43, 0.72);
  transform: translateX(-50%);
}

.incident-size-method {
  margin-top: 9px;
  font-family: var(--font-data);
  font-size: 10px;
  line-height: 1.55;
  text-align: right;
  color: rgba(192, 192, 192, 0.74);
}

/* ===========================================
   LAYER 7: REVELATION
   =========================================== */

#revelation {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
}
#revelation.visible { opacity: 1; }

.rev-number {
  font-family: var(--font-record);
  font-size: clamp(64px, 9vw, 104px);
  font-weight: 600;
  color: var(--human-bright);
  line-height: 1;
  margin-bottom: 24px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  transition: none;
}
/* the figure is logged as a record line, not a headline */
.rev-number::before {
  content: 'RECORDED DEAD';
  display: block;
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.4em;
  color: var(--text-quiet);
  margin-bottom: 16px;
}

.rev-line {
  font-family: var(--font-record);
  font-size: 19px;
  color: var(--text);
  margin-bottom: 8px;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.rev-line.visible { opacity: 1; }
.rev-line.secondary { color: var(--text-faint); font-size: 16px; }

/* ===========================================
   LAYER 8: DATA CUTS
   =========================================== */

#data-cuts {
  position: relative;
  z-index: 30;
  display: none;
  pointer-events: none; /* INT-7 — see .data-cut */
}

.data-cut {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 80px clamp(28px, 8vw, 120px);
  opacity: 0;
  transition: opacity 0.8s ease;
  /* INT-7 — let the map receive hover in the space around the annotations,
     so the death dots stay explorable while reading the data cuts. */
  pointer-events: none;
}
.data-cut.visible { opacity: 1; }

.cut-inner { pointer-events: auto; }

.cut-inner {
  max-width: 720px;
  width: 100%;
  padding: 8px 0 8px 28px;
  border-left: 1px solid rgba(192, 192, 192, 0.18);
  background: transparent;
}

.cut-label {
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-quiet);
  margin-bottom: 12px;
}

.cut-title {
  font-family: var(--font-record);
  font-size: 26px;
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
  margin-bottom: 10px;
  line-height: 1.2;
}

.cut-meta {
  margin-bottom: 24px;
  font-family: var(--font-data);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-quiet);
}

#scale-chart {
  width: 100%;
  min-height: 240px;
}

#scale-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

#scale-chart .axis-label {
  font-family: var(--font-data);
  font-size: 11px;
  fill: var(--text-dim);
}

/* Density Toggle (Cut 2) */

.density-grains {
  max-width: 650px;
  margin-top: 26px;
  border-top: 1px solid rgba(192, 192, 192, 0.16);
  border-bottom: 1px solid rgba(192, 192, 192, 0.16);
}

.density-grain {
  display: grid;
  grid-template-columns: 18px 124px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 48px;
  opacity: 0.82;           /* the unselected archive stays readable; the active one is full */
  transition: opacity 0.7s ease;
}

.density-grain + .density-grain {
  border-top: 1px solid rgba(192, 192, 192, 0.1);
}

.density-grain.active {
  opacity: 1;
}

.density-grain-mark {
  display: block;
  justify-self: center;
}

.density-grain-mark.bird {
  width: 15px;
  height: 1px;
  background: rgba(224, 224, 224, 0.8);
  box-shadow: 5px -3px 0 -0.5px rgba(224, 224, 224, 0.45);
}

.density-grain-mark.human {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--human);
  box-shadow: 0 0 0 1px rgba(192, 57, 43, 0.72);
}

.density-grain-kind,
.density-grain strong {
  font-family: var(--font-data);
  font-size: 11px;
  line-height: 1.6;
}

.density-grain-kind {
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--text-quiet);
}

.density-grain strong {
  font-weight: 400;
  color: var(--accent);
}

#density-toggle {
  display: flex;
  flex-wrap: wrap;
  margin-top: 24px;
  width: fit-content;
  background: transparent;
}

.toggle-btn {
  min-height: 36px;
  margin-left: -1px;
  padding: 8px 13px;
  border: 1px solid rgba(192, 192, 192, 0.18);
  border-radius: 0;
  background: rgba(10, 10, 20, 0.26);
  color: var(--text-quiet);
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0;
  cursor: pointer;
  transition: border-color 0.6s ease, background-color 0.6s ease, color 0.6s ease;
}

.toggle-btn:first-child {
  margin-left: 0;
}

.toggle-btn:hover,
.toggle-btn:focus-visible {
  position: relative;
  border-color: rgba(192, 192, 192, 0.48);
  color: var(--text);
  outline: none;
}

.toggle-btn.active {
  position: relative;
  border-color: var(--human-bright);
  background: rgba(139, 26, 26, 0.12);
  color: var(--accent);
}

.density-method-note {
  max-width: 62em;
  margin-top: 16px;
  font-family: var(--font-data);
  font-size: 11px;
  line-height: 1.7;
  color: rgba(192, 192, 192, 0.74);
}

/* Voice Section (Cut 3) */

.voice-section {
  border-left: 2px solid var(--accent);
}

.voice-label {
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-quiet);
  margin-bottom: 24px;
}

.voice-text p {
  font-family: var(--font-record);
  font-size: 18px;
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
  line-height: 1.75;
  margin-bottom: 20px;
}
.voice-text p:last-child { margin-bottom: 0; }

/* ===========================================
   FLOW BRIDGE
   =========================================== */

.flow-bridge {
  position: relative;
  z-index: 31;
  display: none;
  min-height: 86vh;
  align-items: center;
  padding: 80px clamp(28px, 8vw, 120px);
  pointer-events: none;
}

.flow-bridge-inner {
  max-width: 680px;
  padding-left: 30px;
  border-left: 1px solid rgba(192, 192, 192, 0.18);
}

.flow-bridge-kicker {
  margin-bottom: 18px;
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.34em;
  line-height: 1.8;
  text-transform: uppercase;
  color: var(--text-quiet);
}

.flow-bridge p {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 56px);
  line-height: 0.98;
  color: var(--accent);
}

.flow-bridge .flow-bridge-secondary {
  max-width: 44em;
  font-family: var(--font-data);
  font-size: 11px;
  line-height: 1.9;
  color: rgba(192, 192, 192, 0.74);
}

/* ===========================================
   TOOLTIP
   =========================================== */

#tooltip {
  position: fixed;
  background: transparent;
  border: none;
  border-left: 2px solid var(--human-bright);
  border-top: 1px solid rgba(192, 192, 192, 0.14);
  padding: 14px 0 14px 18px;
  font-family: var(--font-data);
  font-size: 13px;
  color: var(--text);
  pointer-events: none;
  z-index: 200;
  display: none;
  max-width: 320px;
  min-width: 240px;
  line-height: 1.8;
  text-shadow: 0 1px 8px var(--bg), 0 0 16px var(--bg);
}
#tooltip.visible { display: block; }

.tooltip-year {
  color: var(--human-bright);
  font-size: 12px;
  letter-spacing: 0.15em;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.tooltip-count {
  font-family: var(--font-record);
  font-style: normal;
  font-weight: 600;
  font-size: 22px;
  color: var(--accent);
  margin-bottom: 6px;
}
.tooltip-detail {
  color: var(--text-quiet);
  font-size: 12px;
}

/* INT-5 — the absent fields, same language as the memorial grid tooltip */
.tooltip-absent {
  font-family: var(--font-degraded);
  color: var(--text-quiet);
  font-size: 11px;
  line-height: 1.8;
  letter-spacing: 0.02em;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  opacity: 0.7;
}

/* ===========================================
   LAYER 9: TRANSITION OVERLAY
   =========================================== */

#transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}

#equator-line {
  position: absolute;
  top: 50%;
  left: -100%;
  width: 300%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200,200,212,0.2), transparent);
  animation: equator-sweep 2s ease forwards;
  animation-play-state: paused;
}

@keyframes equator-sweep {
  from { left: -100%; }
  to   { left: 0%; }
}

/* ===========================================
   LAYER 10: ENDING
   =========================================== */

#ending {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 1s ease, visibility 0s linear 1s;
}
#ending.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 1s ease;
}

#ending-comparison {
  display: grid;
  grid-template-rows: auto repeat(3, minmax(0, 1fr));
  min-height: 0;
  padding: clamp(28px, 4.2vh, 52px) clamp(32px, 5vw, 80px) 22px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.ending-header {
  display: grid;
  grid-template-columns: minmax(150px, 0.55fr) minmax(360px, 1.45fr) minmax(260px, 0.8fr);
  align-items: end;
  gap: clamp(24px, 4vw, 72px);
  padding-bottom: clamp(22px, 3vh, 36px);
}

.ending-header h2 {
  max-width: 18em;
  font-family: var(--font-record);
  font-size: clamp(28px, 3.1vw, 48px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.06;
  color: var(--accent);
}

.ending-header p {
  max-width: 34em;
  font-family: var(--font-data);
  font-size: 11px;
  line-height: 1.75;
  color: var(--text-quiet);
}

.ending-panel {
  display: grid;
  grid-template-columns: minmax(150px, 0.55fr) minmax(260px, 1.45fr) minmax(180px, 0.8fr) minmax(260px, 0.8fr);
  align-items: center;
  gap: clamp(24px, 4vw, 72px);
  min-width: 0;
  padding: clamp(14px, 2.1vh, 24px) 0;
  border-top: 1px solid var(--border);
}

.ending-kicker,
.ending-label {
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.28em;
  line-height: 1.7;
  text-transform: uppercase;
  color: var(--text-quiet);
}

.ending-value {
  font-family: var(--font-record);
  font-size: clamp(42px, 5.4vw, 82px);
  font-weight: 600;
  line-height: 0.9;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.ending-panel-record .ending-value { color: var(--human-bright); }
.ending-panel-absence .ending-value {
  font-family: var(--font-degraded);
  font-size: clamp(38px, 4.6vw, 70px);
  font-weight: 400;
  letter-spacing: 0.03em;
  color: rgba(192, 192, 192, 0.74);
}

.ending-panel p {
  max-width: 28em;
  font-family: var(--font-record);
  font-size: clamp(14px, 1.15vw, 18px);
  font-style: italic;
  line-height: 1.65;
  color: var(--text);
}

.ending-measure {
  min-width: 0;
}

.ending-measure .ending-label {
  margin-top: 10px;
}

.ending-mark {
  position: relative;
  min-height: 78px;
  overflow: hidden;
}
.ending-mark-line::before {
  content: '';
  position: absolute;
  left: 2%;
  right: 6%;
  top: 55%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(224,224,224,0.2), rgba(224,224,224,0.9));
  transform: rotate(-7deg);
  transform-origin: left center;
  box-shadow:
    36px -28px 0 -1px rgba(224,224,224,0.42),
    78px -6px 0 -1px rgba(224,224,224,0.34),
    124px 18px 0 -1px rgba(224,224,224,0.28),
    172px -16px 0 -1px rgba(224,224,224,0.22),
    220px 8px 0 -1px rgba(224,224,224,0.18);
}
.ending-mark-count {
  background-image: radial-gradient(circle, rgba(192,57,43,0.78) 0 1.2px, transparent 1.5px);
  background-size: 12px 12px;
  mask-image: linear-gradient(90deg, #000, #000 70%, transparent);
}
.ending-mark-field {
  overflow: visible;
}
.ending-mark-field::before {
  content: '';
  position: absolute;
  left: 14%;
  top: 50%;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(192, 57, 43, 0.38);
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow:
    74px -9px 0 15px rgba(192, 57, 43, 0.12),
    162px 7px 0 4px rgba(192, 57, 43, 0.22),
    246px -5px 0 21px rgba(192, 57, 43, 0.08);
}
.ending-mark-field::after {
  content: 'Name: --\A Individual route: --\A Testimony: --';
  white-space: pre;
  position: absolute;
  right: 0;
  bottom: 4px;
  font-family: var(--font-degraded);
  font-size: 11px;
  line-height: 1.9;
  letter-spacing: 0.03em;
  color: rgba(192,192,192,0.42);
}

#ending-text {
  grid-column: 1 / -1;
  padding: 18px 64px;
  text-align: center;
  border-top: 1px solid var(--border);
}

#ending-text span {
  display: block;
  font-family: var(--font-record);
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
  font-size: 16px;
  line-height: 1.55;
  opacity: 0;
  transition: opacity 0.8s ease;
}
#ending-text span.visible { opacity: 1; }
#ending-text span:nth-child(2),
#ending-text span:nth-child(4) { color: var(--text-faint); font-size: 13px; }

/* ── Ending colophon (POR-2 · provenance + ethics) ── */
#ending-colophon {
  grid-column: 1 / -1;
  padding: 13px 64px 18px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
#ending-colophon p {
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--text-quiet);
  line-height: 1.65;
  margin: 0;
}
#ending-colophon em { font-style: italic; }
#ending-colophon a {
  color: var(--accent);
  text-decoration-color: rgba(224, 224, 224, 0.34);
  text-underline-offset: 4px;
}

/* ── INT-6 · Reduced motion ──
   This is a motion-heavy piece. When the OS requests reduced motion we strip
   the most vestibular-risky effects: kill looping/strobe animations (the
   pulsing hint dot, the equator sweep), neutralise translate transforms, and
   collapse long durations. Opacity cross-fades are kept — they carry no motion
   risk and preserve the slow, deliberate reveal. (JS-driven Mapbox camera
   flights and the particle/flight timing are tamed separately — see spec-v3.) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.2s !important;
    scroll-behavior: auto !important;
  }
  .hint-dot { animation: none !important; opacity: 0.85 !important; }
  #equator-line { animation: none !important; left: 0 !important; }
  .opening-line { transform: none !important; }
  #map { transition: opacity 0.3s ease !important; }
}

@media (max-width: 760px) {
  #narrative-bridge {
    left: 22px;
    bottom: 16vh;
    width: calc(100vw - 44px);
    padding-left: 16px;
  }

  .narrative-bridge-title {
    font-size: clamp(28px, 9vw, 42px);
  }

  .flow-bridge {
    min-height: 78vh;
    padding: 72px 24px;
  }

  .flow-bridge-inner {
    padding-left: 18px;
  }

  #story-step-caption {
    top: auto;
    right: 22px;
    bottom: 92px;
    width: calc(100vw - 44px);
    padding-left: 14px;
    background: transparent;
  }

  .story-step-title {
    font-size: 20px;
  }

  .story-step-body {
    max-width: 28em;
    font-size: 11px;
  }

  #bird-label {
    left: 22px;
    right: 22px;
    bottom: 28px;
  }

  #location-evidence-key {
    left: 22px;
    top: 22px;
    bottom: auto;
  }

  #incident-size-key {
    top: 22px;
    right: 22px;
    bottom: auto;
    width: 188px;
  }

  #location-evidence-key.visible + #incident-size-key.visible {
    top: 166px;
  }

  .density-grain {
    grid-template-columns: 16px 94px minmax(0, 1fr);
    gap: 8px;
  }

  .density-grain-kind,
  .density-grain strong {
    font-size: 10px;
  }

  #density-toggle {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .toggle-btn {
    min-width: 0;
    padding: 8px 5px;
    font-size: 10px;
    white-space: nowrap;
  }

  #click-hint {
    right: 22px;
    bottom: 28px;
  }

  #ending {
    display: block;
    overflow-y: auto;
  }

  #ending-comparison {
    display: block;
    padding: 32px 24px 20px;
    overflow: visible;
  }

  .ending-header {
    display: block;
    padding-bottom: 36px;
  }

  .ending-header h2 {
    margin: 18px 0;
    font-size: 34px;
  }

  .ending-header p {
    max-width: 32em;
  }

  .ending-panel {
    grid-template-columns: 1fr auto;
    gap: 18px 24px;
    min-height: 0;
    padding: 28px 0 34px;
    border-bottom: none;
  }

  .ending-panel .ending-kicker,
  .ending-panel .ending-mark,
  .ending-panel p {
    grid-column: 1 / -1;
  }

  .ending-panel p {
    max-width: 34em;
  }

  .ending-mark {
    min-height: 82px;
  }

  .ending-value,
  .ending-panel-absence .ending-value {
    font-size: 54px;
  }

  #ending-text,
  #ending-colophon {
    padding-left: 24px;
    padding-right: 24px;
  }

  #ending-text span {
    font-size: 16px;
  }
}
