/* ============================================================================
   styles.css — warm editorial design system (Session A, immersive rebuild).
   ----------------------------------------------------------------------------
   The 1619-style look: warm paper + ink, serif display/body, full-bleed photo
   sections with dark overlays, generous editorial spacing. This replaces the
   old charcoal/teal "video-game" styling entirely. Content lives in story.js.
   ============================================================================ */

:root {
  --paper: #faf7f1;     /* brighter, cleaner near-white (was sepia) */
  --paper-2: #f0ebdf;
  --ink: #1c1b18;       /* higher-contrast near-black */
  --ink-soft: #595349;
  --line: #e3ddcd;      /* lighter rules */
  --oxblood: #c0432b;   /* brighter brick — emphasis + roadblocks */
  --ochre: #c1851f;     /* brighter amber */
  --pine: #2f6b4a;      /* positive / "housed" outcomes */
  --dark: #1d1812;      /* immersive sections */
  --cream: #f3ecde;     /* text on dark */
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "Newsreader", Georgia, "Times New Roman", serif;
  --ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }   /* the hidden attribute must win over any display rule */
body { background: var(--paper); color: var(--ink); font-family: var(--body); line-height: 1.62; font-size: 19px; -webkit-font-smoothing: antialiased; }
.eyebrow { font-family: var(--ui); text-transform: uppercase; letter-spacing: .2em; font-size: .7rem; font-weight: 600; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--ink); color: var(--cream); padding: 10px 14px; z-index: 200; }
.skip:focus { left: 8px; top: 8px; }

/* reusable photo placeholder (where real, licensed photography goes) */
.photo { position: relative; background: linear-gradient(160deg, #3a2a20, #5a3322 45%, #1d1812); overflow: hidden; }
.photo::after { content: ""; position: absolute; inset: 0; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E"); }
.photo .cap { position: absolute; left: 0; bottom: 0; padding: 10px 16px; font-family: var(--ui); font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: rgba(239,231,215,.62); z-index: 3; }

/* ---------- THIN NAV (hidden until past the cover) ---------- */
.topnav { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 7vw; background: rgba(244,239,228,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  transform: translateY(-101%); transition: transform .35s ease; }
body.past-cover .topnav { transform: none; }
.topnav button { font-family: var(--ui); font-size: .82rem; font-weight: 600; color: var(--ink-soft); background: none; border: 0; cursor: pointer; letter-spacing: .02em; padding: 4px 2px; }
.topnav .brand { font-weight: 700; color: var(--ink); }
.topnav .navlinks { display: flex; gap: 18px; }
.topnav button:hover { color: var(--oxblood); }
@media (prefers-reduced-motion: reduce) { .topnav { transition: none; } }

/* ---------- COVER ---------- */
.cover { height: 100vh; min-height: 600px; position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 7vh 7vw; color: var(--cream); overflow: hidden;
  background: linear-gradient(180deg, rgba(20,16,11,.15), rgba(20,16,11,.78)), linear-gradient(150deg, #6a3a25, #2a1d14 60%, #16110b); }
.cover::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  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.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E"); }
/* parallax image layer + scrim behind the cover text */
.cover-img { position: absolute; inset: -6% 0; z-index: 0; background-size: cover; background-position: center;
  will-change: transform; transform: scale(1.12); }
.cover-scrim { position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(20,16,11,.3), rgba(20,16,11,.4) 45%, rgba(20,16,11,.82)); }
.cover .inner { position: relative; z-index: 3; max-width: 1100px; }
.cover .eyebrow { color: #e6b98f; margin-bottom: 1.6rem; }
.cover h1 { font-family: var(--display); font-weight: 600; font-size: clamp(2.8rem, 7.4vw, 6.4rem); line-height: 1.0; letter-spacing: -.02em; max-width: 18ch; }
.cover p { max-width: 50ch; margin-top: 1.8rem; font-size: clamp(1.05rem, 1.5vw, 1.35rem); color: #e4dccd; }
.cover .by { margin-top: 2.2rem; font-family: var(--ui); font-size: .8rem; letter-spacing: .04em; color: #cdbfa9; }
.cover .photocap-cover { position: absolute; right: 7vw; bottom: 7vh; z-index: 2; font-family: var(--ui); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: rgba(239,231,215,.5); }
.cover .scrollcue { position: absolute; left: 7vw; top: 50%; z-index: 2; font-family: var(--ui); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(239,231,215,.55); }

/* ---------- HUB: three ways in ---------- */
.hub { padding: 13vh 7vw; background: var(--paper); border-bottom: 1px solid var(--line); }
.hub .lead { max-width: 34ch; margin: 0 auto 4rem; text-align: center; }
.hub .lead .eyebrow { color: var(--oxblood); margin-bottom: 1rem; }
.hub .lead h2 { font-family: var(--display); font-weight: 500; font-size: clamp(1.8rem, 3.4vw, 2.8rem); line-height: 1.12; }
.ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.6rem; max-width: 1100px; margin: 0 auto; }
.way { border: 1px solid var(--line); background: #fff; border-radius: 3px; padding: 2rem 1.8rem; cursor: pointer; text-align: left;
  font: inherit; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.way:hover { transform: translateY(-4px); box-shadow: 0 14px 40px rgba(33,27,20,.1); border-color: var(--oxblood); }
.way:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 3px; }
.way .n { font-family: var(--ui); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--oxblood); font-weight: 700; }
.way h3 { font-family: var(--display); font-weight: 600; font-size: 1.6rem; margin: .7rem 0 .6rem; line-height: 1.1; }
.way p { font-size: .98rem; color: var(--ink-soft); line-height: 1.5; }
.way .go { margin-top: 1.2rem; font-family: var(--ui); font-size: .8rem; font-weight: 600; color: var(--ink); letter-spacing: .02em; }

/* ---------- THE STORY — pinned scrollytelling scenes (1619-style) ----------
   Each chapter is a SCROLLY: a full-bleed photo PINS and slowly drifts while the
   title and a few short lines fade THROUGH over it; then the reading flow rises
   up over it on a rounded paper card. */
.scrolly { position: relative; }
.scrolly-bg { position: sticky; top: 0; height: 100vh; overflow: hidden; }
.scrolly-img { position: absolute; inset: -6% -2%; background-size: cover; background-position: center;
  will-change: transform; transform: scale(1.06); }
.scrolly-scrim { position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(20,16,11,.42), rgba(20,16,11,.28) 38%, rgba(20,16,11,.66)); }
.scrolly-bg .cap { z-index: 2; }
/* the stepped lines that scroll over the pinned image */
.scrolly-steps { position: relative; z-index: 2; margin-top: -100vh; padding: 0 7vw; }
.step { min-height: 78vh; display: flex; flex-direction: column; justify-content: center; max-width: 20ch;
  color: var(--cream); opacity: .3; transform: translateY(10px); transition: opacity .55s ease, transform .55s ease; }
.step.is-active { opacity: 1; transform: none; }
.step:first-child { min-height: 92vh; }
.step .ch { font-family: var(--ui); text-transform: uppercase; letter-spacing: .22em; font-size: .72rem; color: #e6b98f; font-weight: 600; margin-bottom: 1rem; }
.step h2 { font-family: var(--display); font-weight: 600; font-size: clamp(2.2rem, 5.4vw, 4.2rem); line-height: 1.03; }
.step p { font-family: var(--display); font-weight: 500; font-size: clamp(1.7rem, 4vw, 3rem); line-height: 1.12; text-shadow: 0 2px 30px rgba(20,16,11,.5); }
/* the reading flow rises up over the pinned photo on a rounded paper card */
.act-flow { position: relative; z-index: 3; margin-top: -8vh; background: var(--paper);
  border-radius: 26px 26px 0 0; box-shadow: 0 -30px 60px rgba(29,24,18,.34); }
.act-flow::before { content: ""; display: block; width: 46px; height: 4px; border-radius: 3px;
  background: var(--line); margin: 22px auto -8px; }
@media (prefers-reduced-motion: reduce) {
  .scrolly-bg { position: relative; height: 80vh; }
  .scrolly-steps { margin-top: 0; }
  .step { min-height: 0; padding: 5vh 0; opacity: 1; transform: none; }
  .scrolly-img { transform: scale(1.04); }
}

.read { max-width: 680px; margin: 0 auto; padding: 11vh 24px; }
.read p { font-size: 1.2rem; line-height: 1.78; margin-bottom: 1.9rem; }
/* reveal-and-persist: fade IN on entry, then STAY (never fades back out) — stepped */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }
.read p.lead-in { font-size: 1.42rem; line-height: 1.6; margin-bottom: 2.1rem; }
.read p.lead-in::first-letter { font-family: var(--display); font-weight: 600; font-size: 3.6rem; float: left; line-height: .8; padding: .08em .12em 0 0; color: var(--oxblood); }
.read p.note { font-family: var(--ui); font-size: .9rem; color: var(--ink-soft); border-left: 3px solid var(--line); padding-left: 14px; }
.read .src { font-family: var(--ui); font-size: .8rem; color: var(--ink-soft); letter-spacing: .02em; }

/* ---------- full-bleed PULL QUOTE ---------- */
.quote { position: relative; padding: 16vh 7vw; color: var(--cream); text-align: center; overflow: hidden;
  background: linear-gradient(180deg, rgba(20,16,11,.3), rgba(20,16,11,.72)), linear-gradient(150deg, #5a3322, #1d1812); }
.quote::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  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.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E"); }
.quote blockquote { position: relative; z-index: 1; font-family: var(--display); font-weight: 500; font-size: clamp(1.8rem, 3.8vw, 3.1rem); line-height: 1.18; max-width: 18ch; margin: 0 auto; letter-spacing: -.01em; }
.quote cite { position: relative; z-index: 1; display: block; margin-top: 1.6rem; font-family: var(--ui); font-style: normal; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: #d9b495; }

/* ---------- DATA SCENE (the bottleneck bars) ---------- */
.scene { background: var(--paper-2); padding: 13vh 7vw; }
.scene .wrap { max-width: 1000px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 4vw; align-items: center; }
.scene .txt .eyebrow { color: var(--oxblood); margin-bottom: 1rem; }
.scene .txt h3 { font-family: var(--display); font-weight: 600; font-size: 2.1rem; line-height: 1.12; margin-bottom: 1rem; }
.scene .txt p { font-size: 1.05rem; color: var(--ink-soft); line-height: 1.6; }
.bars { display: flex; flex-direction: column; gap: 1.6rem; }
.bar .lab { font-family: var(--ui); font-size: .8rem; letter-spacing: .04em; color: var(--ink); margin-bottom: .4rem; font-weight: 600; display: flex; justify-content: space-between; }
.bar .lab .emph { color: var(--oxblood); }
.bar .track { height: 30px; background: #ddd3bf; border-radius: 2px; overflow: hidden; }
.bar .fill { height: 100%; width: 0; transition: width 1.2s cubic-bezier(.2,.7,.3,1); }
.scene.in .fill { width: var(--w); }
.fill.beds { background: var(--ink); }
.fill.exits { background: var(--oxblood); }
.bar .note { font-family: var(--ui); font-size: .74rem; color: var(--ink-soft); margin-top: .4rem; }

/* ---------- MODE BREAK — full-bleed divider between the three ways in ----------
   Gives a hard visual separation between The Story, A Life, and The System so
   each mode reads as its own act (works whichever door you entered from). */
.modebreak { background: var(--dark); color: var(--cream); text-align: center; padding: 15vh 7vw; position: relative; overflow: hidden; }
.modebreak::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  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.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E"); }
.modebreak .inner { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; }
.modebreak .pb-k { font-family: var(--ui); text-transform: uppercase; letter-spacing: .24em; font-size: .72rem; font-weight: 600; color: #e6b98f; }
.modebreak h2 { font-family: var(--display); font-weight: 600; font-size: clamp(2.1rem, 4.6vw, 3.4rem); line-height: 1.08; margin: 1.1rem 0 1rem; }
.modebreak p { color: #d8cfbe; font-size: 1.08rem; line-height: 1.6; max-width: 46ch; margin: 0 auto; }
.modebreak .pb-rule { width: 54px; height: 3px; background: var(--oxblood); margin: 1.8rem auto 0; border-radius: 2px; }

/* ---------- A LIFE — story switcher + journey timeline ----------
   A sticky switcher (always one click to compare another life) over a two-column
   stage: a compact person panel beside a connected vertical "journey" timeline,
   so the whole path is visible the moment you pick someone (no blind scroll). */
.life-head { max-width: 900px; margin: 0 auto; padding: 13vh 7vw 0; text-align: center; }
.life-head .eyebrow { color: var(--oxblood); margin-bottom: 1rem; }
.life-head h3 { font-family: var(--display); font-weight: 600; font-size: clamp(1.8rem, 3.6vw, 2.8rem); line-height: 1.12; }
.life-sub { max-width: 58ch; margin: 1rem auto 0; color: var(--ink-soft); }

/* sticky switcher */
.life-switch { position: sticky; top: 0; z-index: 40; display: flex; gap: .7rem; flex-wrap: wrap; justify-content: center;
  max-width: 1100px; margin: 2.2rem auto 0; padding: 1rem 7vw; background: rgba(250,247,241,.93); backdrop-filter: blur(8px); }
body.past-cover .life-switch { top: 47px; }   /* sit just under the thin nav when it's showing */
.ltab { flex: 1 1 200px; max-width: 262px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 4px;
  padding: .8rem 1rem; cursor: pointer; font: inherit; display: grid; gap: 3px; transition: border-color .2s, box-shadow .2s, transform .2s; }
.ltab:hover { border-color: var(--oxblood); transform: translateY(-2px); }
.ltab:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 2px; }
.ltab.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.ltab-label { font-family: var(--display); font-weight: 600; font-size: 1.08rem; line-height: 1.1; }
.ltab-who { font-family: var(--ui); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.ltab-end { justify-self: start; margin-top: 3px; font-family: var(--ui); font-size: .64rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: 2px 9px; border-radius: 100px; }
.ltab-end.housed { background: #e3efe7; color: var(--pine); }
.ltab-end.stuck, .ltab-end.street { background: #f6e2dc; color: var(--oxblood); }

/* stage: person panel + journey */
.life-stage { background: var(--paper); }
.life-stage-inner { max-width: 1120px; margin: 0 auto; padding: 3.5vh 7vw 12vh;
  display: grid; grid-template-columns: minmax(0, 358px) 1fr; gap: 3.6rem; align-items: start; }
.lp-person { position: sticky; top: 130px; }
.lp-portrait { aspect-ratio: 4 / 3; border-radius: 6px; background: linear-gradient(160deg, #4a3024, #241a12); }
.lp-meta { margin-top: 1.2rem; }
.lp-meta .eyebrow { color: var(--oxblood); margin-bottom: .7rem; }
.lp-meta h3 { font-family: var(--display); font-weight: 600; font-size: 1.7rem; line-height: 1.1; margin-bottom: .8rem; }
.lp-lead { font-family: var(--display); font-style: italic; font-size: 1.12rem; line-height: 1.4; color: var(--ink); margin-bottom: .8rem; }
.lp-summary { color: var(--ink-soft); font-size: 1rem; line-height: 1.55; }
.lp-outcome { margin-top: 1.1rem; font-family: var(--display); font-weight: 600; font-size: 1.05rem; line-height: 1.3;
  padding: .9rem 1.1rem; border-left: 4px solid var(--ink); background: var(--paper-2); }
.lp-outcome.housed { border-left-color: var(--pine); }
.lp-outcome.stuck, .lp-outcome.street { border-left-color: var(--oxblood); color: #6e2a1f; }
.lp-tag { margin-top: 1rem; font-family: var(--ui); font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); line-height: 1.5; }

.lp-journey-h { font-family: var(--ui); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink);
  display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: baseline; padding-bottom: 1.3rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; }
.lp-journey-h span { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-soft); font-size: .82rem; }
.lp-beats { list-style: none; margin: 0; padding: 0; }
.lp-beat, .lp-end { position: relative; padding: 1.4rem 0 1.4rem 2.4rem; }
.lp-beat::before, .lp-end::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.lp-beat:first-child::before { top: 1.85rem; }      /* spine starts at the first dot */
.lp-end::before { bottom: auto; height: 1.7rem; }    /* spine ends at the destination dot */
.lp-dot { position: absolute; left: 0; top: 1.6rem; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--ink-soft); z-index: 1; }
.lp-beat.fall .lp-dot, .lp-beat.stall .lp-dot { background: var(--oxblood); border-color: var(--oxblood); }
.lp-step { font-family: var(--ui); font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); }
.lp-node { font-family: var(--display); font-weight: 600; font-size: 1.25rem; line-height: 1.15; margin: 2px 0 .35rem; }
.lp-beat.fall .lp-node, .lp-beat.stall .lp-node { color: var(--oxblood); }
.lp-beat-c p { color: var(--ink-soft); font-size: 1rem; line-height: 1.55; }
.lp-flag { margin-top: .65rem; font-family: var(--ui); font-size: .82rem; font-weight: 700; color: var(--oxblood); background: #f6e2dc; border-radius: 3px; padding: .5rem .7rem; line-height: 1.35; }
.lp-end .lp-dot { top: 1.5rem; background: var(--ink); border-color: var(--ink); }
.lp-end.housed .lp-dot { background: var(--pine); border-color: var(--pine); }
.lp-end.stuck .lp-dot, .lp-end.street .lp-dot { background: var(--oxblood); border-color: var(--oxblood); }
.lp-end .lp-beat-c { font-family: var(--display); font-weight: 600; font-size: 1.15rem; line-height: 1.25; }
.lp-end.housed .lp-beat-c { color: var(--pine); }
.lp-end.stuck .lp-beat-c, .lp-end.street .lp-beat-c { color: #6e2a1f; }
.lp-foot { font-family: var(--ui); font-size: .82rem; color: var(--ink-soft); margin-top: 1.2rem; font-style: italic; }

/* SOURCES */
.sources { background: var(--paper); padding: 12vh 7vw; border-top: 1px solid var(--line); }
.src-wrap { max-width: 820px; margin: 0 auto; }
.src-wrap .eyebrow { color: var(--oxblood); margin-bottom: 1rem; }
.src-wrap h2 { font-family: var(--display); font-weight: 600; font-size: clamp(1.8rem, 3.4vw, 2.6rem); margin-bottom: 1rem; }
.src-intro { color: var(--ink-soft); max-width: 60ch; margin-bottom: 2rem; }
.src-list { display: grid; border-top: 1px solid var(--line); }
.src-list > div { display: grid; grid-template-columns: 230px 1fr; gap: 1.2rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.src-list dt { font-family: var(--ui); font-weight: 700; font-size: .92rem; }
.src-list dd { margin: 0; color: var(--ink-soft); font-size: .95rem; }

/* ---------- THE SYSTEM (teaser) ---------- */
.systeaser { padding: 13vh 7vw; text-align: center; background: var(--paper); }
.systeaser .eyebrow { color: var(--oxblood); margin-bottom: 1rem; }
.systeaser h3 { font-family: var(--display); font-weight: 600; font-size: clamp(1.8rem, 3.4vw, 2.6rem); max-width: 20ch; margin: 0 auto 2.4rem; line-height: 1.14; }
.minimap { max-width: 880px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 2.4rem 2rem; }
.minimap svg { width: 100%; height: auto; }
.btn { display: inline-block; margin-top: 2.4rem; font-family: var(--ui); font-weight: 600; font-size: .9rem; background: var(--ink); color: var(--paper); padding: 14px 26px; border-radius: 2px; cursor: pointer; border: 0; letter-spacing: .02em; }
.btn:hover { background: var(--oxblood); }
.systeaser .soon { margin-top: 1.2rem; font-family: var(--ui); font-size: .8rem; color: var(--ink-soft); font-style: italic; }

/* ---------- ENDNOTE ---------- */
.endnote { padding: 8vh 7vw; background: var(--dark); color: #c9bda9; font-family: var(--ui); font-size: .82rem; line-height: 1.7; text-align: center; }
.endnote b { color: var(--cream); }
.endnote .madeby { margin-top: 1.4rem; letter-spacing: .08em; text-transform: uppercase; font-size: .72rem; color: #9a8f7c; }

/* ============================================================================
   THE SYSTEM — full map overlay (warm restyle of the flowchart)
   ============================================================================ */
.mapview { position: fixed; inset: 0; z-index: 150; background: var(--paper); display: flex; flex-direction: column; }
.mapview[hidden] { display: none; }   /* explicit display above would otherwise defeat the hidden attribute */
body.map-open { overflow: hidden; }
.mv-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 22px; border-bottom: 1px solid var(--line); }
.mv-back { font-family: var(--ui); font-weight: 600; font-size: .85rem; background: var(--ink); color: var(--paper); border: 0; padding: 9px 16px; border-radius: 2px; cursor: pointer; }
.mv-back:hover { background: var(--oxblood); }
.mv-title { font-family: var(--display); font-weight: 600; font-size: 1.1rem; }
.mv-close { background: none; border: 0; font-size: 1.6rem; line-height: 1; color: var(--ink-soft); cursor: pointer; }
.mv-close:hover { color: var(--ink); }
.mv-intro { padding: 12px 22px 0; font-family: var(--ui); font-size: .84rem; color: var(--ink-soft); max-width: 1000px; line-height: 1.5; }
.mv-intro .ox { color: var(--oxblood); }
.mv-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 10px 22px; overflow: auto; }
.mv-stage svg { width: 100%; height: 100%; max-width: 1400px; }
.mv-legend { display: flex; gap: 18px; flex-wrap: wrap; padding: 6px 22px 16px; font-family: var(--ui); font-size: .74rem; color: var(--ink-soft); }
.mv-legend i { display: inline-block; width: 22px; height: 0; border-top: 2px solid var(--ink-soft); vertical-align: middle; margin-right: 6px; }
.mv-legend i.blk { border-top: 2px dashed var(--oxblood); }
.mv-legend .ox { color: var(--oxblood); letter-spacing: -2px; }

/* svg elements (paper/ink/oxblood — no glow) */
.mapview .node { cursor: pointer; }
.mapview .node rect { fill: #fff; stroke: var(--line); stroke-width: 1.5; }
.mapview .node:hover rect { stroke: var(--ink); stroke-width: 2.5; }
.mapview .node:focus-visible { outline: none; } .mapview .node:focus-visible rect { stroke: var(--ink); stroke-width: 3; }
.mapview .node .t { font-family: var(--ui); font-size: 13px; font-weight: 700; fill: var(--ink); }
.mapview .node .s { font-family: var(--ui); font-size: 10px; font-weight: 500; fill: var(--ink-soft); }
.mapview .node.goal rect { fill: var(--ink); }
.mapview .node.goal .t { fill: var(--paper); } .mapview .node.goal .s { fill: #c9bda9; }
.mapview .edge { fill: none; stroke: var(--ink-soft); stroke-width: 2; }
.mapview .ret { fill: none; stroke: var(--oxblood); stroke-width: 2; stroke-dasharray: 6 7; }
.mapview .ret-text { font-family: var(--ui); font-size: 11px; font-weight: 700; fill: var(--oxblood); }
.mapview .ret-group, .mapview .block { cursor: pointer; }
.mapview .block .g { fill: var(--oxblood); }
.mapview .block .bt { font-family: var(--ui); font-size: 11px; font-weight: 700; fill: var(--oxblood); }
.mapview .block .bt.sub { font-weight: 500; }
.mapview .bottleneck .bt.big { font-size: 14px; }

/* map detail panel */
.mv-detail { position: absolute; top: 54px; right: 0; width: 360px; max-width: 92vw; height: calc(100% - 54px); background: #fff; border-left: 1px solid var(--line); box-shadow: -12px 0 30px rgba(33,27,20,.12); padding: 22px; overflow: auto; z-index: 5; }
.mvd-x { position: absolute; top: 10px; right: 14px; background: none; border: 0; font-size: 1.5rem; line-height: 1; color: var(--ink-soft); cursor: pointer; }
.mvd-k { font-family: var(--ui); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.mvd-k.ox { color: var(--oxblood); }
.mv-detail h3 { font-family: var(--display); font-weight: 600; font-size: 1.4rem; margin: 4px 0 10px; padding-right: 20px; }
.mvd-tag { color: var(--ink-soft); margin-bottom: 12px; font-size: .95rem; line-height: 1.5; }
.mvd-node { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.mvd-n { font-family: var(--display); font-weight: 600; }
.mvd-s { font-family: var(--ui); font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ochre); margin: 2px 0 4px; }
.mvd-node p { font-size: .9rem; color: var(--ink-soft); }
.mvd-cap { font-size: .82rem; color: var(--ink-soft); margin-top: 4px; font-style: italic; }
.mvd-gap { border-left: 3px solid var(--oxblood); padding-left: 12px; margin: 10px 0; }
.mvd-gap strong { color: var(--oxblood); }
.mvd-gap p { font-size: .92rem; color: var(--ink-soft); margin-top: 4px; }
.mvd-num { background: #f3e7d6; border: 1px solid var(--ochre); padding: 12px; margin-top: 10px; font-size: .9rem; }
.mvd-num span { font-family: var(--display); font-weight: 700; font-size: 1.5rem; color: var(--oxblood); display: block; }

/* richer detail: connective narrative, section labels, and "follow a life" chips */
.mvd-story { font-size: 1.02rem; line-height: 1.55; color: var(--ink); margin: 6px 0 4px; padding: 12px 14px; background: var(--paper-2); border-left: 3px solid var(--ink); border-radius: 0 3px 3px 0; }
.mvd-sub { font-family: var(--ui); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin: 18px 0 2px; }
.mvd-lives { margin-top: 6px; }
.mvd-life { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 10px; width: 100%; text-align: left;
  background: #fff; border: 1px solid var(--line); border-left-width: 4px; border-radius: 3px; padding: 10px 12px; margin-top: 8px; cursor: pointer; font: inherit;
  transition: border-color .2s, background .2s; }
.mvd-life:hover { background: var(--paper-2); border-color: var(--oxblood); }
.mvd-life.housed { border-left-color: var(--pine); }
.mvd-life.stuck, .mvd-life.street { border-left-color: var(--oxblood); }
.mvd-life .ml-l { grid-column: 1; font-family: var(--display); font-weight: 600; font-size: 1rem; line-height: 1.1; }
.mvd-life .ml-w { grid-column: 1; font-family: var(--ui); font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-soft); margin-top: 2px; }
.mvd-life .ml-go { grid-column: 2; grid-row: 1 / span 2; color: var(--oxblood); font-weight: 700; font-size: 1.1rem; }

/* expand affordance ( + ) on each box + the open/selected highlight */
.mapview .exp { fill: var(--paper); stroke: var(--line); stroke-width: 1.5; }
.mapview .exp-t { font-family: var(--ui); font-size: 14px; font-weight: 700; fill: var(--ink-soft); pointer-events: none; }
.mapview .node:hover .exp { fill: var(--oxblood); stroke: var(--oxblood); }
.mapview .node:hover .exp-t { fill: #fff; }
.mapview .node.goal .exp { fill: #fff; stroke: #fff; }
.mapview .node.goal .exp-t { fill: var(--ink); }
.mapview .node.sel rect { stroke: var(--ink); stroke-width: 3; }
.mapview .node.sel .exp { fill: var(--ink); stroke: var(--ink); }
.mapview .node.sel .exp-t { fill: #fff; }
.mv-hint { display: block; margin-top: 8px; color: var(--ink); font-weight: 500; }
.mv-hint .exp-chip { color: var(--oxblood); font-style: normal; }

/* ---------- system map: pan / zoom + failure flagging ---------- */
.mv-stage { position: relative; overflow: hidden; }
.mv-stage svg { width: 100%; height: 100%; max-width: none; touch-action: none; user-select: none; cursor: grab; }
.mv-stage svg:active { cursor: grabbing; }

.mv-zoom { position: absolute; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 6px; z-index: 4; }
.mvz { width: 38px; height: 38px; display: grid; place-items: center; font-family: var(--ui); font-size: 1.3rem; line-height: 1; color: var(--ink); background: rgba(250,247,241,.94); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; box-shadow: 0 2px 8px rgba(33,27,20,.1); }
.mvz:hover { border-color: var(--ink); }
.mvz-fit { font-size: 1.05rem; }

/* a roadblock / failed handoff that belongs to the selected section */
.mapview #mv-svg .flag .g { stroke: var(--oxblood); stroke-width: 2; }
.mapview #mv-svg .flag .bt { font-weight: 700; }
.mapview #mv-svg .flag.ret-group .ret { stroke-width: 3.5; }
.mapview #mv-svg .flag .ret { stroke-width: 3.5; }

/* "where this part breaks" list inside the detail panel */
.mvd-fails { margin: 6px 0 4px; }
.mvd-fail { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left;
  font-family: var(--ui); background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--oxblood); border-radius: 3px; padding: 9px 12px; margin-top: 6px; cursor: pointer; }
.mvd-fail:hover { background: var(--paper-2); border-color: var(--oxblood); }
.mvd-fail .mf-t { font-size: .9rem; font-weight: 600; color: var(--ink); line-height: 1.25; }
.mvd-fail .mf-go { color: var(--oxblood); font-weight: 700; }

/* ---------- responsive ---------- */
@media (max-width: 740px) {
  body { font-size: 18px; }
  .life, .scene .wrap { grid-template-columns: 1fr; }
  .scene .wrap { gap: 2.4rem; }
  .life .portrait { min-height: 50vh; }
  .topnav .navlinks { gap: 12px; }
  .cover .scrollcue { display: none; }
  .mv-title { display: none; }
  .mv-zoom { right: 12px; bottom: 12px; }
  .mv-detail { top: auto; bottom: 0; right: 0; left: 0; width: auto; max-width: none; height: auto; max-height: 62vh; border-left: 0; border-top: 1px solid var(--line); box-shadow: 0 -12px 30px rgba(33,27,20,.16); }
  .beat { grid-template-columns: 40px 1fr; gap: .9rem; }
  .src-list > div { grid-template-columns: 1fr; gap: .2rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .way, .fill { transition: none; }
}
