/*!
 * JBM Spread Map — styles ported verbatim from the Astro site
 * (src/styles/blocks.css + tokens.css). The map markup is namespaced under
 * .spread / .scroll-story, and the JS-appended dive overlay under .story-scene /
 * .spread-flyin / html.story-open, so collisions with a host theme are unlikely.
 *
 * Fonts (Fraunces, Inter, JetBrains Mono) are enqueued separately by the plugin
 * from Google Fonts. --nav-height is deliberately NOT set here: the map's rules
 * fall back to 0px (full-bleed) when it's undefined, and the JBM Theme defines
 * the real header offset when it's active — setting it here would override the
 * theme for every other block on the page.
 */
:root {
  --gold: #E8B873;
  --rust: #7D3421;
  --paper: #F7F3EC;
  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ============ Reusable scroll story (partner dives) ============ */
.scroll-story {
  position: relative;
  background: #0d0703;
  color: var(--paper);
}

.scroll-story .story-intro-eyebrow {
  position: absolute;
  /* Sit in the upper-middle, clear of the top-left hub label and top-right
     thesis (which can wrap to a couple of lines), so the partner/context line
     never overlaps them. */
  top: clamp(190px, 30vh, 340px);
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(247, 243, 236, 0.78);
  z-index: 5;
  pointer-events: none;
  padding-inline: clamp(16px, 4vw, 40px);
}

.scroll-story .story-track {
  position: relative;
  /* height set inline by the React component based on frame count */
}

.scroll-story .story-stage {
  position: sticky;
  top: var(--nav-height, 0px);
  /* dvh = dynamic viewport height: tracks the actual visible area on mobile as
     the browser toolbars show/hide, so the dark stage always fills the screen
     (no white gap below) and the bottom HUD stays visible. vh fallback first. */
  height: calc(100vh - var(--nav-height, 0px));
  height: calc(100dvh - var(--nav-height, 0px));
  overflow: hidden;
  background: #15100a;
}

.scroll-story .story-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  /* Eased crossfade fires ONLY when the active frame changes (the renderer
     picks one discrete frame per scroll position) — so the story never rests
     in a 50/50 blend and scrolling feels smooth instead of jumpy. */
  transition: opacity 0.85s ease-in-out;
  will-change: opacity;
}

.scroll-story .story-frame.is-active {
  opacity: 1;
}

/* Ken Burns pan. object-fit: cover crops these landscape photos to fill the
   sticky stage — on phones (tall/narrow) they crop left/right; on desktop
   (wide/short) they crop top/bottom. A slow DIAGONAL object-position pan
   reveals whichever edges are hidden: the horizontal part shows on phones,
   the vertical part shows on desktop, so over time the whole photo is seen in
   either orientation (a pan in an un-cropped axis is simply a no-op).
   Alternating diagonal per frame for variety. Off under reduced-motion. */
@media (prefers-reduced-motion: no-preference) {
  /* Animate the active frame AND the one currently fading out (.is-leaving),
     so the outgoing image keeps panning during its fade instead of snapping
     its crop back to center. Only ~2 layers ever animate at once. */
  .scroll-story .story-frame.is-active,
  .scroll-story .story-frame.is-leaving {
    animation: story-kb-a 26s ease-in-out infinite alternate;
  }
  .scroll-story .story-frame.is-active:nth-of-type(even),
  .scroll-story .story-frame.is-leaving:nth-of-type(even) {
    animation-name: story-kb-b;
  }
}

@keyframes story-kb-a {
  from { object-position: 0% 0%; }
  to   { object-position: 100% 100%; }
}
@keyframes story-kb-b {
  from { object-position: 100% 0%; }
  to   { object-position: 0% 100%; }
}

.scroll-story .veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(18, 13, 7, 0.55),
    rgba(18, 13, 7, 0.15) 26%,
    rgba(18, 13, 7, 0.15) 50%,
    rgba(18, 13, 7, 0.86)
  );
}

.scroll-story .hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: var(--paper);
}

.scroll-story .hud-eyebrow {
  position: absolute;
  top: clamp(24px, 5vh, 46px);
  left: clamp(22px, 5vw, 56px);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(247, 243, 236, 0.82);
}

.scroll-story .hud-thesis {
  position: absolute;
  top: clamp(24px, 5vh, 46px);
  right: clamp(22px, 5vw, 56px);
  max-width: 22ch;
  text-align: right;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1rem, 1.7vw, 1.35rem);
  color: rgba(247, 243, 236, 0.92);
  line-height: 1.3;
}

/* Lower HUD: era + caption + timeline as ONE bottom-anchored stack so the big
   year can never overlap the caption (which wraps to 2+ lines) regardless of
   length — the flex gap keeps them apart. */
.scroll-story .hud-lower {
  position: absolute;
  left: clamp(22px, 5vw, 56px);
  right: clamp(22px, 5vw, 56px);
  bottom: clamp(28px, 5vh, 46px);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.5vh, 18px);
}

.scroll-story .hud-era {
  font-weight: 300;
  font-size: clamp(2.6rem, 8.5vw, 6.2rem);
  line-height: 0.85;
  letter-spacing: -0.03em;
  color: var(--paper);
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.45);
}

.scroll-story .hud-cap {
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.05rem, 2.1vw, 1.55rem);
  color: var(--gold);
  max-width: 42ch;
  line-height: 1.32;
}

.scroll-story .hud-cap em {
  font-style: italic;
  color: var(--gold);
}

.scroll-story .hud-timeline {
  margin-top: clamp(2px, 0.8vh, 10px);
}

.scroll-story .hud-timeline .bar {
  height: 3px;
  background: rgba(247, 243, 236, 0.32);
  position: relative;
  border-radius: 3px;
}

.scroll-story .hud-timeline .fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--rust), var(--gold));
  border-radius: 3px;
}

.scroll-story .hud-timeline .marker {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 5px rgba(232, 184, 115, 0.22), 0 0 16px rgba(232, 184, 115, 0.55);
}

.scroll-story .hud-timeline .ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 13px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: rgba(247, 243, 236, 0.62);
}

/* Ticks are buttons: click a year to jump the story straight to it. */
.scroll-story .hud-timeline .ticks button {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  margin: 0;
  padding: 5px 3px;
  font: inherit;
  line-height: 1;
  color: inherit;
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}
.scroll-story .hud-timeline .ticks button:hover {
  color: var(--gold);
}
.scroll-story .hud-timeline .ticks button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  color: var(--gold);
}
/* Years with no matching frame (gap years) aren't jumpable. */
.scroll-story .hud-timeline .ticks button[disabled] {
  cursor: default;
  opacity: 0.5;
}

/* The year currently in view lights up so the timeline is easy to follow. */
.scroll-story .hud-timeline .ticks button.is-active {
  color: var(--gold);
  font-weight: 600;
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .scroll-story .story-track { height: auto !important; }
  .scroll-story .story-stage { position: relative; height: auto; }
  .scroll-story .story-frame { position: relative; opacity: 1 !important; height: auto; aspect-ratio: 16 / 9; }
  .scroll-story .veil, .scroll-story .hud { display: none; }
}

/* Mobile: the corner-anchored HUD (eyebrow top-left, thesis top-right, era +
   caption + timeline bottom) collides on a phone. Lay the HUD out as a flex
   column instead — eyebrow + thesis pinned to the top, era + caption +
   timeline pushed to the bottom — so nothing overlaps and it adapts to the
   viewport height. */
@media (max-width: 640px) {
  .scroll-story .hud {
    display: flex;
    flex-direction: column;
    padding: clamp(16px, 4vw, 24px);
    /* The stage is already offset below the fixed nav (top: --nav-height), so
       the HUD only needs a small top gap — not another full nav-height. */
    padding-top: 16px;
    /* Keep the bottom HUD (year / caption / timeline) clear of the iOS home
       indicator so it's never cut off. */
    padding-bottom: calc(clamp(16px, 4vw, 24px) + env(safe-area-inset-bottom, 0px));
  }
  .scroll-story .hud-eyebrow,
  .scroll-story .hud-thesis,
  .scroll-story .hud-lower,
  .scroll-story .hud-era,
  .scroll-story .hud-cap,
  .scroll-story .hud-timeline {
    position: static;
    inset: auto;
    max-width: none;
    text-align: left;
  }
  .scroll-story .hud-thesis {
    margin-top: 6px;
    font-size: 1rem;
    max-width: 32ch;
  }
  .scroll-story .hud-eyebrow {
    font-size: 11px;
  }
  /* Spacer: push the era/caption/timeline stack to the bottom of the stage. */
  .scroll-story .hud-lower {
    margin-top: auto;
    gap: clamp(6px, 1.4vh, 10px);
  }
  .scroll-story .hud-era {
    font-size: clamp(1.9rem, 9.5vw, 2.6rem);
  }
  .scroll-story .hud-cap {
    font-size: 0.95rem;
    line-height: 1.3;
  }
  /* 11 year ticks must fit a phone width without crowding. */
  .scroll-story .hud-timeline .ticks {
    font-size: 9.5px;
    letter-spacing: 0;
    margin-top: 10px;
  }

  /* Intro eyebrow: keep the base upper-middle position (clear of the top
     hub label + thesis); just shrink the type on phones. */
  .scroll-story .story-intro-eyebrow {
    font-size: 11px;
  }
}

/* ============ The Spread map ============ */
.spread {
  position: relative;
  background: #05101a;
  color: #f4efe6;
}

.spread-graphic {
  position: sticky;
  top: var(--nav-height, 0px);
  height: calc(100vh - var(--nav-height, 0px));
  width: 100%;
  overflow: hidden;
  z-index: 0;
}

/* On chrome pages (the home page) the fixed nav hides on scroll-down. If the
   map sat inset below it (top: --nav-height) that reserved band would expose a
   flat strip above the satellite the moment the nav slid away — the "bald spot".
   So on chrome pages the map runs FULL-BLEED (the translucent nav simply
   overlays its top), and the top HUD is nudged below the nav so it stays
   readable while the nav is shown. /spread is no-chrome → already full-bleed and
   untouched. The scroll spacers mirror the graphic height so beat timing holds. */
.with-chrome .spread-graphic {
  top: 0;
  height: 100vh;
  height: 100dvh;
}
.with-chrome .spread-steps {
  margin-top: -100vh;
}
/* Only the eyebrow still needs to clear the nav. The legend is bottom-anchored
   now, and setting `top` as well would stretch it between both edges. */
.with-chrome .spread .hud-eyebrow {
  top: calc(var(--nav-height, 0px) + clamp(20px, 4vh, 40px));
}

.spread-graphic::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 220px 70px rgba(2, 10, 16, 0.72);
  z-index: 4;
}

.spread canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.spread-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.spread-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  color: #fff;
}

.spread .hud-eyebrow {
  position: absolute;
  top: clamp(20px, 4vh, 40px);
  left: clamp(20px, 5vw, 54px);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

/* The key sits at the BOTTOM right, stacked above the imagery credit.
   It used to be top-anchored, which put it straight under a host site's sticky
   header — the `.with-chrome` offset above only knows this project's own nav
   height, so it cannot save a header the map does not control (e.g. an
   Elementor Theme Builder header). The bottom edge is uncontended: the caption
   card owns bottom-left and the scroll cue bottom-centre. */
.spread .hud-legend {
  position: absolute;
  top: auto;
  bottom: clamp(30px, 4.5vh, 48px);
  right: clamp(20px, 5vw, 54px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

.spread .hud-legend .sw {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-left: 8px;
  vertical-align: middle;
}

.spread .sw.gold   { background: #e8b873; box-shadow: 0 0 8px #e8b873; }
.spread .sw.indigo { background: #9686ff; box-shadow: 0 0 8px #9686ff; }
.spread .sw.teal   { background: #56e0d0; box-shadow: 0 0 8px #56e0d0; }

.spread .hud-legend .star {
  margin-left: 8px;
  font-style: normal;
  font-size: 13px;
  line-height: 1;
  color: #ffd9a0;
  text-shadow: 0 0 9px #ffd28a;
}

.spread .hud-timeline {
  position: absolute;
  left: clamp(20px, 5vw, 54px);
  right: clamp(20px, 5vw, 54px);
  bottom: clamp(24px, 4.5vh, 40px);
}

.spread .hud-timeline .bar {
  height: 2px;
  background: rgba(255, 255, 255, 0.24);
  border-radius: 2px;
  position: relative;
}

.spread .hud-timeline .fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: var(--gold);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--gold);
  transition: width 0.6s ease;
}

.spread .hud-credit {
  position: absolute;
  right: clamp(20px, 5vw, 54px);
  bottom: 7px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
}

/* finale overlay */
.spread-finale {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s ease;
  /* A warm "symposium glow" (the gold of the beacons) blooms behind the words
     so the cream text and logo lift off the dark map, over a soft dark vignette
     that keeps the edges readable. Fades in with the overlay. */
  background:
    radial-gradient(
      ellipse 58% 44% at 50% 47%,
      rgba(255, 209, 136, 0.5) 0%,
      rgba(232, 184, 115, 0.3) 30%,
      rgba(176, 120, 60, 0.12) 52%,
      rgba(5, 16, 26, 0) 72%
    ),
    radial-gradient(
      ellipse 100% 90% at 50% 50%,
      rgba(5, 16, 26, 0.28),
      rgba(5, 16, 26, 0.84)
    );
}

.spread-finale .f-big {
  font-family: var(--font-serif);
  font-weight: 340;
  font-size: clamp(1.8rem, 4.4vw, 3.4rem);
  line-height: 1.3;
  color: #fff3d6;
  text-shadow: 0 0 36px rgba(255, 200, 120, 0.5);
}

.spread-finale .f-logo {
  display: block;
  margin: 32px auto 0;
  width: clamp(190px, 30vw, 300px);
  height: auto;
  filter: drop-shadow(0 0 18px rgba(255, 209, 136, 0.45));
}

/* "Our partners" — the discrete partner list that lives on the finale screen
   (it replaced the always-on callout pills that rode each pin). The buttons are
   created by spread-map-renderer.js, so they're styled here in the global sheet
   (Astro's scoped styles don't reach JS-created nodes). pointer-events is held
   off until the renderer turns the list on for the finale beat only. */
.spread-finale .f-partners {
  margin-top: clamp(22px, 4vh, 40px);
  pointer-events: none;
}
.spread-finale .f-partners-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 243, 214, 0.7);
  margin: 0 0 13px;
}
.spread-finale .f-partners-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.spread-finale .f-partner {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: #fff6e2;
  background: rgba(20, 12, 6, 0.55);
  border: 1px solid rgba(255, 209, 136, 0.5);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease,
    transform 0.12s ease;
}
.spread-finale .f-partner:hover,
.spread-finale .f-partner:focus-visible {
  background: rgba(40, 22, 10, 0.82);
  border-color: rgba(255, 209, 136, 0.85);
  box-shadow: 0 0 22px rgba(255, 200, 120, 0.4);
  outline: none;
  transform: translateY(-1px);
}
.spread-finale .f-partner.soon {
  cursor: default;
  color: rgba(255, 246, 226, 0.55);
  border-color: rgba(255, 255, 255, 0.18);
}
@media (max-width: 640px) {
  .spread-finale .f-partner {
    font-size: 12px;
    padding: 7px 13px;
  }
}

/* "Scroll to follow the spread" cue — a bottom-center chevron shown only on the
   opening beat (the renderer fades it out once the story starts moving) so the
   sticky full-screen map reads as scrollable. Non-interactive; JS toggles only
   its opacity. Created in markup, styled here so it covers both map renderings. */
.spread-scrollcue {
  position: absolute;
  left: 50%;
  bottom: clamp(46px, 7.5vh, 84px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: 3;
}
.spread-scrollcue .sc-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.spread-scrollcue .sc-chev {
  animation: sc-bounce 1.8s ease-in-out infinite;
}
@keyframes sc-bounce {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  50% {
    transform: translateY(5px);
    opacity: 1;
  }
}
/* On phones the caption spans full width, so drop the label and tuck the bare
   chevron into the band between the caption card and the timeline bar. */
@media (max-width: 640px) {
  .spread-scrollcue {
    bottom: 38px;
  }
  .spread-scrollcue .sc-label {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .spread-scrollcue .sc-chev {
    animation: none;
  }
}

/* fixed cross-fading caption */
.spread-caption {
  position: absolute;
  z-index: 3;
  left: clamp(20px, 5vw, 54px);
  bottom: clamp(54px, 9vh, 96px);
  width: min(30rem, 46vw);
  background: rgba(8, 14, 20, 0.52);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  padding: 20px 26px 22px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.42s ease;
}

.spread .cap-eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(180, 205, 235, 0.8);
  margin-bottom: 10px;
}
.spread .cap-eyebrow:empty { display: none; }

.spread .cap-meta {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 8px;
}

.spread .cap-year {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(2.6rem, 4.4vw, 3.6rem);
  line-height: 0.9;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6);
}
.spread .cap-year:empty { display: none; }

.spread .cap-count {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}
.spread .cap-count:empty { display: none; }

.spread .cap-title {
  font-family: var(--font-serif);
  font-weight: 360;
  font-size: clamp(1.3rem, 2.4vw, 1.85rem);
  line-height: 1.14;
  letter-spacing: -0.01em;
  margin: 0 0 9px;
  color: #fff;
}

.spread .cap-title em {
  font-style: italic;
  color: var(--gold);
}

.spread .cap-body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: rgba(244, 239, 230, 0.86);
  margin: 0;
}

/* cumulative impact counter — climbs as the years scroll by */
.spread .cap-impact {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: rgba(244, 239, 230, 0.74);
}
.spread .cap-impact:empty { display: none; }
.spread .cap-impact b { font-weight: 600; color: var(--gold); }

/* invisible scroll spacers — overlap with the sticky graphic (same
   height as graphic, which is reduced by --nav-height) */
.spread-steps {
  position: relative;
  z-index: 1;
  margin-top: calc(-100vh + var(--nav-height, 0px));
  pointer-events: none;
}

.spread .beat {
  height: 100vh;
}

/* injected country labels */
.spread .spread-clabel {
  position: absolute;
  top: 0;
  left: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.6);
  text-shadow: 0 0 4px rgba(6, 18, 26, 0.95), 0 1px 3px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  transform: translate(-9999px, -9999px);
  opacity: 0;
  transition: opacity 0.6s ease, color 0.6s ease, text-shadow 0.6s ease;
  will-change: transform, opacity;
}

.spread .spread-clabel.reached {
  font-weight: 600;
  text-shadow: 0 0 10px currentColor, 0 0 4px rgba(6, 18, 26, 0.95),
    0 1px 3px rgba(0, 0, 0, 0.85);
}

/* ============ Story-dive overlay (JS-appended to <body>) ============ */
.spread-flash {
  position: fixed;
  inset: 0;
  background: #fff6ec;
  opacity: 0;
  pointer-events: none;
  z-index: 9998;
}

/* Google Earth Studio "fly-in" video overlay (space → location), shown on the
   map page between the flash and the navigation to the story page. */
.spread-flyin {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9990;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.spread-flyin.show {
  opacity: 1;
  pointer-events: auto;
}
.spread-flyin video {
  width: 100%;
  height: 100%;
  /* contain (not cover) so Earth Studio's required Google attribution, burned
     into the bottom of the frame, always stays visible */
  object-fit: contain;
  display: block;
}
.spread-flyin-skip {
  position: absolute;
  bottom: clamp(18px, 4vh, 36px);
  right: clamp(18px, 5vw, 40px);
  padding: 9px 16px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #fff6e2;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.spread-flyin-skip:hover {
  background: rgba(0, 0, 0, 0.75);
}

/* full-screen "story scene" overlay the map fades away into. Kept in the DOM
   (visibility-toggled, not display) so its cloned scroll story can lay out and
   initialize correctly. Its own scroll container drives the Zion crossfade. */
.story-scene {
  position: fixed;
  inset: 0;
  z-index: 9995;
  background: #0b0b0d;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}
.story-scene.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.5s ease, visibility 0s;
}
.story-scene-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* lock the page behind the story scene so it can't scroll while open */
html.story-open,
html.story-open body {
  overflow: hidden;
}

/* "← Back to the map" control inside the story-scene overlay */
.story-back {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.03em;
  text-decoration: none;
  color: #fff6e2;
  background: rgba(20, 12, 6, 0.82);
  border: 1px solid rgba(255, 209, 136, 0.6);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4), 0 0 18px rgba(255, 200, 120, 0.3);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: background 0.25s ease;
}
.story-back:hover {
  background: rgba(40, 22, 10, 0.92);
}


/* ============ Mobile ============ */
@media (max-width: 640px) {
  .spread-caption {
    left: 12px;
    right: 12px;
    bottom: 56px;
    width: auto;
  }

  /* The top-left eyebrow and top-right legend collide on narrow screens.
     Drop the long "· Teach → Equip → Send → Sustain" pipeline (the legend
     already conveys the categories) and tighten the legend so they clear. */
  .spread .hud-eyebrow {
    left: 16px;
    max-width: 45%;
    font-size: 11px;
  }
  .spread .hud-eyebrow .he-flow {
    display: none;
  }
  .spread .hud-legend {
    right: 16px;
    gap: 4px;
    font-size: 10px;
  }
}
