/* sidequest.science — one stylesheet, no build step.
   Layout of this file: it is layered in the order the site was built, and later layers override earlier ones,
   so ORDER MATTERS. Add new rules at the end, or next to the rule they replace.
     base → hero → figures → sail lab → engine → cards → finale        the original page
     R9–R14, mobile pass                                              type system, openers, rail, scrollytelling, citation cards, kinetic hero
     C1–C10                                                           overview, glossary, figure system, charts, illustrations, sequences, labs, references, kit, print, QA
     D1–D10                                                           verification, cross-browser, dial charts, small screens, accessibility, evidence strip, hero deck, dark scheme
   Conventions: figure sequences are gated behind html.motion; print rules are in the single @media print block;
   colours come from the custom properties in :root (dark scheme overrides them at the end of the file).
   `node scripts/css-prune.mjs` lists selectors that can no longer match; `node scripts/visual-diff.mjs` catches visual regressions. */
:root {
  --paper: #f5efe2;
  --card: #fbf8f1;
  --card-2: #fffdf7;
  --paper-2: #ece4d2;
  --ink: #1d2433;
  --ink-soft: #4a5265;
  --line: #d6cbb3;
  --signal: #d4502a;
  --sea: #1f5f7a;
  --gold: #c99a2e;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", ui-sans-serif, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --measure: 40rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--sea); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--signal); }

.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 50; }
.progress span { display: block; height: 100%; width: 0; background: var(--signal); }

/* Hero */
.hero { position: relative; min-height: 100svh; display: grid; align-items: center; justify-items: start; text-align: left; padding: 6rem 1.5rem; overflow: hidden; border-bottom: 1px solid var(--line); }
.chart { position: absolute; inset: 0; width: 100%; height: 100%; }
.grid-line { stroke: var(--line); stroke-width: 1; opacity: .55; }
.contours path { fill: none; stroke: var(--sea); stroke-width: 1; opacity: .22; }
.wind-marks path { fill: none; stroke: var(--sea); stroke-width: 1.5; opacity: .45; stroke-linecap: round; stroke-linejoin: round; }
.route-ghost { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 2 10; opacity: .25; fill: none; }
.route { fill: none; stroke: var(--signal); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 3.2s .3s cubic-bezier(.6,0,.2,1) forwards; }
.waypoints .wp { opacity: 0; animation: pop .5s cubic-bezier(.3,1.6,.5,1) forwards; }
.waypoints > g:nth-child(1) .wp { animation-delay: .9s; } .waypoints > g:nth-child(2) .wp { animation-delay: 1.5s; } .waypoints > g:nth-child(3) .wp { animation-delay: 2.1s; } .waypoints > g:nth-child(4) .wp { animation-delay: 2.7s; }
.waypoints circle { fill: var(--gold); stroke: var(--paper); stroke-width: 3; }
.waypoints text { font: 700 16px var(--sans); fill: var(--ink); text-anchor: middle; }
.goal-buoy circle { fill: var(--signal); }
.goal-buoy .pulse { fill: none; stroke: var(--signal); stroke-width: 1.5; transform-origin: center; transform-box: fill-box; animation: pulse 2.4s 3.4s ease-out infinite; opacity: 0; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
.waypoints .wp { transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 0% { opacity: .8; transform: scale(.5); } 100% { opacity: 0; transform: scale(1.6); } }
.hero-inner { position: relative; z-index: 1; max-width: 46rem; margin-left: max(0rem, calc((100vw - 72rem) / 2)); }
.kicker { display: flex; align-items: center; gap: .9rem; }
.kicker-rule { width: 2.5rem; height: 2px; background: var(--signal); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; }
.cta-ghost { font: 600 .9rem var(--sans); color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--ink); padding-bottom: 2px; }
.hero-meta { font: .78rem var(--sans); letter-spacing: .06em; color: var(--ink-soft); margin: 2.5rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); max-width: 30rem; }
.irons-label { font: 600 11px var(--sans); letter-spacing: .14em; text-transform: uppercase; fill: var(--ink-soft); opacity: .6; }
.boat-icon path { fill: var(--ink); }
@media (max-width: 860px) {
  .hero { text-align: left; padding: 5rem 1.25rem 4rem; }
  .hero { align-items: end; padding-bottom: 5rem; }
  .hero-inner { padding: 0; }
  .chart { opacity: .9; -webkit-mask: linear-gradient(180deg, #000 0 24%, transparent 38%, transparent 90%, rgba(0,0,0,.4)); mask: linear-gradient(180deg, #000 0 24%, transparent 38%, transparent 90%, rgba(0,0,0,.4)); }
  .irons-label { display: none; }
  .hero h1 { font-size: clamp(3rem, 14vw, 4.5rem); }
}
.kicker { font: 600 .78rem var(--sans); letter-spacing: .24em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 1.25rem; }
.hero h1 { font-size: clamp(3.2rem, 10vw, 8.5rem); line-height: .92; letter-spacing: -.035em; margin: 0; font-weight: 600; }
.hero h1 .h1-line { display: block; font-size: .5em; letter-spacing: -.02em; margin-bottom: .1em; }
.hero h1 em { color: var(--signal); display: block; }
.subtitle { font-size: clamp(1.2rem, 2.4vw, 1.6rem); font-style: italic; color: var(--ink-soft); margin: 1.25rem 0 2.25rem; }
.cta { display: inline-flex; gap: .6rem; align-items: center; font: 600 .85rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--paper); background: var(--ink); padding: 1rem 1.6rem; border-radius: 999px; text-decoration: none; transition: background .2s, transform .2s; }
.cta:hover { background: var(--signal); color: var(--paper); transform: translateY(-2px); }
.cta span { animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(3px); } }
.hero-legend { position: absolute; bottom: 1.25rem; left: max(1.5rem, calc((100vw - 72rem) / 2)); margin: 0; font: .72rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; display: flex; align-items: center; gap: .4rem; }
.lg-route { width: 20px; height: 3px; background: var(--signal); display: inline-block; }
.lg-q { width: 16px; height: 16px; border-radius: 50%; background: var(--gold); color: var(--ink); font-weight: 700; font-size: 10px; display: inline-grid; place-items: center; }
.lg-goal { width: 10px; height: 10px; border-radius: 50%; background: var(--signal); display: inline-block; }

/* Paper grain */
body { position: relative; }
body::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 100; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .25 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* Reveal */
[data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1); }
[data-reveal].in { opacity: 1; transform: none; }

/* Mobile chapter bar */
.mobile-bar { display: none; }
@media (max-width: 860px) {
  .mobile-bar { display: flex; position: sticky; top: 0; z-index: 40; align-items: center; gap: .75rem; padding: .7rem 1rem; background: rgba(245,239,226,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); font: 600 .85rem var(--sans); }
  .mb-home { background: var(--ink); color: var(--paper); border-radius: 6px; padding: .2rem .45rem; text-decoration: none; font-size: .72rem; letter-spacing: .05em; }
  #mb-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mb-num { color: var(--signal); font-family: var(--serif); }
}

.vec { position: relative; display: inline-block; }
.vec::before { content: "→"; position: absolute; left: 50%; top: -.72em; transform: translateX(-50%); font-size: .7em; font-style: normal; }

/* Layout */
.layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 3rem; max-width: 72rem; margin: 0 auto; padding: 4rem 1.5rem; }
.toc { position: sticky; top: 2rem; align-self: start; font-family: var(--sans); font-size: .9rem; }
.toc-title { font-weight: 700; letter-spacing: .15em; text-transform: uppercase; font-size: .72rem; color: var(--ink-soft); }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line); }
.toc a { display: flex; gap: .6rem; padding: .45rem .9rem; color: var(--ink-soft); text-decoration: none; border-left: 2px solid transparent; margin-left: -1px; }
.toc a span { font-family: var(--serif); color: var(--line); width: 1.6rem; }
.toc a.active { color: var(--ink); border-left-color: var(--signal); }
.toc a.active span { color: var(--signal); }

main { max-width: 46rem; }
.chapter { padding: 2rem 0 5rem; border-bottom: 1px solid var(--line); scroll-margin-top: 1rem; }
.chapter-num { font: 600 .75rem var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--signal); margin: 0; }
.chapter h2 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.05; letter-spacing: -.02em; margin: .4rem 0 .5rem; font-weight: 600; }
.chapter-sub { font-style: italic; color: var(--ink-soft); font-size: 1.3rem; margin: 0 0 2rem; }
.lede { font-size: 1.35rem; line-height: 1.6; }
.lede::first-letter { float: left; font-size: 4.2em; line-height: .85; padding: .08em .1em 0 0; color: var(--signal); }
.pull { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.3; font-style: italic; border-left: 3px solid var(--signal); padding-left: 1.5rem; margin: 2.5rem 0; }
.cite { font-family: var(--sans); font-size: .72em; color: var(--ink-soft); text-decoration: none; white-space: normal; }
.cite:hover { color: var(--signal); }

.callout { background: var(--ink); color: var(--paper); padding: 2rem; border-radius: 4px; margin: 2.5rem 0 0; }
.callout strong { color: #f3a27f; }
.callout-label { font: 700 .72rem var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin: 0 0 .5rem; }
.callout p:last-child { margin-bottom: 0; }

/* Figures */
figure { margin: 2.5rem 0; }
svg text { font-family: var(--sans); fill: var(--ink); font-size: 12px; }
svg .small { font-size: 10px; fill: var(--ink-soft); }

.stages { list-style: none; padding: 0; margin: 2.5rem 0; display: grid; grid-template-columns: repeat(3, 1fr); font-family: var(--sans); position: relative; }
.stages::before { content: ""; position: absolute; left: 1.4rem; right: 30%; top: 1.4rem; height: 2px; background: linear-gradient(90deg, var(--signal), var(--gold), var(--sea)); }
.stages a { position: relative; display: grid; gap: .1rem; text-decoration: none; color: var(--ink); padding-right: 1rem; }
.st-n { width: 2.8rem; height: 2.8rem; border-radius: 50%; display: grid; place-items: center; background: var(--paper); border: 2px solid var(--ink); font: 700 .8rem var(--mono); margin-bottom: .6rem; transition: background .2s, color .2s; }
.stages a:hover .st-n { background: var(--ink); color: var(--paper); }
.stages b { font: 600 1.1rem var(--serif); }
.stages small { color: var(--ink-soft); font-size: .82rem; }
.stage { margin-top: 3rem; scroll-margin-top: 1rem; }
.stage h3 { font-size: 1.7rem; line-height: 1.2; display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
.stage h3 small { font-size: .9rem; font-style: italic; color: var(--ink-soft); font-weight: 400; }
.stage-n { font: 700 .9rem var(--sans); background: var(--signal); color: var(--paper); width: 1.8rem; height: 1.8rem; border-radius: 50%; display: inline-grid; place-items: center; }
figcaption { font: .8rem var(--sans); color: var(--ink-soft); margin-top: .75rem; }

.flow-chart svg { width: 100%; display: block; }
.fc-bg { fill: var(--card); }
.fc-anx { fill: rgba(212,80,42,.07); }
.fc-apa { fill: rgba(74,82,101,.06); }
.channel { fill: url(#fc-g); stroke: var(--sea); stroke-width: 1; stroke-dasharray: 4 4; }
.axis { stroke: var(--ink); stroke-width: 1.5; }
svg .zone { font: 600 18px var(--serif); }
.zone.anx { fill: var(--signal); } .zone.apa { fill: var(--ink-soft); }
svg .zone.flow { font: 700 11px var(--sans); fill: var(--sea); letter-spacing: .32em; }
svg .zone-sub { font-size: 10px; fill: var(--ink-soft); }
.fc-a circle { fill: var(--signal); } .fc-b circle { fill: var(--gold); } .fc-c circle { fill: var(--sea); }
.fc-a circle, .fc-b circle, .fc-c circle { stroke: var(--card); stroke-width: 3; }
svg .fc-lab { font-size: 10.5px; font-weight: 600; fill: var(--ink); }
svg .ax-lab { font-size: 11px; fill: var(--ink-soft); letter-spacing: .04em; }
.pivot { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 3; }
.pivot.back { stroke: var(--sea); }
#ah path { fill: var(--ink); }

/* Zeigarnik tickets */
.tickets { display: flex; gap: 2rem; align-items: flex-start; justify-content: center; flex-wrap: wrap; font-family: var(--mono); padding-top: .5rem; }
.ticket { width: 14rem; background: var(--card-2); padding: 1rem 1.1rem 1.4rem; font-size: .8rem; line-height: 1.6; position: relative; filter: drop-shadow(0 12px 14px rgba(29,36,51,.18)); }
.ticket::after { content: ""; position: absolute; left: 0; right: 0; bottom: -7px; height: 8px; background: radial-gradient(circle at 8px -2px, transparent 7px, var(--card-2) 7.5px) 0 0 / 16px 8px repeat-x; }
.ticket.open { transform: rotate(-2deg); outline: 2px solid var(--signal); outline-offset: 0; }
.ticket.open::before { content: ""; position: absolute; top: -8px; left: 50%; width: 14px; height: 14px; border-radius: 50%; background: var(--signal); transform: translateX(-50%); box-shadow: 0 2px 0 rgba(0,0,0,.2); }
.ticket.paid { transform: rotate(2.5deg) translateY(1.5rem); opacity: .42; }
.ticket ul { list-style: none; margin: .4rem 0; border-top: 1px dashed #c9bfa8; border-bottom: 1px dashed #c9bfa8; padding: .4rem 0; }
.t-head { display: flex; justify-content: space-between; font-weight: 700; margin: 0; }
.t-head span { font-size: .65rem; letter-spacing: .1em; padding: .05rem .4rem; border-radius: 3px; background: var(--signal); color: #fff; }
.paid .t-head span { background: var(--ink-soft); }
.t-foot { margin: 0; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.tickets figcaption { flex-basis: 100%; text-align: center; margin-top: 2rem; }

/* Incubation network */
.network { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.net-panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.net-panel.lit { background: var(--ink); border-color: var(--ink); }
.net-title { font: 600 1rem var(--serif); margin: 0 0 .25rem; display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.net-title small { font: 600 .62rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.lit .net-title { color: var(--paper); } .lit .net-title small { color: #f3a27f; }
.net { width: 100%; display: block; }
.net line { stroke: #d9cfb9; stroke-width: 1; }
.net line.strong { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.net circle { fill: #cfc5ae; }
.net circle.on { fill: var(--ink); }
.loose line { stroke: rgba(245,239,226,.16); }
.loose line.weak { stroke: #f3a27f; stroke-width: 1.2; stroke-dasharray: 3 3; animation: dash 1.6s linear infinite; }
.loose circle { fill: rgba(245,239,226,.35); }
.loose circle.on { fill: #f3a27f; }
.loose circle.aha { fill: var(--gold); filter: drop-shadow(0 0 6px rgba(201,154,46,.9)); }
.net text { font: 700 12px var(--sans); fill: var(--gold); }
@keyframes dash { to { stroke-dashoffset: -12; } }
.network figcaption { grid-column: 1 / -1; }
@media (max-width: 860px) { .network, .stages { grid-template-columns: 1fr; gap: 1rem; } .stages::before { display: none; } }

/* Sail lab */
.sail-lab { background: var(--ink); color: var(--paper); border-radius: 10px; padding: 2rem; margin: 3rem -2rem; box-shadow: 0 30px 60px -30px rgba(29,36,51,.5); }
.sail-head h3 { font-size: 1.9rem; line-height: 1.1; margin: .2rem 0 .4rem; }
.sail-head p:last-child { font: .95rem/1.5 var(--sans); color: #b9bfcc; margin: 0 0 1.5rem; max-width: 34rem; }
.sail-body { display: grid; grid-template-columns: 1.05fr 1fr; gap: 2rem; align-items: center; }
.sail-canvas svg { width: 100%; display: block; }
.sail-lab svg text { fill: #b9bfcc; }
.ring { fill: none; stroke: rgba(245,239,226,.18); stroke-dasharray: 2 4; }
.ticks line { stroke: rgba(245,239,226,.35); }
.irons { fill: rgba(212, 80, 42, .16); transition: fill .3s; }
.stall .irons { fill: rgba(212, 80, 42, .38); }
.irons-txt { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; fill: #e48b6a !important; }
.wind path { stroke: #7fb3c9; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.sail-lab .wind text { fill: #7fb3c9; font-size: 11px; }
.buoy { fill: var(--signal); }
.goal-line { stroke: rgba(245,239,226,.35); stroke-width: 1.5; stroke-dasharray: 4 5; }
.heading { stroke: var(--paper); stroke-width: 2.5; transition: opacity .2s; }
#arrow-boat path { fill: var(--paper); }
.proj { stroke: rgba(245,239,226,.55); stroke-width: 1; stroke-dasharray: 3 3; }
.vmg { stroke: var(--signal); stroke-width: 7; stroke-linecap: round; transition: stroke .2s; }
.neg .vmg { stroke: #7c8598; }
.hull { fill: var(--gold); stroke: var(--ink); stroke-width: 1.5; }
.sailcloth { fill: none; stroke: var(--paper); stroke-width: 2; stroke-linecap: round; }
.sail-controls { font-family: var(--sans); font-size: .95rem; }
.angle-label { display: flex; justify-content: space-between; align-items: baseline; color: #b9bfcc; }
.angle-label output { font: 600 2.2rem var(--serif); color: var(--paper); }
.sail-controls input[type=range] { width: 100%; accent-color: var(--signal); margin: .25rem 0 .75rem; }
.presets { display: flex; flex-wrap: wrap; gap: .35rem; }
.sail-lab button { border-color: rgba(245,239,226,.4); color: var(--paper); font-size: .78rem; padding: .35rem .7rem; }
.sail-lab button:hover { background: var(--paper); color: var(--ink); }
.readout { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.25rem 0 .75rem; }
.readout div { border-top: 1px solid rgba(245,239,226,.2); padding-top: .5rem; }
.readout dt { color: #b9bfcc; font-size: .78rem; } .readout dd { margin: 0; font: 600 1.6rem var(--mono); }
#r-vmg { color: #f3a27f; } .neg #r-vmg { color: #9aa3b5; }
.polar { width: 100%; display: block; }
.polar .zero { stroke: rgba(245,239,226,.3); }
.polar-path { fill: none; stroke: #f3a27f; stroke-width: 2; }
.polar-cursor { stroke: rgba(245,239,226,.35); stroke-dasharray: 2 3; }
.polar-dot { fill: var(--paper); stroke: var(--signal); stroke-width: 2; }
.verdict { font: 600 1rem/1.45 var(--serif); font-style: italic; min-height: 4.4em; margin: .75rem 0 0; color: var(--paper); }
.sail-lab figcaption { color: #8d94a5; border-top: 1px solid rgba(245,239,226,.12); padding-top: 1rem; margin-top: 1.5rem; }
button { font: 600 .85rem var(--sans); border: 1px solid var(--ink); background: transparent; color: var(--ink); padding: .45rem .8rem; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s; }
button:hover { background: var(--ink); color: var(--paper); }
button:disabled { opacity: .35; cursor: not-allowed; }
.fineprint { font: .78rem/1.5 var(--sans); color: var(--ink-soft); }
.math { font-family: var(--serif); font-style: italic; white-space: nowrap; display: inline-block; }

.variety { display: grid; grid-template-columns: 1fr 2fr; gap: 1rem; margin: 2rem 0; font-family: var(--sans); }

.params { list-style: none; padding: 0; margin: 2rem 0; display: grid; gap: .75rem; }
.params li { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1.25rem; padding: 1.25rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.sym-col { display: grid; gap: .35rem; align-content: start; }
.sym { font: italic 600 2.2rem/1 var(--serif); color: var(--signal); }
.spark { width: 100%; overflow: visible; }
.spark path { fill: none; stroke: var(--ink); stroke-width: 1.75; stroke-linecap: round; }
.spark .mark { stroke: var(--signal); stroke-dasharray: 2 2; }
.spark text { font-size: 8px; fill: var(--ink-soft); }
.spark .arr { stroke: var(--ink-soft); stroke-dasharray: 2 2; }
.spark .m1 { fill: var(--ink); } .spark .m2 { fill: var(--gold); } .spark .m3 { fill: var(--sea); }
.spark .dot { fill: var(--signal); }
.spark .d { stroke: var(--signal); } .spark .a { stroke: var(--sea); }
.params h4 { margin: 0 0 .3rem; font-family: var(--sans); }
.params p { margin: 0; font-size: 1.05rem; }

/* Spiral */
.spiral svg { width: 100%; display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.sp-base { stroke: var(--ink); }
.sp-flat { stroke: var(--ink-soft); stroke-dasharray: 3 5; }
.sp-path { fill: none; stroke: var(--signal); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 2.6s cubic-bezier(.5,0,.2,1) .2s; }
#sp-ah path { fill: var(--signal); }
.in .sp-path { stroke-dashoffset: 0; }
.sp-stn circle { stroke: var(--card); stroke-width: 3; }
.st-stall circle { fill: var(--ink); } .st-esc circle { fill: var(--signal); } .st-sq circle { fill: var(--gold); } .st-goal circle { fill: var(--sea); }
.sp-stn text { font: 600 11px var(--sans); fill: var(--ink); }
.sp-stn text.q { font-size: 12px; }

.engine-demo { background: var(--ink); color: var(--paper); border-radius: 6px; padding: 1.75rem; margin-top: 2rem; font-family: var(--sans); }
.engine-demo .fineprint { color: #a9b0c0; margin-top: 0; }
.engine-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 1.75rem; }
.gauge { margin-bottom: .9rem; font-size: .85rem; }
.meter { height: 8px; background: rgba(255,255,255,.12); border-radius: 99px; margin-top: .3rem; overflow: hidden; }
.meter i { display: block; height: 100%; width: 50%; background: var(--gold); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.time { font-size: .85rem; display: block; margin-top: 1.25rem; }
.engine-card { background: rgba(255,255,255,.05); border-radius: 4px; padding: 1.25rem; }
.now-label { font-size: .7rem; letter-spacing: .15em; text-transform: uppercase; color: #a9b0c0; margin: 0; }
.now { margin: .2rem 0 1rem; }
.suggest { font: 600 1.4rem/1.25 var(--serif); color: #f3a27f; margin: .2rem 0 .3rem; }
.why { font-size: .82rem; color: #a9b0c0; margin: 0 0 1rem; }
.engine-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.engine-demo button { border-color: var(--paper); color: var(--paper); }
.engine-demo button:hover { background: var(--paper); color: var(--ink); }
.engine-demo button.esc { background: var(--signal); border-color: var(--signal); }
.engine-demo button.ghost { border-color: transparent; color: #a9b0c0; }
.log { font: .78rem var(--mono); color: #a9b0c0; padding-left: 1.2rem; margin: 1rem 0 0; max-height: 7rem; overflow: auto; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin: 2.5rem 0; }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem 1.5rem 1.5rem; background: var(--card); position: relative; overflow: hidden; box-shadow: 0 24px 40px -32px rgba(29,36,51,.45); }
.card::after { content: ""; position: absolute; inset: 8px; border: 1px solid var(--line); border-radius: 8px; pointer-events: none; }
.card-art { width: 100%; height: 9rem; display: block; margin: -.25rem 0 .5rem; background: radial-gradient(ellipse at 50% 60%, var(--paper-2), transparent 70%); }
.pl { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.pl-in { fill: none; stroke: var(--line); }
.pl-ghost { fill: none; stroke: var(--signal); stroke-width: 1.2; stroke-dasharray: 3 3; }
.wob { transform-origin: 100px 70px; animation: wob 2.4s ease-in-out infinite; }
@keyframes wob { 0%,100% { transform: rotate(-6deg) scaleY(1.25); } 50% { transform: rotate(6deg) scaleY(.8); } }
.spinarrow { fill: none; stroke: var(--sea); stroke-width: 1.5; }
.card-art .eq { font: italic 12px var(--serif); fill: var(--ink-soft); }
.soil { fill: none; stroke: var(--ink-soft); stroke-width: 1.2; }
.worm { fill: none; stroke: #b7745a; stroke-width: 5; stroke-linecap: round; }
.stem { fill: none; stroke: #4f7a52; stroke-width: 2; }
.petals ellipse { fill: #e8b8c8; stroke: #9b5a73; stroke-width: 1; opacity: .9; }
.petals .lip { fill: var(--gold); }
.bee { fill: var(--gold); stroke: var(--ink); }
.card-kicker { font: 600 .65rem var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); margin: 0; }
.card-name { font: 600 1.6rem/1.15 var(--serif); margin: .2rem 0 .6rem; }
.card-main { font: .88rem var(--sans); margin: 0 0 .75rem; padding: .5rem .75rem; background: var(--paper-2); border-radius: 6px; }
.card-main span { font-size: .65rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); margin-right: .4rem; }
.card-side { list-style: none; font: .88rem/1.45 var(--sans); padding: 0; margin: 0 0 .9rem; }
.card-side li { padding: .3rem 0 .3rem 1.4rem; position: relative; }
.card-side li::before { content: "?"; position: absolute; left: 0; top: .38rem; width: 1rem; height: 1rem; border-radius: 50%; background: var(--gold); font: 700 .6rem/1rem var(--sans); text-align: center; color: var(--ink); }
.card-payoff { font-style: italic; color: var(--signal); margin: 0; font-size: 1rem; line-height: 1.4; }

/* Finale */
.finale { position: relative; background: var(--ink); color: var(--paper); overflow: hidden; padding: 7rem 1.5rem 20rem; text-align: center; }
.finale-art { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 300px; }
.sea1 { fill: #22304a; } .sea2 { fill: #18213a; }
.fin-trail { fill: none; stroke: var(--signal); stroke-width: 2; stroke-dasharray: 2 7; stroke-linecap: round; opacity: .8; }
.hull2 { fill: var(--gold); }
.mast { stroke: var(--paper); stroke-width: 4; }
.sail1 { fill: var(--paper); } .sail2 { fill: #f3a27f; }
.fin-boat { animation: rock 5s ease-in-out infinite; transform-origin: 0 20px; }
@keyframes rock { 50% { transform: rotate(-3deg) translateY(3px); } }
.fin-wind path { fill: none; stroke: #7fb3c9; stroke-width: 1.5; opacity: .55; stroke-linecap: round; stroke-linejoin: round; }
.fin-buoy path, .fin-buoy circle { fill: var(--signal); }
.fin-buoy .halo { fill: none; stroke: var(--signal); opacity: .4; }
.fin-stars circle { fill: var(--paper); opacity: .6; }
.finale-inner { position: relative; max-width: 44rem; margin: 0 auto; }
.finale-kicker { font: 600 .72rem var(--sans); letter-spacing: .24em; text-transform: uppercase; color: var(--gold); margin: 0 0 1.5rem; }
.finale .closing { font-size: 1.3rem; color: #c6cbd6; line-height: 1.6; }
.finale .closing-big { font-size: clamp(2.4rem, 6vw, 4.4rem); line-height: 1.02; letter-spacing: -.025em; font-weight: 600; color: var(--paper); margin: 1.5rem 0 2.5rem; }
.finale .closing-big em { color: #f3a27f; }
.cta.light { background: var(--paper); color: var(--ink); }
.cta.light:hover { background: var(--signal); color: var(--paper); }
@media (max-width: 860px) { .params li { grid-template-columns: 1fr; gap: .5rem; } .sym-col { grid-template-columns: auto 8rem; align-items: center; gap: 1rem; } .finale { padding: 5rem 1.25rem 16rem; } }

.sources { padding: 3rem 0; font-family: var(--sans); font-size: .85rem; }
.sources h2 { font: 600 1.4rem var(--serif); }
.sources li { margin: .3rem 0; }

footer { text-align: center; padding: 3rem 1rem; border-top: 1px solid var(--line); font: .85rem var(--sans); color: var(--ink-soft); }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .toc { display: none; }
  .sail-lab { margin: 2.5rem -1rem; padding: 1.25rem; }
  .sail-body, .engine-grid, .cards, .variety { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before { transition: none !important; animation: none !important; }
  .route { stroke-dashoffset: 0; } .waypoints .wp { opacity: 1; } [data-reveal] { opacity: 1; transform: none; }
}
.nowrap { white-space: nowrap; }

/* Chapter I quest map */
.questmap { margin: 3rem 0; display: grid; gap: 1rem; }
.qm-lane { display: grid; grid-template-columns: 11rem 1fr; gap: 1rem; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.25rem; }
.qm-label { font-family: var(--sans); display: grid; gap: .15rem; }
.qm-label b { font: 600 1.15rem/1.15 var(--serif); }
.qm-label small { font-size: .78rem; color: var(--ink-soft); line-height: 1.35; }
.qm-tag { font-size: .65rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }
.qm-svg { width: 100%; display: block; overflow: visible; }
.road { stroke: var(--ink-soft); stroke-width: 2; stroke-dasharray: 3 7; stroke-linecap: round; }
.trail { fill: none; stroke: var(--signal); stroke-width: 2.5; stroke-linecap: round; }
.node { fill: var(--ink); }
.castle path { fill: var(--ink); }
.boss-x path { stroke: var(--signal); stroke-width: 3; stroke-linecap: round; opacity: .85; }
.flag path { fill: var(--gold); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.wall line { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.sq circle { fill: var(--gold); stroke: var(--card); stroke-width: 2.5; }
.sq text { font: 700 12px var(--sans); text-anchor: middle; }
.energy { fill: none; stroke: var(--ink-soft); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 2.2s cubic-bezier(.6,0,.2,1) .2s; }
.energy.good { stroke: var(--sea); stroke-width: 2.5; }
.in .energy { stroke-dashoffset: 0; }
.axis-faint { stroke: var(--line); }
svg .tiny { font-size: 10px; fill: var(--ink-soft); letter-spacing: .02em; }
svg .tiny.warn { fill: var(--signal); font-weight: 600; }
svg .tiny.good { fill: var(--sea); font-weight: 600; }
.questmap figcaption { text-align: center; font-style: italic; font-family: var(--serif); font-size: .95rem; }

/* Chapter II threat diagram */
.threat { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: 2.5rem 0; font-family: var(--sans); }
.threat figcaption { grid-column: 1 / -1; }

/* Perry list */
.perry { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: stretch; margin: 2.5rem 0; font-family: var(--sans); }
.perry-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem 1.25rem 1rem; box-shadow: 0 1px 0 var(--line), 0 18px 30px -24px rgba(29,36,51,.35); transform: rotate(-.6deg); }
.perry-card.bad { background: #2a2f3c; color: #d7dbe4; border-color: #2a2f3c; transform: rotate(.6deg); }
.perry-head { font: 600 1.15rem var(--serif); margin: 0 0 .75rem; display: flex; justify-content: space-between; align-items: baseline; }
.perry-head small { font: 600 .65rem var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.bad .perry-head small { color: #8d94a5; }
.perry ol { list-style: none; margin: 0; padding: 0; font-size: .9rem; line-height: 1.35; }
.perry li { display: flex; gap: .6rem; align-items: center; padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.perry li.dread { font-weight: 700; color: var(--signal); }
.perry li.dread em { font-weight: 400; color: var(--ink-soft); }
.perry li:not(.dread) { color: var(--ink-soft); }
.box { width: 1rem; height: 1rem; border: 1.5px solid currentColor; border-radius: 3px; flex: none; position: relative; }
.box.done { background: var(--sea); border-color: var(--sea); }
.box.done::after { content: ""; position: absolute; left: 4px; top: 0; width: 4px; height: 9px; border: solid var(--paper); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.perry li:not(.dread) { text-decoration-color: var(--sea); }
.perry-foot { font-size: .8rem; font-weight: 600; margin: .9rem 0 0; color: var(--sea); }
.bad .perry-foot { color: #f3a27f; }
.perry-vs { align-self: center; font: italic 1.4rem var(--serif); color: var(--ink-soft); }
.slot { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; background: #1d2433; border-radius: 8px; padding: .5rem; height: 7.2rem; overflow: hidden; }
.reel { display: flex; flex-direction: column; align-items: center; gap: .6rem; font-size: 1.6rem; background: #f5efe2; border-radius: 4px; padding: .4rem 0; animation: spin 1.4s linear infinite; }
.reel:nth-child(2) { animation-duration: 1.1s; } .reel:nth-child(3) { animation-duration: 1.7s; }
@keyframes spin { 50% { transform: translateY(-1.2rem); } }
@media (max-width: 860px) {
  .qm-lane { grid-template-columns: 1fr; }
  .perry { grid-template-columns: 1fr; }
  .perry-vs { justify-self: center; }
  .threat { grid-template-columns: 1fr; }
}
.loose .aha-path { stroke: var(--gold); stroke-width: 3; stroke-linecap: round; filter: drop-shadow(0 0 4px rgba(201,154,46,.7)); }
.net .track-lab { fill: var(--ink); font-size: 10px; letter-spacing: .06em; }

@media (max-width: 640px) {
  .hero-legend { display: none; }
  .hero { padding-top: 46svh; align-items: start; }
}

/* Citations (author–year) */
.cites { font-family: var(--sans); font-size: .78em; color: var(--ink-soft); white-space: normal; }
.cites .cite { color: var(--sea); text-decoration: none; border-bottom: 1px dotted currentColor; }
.cites .cite:hover { color: var(--signal); }

.aside-note { font: .95rem/1.55 var(--sans); background: var(--card); border-left: 3px solid var(--gold); padding: .9rem 1.1rem; border-radius: 0 8px 8px 0; color: var(--ink); }
.aside-note b { font-weight: 700; letter-spacing: .02em; }

/* Evidence notes */
.evidence { margin: 3rem 0 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-family: var(--sans); }
.evidence summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; }
.evidence summary::-webkit-details-marker { display: none; }
.ev-title { font: 600 1.05rem var(--serif); display: flex; align-items: center; gap: .6rem; }
.ev-title::before { content: "+"; width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 1.5px solid var(--ink); display: inline-grid; place-items: center; font: 600 .9rem/1 var(--sans); transition: transform .25s; }
.evidence[open] .ev-title::before { transform: rotate(45deg); background: var(--ink); color: var(--paper); }
.ev-meta { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.ev-body { padding: 0 1.25rem 1.25rem; border-top: 1px dashed var(--line); }
.ev-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-top: 1rem; }
.ev-cols h4, .ev-refs-h { font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; margin: 0 0 .5rem; }
.ev-good h4 { color: var(--sea); } .ev-hedge h4 { color: var(--signal); }
.ev-cols ul { margin: 0; padding: 0; list-style: none; font-size: .9rem; line-height: 1.5; }
.ev-cols li { padding: .35rem 0 .35rem 1.3rem; position: relative; border-bottom: 1px solid rgba(214,203,179,.5); }
.ev-good li::before { content: "✓"; position: absolute; left: 0; color: var(--sea); font-weight: 700; }
.ev-hedge li::before { content: "~"; position: absolute; left: .1rem; color: var(--signal); font-weight: 700; }
.ev-refs-h { margin-top: 1.5rem !important; color: var(--ink-soft); }
.refs { margin: 0; padding-left: 1.3rem; font-size: .82rem; line-height: 1.5; color: var(--ink); }
.refs li { margin: .4rem 0; }
.refs li::marker { color: var(--ink-soft); }
.refs a, .src-group a { word-break: break-all; color: var(--sea); }

/* Sources by chapter */
.src-intro { max-width: 40rem; color: var(--ink-soft); font-size: .9rem; line-height: 1.55; }
.src-grid { display: grid; gap: 1.75rem; margin-top: 1.5rem; }
.src-group h3 { font: 600 1.05rem var(--serif); margin: 0 0 .5rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line); }
.src-group ol { margin: 0; padding-left: 1.3rem; font-size: .82rem; line-height: 1.5; }
.src-group li { margin: .35rem 0; }
@media (max-width: 860px) { .ev-cols { grid-template-columns: 1fr; } .evidence summary { flex-direction: column; gap: .2rem; } }

/* ===================== R9: Type system ===================== */
body { font-family: var(--serif); font-size: clamp(1.08rem, .95rem + .35vw, 1.22rem); line-height: 1.68; font-optical-sizing: auto; font-variant-numeric: oldstyle-nums proportional-nums; font-kerning: normal; text-rendering: optimizeLegibility; hanging-punctuation: first allow-end; }
p, li, figcaption { text-wrap: pretty; }
h1, h2, h3, .pull, .closing-big, .lede::first-letter { text-wrap: balance; }
h1, h2, h3, .pull, .card-name, .closing-big, .sail-head h3, .suggest, .angle-label output, .perry-head, .net-title, .src-group h3, .ev-title, .qm-label b, .stages b, .sources h2 { font-family: var(--display); }
.hero h1 { font-weight: 400; letter-spacing: -.045em; font-variation-settings: "SOFT" 30, "WONK" 0; line-height: .9; }
.hero h1 .h1-line { font-weight: 350; letter-spacing: -.03em; font-variation-settings: "SOFT" 100; }
.hero h1 em { font-weight: 500; font-style: italic; font-variation-settings: "SOFT" 100, "WONK" 1; letter-spacing: -.035em; padding-right: .06em; }
.chapter h2 { font-weight: 450; letter-spacing: -.035em; font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: .98; font-variation-settings: "SOFT" 50; }
.chapter-sub { font-family: var(--display); font-weight: 300; font-style: italic; font-variation-settings: "SOFT" 100, "WONK" 1; font-size: clamp(1.25rem, 2vw, 1.55rem); }
.stage h3 { font-weight: 500; letter-spacing: -.02em; font-size: clamp(1.6rem, 3vw, 2.1rem); }
.pull { font-weight: 350; font-style: italic; letter-spacing: -.015em; font-variation-settings: "SOFT" 100, "WONK" 1; font-size: clamp(1.6rem, 3.2vw, 2.3rem); line-height: 1.22; border-left: 0; padding-left: 0; position: relative; margin: 3.5rem 0; }
.pull::before { content: "“"; position: absolute; left: -.55em; top: -.15em; font-size: 2.6em; line-height: 1; color: var(--signal); font-style: normal; font-weight: 600; }
.lede { font-size: 1.32em; line-height: 1.55; font-weight: 400; }
.lede::first-letter { font-family: var(--display); font-weight: 600; font-variation-settings: "SOFT" 0, "WONK" 1; font-size: 4.6em; line-height: .78; padding: .06em .08em 0 0; }
.closing-big { font-weight: 400 !important; font-variation-settings: "SOFT" 60; letter-spacing: -.04em !important; }
.closing-big em { font-variation-settings: "SOFT" 100, "WONK" 1; font-weight: 500; }
.card-name { font-weight: 500; letter-spacing: -.02em; }
.kicker, .chapter-num, .toc-title, .callout-label, .ev-meta, .card-kicker, .qm-tag, .now-label { font-feature-settings: "ss01", "cv11"; }
.chapter-num { font-size: .72rem; letter-spacing: .28em; }
strong, b { font-weight: 650; }
.readout dd, .ticket, .log, .st-n { font-variant-numeric: tabular-nums lining-nums; }
.sail-controls, .engine-demo { font-variant-numeric: lining-nums tabular-nums; }
::selection { background: rgba(212,80,42,.22); }
a { text-decoration-thickness: from-font; }

/* ===================== R10: Layout, rail, chapter openers ===================== */
html { overflow-x: clip; }
.layout { display: block; max-width: none; padding: 0 1.5rem; margin: 0; }
main { max-width: 42rem; margin: 0 auto; }
.chapter { padding: 0 0 6rem; border-bottom: 0; scroll-margin-top: 0; }
.wide { margin-inline: calc(50% - min(33rem, 50vw - 1.5rem)) !important; }
.sail-lab.wide { padding: 2.5rem; }

/* Rail navigation */
.toc.rail { position: fixed; left: 1.75rem; top: 50%; transform: translate(-1rem, -50%); z-index: 30; opacity: 0; pointer-events: none; transition: opacity .4s, transform .4s; font-size: .82rem; }
.toc.rail.show { opacity: 1; transform: translate(0, -50%); pointer-events: auto; }
.rail .toc-title { display: none; }
.rail ol { border: 0; display: grid; gap: .15rem; }
.rail a { position: relative; align-items: center; gap: .75rem; padding: .35rem .5rem; border: 0; margin: 0; color: var(--ink-soft); border-radius: 999px; }
.rail a > span:first-child { width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center; font: 500 .78rem var(--display); color: var(--ink-soft); background: conic-gradient(var(--signal) calc(var(--p, 0) * 1turn), rgba(214,203,179,.7) 0); position: relative; flex: none; }
.rail a > span:first-child::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: var(--paper); z-index: -1; }
.rail a > span:first-child { isolation: isolate; }
.rail a .lbl { font: 500 .82rem var(--sans); color: var(--ink); box-shadow: 0 2px 10px rgba(29,36,51,.08); opacity: 0; transform: translateX(-6px); transition: opacity .25s, transform .25s; white-space: nowrap; background: var(--paper); padding: .15rem .5rem; border-radius: 6px; }
.rail:hover a .lbl, .rail a.active .lbl { opacity: 1; transform: none; }
.rail a.active > span:first-child { color: var(--paper); background: var(--signal); }
.rail a.active > span:first-child::after { display: none; }
.rail a.active { color: var(--ink); }
@media (max-width: 1180px) { .toc.rail { display: none; } }

/* Openers */
.opener { --op-bg: var(--paper-2); --op-ink: var(--ink); --op-soft: var(--ink-soft); --op-accent: var(--signal);
  position: relative; overflow: hidden; margin-inline: calc(50% - 50vw); padding: clamp(7rem, 20vh, 12rem) calc(50vw - 50%) clamp(4rem, 10vh, 6rem); margin-bottom: 4rem; background: var(--op-bg); color: var(--op-ink); isolation: isolate; }
.opener::after { content: ""; position: absolute; inset: auto 0 0 0; height: 1px; background: linear-gradient(90deg, transparent, var(--op-accent), transparent); opacity: .4; }
.op-inner { position: relative; z-index: 1; }
.op-num { position: absolute; z-index: 0; right: -2vw; bottom: -.2em; font: 300 clamp(14rem, 34vw, 30rem)/.8 var(--display); font-variation-settings: "SOFT" 100, "WONK" 0; letter-spacing: -.06em; color: transparent; -webkit-text-stroke: 1.5px var(--op-accent); opacity: .35; transform: translateY(calc(var(--par, 0) * 1px)); pointer-events: none; user-select: none; }
.opener .chapter-num { color: var(--op-accent); display: flex; gap: 1rem; align-items: center; }
.op-time { color: var(--op-soft); letter-spacing: .12em; font-weight: 500; }
.op-time:not(:empty)::before { content: "·"; margin-right: 1rem; color: var(--op-soft); }
.opener h2 { color: var(--op-ink); margin: .5rem 0 .75rem; font-size: clamp(3rem, 7.5vw, 6rem) !important; max-width: 12ch; }
.opener .chapter-sub { color: var(--op-soft); margin: 0; }
.op-emblem { width: 92px; height: 92px; margin-bottom: 1.75rem; }
.emblem { width: 100%; height: 100%; overflow: visible; }
.emblem * { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.e-line { stroke: var(--op-ink); stroke-width: 2.5; }
.e-thin { stroke: var(--op-soft); stroke-width: 1.5; opacity: .7; }
.e-dash { stroke: var(--op-soft); stroke-width: 1.5; stroke-dasharray: 2 5; }
.e-route { stroke: var(--op-accent); stroke-width: 3; stroke-dasharray: 220; stroke-dashoffset: 220; transition: stroke-dashoffset 1.6s cubic-bezier(.6,0,.2,1) .2s; }
.opener.in .e-route { stroke-dashoffset: 0; }
.emblem .e-q { fill: var(--gold); stroke: none; }
.emblem .e-fill { fill: var(--op-ink); stroke: none; }
.e-petal ellipse { fill: #e8b8c8; stroke: #9b5a73; stroke-width: 1; }
.opener .op-inner > * { opacity: 0; transform: translateY(18px); transition: opacity .9s cubic-bezier(.2,.7,.2,1), transform .9s cubic-bezier(.2,.7,.2,1); }
.opener.in .op-inner > * { opacity: 1; transform: none; }
.opener.in .op-inner > :nth-child(2) { transition-delay: .08s; } .opener.in .op-inner > :nth-child(3) { transition-delay: .16s; } .opener.in .op-inner > :nth-child(4) { transition-delay: .26s; }

.opener[data-ch="paradox"] { --op-bg: #efe3c8; --op-accent: #c8461f; }
.opener[data-ch="rebellion"] { --op-bg: #1d2433; --op-ink: #f5efe2; --op-soft: #aab1c1; --op-accent: #f3a27f; }
.opener[data-ch="brain"] { --op-bg: #dfe7de; --op-accent: #1f5f7a; --op-soft: #4f5d5a; }
.opener[data-ch="sailing"] { --op-bg: #17465c; --op-ink: #f5efe2; --op-soft: #a9c6d3; --op-accent: #e9b949; }
.opener[data-ch="engine"] { --op-bg: #f0dfae; --op-accent: #1d2433; --op-soft: #6b5a2e; }
.opener[data-ch="polymath"] { --op-bg: #ead8d1; --op-accent: #9b4a5f; --op-soft: #6e5059; }
.opener[data-ch="rebellion"] .e-fill, .opener[data-ch="sailing"] .e-fill { fill: var(--op-ink); }

@media (max-width: 860px) {
  .opener { padding-top: 6rem; padding-bottom: 3rem; margin-bottom: 2.5rem; }
  .op-num { font-size: 16rem; right: -1rem; }
  .op-emblem { width: 70px; height: 70px; }
  .wide { margin-inline: 0 !important; }
}
@media (prefers-reduced-motion: reduce) { .opener .op-inner > * { opacity: 1; transform: none; } .e-route { stroke-dashoffset: 0; } }

/* ===================== R11: Scrollytelling sail ===================== */
.scrolly { position: relative; display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; margin-top: 4rem; margin-bottom: 4rem; }
.sc-graphic { position: sticky; top: 8vh; height: 84vh; align-self: start; background: #17465c; border-radius: 16px; overflow: hidden; box-shadow: 0 40px 80px -40px rgba(23,70,92,.7); }
.sc-svg { width: 100%; height: calc(100% - 4.5rem); display: block; }
.sc-gridline { stroke: rgba(245,239,226,.07); }
.sc-wind path { stroke: #a9c6d3; stroke-width: 1.5; stroke-linecap: round; opacity: .55; stroke-dasharray: 6 10; animation: windflow 1.6s linear infinite; }
@keyframes windflow { to { stroke-dashoffset: -32; } }
.sc-lab { font: 600 9px var(--sans); letter-spacing: .2em; fill: #a9c6d3; }
.sc-nogo { fill: rgba(243,162,127,.0); stroke: rgba(243,162,127,0); transition: fill .6s, stroke .6s; }
.nogo-lab { opacity: 0; transition: opacity .6s; fill: #f3a27f; }
.sc-halfplane { opacity: 0; transition: opacity .6s; }
.hp-good { fill: rgba(233,185,73,.06); } .hp-bad { fill: rgba(0,0,0,.25); }
.hp-lab { fill: #e9b949; font-size: 10px; }
.sc-junk { opacity: 0; transition: opacity .6s; }
.sc-junk circle { fill: rgba(245,239,226,.06); stroke: rgba(245,239,226,.35); stroke-dasharray: 2 3; }
.sc-junk path { stroke: #f3a27f; stroke-width: 2; stroke-linecap: round; }
.sc-route-ghost { fill: none; stroke: rgba(245,239,226,.18); stroke-width: 1.5; stroke-dasharray: 3 7; }
.sc-trail { fill: none; stroke: #e9b949; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.sc-wps g { opacity: .35; transition: opacity .4s, transform .4s; }
.sc-wps g.hit { opacity: 1; }
.sc-wps circle { fill: #e9b949; stroke: #17465c; stroke-width: 3; }
.sc-wps text { font: 700 11px var(--sans); text-anchor: middle; fill: #1d2433; }
.sc-buoy path, .sc-buoy circle { fill: var(--signal); }
.sc-buoy-glow { opacity: .4; transition: opacity .6s; }
.sc-hull { fill: #f5efe2; stroke: #1d2433; stroke-width: 1.5; }
.sc-sail { fill: none; stroke: #e9b949; stroke-width: 3; stroke-linecap: round; }
.sc-mast { stroke: #1d2433; stroke-width: 1.5; }
.sc-keel { fill: #e9b949; opacity: 0; transition: opacity .5s; }
.sc-drift { opacity: 0; transition: opacity .5s; }
.sc-drift path { fill: none; stroke: #f3a27f; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.scrolly[data-active="0"] .sc-nogo { fill: rgba(243,162,127,.18); stroke: rgba(243,162,127,.5); }
.scrolly[data-active="0"] .nogo-lab { opacity: 1; }
.scrolly[data-active="0"] .sc-sail { animation: luff .35s ease-in-out infinite alternate; }
@keyframes luff { from { d: path("M0 -18 Q 8 -10 -3 -2 Q 8 6 0 14"); } to { d: path("M0 -18 Q -8 -10 3 -2 Q -8 6 0 14"); } }
.scrolly[data-active="1"] .sc-halfplane, .scrolly[data-active="1"] .sc-junk, .scrolly[data-active="1"] .sc-keel, .scrolly[data-active="1"] .sc-drift { opacity: 1; }
.scrolly[data-active="1"] .sc-drift path { animation: cancel 1.4s ease-in-out infinite; }
@keyframes cancel { 0%,100% { opacity: 1; } 50% { opacity: .15; } }
.scrolly[data-active="3"] .sc-buoy-glow { opacity: 1; }
.sc-hud { position: absolute; left: 0; right: 0; bottom: 0; height: 4.5rem; display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: center; padding: 0 1.5rem; background: rgba(13,40,54,.6); backdrop-filter: blur(6px); color: #f5efe2; font-family: var(--sans); border-top: 1px solid rgba(245,239,226,.1); }
.hud-k { display: block; font-size: .62rem; letter-spacing: .18em; text-transform: uppercase; color: #a9c6d3; margin-bottom: .35rem; }
.hud-bar { height: 6px; background: rgba(245,239,226,.15); border-radius: 99px; overflow: hidden; }
.hud-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #e9b949, var(--signal)); border-radius: 99px; }
.sc-hud b { font: 500 1.4rem var(--display); font-variant-numeric: lining-nums; }
.sc-steps { padding: 20vh 0 30vh; }
.sc-step { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; opacity: .25; transition: opacity .5s; }
.sc-step.on { opacity: 1; }
.sc-k { font: 600 .7rem var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--signal); margin: 0; }
.sc-step h3 { font: 450 clamp(1.8rem, 3vw, 2.5rem)/1.05 var(--display); letter-spacing: -.025em; margin: .4rem 0 1rem; }
.sc-map { font: .95rem/1.45 var(--sans); background: var(--paper-2); border-radius: 8px; padding: .7rem .9rem; margin: 0 0 1rem; }
.sc-map > span:first-child { display: block; font-size: .62rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: .2rem; }
.sc-step > p:last-child { margin: 0; font-size: 1.1rem; }
@media (max-width: 860px) {
  .scrolly { grid-template-columns: 1fr; gap: 0; }
  .sc-graphic { top: 3.5rem; height: 55vh; z-index: 1; }
  .sc-steps { position: relative; z-index: 2; padding: 10vh 0 20vh; }
  .sc-step { min-height: 75vh; justify-content: flex-end; opacity: 1; }
  .sc-step > * { background: var(--paper); }
  .sc-step { padding: 0; }
  .sc-step::before { content: none; }
  .sc-step > .sc-k { padding: 1rem 1rem 0; border-radius: 10px 10px 0 0; margin-top: 0; }
  .sc-step > h3, .sc-step > p { padding-inline: 1rem; margin: 0; }
  .sc-step > p:last-child { padding-bottom: 1rem; border-radius: 0 0 10px 10px; box-shadow: 0 12px 20px -12px rgba(29,36,51,.3); }
  .sc-step > .sc-map { margin: 0; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) { .sc-step { opacity: 1; } }
.hp-line { stroke: #e9b949; stroke-dasharray: 4 4; opacity: .7; }

/* ===================== R12: Citation cards ===================== */
.cite-card { position: absolute; left: 0; top: 0; z-index: 80; background: var(--ink); color: var(--paper); border-radius: 12px; padding: 1rem 1.1rem .9rem; font: .84rem/1.5 var(--sans); box-shadow: 0 24px 48px -16px rgba(29,36,51,.55), 0 0 0 1px rgba(255,255,255,.04); opacity: 0; pointer-events: none; transition: opacity .18s ease, margin .18s ease; margin-top: 6px; }
.cite-card.show { opacity: 1; pointer-events: auto; margin-top: 0; }
.cite-card::after { content: ""; position: absolute; left: var(--ax, 50%); bottom: -6px; width: 12px; height: 12px; background: var(--ink); transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.cite-card.below::after { bottom: auto; top: -6px; }
.cc-k { margin: 0 0 .4rem; font-size: .62rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.cc-ref { margin: 0 0 .7rem; color: #e6e1d5; }
.cc-ref em { color: var(--paper); }
.cc-open { color: #f3a27f; font-weight: 600; text-decoration: none; font-size: .8rem; }
.cc-open:hover { color: var(--paper); }
.cites .cite:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 2px; }

/* ===================== R13: Kinetic hero ===================== */
.hero h1 .ch { display: inline-block; opacity: 0; transform: translateY(.45em) rotate(4deg); filter: blur(6px); animation: rise .9s cubic-bezier(.2,.8,.2,1) forwards; animation-delay: calc(var(--i) * 28ms + .15s); }
.hero h1 .w { display: inline-block; white-space: nowrap; }
@keyframes rise { to { opacity: 1; transform: none; filter: none; } }
.hero .kicker, .hero .subtitle, .hero-actions, .hero-meta, .hero-legend { opacity: 0; animation: fadeup .9s cubic-bezier(.2,.8,.2,1) forwards; }
.hero .kicker { animation-delay: .05s; } .hero .subtitle { animation-delay: .75s; } .hero-actions { animation-delay: .9s; } .hero-meta { animation-delay: 1.05s; } .hero-legend { animation-delay: 1.3s; }
@keyframes fadeup { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.hero-legend { animation-name: fadein; } @keyframes fadein { to { opacity: 1; } }
.route-real { fill: none; stroke: none; }
.wake { fill: none; stroke: rgba(31,95,122,.22); stroke-width: 14; stroke-linecap: round; stroke-linejoin: round; }
.hb-hull { fill: var(--ink); }
.hb-sail { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-linecap: round; }
.boat-icon { transition: none; }
.wind-marks path { stroke-dasharray: 8 6; animation: windflow 2.4s linear infinite; }
.hero-inner { transform: translateY(calc(var(--hy, 0) * -0.2px)); opacity: calc(1 - var(--hp, 0) * .85); }
@media (prefers-reduced-motion: reduce) {
  .hero h1 .ch, .hero .kicker, .hero .subtitle, .hero-actions, .hero-meta, .hero-legend { opacity: 1 !important; transform: none !important; filter: none !important; animation: none !important; }
  .hero-inner { transform: none !important; opacity: 1 !important; }
}

/* ===================== R14: QA polish ===================== */
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 4px; }
.cta:focus-visible, button:focus-visible { outline-offset: 4px; }
.evidence summary:focus-visible { outline-offset: -2px; border-radius: 12px; }
input[type=range]:focus-visible { outline-offset: 6px; }
.skip { position: absolute; left: 1rem; top: -3rem; z-index: 100; background: var(--ink); color: var(--paper); padding: .6rem 1rem; border-radius: 8px; font: 600 .85rem var(--sans); transition: top .2s; }
.skip:focus { top: 1rem; color: var(--paper); }

/* ===================== Mobile optimization pass ===================== */
/* Grain: viewport-sized fixed layer, never a page-height blended layer */
body::before { position: fixed; inset: 0; }
@media (hover: none), (max-width: 860px) { body::before { mix-blend-mode: normal; opacity: .22; } }

/* Navigation gap 860–1180px: show the chapter bar wherever the rail is hidden */
@media (max-width: 1180px) {
  .mobile-bar { display: flex; position: sticky; top: 0; z-index: 40; align-items: center; gap: .75rem; padding: .7rem 1rem; padding-top: max(.7rem, env(safe-area-inset-top)); background: rgba(245,239,226,.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); font: 600 .85rem var(--sans); }
  .mb-home { background: var(--ink); color: var(--paper); border-radius: 8px; padding: .55rem .7rem; text-decoration: none; font-size: .75rem; letter-spacing: .05em; min-height: 36px; display: inline-grid; place-items: center; }
  #mb-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mb-num { color: var(--signal); font-family: var(--display); }
}

/* Touch targets */
@media (pointer: coarse) {
  .cites { font-size: .86em; }
  .cites .cite { padding: .55em .1em; margin: -.55em -.1em; -webkit-tap-highlight-color: rgba(212,80,42,.15); }
  .cta-ghost { display: inline-block; padding: .7rem 0; }
  button, .presets button, .sail-lab button, .engine-demo button { min-height: 40px; padding-inline: .95rem; touch-action: manipulation; }
  .evidence summary { min-height: 52px; }
  .refs a, .src-group a { padding: .35em 0; }
  .rail a { min-height: 44px; }
}
input[type=range] { height: 40px; touch-action: pan-y; cursor: pointer; }
a, button, summary { -webkit-tap-highlight-color: rgba(212,80,42,.12); }

/* Legible micro-type on small screens */
@media (max-width: 640px) {
  .chapter-num, .op-time, .callout-label, .ev-meta, .ev-cols h4, .ev-refs-h, .qm-tag, .card-kicker, .now-label, .hud-k, .sc-k, .sc-map > span:first-child, .kicker { font-size: .75rem; }
  /* quest map: bigger SVG labels, drop the optional ones */
.qm-svg .tiny { font-size: 21px; }
  .qm-svg .opt { display: none; }
  .qm-svg .sq text { font-size: 15px; }
  /* flow chart */
.flow-chart svg .fc-lab { font-size: 15px; }
  .flow-chart svg .zone-sub { font-size: 13.5px; }
  .flow-chart svg .ax-lab { font-size: 15px; }
  .flow-chart svg .zone { font-size: 22px; }
  .spark text { font-size: 10px; }
  .polar text, .sail-canvas text { font-size: 13px; }
  .sc-lab { font-size: 13px; }
}

/* Sticky heights that don't jump with the mobile URL bar */
.sc-graphic { height: 84vh; height: 84svh; top: 8svh; }
@media (max-width: 860px) { .sc-graphic { height: 55vh; height: 55svh; top: calc(3.6rem + env(safe-area-inset-top)); } }
/* Phone landscape: side-by-side, graphic fills the short screen */
@media (max-height: 520px) and (orientation: landscape) {
  .scrolly { grid-template-columns: 1fr 1fr; gap: 1.25rem; }
  .sc-graphic { top: 3.6rem; height: calc(100svh - 4.4rem); }
  .sc-hud { height: 3rem; padding: 0 1rem; }
  .sc-svg { height: calc(100% - 3rem); }
  .sc-steps { padding: 10svh 0 30svh; }
  .sc-step { min-height: 90svh; justify-content: center; }
  .sc-step > * { background: transparent !important; box-shadow: none !important; }
  .hero { min-height: 100svh; padding-top: 4rem; align-items: center; }
  .chart { -webkit-mask: none; mask: none; opacity: .5; }
  .opener { padding-top: 4rem; padding-bottom: 2.5rem; }
}

/* ===================== C1: Chunking — overview, signposts, takeaways, bridges ===================== */
.brief { padding: clamp(4rem, 10vh, 7rem) 0 clamp(3rem, 8vh, 5rem); scroll-margin-top: 1rem; }
.brief-k { font: 600 .72rem var(--sans); letter-spacing: .28em; text-transform: uppercase; color: var(--signal); margin: 0 0 1.25rem; display: flex; align-items: center; gap: .9rem; }
.brief-k::before { content: ""; width: 2.5rem; height: 2px; background: var(--signal); }
.brief-thesis { font: 380 clamp(1.7rem, 3.6vw, 2.9rem)/1.14 var(--display); letter-spacing: -.025em; font-variation-settings: "SOFT" 60; margin: 0 0 3rem; max-width: 22em; text-wrap: balance; }
.brief-thesis em { color: var(--signal); font-variation-settings: "SOFT" 100, "WONK" 1; }
.brief-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--ink); }
.brief-steps li { border-bottom: 1px solid var(--line); }
.brief-steps li:not(:nth-child(3n)) { border-right: 1px solid var(--line); }
.brief-steps a { display: grid; grid-template-columns: 2.4rem 1fr; column-gap: .9rem; row-gap: .15rem; padding: 1.35rem 1.25rem 1.5rem 0; height: 100%; text-decoration: none; color: var(--ink); align-content: start; transition: background .25s; }
.brief-steps li:not(:nth-child(3n+1)) a { padding-left: 1.25rem; }
.bs-n { grid-row: span 2; font: 400 1.5rem/1.1 var(--display); color: var(--signal); font-variation-settings: "SOFT" 100; }
.brief-steps b { font: 600 .95rem/1.3 var(--sans); letter-spacing: .01em; }
.bs-t { grid-column: 2; font-size: .98rem; line-height: 1.45; color: var(--ink-soft); }
.brief-steps a:hover { background: rgba(212,80,42,.05); }
.brief-steps a:hover b { color: var(--signal); }
.brief-foot { font: .82rem/1.5 var(--sans); color: var(--ink-soft); margin: 1.25rem 0 0; }
.brief-foot b { color: var(--ink); }

.signpost { font: 600 .8rem/1.3 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); margin: 3.25rem 0 1rem; display: flex; align-items: center; gap: .8rem; text-wrap: balance; }
.signpost::before { content: ""; flex: none; width: 1.4rem; height: 2px; background: var(--signal); }
.chapter > p + .signpost, .chapter > figure + .signpost { margin-top: 3.5rem; }

.takeaway { margin: 3.5rem 0 0; padding: 1.5rem 0 0; border-top: 2px solid var(--ink); }
.tk-label { font: 600 .7rem var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--signal); margin: 0 0 .5rem; }
.tk-line { font: 420 clamp(1.45rem, 2.6vw, 1.95rem)/1.2 var(--display); letter-spacing: -.02em; font-variation-settings: "SOFT" 60; margin: 0; text-wrap: balance; }
.tk-line em { font-variation-settings: "SOFT" 100, "WONK" 1; color: var(--signal); }
.takeaway + .evidence { margin-top: 2.25rem; }

.bridge { display: grid; grid-template-columns: 1fr auto; column-gap: 1.5rem; align-items: center; margin: 1.25rem 0 0; padding: 1.1rem 1.25rem; border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--paper-2); transition: background .25s, color .25s, transform .25s; }
.br-k { grid-column: 1; font: 600 .68rem var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft); }
.br-t { grid-column: 1; font: 500 1.35rem/1.2 var(--display); letter-spacing: -.02em; }
.br-s { grid-column: 1; font: .88rem/1.45 var(--sans); color: var(--ink-soft); }
.br-arrow { grid-column: 2; grid-row: 1 / span 3; font: 400 1.8rem var(--display); transition: transform .25s; }
.bridge:hover { background: var(--ink); color: var(--paper); }
.bridge:hover .br-k, .bridge:hover .br-s { color: #b9bfcc; }
.bridge:hover .br-arrow { transform: translateX(6px); }
@media (max-width: 860px) {
  .brief-steps { grid-template-columns: 1fr; }
  .brief-steps li { border-right: 0 !important; }
  .brief-steps li a { padding-left: 0 !important; }
  .brief-thesis { margin-bottom: 2rem; }
}
@media (min-width: 861px) and (max-width: 1100px) {
  .brief-steps { grid-template-columns: repeat(2, 1fr); }
  .brief-steps li { border-right: 0 !important; }
  .brief-steps li:nth-child(odd) { border-right: 1px solid var(--line) !important; }
  .brief-steps li a { padding-left: 0 !important; }
  .brief-steps li:nth-child(even) a { padding-left: 1.25rem !important; }
}

/* ===================== C2: Phrasing — glossary terms ===================== */
dfn.term { font-style: inherit; cursor: help; text-decoration: underline dotted var(--gold); text-decoration-thickness: 2px; text-underline-offset: 4px; border-radius: 2px; transition: background .2s; }
dfn.term:hover, dfn.term:focus-visible { background: rgba(201,154,46,.18); }
h3 dfn.term, .card-main dfn.term { text-decoration-thickness: 1.5px; }
.cite-card.is-term { border-top: 3px solid var(--gold); }
.cc-term { font: 500 1.15rem/1.2 var(--display); margin: 0 0 .35rem; color: var(--paper); }
.cc-def { font-size: .92rem; line-height: 1.5; margin-bottom: .1rem; }
.callout-gloss { font: .92rem/1.55 var(--sans); color: #b9bfcc; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid rgba(245,239,226,.14); }

/* ===================== C3: Pacing — figure system, entry paragraphs, time left ===================== */
main { counter-reset: fig; }
.fig-n::before { counter-increment: fig; content: "Fig. " counter(fig); }
.fig-head { grid-column: 1 / -1; flex-basis: 100%; margin: 0 0 1.1rem; text-align: left; }
.fig-meta { display: flex; align-items: center; gap: .7rem; margin: 0 0 .45rem; font: 600 .68rem var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--signal); }
.fig-title { font: 480 clamp(1.2rem, 2vw, 1.5rem)/1.2 var(--display); letter-spacing: -.015em; margin: 0; max-width: 32em; text-wrap: balance; color: var(--ink); }
.fig-badge { display: inline-flex; align-items: center; gap: .4em; font: 600 .62rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; padding: .38em .65em .36em; border-radius: 999px; border: 1px solid currentColor; color: var(--ink-soft); cursor: help; white-space: nowrap; vertical-align: middle; }
.fig-badge::before { content: ""; width: .55em; height: .55em; border-radius: 50%; background: currentColor; }
.fig-badge[data-kind="illustration"] { color: #8a6a12; }
.fig-badge[data-kind="schematic"] { color: var(--sea); }
.fig-badge[data-kind="concept"] { color: #7a4a86; }
.fig-badge[data-kind="toy"] { color: var(--signal); }
.fig-badge[data-kind="record"] { color: #4f7a52; }
.fig-badge:hover, .fig-badge:focus-visible { background: rgba(29,36,51,.06); }
.sail-lab .fig-meta, .engine-demo .fig-meta { color: var(--gold); }
.sail-lab .fig-badge, .engine-demo .fig-badge { color: #f3a27f; }
.sail-lab .fig-badge:hover, .engine-demo .fig-badge:hover { background: rgba(245,239,226,.08); }
.engine-head h3 { font: 500 1.7rem/1.15 var(--display); letter-spacing: -.02em; margin: .2rem 0 .4rem; color: var(--paper); }
figure.engine-demo { margin-bottom: 0; }
figcaption { font: .84rem/1.5 var(--sans); max-width: 44rem; }
.questmap figcaption { text-align: left; font: .84rem/1.5 var(--sans); font-style: normal; }
.tickets figcaption { text-align: left; }
.perry figcaption { grid-column: 1 / -1; }
.variety figcaption { grid-column: 1 / -1; margin-top: 0; }
figure.variety { margin: 2.5rem 0; }
.cards .fig-head { margin-bottom: .25rem; }
.brief-foot .fig-badge { margin: .15rem .1rem; font-size: .58rem; }
.brief-foot { line-height: 1.9; max-width: 52rem; }

/* entry paragraph: a slightly larger first paragraph gives each chapter a way in */
.chapter > .opener + p:not(.lede) { font-size: 1.16em; line-height: 1.58; }

/* time left */
.rail-left { font: 600 .66rem var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); margin: .9rem 0 0 .5rem; white-space: nowrap; }
.mb-left { font: 500 .72rem var(--sans); color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums lining-nums; }
@media (max-width: 640px) { .fig-meta { font-size: .72rem; flex-wrap: wrap; } .fig-badge { font-size: .66rem; } }

/* ===================== C4: Chart redesign ===================== */
/* Break types: categorical slopes, not bar lengths */
.breaks { font-family: var(--sans); }
.bk-design { list-style: none; margin: 0 0 1.1rem; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 0; font-size: .8rem; color: var(--ink-soft); }
.bk-design li { display: flex; align-items: center; gap: .45rem; }
.bk-design li + li::before { content: "→"; margin: 0 .7rem; color: var(--line); font-weight: 700; }
.bk-design span { width: 1.3rem; height: 1.3rem; border-radius: 50%; border: 1.5px solid var(--ink-soft); display: inline-grid; place-items: center; font: 700 .66rem var(--mono); }
.bk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; }
.bk { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .8rem .85rem .9rem; display: grid; gap: .15rem; align-content: start; }
.bk svg { width: 100%; display: block; margin-bottom: .35rem; overflow: visible; }
.bk-base { stroke: var(--line); }
.bk-line { fill: none; stroke: var(--ink-soft); stroke-width: 2.5; stroke-linecap: round; }
.bk-a, .bk-b { fill: var(--card); stroke: var(--ink-soft); stroke-width: 2.5; }
.bk svg .bk-t { font-size: 8px; fill: var(--ink-soft); letter-spacing: .04em; }
.bk b { font-size: .92rem; line-height: 1.2; }
.bk small { font-size: .78rem; line-height: 1.35; color: var(--ink-soft); min-height: 2.7em; }
.bk-res { justify-self: start; margin-top: .35rem; font: 600 .66rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); padding: .3em .6em; border-radius: 999px; background: var(--paper-2); }
.bk.hi { border-color: var(--signal); box-shadow: 0 14px 28px -20px rgba(212,80,42,.6); }
.bk.hi .bk-line { stroke: var(--signal); stroke-width: 3; }
.bk.hi .bk-b { fill: var(--signal); stroke: var(--signal); }
.bk.hi .bk-a { stroke: var(--signal); }
.bk.hi .bk-res { background: var(--signal); color: #fff; }

/* Threat: a causal chain read left to right */
.threat { display: block; }
.tf { display: grid; grid-template-columns: 1.25fr auto 1.1fr auto 1fr auto 1fr; align-items: center; gap: .6rem; font-family: var(--sans); }
.tf-causes { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.tf-causes li { border-left: 3px solid var(--signal); background: var(--card); border-radius: 0 8px 8px 0; padding: .5rem .75rem; display: grid; }
.tf-causes b, .tf-node b { font-size: .95rem; line-height: 1.2; }
.tf small { color: var(--ink-soft); font-size: .8rem; line-height: 1.3; }
.tf-arrow { width: 1.6rem; height: 2px; background: var(--ink); position: relative; justify-self: center; }
.tf-arrow::after { content: ""; position: absolute; right: -1px; top: -4px; border: solid var(--ink); border-width: 2px 2px 0 0; width: 8px; height: 8px; transform: rotate(45deg); }
.tf-core { text-align: center; background: var(--ink); color: var(--paper); padding: 1rem 1rem; border-radius: 14px; box-shadow: 0 0 0 7px rgba(212,80,42,.12), 0 0 0 15px rgba(212,80,42,.06); margin: 0 .5rem; }
.tf-core span { font: 600 1.1rem/1.15 var(--display); display: block; }
.tf-core small { color: #f3a27f; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }
.tf-node { display: grid; text-align: center; border: 1.5px solid var(--ink); border-radius: 12px; padding: .7rem .6rem; background: var(--paper); }
.tf-node.out { background: var(--signal); border-color: var(--signal); color: #fff; }
.tf-node.out small { color: #ffe3d6; }
.threat figcaption { margin-top: 1.4rem; }

/* Requisite variety board */
figure.variety { display: block; }
.vb { font-family: var(--sans); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.vb-row { display: grid; grid-template-columns: 9.5rem 1fr 1.25fr; align-items: stretch; border-top: 1px solid var(--line); }
.vb-headrow { border-top: 0; background: var(--paper-2); font: 600 .68rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.vb-headrow > div { padding: .7rem .9rem; }
.vb-headrow em { font-style: normal; color: var(--signal); margin-left: .4rem; white-space: nowrap; }
.vb-headrow > div:last-child em { color: var(--sea); }
.vb-state { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; }
.vb-state svg { width: 1.35rem; height: 1.35rem; flex: none; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.vb-cell { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem .9rem; border-left: 1px solid var(--line); font-size: .93rem; line-height: 1.3; }
.vb-cell i { font: 600 .64rem var(--sans); letter-spacing: .1em; text-transform: uppercase; padding: .3em .6em; border-radius: 999px; white-space: nowrap; }
.vb-cell.ok i { background: rgba(31,95,122,.12); color: var(--sea); }
.vb-cell.ok i::before { content: "✓ "; }
.vb-cell.no { background: repeating-linear-gradient(135deg, transparent 0 7px, rgba(212,80,42,.05) 7px 14px); }
.vb-cell.no span { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: rgba(212,80,42,.6); }
.vb-cell.no i { background: rgba(212,80,42,.12); color: var(--signal); }
.vb-cell.no i::before { content: "✕ "; }
.variety figcaption { margin-top: .9rem; }

@media (max-width: 860px) {
  .bk-grid { grid-template-columns: 1fr 1fr; }
  .tf { grid-template-columns: 1fr; justify-items: stretch; gap: .5rem; }
  .tf-arrow { width: 2px; height: 1.3rem; }
  .tf-arrow::after { right: -4px; top: auto; bottom: -1px; transform: rotate(135deg); }
  .tf-core { margin: .6rem 1rem; }
  .vb-row { grid-template-columns: 1fr 1fr; }
  .vb-state { grid-column: 1 / -1; padding-bottom: .2rem; }
  .vb-headrow > div:first-child { display: none; }
  .vb-cell { flex-direction: column; align-items: flex-start; gap: .35rem; padding-top: .45rem; }
  .bk-design li + li::before { margin: 0 .4rem; }
}
.bk-res { white-space: nowrap; letter-spacing: .06em; }
.tf { grid-template-columns: 1.3fr auto 1.35fr auto 1fr auto 1fr; }
.tf-core { margin: 0 .35rem; padding: 1rem .75rem; }
.tf-core small { display: block; line-height: 1.35; margin-top: .3rem; }
.vb-state b { font-size: .98rem; }
.vb-row { grid-template-columns: 8.5rem 1.1fr 1.25fr; }
@media (max-width: 860px) {
  .tf, .vb-row { grid-template-columns: 1fr; }
  .vb-row { grid-template-columns: 1fr 1fr; }
  .bk-design { flex-direction: column; gap: .3rem; }
  .bk-design li + li::before { content: none; }
}

/* ===================== C5: New explanatory illustrations ===================== */
.fig-badge[data-kind="geometry"] { color: #1d2433; }
.defs-only { position: absolute; }

/* Dot product, small multiples */
.dp-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.dp { display: grid; justify-items: center; text-align: center; font-family: var(--sans); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .5rem .3rem .75rem; align-content: start; }
.dp svg { width: 100%; max-width: 7.5rem; display: block; overflow: visible; }
.dp-axis { stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 2 4; }
.dp-goal { fill: var(--signal); }
.dp-arrow { stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
#dp-ah path { fill: var(--ink); }
.dp-o { fill: var(--ink); }
.dp-proj { stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 2 3; }
.dp-shadow { stroke: var(--signal); stroke-width: 7; stroke-linecap: round; opacity: .9; }
.dp.neg .dp-shadow { stroke: #8b93a5; }
.dp b { font: 600 1.25rem/1.1 var(--mono); font-variant-numeric: lining-nums tabular-nums; color: var(--signal); margin-top: .2rem; }
.dp.neg b { color: #6c7488; } .dp.zero b { color: var(--ink); }
.dp span { font-size: .82rem; font-weight: 600; line-height: 1.25; margin-top: .2rem; }
.dp small { font-size: .76rem; line-height: 1.3; color: var(--ink-soft); font-style: italic; font-family: var(--serif); }

/* Bandits */
.bandit { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; font-family: var(--sans); }
.bandit figcaption { grid-column: 1 / -1; margin-top: 0; }
.bd { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem 1.2rem; }
.bd svg { width: 100%; display: block; margin-bottom: .6rem; }
.bd p { margin: 0; font-size: .9rem; line-height: 1.5; }
.bd .bd-k { font: 600 .7rem var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--signal); margin-bottom: .35rem; }
.sm-body { fill: var(--ink); } .sm-win { fill: var(--paper); } .sm-lever { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; fill: none; } .sm-knob { fill: var(--signal); }
.bd use.off { opacity: .28; }
.bd svg text { text-anchor: middle; }
.bd svg .bd-q { font: 700 9px var(--sans); fill: var(--ink); }
.bd svg .bd-lab { font: 700 10px var(--sans); fill: var(--ink); }
.bd svg .bd-lab.sm { font-size: 8.5px; font-weight: 600; }
.bd svg .bd-lab.off { fill: var(--ink-soft); text-decoration: line-through; }
.bd svg .bd-note { font: 500 7.5px var(--sans); fill: var(--ink-soft); letter-spacing: .03em; }
.bd svg .bd-ctx { font: 600 8px var(--sans); fill: var(--ink-soft); text-anchor: start; letter-spacing: .08em; text-transform: uppercase; }
.bd-rule { stroke: var(--line); stroke-width: 1; }
.bd-bar { fill: #cfc5ae; } .bd-bar.best { fill: var(--gold); }
.bd-x { stroke: var(--signal); stroke-width: 3; stroke-linecap: round; }

/* Timelines */
.timelines { font-family: var(--sans); }
.tl-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .76rem; color: var(--ink-soft); margin: 0 0 .5rem; }
.tl-legend span { width: .7rem; height: .7rem; border-radius: 50%; display: inline-block; margin-left: .7rem; }
.tl-legend span:first-child { margin-left: 0; }
.k-main { background: var(--ink); } .k-side { background: var(--gold); } .k-approx { border: 2px dashed var(--gold); }
.tl { --A: 6.4rem; position: relative; height: calc(var(--A) + 1.2rem + (var(--rows) - 1) * 3.5rem + 4.6rem); margin: 1rem 0 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.tl + .tl { margin-top: .9rem; }
.tl-name { position: absolute; left: 1.1rem; top: .8rem; margin: 0; font: 500 1.25rem var(--display); letter-spacing: -.015em; }
.tl-axis, .tl ol { position: absolute; left: 2rem; right: 2rem; margin: 0; padding: 0; list-style: none; }
.tl-axis { top: var(--A); height: 2px; background: var(--ink); }
.tl-axis span { --x: calc((var(--y) - var(--from)) / (var(--to) - var(--from)) * 100%); position: absolute; left: var(--x); top: -1.25rem; transform: translateX(-50%); font: 500 .66rem var(--mono); color: #9a927f; font-variant-numeric: lining-nums; }
.tl-axis span::after { content: ""; position: absolute; left: 50%; top: 1.05rem; width: 1px; height: .4rem; background: #9a927f; }
.tl ol { top: 0; bottom: 0; }
.tl li { --x: calc((var(--y) - var(--from)) / (var(--to) - var(--from)) * 100%); --off: calc(1.2rem + var(--row) * 3.5rem); position: absolute; left: 0; right: 0; padding-left: calc(var(--x) + .55rem); font-size: .82rem; line-height: 1.3; }
.tl li > b, .tl li > span { display: block; max-width: 9.5rem; }
.tl li > b { font: 700 .74rem var(--mono); font-variant-numeric: lining-nums; letter-spacing: .02em; }
.tl li::before { content: ""; position: absolute; left: var(--x); width: 1.5px; background: var(--ink); }
.tl li::after { content: ""; position: absolute; left: calc(var(--x) - 5px); width: 11px; height: 11px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px var(--card); }
.tl-main { bottom: calc(100% - var(--A) + 1.7rem); }
.tl-main::before { bottom: -1.7rem; height: calc(1.7rem + 100%); }
.tl-main::after { bottom: calc(-1.7rem - 6px); }
.tl-side { top: calc(var(--A) + var(--off)); }
.tl-side::before { top: calc(-1 * var(--off)); height: calc(var(--off) + 100%); background: var(--gold) !important; }
.tl-side::after { top: calc(-1 * var(--off) - 5px); background: var(--gold) !important; }
.tl-side > b { color: #8a6a12; }
.tl-approx::after { background: var(--card) !important; border: 2.5px dashed var(--gold); width: 12px; height: 12px; box-shadow: none !important; }
.tl-right { padding-left: 0 !important; padding-right: calc(100% - var(--x) + .55rem); text-align: right; }
.tl-right > b, .tl-right > span { margin-left: auto; }
.tl-range > b::before { content: ""; position: absolute; left: var(--x); width: calc((var(--y2) - var(--y)) / (var(--to) - var(--from)) * 100%); top: calc(-1 * var(--off) - 2px); height: 6px; border-radius: 3px; background: var(--gold); }
.tl-dashed > b::before { height: 0; background: none; border-top: 3px dashed var(--gold); top: calc(-1 * var(--off) + 5px); border-radius: 0; opacity: .8; }

@media (max-width: 860px) {
  .dp-grid { gap: .25rem; } .dp { padding: .35rem .15rem .6rem; border-radius: 8px; }
  .dp b { font-size: 1rem; } .dp span { font-size: .72rem; } .dp small { font-size: .7rem; }
  .bandit { grid-template-columns: 1fr; }
  .bd svg { max-width: 20rem; margin-inline: auto; }
  .tl { height: auto; padding: 1rem 1.1rem 1.1rem; }
  .tl-name { position: static; margin-bottom: .7rem; }
  .tl-axis { display: none; }
  .tl ol { position: static; border-left: 2px solid var(--ink); margin-left: .35rem; }
  .tl li, .tl-right { position: relative; inset: auto; padding: 0 0 .9rem 1.1rem !important; text-align: left; font-size: .9rem; }
  .tl li:last-child { padding-bottom: 0 !important; }
  .tl li > b, .tl li > span { max-width: none; margin-left: 0; }
  .tl li::before, .tl-range > b::before { content: none; }
  .tl li::after { left: -7.5px; top: .2rem; bottom: auto; }
  .tl-approx::after { left: -8px; }
}

/* ===================== C6: Animation choreography ===================== */
/* Rules live under .motion (set before first paint unless the reader prefers reduced motion), so no-JS and reduced-motion both get the finished figure. */
.replay { margin-left: auto; border: 0; background: none; padding: .2rem .1rem; font: 600 .66rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); border-radius: 4px; opacity: 0; transition: opacity .4s, color .2s; min-height: 0 !important; }
.replay:hover { background: none; color: var(--signal); }
.play .replay { opacity: 1; transition-delay: 1.5s; }
.replay span { display: inline-block; transition: transform .5s; font-size: 1.15em; }
.replay:hover span { transform: rotate(180deg); }

/* overview steps */
.motion .brief:not(.play) .brief-steps li { opacity: 0; transform: translateY(14px); }
.motion .brief .brief-steps li { transition: opacity .6s cubic-bezier(.2,.7,.2,1), transform .6s cubic-bezier(.2,.7,.2,1); }
.brief.play .brief-steps li:nth-child(2) { transition-delay: .12s; } .brief.play .brief-steps li:nth-child(3) { transition-delay: .24s; }
.brief.play .brief-steps li:nth-child(4) { transition-delay: .36s; } .brief.play .brief-steps li:nth-child(5) { transition-delay: .48s; } .brief.play .brief-steps li:nth-child(6) { transition-delay: .6s; }

/* quest map */
.qm-you, .qm-edot, .qm-guide, .fc-you, .sp-you { display: none; }
.motion .qm-you { display: block; fill: var(--ink); stroke: var(--card); stroke-width: 2.5; }
.motion .qm-edot { display: block; fill: var(--card); stroke: var(--ink-soft); stroke-width: 2; }
.motion .qm-open .qm-edot { stroke: var(--sea); }
.motion .qm-guide { display: block; stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0; transition: opacity .3s; }
.motion .moving .qm-guide { opacity: .55; }
.motion .questmap .trail { stroke-dasharray: 0 1; }
.motion .questmap .energy { stroke-dasharray: 0 1; stroke-dashoffset: 0; transition: none; }
.motion .questmap .sq, .motion .questmap .boss-x, .motion .questmap .flag, .motion .questmap .tiny.good, .motion .questmap .tiny.warn:not(.opt) { opacity: 0; transition: opacity .35s; }
.motion .questmap .wall .tiny.warn { opacity: 1; }
.motion .questmap .on { opacity: 1 !important; }
.motion .questmap .sq circle { transform-box: fill-box; transform-origin: center; transform: scale(.4); transition: transform .45s cubic-bezier(.3,1.7,.5,1); }
.motion .questmap .sq.on circle { transform: none; }
.qm-svg { touch-action: pan-y; }

/* threat chain */
.motion .threat:not(.play) .tf > * { opacity: 0; transform: translateX(-12px); }
.motion .threat .tf > * { transition: opacity .5s ease, transform .5s cubic-bezier(.2,.7,.2,1); }
.threat.play .tf > :nth-child(2) { transition-delay: .5s; } .threat.play .tf > :nth-child(3) { transition-delay: .8s; }
.threat.play .tf > :nth-child(4) { transition-delay: 1.3s; } .threat.play .tf > :nth-child(5) { transition-delay: 1.6s; }
.threat.play .tf > :nth-child(6) { transition-delay: 2.1s; } .threat.play .tf > :nth-child(7) { transition-delay: 2.4s; }
.motion .threat.play .tf-node.out { animation: urge 1s 3s 2; }
@keyframes urge { 50% { box-shadow: 0 0 0 10px rgba(212,80,42,.18); } }
@media (max-width: 860px) { .motion .threat:not(.play) .tf > * { transform: translateY(-10px); } }

/* Perry's list ticks itself off beneath the dreaded item */
.motion .perry:not(.play) .box.done { background: transparent; border-color: currentColor; }
.motion .perry:not(.play) .box.done::after, .motion .perry:not(.play) .perry-foot { opacity: 0; }
.motion .perry .box.done, .motion .perry .box.done::after, .motion .perry .perry-foot { transition: background .25s, border-color .25s, opacity .3s; }
.perry.play li:nth-child(5) .box, .perry.play li:nth-child(5) .box::after { transition-delay: .5s; }
.perry.play li:nth-child(4) .box, .perry.play li:nth-child(4) .box::after { transition-delay: 1s; }
.perry.play li:nth-child(3) .box, .perry.play li:nth-child(3) .box::after { transition-delay: 1.5s; }
.perry.play li:nth-child(2) .box, .perry.play li:nth-child(2) .box::after { transition-delay: 2s; }
.perry.play .perry-foot { transition-delay: 2.6s; }
.motion .perry.play .dread { animation: dread .5s 2.9s 2; }
@keyframes dread { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* tickets */
.motion .tickets:not(.play) .ticket.paid { opacity: 1; }
.motion .tickets .ticket.paid { transition: opacity 1.8s ease 1.1s; }
.motion .tickets:not(.play) .paid .t-head span { opacity: 0; transform: scale(2) rotate(-12deg); }
.motion .tickets .paid .t-head span { transition: opacity .25s ease .5s, transform .35s cubic-bezier(.3,1.5,.5,1) .5s; }
.motion .tickets:not(.play) .ticket.open::before { transform: translateX(-50%) translateY(-18px); opacity: 0; }
.motion .tickets .ticket.open::before { transition: transform .4s cubic-bezier(.3,1.6,.5,1) .2s, opacity .2s ease .2s; }

/* break slopes */
.bk-line { stroke-dasharray: 1; }
.motion .breaks:not(.play) .bk-line { stroke-dashoffset: 1; }
.motion .breaks:not(.play) .bk-b, .motion .breaks:not(.play) .bk-res { opacity: 0; }
.motion .breaks .bk-line { transition: stroke-dashoffset .7s ease; } .motion .breaks .bk-b, .motion .breaks .bk-res { transition: opacity .3s; }
.breaks.play .bk:nth-child(1) .bk-line { transition-delay: .2s; } .breaks.play .bk:nth-child(1) .bk-b, .breaks.play .bk:nth-child(1) .bk-res { transition-delay: .8s; }
.breaks.play .bk:nth-child(2) .bk-line { transition-delay: .7s; } .breaks.play .bk:nth-child(2) .bk-b, .breaks.play .bk:nth-child(2) .bk-res { transition-delay: 1.3s; }
.breaks.play .bk:nth-child(3) .bk-line { transition-delay: 1.2s; } .breaks.play .bk:nth-child(3) .bk-b, .breaks.play .bk:nth-child(3) .bk-res { transition-delay: 1.8s; }
.breaks.play .bk:nth-child(4) .bk-line { transition-delay: 1.9s; transition-duration: 1s; } .breaks.play .bk:nth-child(4) .bk-b, .breaks.play .bk:nth-child(4) .bk-res { transition-delay: 2.8s; }

/* network */
.loose .aha-path { stroke-dasharray: 1; }
.motion .network:not(.play) .aha-path { stroke-dashoffset: 1; }
.motion .network:not(.play) circle.aha, .motion .network:not(.play) .loose text { opacity: 0; }
.motion .network:not(.play) .loose line.weak { opacity: 0; }
.motion .network .loose line.weak { transition: opacity .8s ease .3s; }
.motion .network .aha-path { transition: stroke-dashoffset 1.2s cubic-bezier(.5,0,.2,1) 1.5s; }
.motion .network circle.aha, .motion .network .loose text { transition: opacity .4s ease 2.6s; }

/* flow channel */
.motion .fc-you { display: block; fill: none; stroke: var(--ink); stroke-width: 2; opacity: 0; transition: opacity .3s; }
.motion .fc-you.on { opacity: 1; animation: youpulse 1.6s ease-in-out infinite; }
@keyframes youpulse { 50% { stroke-opacity: .35; } }
.motion .flow-chart .fc-b, .motion .flow-chart .fc-c, .motion .flow-chart .pivot { opacity: 0; transition: opacity .5s; }
.motion .flow-chart .on { opacity: 1; }
.motion .flow-chart:not(.play) .fc-a { opacity: 0; }

/* dot product */
.dp-shadow { transform-origin: 50px 66px; }
.motion .dotprod:not(.play) .dp-arrow, .motion .dotprod:not(.play) .dp-proj, .motion .dotprod:not(.play) .dp b { opacity: 0; }
.motion .dotprod:not(.play) .dp-shadow { transform: scaleY(0); }
.motion .dotprod .dp-arrow, .motion .dotprod .dp-proj, .motion .dotprod .dp b { transition: opacity .4s; }
.motion .dotprod .dp-shadow { transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.dotprod.play .dp .dp-arrow { transition-delay: calc(var(--k) * .45s); }
.dotprod.play .dp .dp-proj { transition-delay: calc(var(--k) * .45s + .3s); }
.dotprod.play .dp .dp-shadow { transition-delay: calc(var(--k) * .45s + .45s); }
.dotprod.play .dp b { transition-delay: calc(var(--k) * .45s + .8s); }
.dp:nth-child(1) { --k: 0; } .dp:nth-child(2) { --k: 1; } .dp:nth-child(3) { --k: 2; } .dp:nth-child(4) { --k: 3; } .dp:nth-child(5) { --k: 4; }

/* variety board */
.motion .variety:not(.play) .vb-row:not(.vb-headrow) { opacity: 0; }
.motion .variety:not(.play) .vb-cell i { transform: scale(.5); opacity: 0; }
.motion .variety .vb-row { transition: opacity .5s; } .motion .variety .vb-cell i { transition: transform .35s cubic-bezier(.3,1.6,.5,1), opacity .2s; }
.vb-row:nth-child(2) { --k: 0; } .vb-row:nth-child(3) { --k: 1; } .vb-row:nth-child(4) { --k: 2; } .vb-row:nth-child(5) { --k: 3; }
.variety.play .vb-row { transition-delay: calc(var(--k, 0) * .45s); }
.variety.play .vb-cell:nth-child(2) i { transition-delay: calc(var(--k, 0) * .45s + .35s); }
.variety.play .vb-cell:nth-child(3) i { transition-delay: calc(var(--k, 0) * .45s + .6s); }

/* bandit */
.bd-bar { transform-box: fill-box; transform-origin: bottom; }
.motion .bandit:not(.play) .bd-bar { transform: scaleY(0); }
.motion .bandit:not(.play) .bd-x { opacity: 0; } .motion .bandit:not(.play) use.off { opacity: 1; }
.motion .bandit .bd-bar { transition: transform .7s cubic-bezier(.2,.8,.2,1) .4s; }
.motion .bandit .bd-bar.best { transition-delay: .9s; }
.motion .bandit .bd-x, .motion .bandit use.off { transition: opacity .4s ease 1.6s; }

/* spiral */
.motion .spiral .sp-path { transition: none; stroke-dashoffset: 1; }
.motion .spiral:not(.done) .sp-path { marker-end: none; }
.motion .sp-you { display: block; fill: var(--paper); stroke: var(--signal); stroke-width: 3; }
.motion .spiral.done .sp-you, .motion .spiral:not(.play) .sp-you { opacity: 0; }
.motion .spiral .sp-stn { opacity: 0; transition: opacity .35s; }
.motion .spiral .sp-stn.on { opacity: 1; }
.motion .spiral .sp-stn circle { transform-box: fill-box; transform-origin: center; transform: scale(.3); transition: transform .45s cubic-bezier(.3,1.7,.5,1); }
.motion .spiral .sp-stn.on circle { transform: none; }

/* timelines */
.tl-axis { transform-origin: left; }
.motion .timelines:not(.play) .tl-axis { transform: scaleX(0); }
.motion .timelines:not(.play) .tl li { opacity: 0; }
.motion .timelines .tl-axis { transition: transform 1.2s cubic-bezier(.5,0,.2,1); }
.motion .timelines .tl li { transition: opacity .5s; }
.tl li:nth-child(1) { --k: 0; } .tl li:nth-child(2) { --k: 1; } .tl li:nth-child(3) { --k: 2; } .tl li:nth-child(4) { --k: 3; } .tl li:nth-child(5) { --k: 4; }
.timelines.play .tl li { transition-delay: calc(.5s + var(--k) * .45s); }
.timelines.play .tl + .tl .tl-axis { transition-delay: 1.4s; }
.timelines.play .tl + .tl li { transition-delay: calc(1.9s + var(--k) * .45s); }
@media (pointer: coarse) { .replay { min-height: 36px !important; padding-inline: .5rem; } }
/* Rail: the active label announces a new chapter, then steps aside so it never sits on a wide figure */
.rail a.active .lbl { opacity: 0; transform: none; animation: lblflash 3.2s ease forwards; }
@keyframes lblflash { 0% { opacity: 0; transform: translateX(-6px); } 10%, 72% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.rail:hover a .lbl, .rail a:focus-visible .lbl { opacity: 1 !important; animation: none; }

/* ===================== C7: Interactives that explain themselves ===================== */
/* Sail lab: draggable bow, direct labels */
#sail-svg { cursor: grab; user-select: none; -webkit-user-select: none; }
.dragging #sail-svg { cursor: grabbing; }
#bow-handle, #boat { touch-action: none; }
.handle-hit { fill: transparent; }
.handle { fill: var(--gold); stroke: var(--ink); stroke-width: 2; }
.handle-hint { fill: none; stroke: var(--gold); stroke-width: 1.5; opacity: 0; }
.motion .sail-lab:not(.touched) .handle-hint { animation: hint 1.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes hint { 0% { opacity: .9; transform: scale(.6); } 100% { opacity: 0; transform: scale(1.7); } }
.sail-lab svg .lab { font: 600 9px var(--sans); letter-spacing: .08em; text-transform: uppercase; transition: opacity .2s; pointer-events: none; }
.sail-lab svg .lab-speed { fill: var(--paper); }
.sail-lab svg .lab-prog { fill: #f3a27f; }
.neg svg .lab-prog { fill: #9aa3b5; }
.readout dt small { display: block; font: .68rem var(--mono); color: #7f8798; margin-top: .1rem; }
.polar-neg { fill: rgba(124,133,152,.12); }
.sail-lab svg .polar-note { fill: #f3a27f; font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }
.sail-lab svg .polar-note.neg { fill: #8d94a5; }

/* Engine: guide, gauges with values, energy curve, ranking */
.e-guide { list-style: none; margin: 1rem 0 1.4rem; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; font-size: .82rem; }
.e-guide li { display: flex; align-items: center; gap: .45rem; padding: .35rem .7rem .35rem .4rem; border-radius: 999px; border: 1px solid rgba(245,239,226,.22); color: #c6cbd6; transition: background .3s, color .3s, border-color .3s; }
.e-guide span { width: 1.3rem; height: 1.3rem; border-radius: 50%; display: inline-grid; place-items: center; font: 700 .68rem var(--mono); background: rgba(245,239,226,.14); }
.e-guide li.done { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.e-guide li.done span { background: var(--ink); color: var(--gold); font-size: 0; }
.e-guide li.done span::before { content: "✓"; font-size: .7rem; }
.gauge span { display: flex; align-items: baseline; gap: .35rem; }
.gauge .g-sym { font: italic 600 1.05rem var(--serif); color: var(--gold); }
.gauge output { margin-left: auto; font: 600 .8rem var(--mono); color: var(--paper); transition: color .3s; }
.gauge small { display: block; font-size: .72rem; color: #8d94a5; margin-top: .05rem; }
.gauge.flash[data-dir="up"] output { animation: gup 1.2s; } .gauge.flash[data-dir="down"] output { animation: gdown 1.2s; }
@keyframes gup { 0%, 60% { color: #7fd1a0; } } @keyframes gdown { 0%, 60% { color: #f3a27f; } }
.gauge.flash[data-dir="up"] output::after { content: " ↑"; } .gauge.flash[data-dir="down"] output::after { content: " ↓"; }
.gauge output::after { content: " ·"; opacity: .0; }
.gauge.flash output::after { opacity: 1; animation: fadeout 1.6s forwards; }
@keyframes fadeout { 70% { opacity: 1; } 100% { opacity: 0; } }
.time { display: flex; justify-content: space-between; align-items: baseline; margin-top: 1.4rem; }
.time output { font: 600 .9rem var(--mono); color: var(--paper); }
.beta-curve { width: 100%; display: block; margin: .3rem 0 -.6rem; overflow: visible; }
.beta-area { fill: rgba(201,154,46,.14); } .beta-line { fill: none; stroke: var(--gold); stroke-width: 1.8; }
.beta-cur { stroke: rgba(245,239,226,.4); stroke-dasharray: 2 3; } .beta-dot { fill: var(--paper); stroke: var(--gold); stroke-width: 2; }
.engine-demo input[type=range] { width: 100%; accent-color: var(--gold); }
.beta-note { font-size: .72rem; line-height: 1.45; color: #8d94a5; margin: .2rem 0 0; }
.e-rank { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid rgba(245,239,226,.14); }
#e-rank { list-style: none; margin: .6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
#e-rank li { display: grid; grid-template-columns: minmax(0, 15rem) 4.6rem 1fr 3.2rem; gap: .75rem; align-items: center; font-size: .82rem; padding: .28rem .5rem; border-radius: 6px; color: #c6cbd6; transition: background .3s, opacity .3s; }
.rk-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-mode { font: 600 .6rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: #8d94a5; }
.rk-bar { display: flex; height: 10px; background: rgba(245,239,226,.07); border-radius: 99px; overflow: hidden; }
.rk-bar i { display: block; height: 100%; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.s-a, .k-a { background: var(--signal); } .s-b, .k-b { background: #7fb3c9; } .s-g, .k-g { background: var(--gold); } .s-d, .k-d { background: #f3c4ad; }
.s-p, .k-p { background: repeating-linear-gradient(135deg, rgba(245,239,226,.38) 0 2px, transparent 2px 5px); }
.rk-score { font: 600 .78rem var(--mono); text-align: right; font-variant-numeric: tabular-nums lining-nums; }
#e-rank li.best { background: rgba(245,239,226,.1); color: var(--paper); }
#e-rank li.best .rk-name::before { content: "→ "; color: var(--gold); font-weight: 700; }
.on-main #e-rank li.best { background: rgba(245,239,226,.05); }
#e-rank li.blocked { color: #8d94a5; grid-template-columns: minmax(0, 15rem) 4.6rem 1fr auto; }
#e-rank li.blocked .rk-name { text-decoration: line-through; text-decoration-color: var(--signal); }
#e-rank li.blocked .rk-bar { opacity: .35; }
#e-rank li.blocked .rk-score { color: #f3a27f; font-size: .68rem; white-space: nowrap; }
.e-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; font-size: .72rem; color: #a9b0c0; margin: .9rem 0 0; }
.e-legend .k { width: .8rem; height: .8rem; border-radius: 3px; display: inline-block; margin-right: -.6rem; }
.engine-demo figcaption { color: #8d94a5; border-top: 1px solid rgba(245,239,226,.12); padding-top: 1rem; margin-top: 1.25rem; }
@media (max-width: 860px) {
  #e-rank li, #e-rank li.blocked { grid-template-columns: 1fr auto; gap: .25rem .75rem; padding: .45rem .5rem; }
  .rk-mode { display: none; } .rk-bar { grid-column: 1 / -1; order: 3; }
  .sail-lab svg .lab { font-size: 11px; }
}
.e-legend span { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.e-legend .k { margin-right: 0; }
@media (max-width: 640px) { .sail-lab svg .polar-note.neg { display: none; } .sail-lab svg .polar-note { font-size: 10px; } }

/* ===================== C8: References ===================== */
.rt { --c: var(--ink-soft); display: inline-block; font: 600 .6rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--c); border: 1px solid var(--c); border-radius: 4px; padding: .28em .45em .24em; margin-right: .35em; vertical-align: .12em; white-space: nowrap; }
[data-t="meta"] { --c: #1f5f7a; } [data-t="exp"] { --c: #2f7d5b; } [data-t="obs"] { --c: #6f7f2a; } [data-t="review"] { --c: #7a4a86; } [data-t="theory"] { --c: #8a6a12; }
[data-t="method"] { --c: #4a5265; } [data-t="book"] { --c: #9b4a5f; } [data-t="primary"] { --c: #1d2433; } [data-t="story"] { --c: #c8461f; }
.rt[data-t="meta"] { background: var(--c); color: #fff; }
.refs li[data-t], .src-group li[data-t] { padding-left: .1rem; }
.ref-back { border: 0; background: none; padding: 0 .2em; font: 600 .7rem var(--sans); color: var(--ink-soft); border-radius: 3px; min-height: 0 !important; white-space: nowrap; }
.ref-back:hover { background: none; color: var(--signal); }
.cite-flash { animation: citeflash 2.2s ease; border-radius: 3px; }
@keyframes citeflash { 0%, 55% { background: rgba(233,185,73,.55); box-shadow: 0 0 0 4px rgba(233,185,73,.55); } 100% { background: transparent; box-shadow: 0 0 0 4px transparent; } }
@media (prefers-reduced-motion: reduce) { .cite-flash { animation: none !important; outline: 2px solid var(--gold); outline-offset: 2px; } }

.ev-meta { display: inline-flex; align-items: center; gap: .4em; white-space: nowrap; }
.ev-n { display: inline-grid; place-items: center; min-width: 1.5em; height: 1.5em; border-radius: 999px; font: 700 .72rem var(--mono); color: #fff; letter-spacing: 0; margin-left: .5em; }
.ev-n:first-child { margin-left: 0; }
.ev-n.good { background: var(--sea); } .ev-n.hedge { background: var(--signal); }
.ev-sep { margin: 0 .3em; color: var(--line); }

.src-weigh { margin: 1.75rem 0 2rem; padding: 1.25rem 1.25rem 1.1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.src-weigh-h { font: 600 .7rem var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--signal); margin: 0 0 .8rem; }
.src-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; gap: 2px; }
.src-bar i { background: var(--c); min-width: 6px; cursor: pointer; transition: opacity .3s; }
.src-bar i.dim { opacity: .18; }
.src-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0 .8rem; }
.src-chip { display: inline-flex; align-items: center; gap: .4em; font: 500 .78rem var(--sans); padding: .35rem .7rem; border-color: var(--line); background: var(--paper); color: var(--ink); }
.src-chip b { font: 600 .72rem var(--mono); color: var(--ink-soft); }
.src-chip .rt { width: .7em; height: .7em; padding: 0; border-radius: 50%; background: var(--c); margin: 0; }
.src-chip:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink-soft); }
.src-chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.src-chip.on b { color: #b9bfcc; }
.src-def { font-size: .88rem; line-height: 1.5; color: var(--ink); margin: 0; min-height: 3em; max-width: 40rem; }
.src-tools { margin: .5rem 0 0; display: flex; align-items: center; gap: .75rem; font-size: .8rem; color: var(--sea); }
.src-copy { font-size: .74rem; padding: .3rem .7rem; border-color: var(--line); color: var(--ink-soft); }
.src-group[hidden], .src-group li[hidden] { display: none; }
@media (max-width: 860px) { .ev-meta { white-space: normal; flex-wrap: wrap; } }

/* ===================== C9: Closing — field kit, finale, print ===================== */
.kit { padding: clamp(4rem, 10vh, 6rem) 0 2rem; scroll-margin-top: 1rem; border-top: 1px solid var(--line); margin-top: 1rem; }
.kit-head h2 { font: 450 clamp(2.4rem, 5.5vw, 4rem)/1 var(--display); letter-spacing: -.035em; font-variation-settings: "SOFT" 50; margin: 0 0 .9rem; }
.kit-sub { max-width: 38rem; color: var(--ink-soft); margin: 0 0 2.25rem; }
.kit-card { position: relative; background: var(--card-2); border: 1.5px solid var(--ink); border-radius: 14px; padding: 2.25rem 2.25rem 1.25rem; box-shadow: 8px 8px 0 var(--ink); }
.kit-stamp { position: absolute; top: -.85rem; left: 1.75rem; margin: 0; background: var(--signal); color: #fff; font: 700 .7rem var(--sans); letter-spacing: .24em; text-transform: uppercase; padding: .4rem .8rem; border-radius: 4px; transform: rotate(-2deg); }
.kit-steps { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 2.5rem; column-rule: 1px dashed var(--line); }
.kit-steps > li { break-inside: avoid; position: relative; padding: 0 0 1.5rem 3rem; }
.kit-n { position: absolute; left: 0; top: -.1rem; width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 1.5px solid var(--ink); display: grid; place-items: center; font: 500 1.05rem var(--display); }
.kit-steps h3 { font: 500 1.3rem/1.2 var(--display); letter-spacing: -.015em; margin: 0 0 .25rem; }
.kit-steps p { font: .9rem/1.5 var(--sans); color: var(--ink-soft); margin: 0 0 .6rem; }
.kit-ref { font: 600 .66rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--sea); text-decoration: none; white-space: nowrap; margin-left: .2rem; }
.kit-line { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: .6rem; margin: .1rem 0; font-family: var(--sans); }
.kit-line span { font: 600 .68rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
.kit-line.w span { width: 5.6rem; }
.kit-line input { font: 1.05rem var(--serif); font-style: italic; color: var(--ink); background: none; border: 0; border-bottom: 1.5px dotted var(--ink-soft); padding: .35rem .1rem .2rem; width: 100%; border-radius: 0; min-height: 40px; }
.kit-line input::placeholder { color: #b3aa96; opacity: 1; }
.kit-line input:focus { outline: none; border-bottom: 1.5px solid var(--signal); background: rgba(212,80,42,.04); }
.kit-checks { list-style: none; margin: 0; padding: 0; font: .92rem/1.4 var(--sans); }
.kit-checks label { display: flex; align-items: center; gap: .6rem; padding: .3rem 0; cursor: pointer; min-height: 36px; }
.kit-checks input { width: 1.05rem; height: 1.05rem; accent-color: var(--sea); flex: none; }
.kit-foot { display: flex; justify-content: space-between; gap: 1rem; margin: .5rem 0 0; padding-top: .9rem; border-top: 1px solid var(--line); font: 600 .66rem var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); }
.kit-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: 1.75rem 0 0; font: .8rem var(--sans); color: var(--ink-soft); }
#kit-print { background: var(--ink); color: var(--paper); padding: .7rem 1.2rem; }
#kit-print:hover { background: var(--signal); border-color: var(--signal); }
.finale-actions { display: flex; flex-wrap: wrap; gap: 1.25rem 1.75rem; justify-content: center; align-items: center; }
.cta-ghost.light { color: var(--paper); border-color: rgba(245,239,226,.6); }
.cta-ghost.light:hover { color: #f3a27f; }
.foot-prov { font-size: .74rem; margin-top: .4rem; }
.foot-prov a { color: inherit; }
@media (max-width: 860px) { .kit-steps { columns: 1; } .kit-card { padding: 2rem 1.1rem 1rem; box-shadow: 5px 5px 0 var(--ink); } .kit-steps > li { padding-left: 2.7rem; } .kit-foot { flex-direction: column; gap: .2rem; } }

@media print {
  @page { margin: 16mm 14mm; }
  html { scroll-behavior: auto; }
  body { background: #fff; font-size: 10.5pt; }
  body::before, .progress, .rail, .mobile-bar, .skip, .hero .chart, .hero-actions, .hero-legend, .replay, .bridge, .finale-art, .cite-card, .presets, .engine-buttons, .kit-tools, .src-chips, .src-tools, .ref-back, input[type=range], .sc-hud, .op-num, #bow-handle { display: none !important; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal], .opener .op-inner > * { opacity: 1 !important; transform: none !important; }
  .hero { min-height: 0; padding: 0 0 2rem; border: 0; } .hero-inner { opacity: 1 !important; transform: none !important; margin: 0; }
  .hero h1 .ch, .hero .kicker, .hero .subtitle, .hero-meta { opacity: 1 !important; transform: none !important; filter: none !important; }
  .layout { padding: 0; } main { max-width: none; } .wide { margin-inline: 0 !important; }
  .opener { margin-inline: 0; padding: 1.5rem 0 1rem; background: none !important; color: #000 !important; --op-ink: #000 !important; --op-soft: #444 !important; break-before: page; }
  .opener h2 { font-size: 30pt !important; }
  figure, .takeaway, .callout, .kit-card, .bk, .card, .tl, .aside-note, .params li { break-inside: avoid; }
  .scrolly { display: block; } .sc-graphic { position: static; height: 9cm; } .sc-steps { padding: 0; } .sc-step { min-height: 0; opacity: 1; padding: .6rem 0; }
  .sail-lab, .engine-demo, .finale, .callout, .net-panel.lit, .perry-card.bad, .tf-core { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .finale { padding: 3rem 1rem; }
  a { color: inherit; text-decoration: none; }
  .refs a, .src-group a { color: #1f5f7a; }
  .evidence { border: 1px solid #ccc; }
  .kit-card { box-shadow: none; }
  /* print only the card */
body.print-kit > *:not(.layout), body.print-kit main > *:not(.kit), body.print-kit .kit-head, body.print-kit .kit-ref { display: none !important; }
  body.print-kit .kit { padding: 1cm 0 0; border: 0; margin: 0; }
  body.print-kit .kit-card { border-width: 1pt; padding: 1.2cm 1cm .6cm; }
  body.print-kit .kit-line input { border-bottom: 1pt dotted #555; min-height: 1.1cm; }
  body.print-kit .kit-line input::placeholder { color: transparent; }
}
.kit-steps { columns: auto; display: grid; grid-template-columns: 1fr 1fr; column-gap: 2.5rem; grid-template-rows: auto auto 1fr; }
.kit-steps > li:nth-child(1) { grid-area: 1 / 1; } .kit-steps > li:nth-child(2) { grid-area: 2 / 1 / 4 / 1; }
.kit-steps > li:nth-child(3) { grid-area: 1 / 2; } .kit-steps > li:nth-child(4) { grid-area: 2 / 2; } .kit-steps > li:nth-child(5) { grid-area: 3 / 2; }
.kit-n { top: 0; }
@media (max-width: 860px) { .kit-steps { display: block; } }

/* ===================== C10: QA ===================== */
/* Without JavaScript (or with reduced motion) nothing waits for a reveal */
html:not(.motion) [data-reveal], html:not(.motion) .opener .op-inner > * { opacity: 1; transform: none; }
html:not(.motion) .e-route, html:not(.motion) .energy, html:not(.motion) .sp-path { stroke-dashoffset: 0; }

/* Contrast: small-caps labels use a darker signal; tag colours meet 4.5:1 on paper */
:root { --signal-text: #b33d18; }
.fig-meta, .tk-label, .brief-k, .bd-k, .src-weigh-h, .sc-k, .signpost::before { color: var(--signal-text); }
.sail-lab .fig-meta, .engine-demo .fig-meta { color: var(--gold); }
.fig-badge[data-kind="illustration"] { color: #765a0c; }
[data-t="exp"] { --c: #246a4b; } [data-t="obs"] { --c: #55631b; } [data-t="theory"] { --c: #765a0c; } [data-t="story"] { --c: #b33d18; }
.tl-axis span { color: #746c5a; } .tl-axis span::after { background: #746c5a; }
.tl-side > b { color: #765a0c; }
.kit-line input::placeholder { color: #8a816d; }
.vb-headrow em { color: var(--signal-text); }

/* Smallest labels: floor at ~11px on every screen */
.fig-badge { font-size: .68rem; } .brief-foot .fig-badge { font-size: .66rem; }
.rt { font-size: .66rem; } .hud-k, .qm-tag, .card-kicker, .perry-head small, .net-title small { font-size: .7rem; } .rk-mode { font-size: .66rem; }
.bk svg .bk-t { font-size: 9.5px; } .spark text { font-size: 9.5px; }
.bk-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .bk { min-width: 0; }

@media (max-width: 860px) { .bk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .fig-badge, .brief-foot .fig-badge, .rt, .tk-label, .br-k, .bd-k, .src-weigh-h, .kit-stamp, .kit-ref, .finale-kicker, .brief-k, .tf-core small, .t-head span, .t-foot, .vb-headrow, .beta-note, .rk-score, .ev-n, .ref-back, .src-copy, .foot-prov, .tl li > b, .tl-legend, .kit-line span, .kit-foot, .e-legend, .gauge small, .bk-res, .vb-cell i, .replay, .e-guide span { font-size: .75rem; }
  .cites .cite { font-size: .88em; }
  .bk svg .bk-t { font-size: 10.5px; }
  .flow-chart svg .zone-sub { font-size: 16px; }
  .qm-svg .sq text { font-size: 18px; }
  .sc-lab { font-size: 16px; }
  .bk-res { white-space: normal; }
}
@media (pointer: coarse) {
  .ref-back { display: inline-block; padding: .5em .45em; min-height: 28px !important; }
  .kit-checks input { width: 1.3rem; height: 1.3rem; }
  .fig-badge { padding: .55em .75em; }
  dfn.term { padding: .3em 0; }
}
/* Focus: glossary terms and badges get the same visible ring as links */
dfn.term:focus-visible, .fig-badge:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
@media (max-width: 640px) {
  .qm-tag, .perry-head small, .net-title small, .hud-k, .bd .bd-k, #e-rank li.blocked .rk-score, .card-kicker, .e-guide span, .src-chip b, .now-label, .tl-axis span { font-size: .75rem; }
}

/* ===================== D1: Verification ===================== */
.tl-approx.tl-range > b::before { background: repeating-linear-gradient(90deg, var(--gold) 0 6px, transparent 6px 10px); }

/* ===================== D2: Cross-browser ===================== */
/* Animating the SVG `d` property only works in Chromium; flap the luffing sail with a transform everywhere */
.scrolly[data-active="0"] .sc-sail { animation: luffx .32s ease-in-out infinite alternate; transform-box: view-box; transform-origin: 0 0; }
@keyframes luffx { from { transform: scaleX(.55); } to { transform: scaleX(-.55); } }

/* ===================== D3: Scrollytelling copy ===================== */
.sc-water { font-size: 1.1rem; line-height: 1.5; margin: 0 0 1rem; }
.sc-water > span:first-child { display: block; font: 600 .68rem var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--sea); margin-bottom: .2rem; }
.sc-step > p.sc-map:last-child { font: .95rem/1.5 var(--sans); margin: 0; border-left: 3px solid var(--gold); border-radius: 0 8px 8px 0; }
.sc-map > span:first-child { color: #765a0c; font-weight: 600; }
@media (max-width: 860px) {
  .sc-step > p.sc-water { padding-bottom: .7rem; }
  .sc-step > p.sc-map:last-child { padding: .7rem 1rem 1rem; border-left: 0; border-top: 1px dashed var(--line); border-radius: 0 0 10px 10px; background: var(--paper-2); }
  .sc-water > span:first-child, .sc-map > span:first-child { font-size: .75rem; }
}
@media (max-width: 860px) { .sc-step > h3 { padding-bottom: .5rem; } }

/* ===================== D4: Dial cards show their effect ===================== */
.params li > .pm-bump { grid-column: 2; max-width: 21rem; margin-top: -.25rem; }
.pm-bump svg { width: 100%; display: block; overflow: visible; }
.pm-bump svg text { font: 600 9px var(--sans); fill: var(--ink-soft); }
.pm-bump svg .pb-h { font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
.pb-l { fill: none; stroke: #d9cfb9; stroke-width: 1.2; }
.pb-l.up { stroke: var(--sea); stroke-width: 2.4; } .pb-l.down { stroke: var(--signal); stroke-width: 2.4; }
.pb-d.up { fill: var(--sea); } .pb-d.down { fill: var(--signal); }
.pm-bump svg .pb-t.up { fill: var(--sea); } .pm-bump svg .pb-t.down { fill: var(--signal-text); }
.pm-note { font: .84rem/1.5 var(--sans); color: var(--ink-soft); margin: -.75rem 0 2.5rem; }
@media (max-width: 860px) {
  .params li > .pm-bump { grid-column: 1; }
  .pm-bump svg text { font-size: 10px; } .pm-bump svg .pb-h { font-size: 9px; }
}

/* ===================== D5: Small-screen figures ===================== */
svg .m-only { display: none; }
@media (max-width: 640px) {
  svg .d-only { display: none; } svg .m-only { display: inline; }
  /* spiral: labels sized for a 340px-wide rendering of a 640-unit drawing */
.spiral svg { border-radius: 10px; }
  .spiral .sp-stn text { font-size: 19px; }
  .spiral svg .small { font-size: 17px; }
  .spiral .sp-stn text.q { font-size: 15px; }
  .spiral .sp-stn circle { r: 9px; } .spiral .st-sq circle { r: 12px; }
  .spiral .sp-path { stroke-width: 4; }
  /* quest map: keep the end label clear of the energy line */
.qm-open .tiny.good:not(.opt) { transform: translateY(34px); }
  .qm-svg .energy { stroke-width: 3.5; } .qm-svg .trail { stroke-width: 3.5; } .qm-svg .road { stroke-width: 3; }
  .qm-svg .sq circle { r: 14px; }
  .qm-lane { padding: .9rem 1rem .6rem; }
}

/* ===================== D6: Accessibility ===================== */
:root { --signal-deep: #b9401a; }
.ev-hedge h4, .bd .bd-k, .dp b, .card-payoff, .perry li.dread, .fig-badge[data-kind="toy"], .ev-hedge li::before { color: var(--signal-text); }
.sail-lab .fig-badge, .engine-demo .fig-badge { color: #f3a27f; }
.dp.neg b { color: #5d6578; } .dp.zero b { color: var(--ink); }
.tf-node.out, .bk.hi .bk-res, .engine-demo button.esc, .kit-stamp, .t-head span, .ev-n.hedge { background: var(--signal-deep); border-color: var(--signal-deep); }
.paid .t-head span { background: var(--ink-soft); }
.engine-demo button.esc { color: #fff; }
.tf-node.out small { color: #ffe9df; }
.readout dt small { color: #9aa3b5; }
.bad .perry-head small, .rk-mode { color: #a9b0c0; }
.opener[data-ch="paradox"] { --op-accent: #a8391a; } .opener[data-ch="polymath"] { --op-accent: #8a3d52; }
.fig-badge[data-kind="record"] { color: #3f6843; }
.ref-back { display: inline-block; min-height: 24px !important; min-width: 24px; line-height: 24px; padding: 0 .35em; }
.fig-badge, dfn.term { scroll-margin: 6rem; }
.tk-line em { color: var(--signal-text); }
main:focus { outline: none; }

/* ===================== D7: Evidence in the flow ===================== */
.tk-ev { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 1.5rem 0 0; font-family: var(--sans); }
.tk-ev > div { padding-top: .7rem; border-top: 2px solid var(--sea); }
.tk-ev > .hedge { border-top-color: var(--signal-deep); }
.tk-ev dt { font: 600 .7rem var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--sea); margin-bottom: .3rem; display: flex; align-items: center; gap: .45em; }
.tk-ev dt::before { content: "✓"; font-weight: 700; }
.tk-ev .hedge dt { color: var(--signal-text); } .tk-ev .hedge dt::before { content: "~"; }
.tk-ev dd { margin: 0; font-size: .92rem; line-height: 1.5; color: var(--ink); }
.takeaway + .evidence { margin-top: 1.5rem; }
@media (max-width: 640px) { .tk-ev { grid-template-columns: 1fr; gap: 1rem; } .tk-ev dt { font-size: .75rem; } }

/* ===================== D8: Hero deck ===================== */
.subtitle { margin-bottom: .9rem; }
.hero-deck { font: 400 clamp(1rem, 1.5vw, 1.15rem)/1.5 var(--sans); color: var(--ink); max-width: 30rem; margin: 0 0 2.25rem; opacity: 0; animation: fadeup .9s cubic-bezier(.2,.8,.2,1) .82s forwards; }
@media (prefers-reduced-motion: reduce) { .hero-deck { opacity: 1 !important; animation: none !important; } }
@media print { .hero-deck { opacity: 1 !important; } }

/* ===================== D9: Consolidation ===================== */
/* (dead rules removed by scripts/css-prune.mjs; the rule below replaces one that could never match) */
@media (max-width: 860px) { .vb-row:not(.vb-headrow) .vb-cell:nth-child(2) { border-left: 0; } }

/* ===================== D10: Dark scheme ===================== */
.theme-toggle { position: absolute; z-index: 3; top: 1.1rem; right: 1.25rem; display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .75rem .4rem .5rem; font: 600 .72rem var(--sans); letter-spacing: .1em; text-transform: uppercase; border-color: var(--line); color: var(--ink-soft); background: color-mix(in srgb, var(--paper) 80%, transparent); min-height: 36px; }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; } .theme-toggle circle { fill: none; stroke: currentColor; stroke-width: 2; } .theme-toggle .half { fill: currentColor; }
.theme-toggle:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.theme-link { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 3px; min-height: 24px !important; border-radius: 2px; }
.theme-link:hover { background: none; color: var(--signal-text); }
@media (max-width: 1180px) { .theme-toggle { top: .9rem; right: .9rem; } }
@media print { .theme-toggle, .theme-link { display: none !important; } }

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #14181f; --paper-2: #1b212b; --card: #1a1f28; --card-2: #1f2530; --line: #323b4a;
  --ink: #ebe5d7; --ink-soft: #a9b0c0;
  --signal: #e8643c; --signal-text: #f08a63; --sea: #7fb3c9; --gold: #e3b450;
}
/* Panels that are dark in the light scheme keep their own palette, so everything inside them is unchanged */
[data-theme="dark"] :is(.sail-lab, .engine-demo, .callout, .finale, .cite-card, .net-panel.lit, .tf-core, .perry-card.bad, .sc-graphic, .slot) {
  --paper: #f5efe2; --paper-2: #ece4d2; --card: #fbf8f1; --card-2: #fffdf7; --line: #d6cbb3; --ink: #10141b; --ink-soft: #4a5265;
  --signal: #d4502a; --signal-text: #f3a27f; --sea: #1f5f7a; --gold: #c99a2e;
}
[data-theme="dark"] :is(.sail-lab, .engine-demo, .callout, .cite-card, .net-panel.lit, .tf-core) { box-shadow: 0 0 0 1px rgba(245,239,226,.1); }
[data-theme="dark"] .cite-card { box-shadow: 0 0 0 1px rgba(245,239,226,.16), 0 24px 48px -16px rgba(0,0,0,.7); }
[data-theme="dark"] .finale { border-top: 1px solid rgba(245,239,226,.08); }
[data-theme="dark"] body::before { opacity: .12; mix-blend-mode: normal; }
[data-theme="dark"] .mobile-bar { background: rgba(20,24,31,.92); }
[data-theme="dark"] ::selection { background: rgba(232,100,60,.4); }
/* chapter plates: same hues, turned down */
[data-theme="dark"] .opener { --op-ink: #f5efe2; --op-soft: #aab1c1; }
[data-theme="dark"] .opener[data-ch="paradox"] { --op-bg: #2a2317; --op-accent: #f3a27f; }
[data-theme="dark"] .opener[data-ch="rebellion"] { --op-bg: #0e1218; }
[data-theme="dark"] .opener[data-ch="brain"] { --op-bg: #18231f; --op-accent: #7fb3c9; }
[data-theme="dark"] .opener[data-ch="sailing"] { --op-bg: #113646; }
[data-theme="dark"] .opener[data-ch="engine"] { --op-bg: #2a2514; --op-accent: #e9b949; --op-soft: #c9b98a; }
[data-theme="dark"] .opener[data-ch="polymath"] { --op-bg: #2a1d21; --op-accent: #e0a3b4; --op-soft: #c4a9b0; }
[data-theme="dark"] .emblem .e-fill { fill: var(--op-ink); }
/* labels and tags: lighter tints of the same hues */
[data-theme="dark"] .fig-badge[data-kind="illustration"] { color: #e0bd5c; } [data-theme="dark"] .fig-badge[data-kind="schematic"] { color: #7fb3c9; }
[data-theme="dark"] .fig-badge[data-kind="concept"] { color: #cba6d6; } [data-theme="dark"] .fig-badge[data-kind="toy"] { color: #f08a63; }
[data-theme="dark"] .fig-badge[data-kind="record"] { color: #93c797; } [data-theme="dark"] .fig-badge[data-kind="geometry"] { color: #ebe5d7; }
[data-theme="dark"] .fig-badge:hover { background: rgba(245,239,226,.08); }
[data-theme="dark"] [data-t="meta"] { --c: #7fb3c9; } [data-theme="dark"] [data-t="exp"] { --c: #7fd1a0; } [data-theme="dark"] [data-t="obs"] { --c: #bccb6c; }
[data-theme="dark"] [data-t="review"] { --c: #cba6d6; } [data-theme="dark"] [data-t="theory"] { --c: #e0bd5c; } [data-theme="dark"] [data-t="method"] { --c: #a9b0c0; }
[data-theme="dark"] [data-t="book"] { --c: #e0a3b4; } [data-theme="dark"] [data-t="primary"] { --c: #ebe5d7; } [data-theme="dark"] [data-t="story"] { --c: #f08a63; }
[data-theme="dark"] .rt[data-t="meta"] { color: #10141b; }
[data-theme="dark"] .cite-card .rt { --c: #e9b949 !important; }
[data-theme="dark"] .ev-n { color: #10141b; } [data-theme="dark"] .ev-n.hedge { background: #f08a63; }
[data-theme="dark"] .tk-ev > .hedge { border-top-color: #f08a63; }
[data-theme="dark"] :is(.sc-map > span:first-child, .tl-side > b, .dp.neg b) { color: #e0bd5c; } [data-theme="dark"] .dp.neg b { color: #a9b0c0; }
[data-theme="dark"] :is(.tl-axis span) { color: #8d94a5; } [data-theme="dark"] .tl-axis span::after { background: #8d94a5; }
[data-theme="dark"] .kit-line input::placeholder { color: #7f8798; }
/* drawings with literal light-scheme greys */
[data-theme="dark"] .net:not(.loose) line:not(.strong) { stroke: #3a4352; } [data-theme="dark"] .net:not(.loose) circle:not(.on) { fill: #56607a; }
[data-theme="dark"] .pb-l:not(.up):not(.down) { stroke: #3a4352; } [data-theme="dark"] .bd-bar:not(.best) { fill: #4a5468; }
[data-theme="dark"] .bk-res { background: #2a3140; } [data-theme="dark"] .bk.hi .bk-res { background: var(--signal-deep); }
[data-theme="dark"] .fc-anx { fill: rgba(232,100,60,.12); } [data-theme="dark"] .fc-apa { fill: rgba(169,176,192,.08); }
[data-theme="dark"] .channel { stroke: #7fb3c9; fill: rgba(127,179,201,.2); }
[data-theme="dark"] .ticket { filter: drop-shadow(0 12px 14px rgba(0,0,0,.5)); }
[data-theme="dark"] .ticket ul { border-color: #3a4352; }
[data-theme="dark"] .vb-cell.ok i { background: rgba(127,179,201,.16); } [data-theme="dark"] .vb-cell.no i { background: rgba(232,100,60,.18); }
[data-theme="dark"] .kit-card { box-shadow: 8px 8px 0 #06080b; }
[data-theme="dark"] .petals ellipse, [data-theme="dark"] .e-petal ellipse { fill: #b98a9b; stroke: #e0a3b4; }
[data-theme="dark"] .worm { stroke: #c98a72; } [data-theme="dark"] .stem { stroke: #7fae82; }
[data-theme="dark"] .wake { stroke: rgba(127,179,201,.22); }
[data-theme="dark"] .card, [data-theme="dark"] .perry-card:not(.bad), [data-theme="dark"] .sail-lab { box-shadow: none; }
[data-theme="dark"] .cta:hover, [data-theme="dark"] .cta.light:hover { color: #fff; }
[data-theme="dark"] .src-chip.on b { color: #4a5265; }
[data-theme="dark"] .ticket.paid { opacity: .62; }
