/* The Bohr Effect v3 — "Arterial Noir": a dark lab-instrument page.
 * Signal colours: oxygen-red (oxy / lung / loading) and deoxy-violet (deoxy / tissue / unloading).
 * Amber only for whatever is grabbed right now. Ink is warm off-white; greys are neutral.
 */
:root {
  --bg: #0a0a0b;
  --bg-2: #111113;
  --bg-3: #17171a;
  --line: rgba(239, 232, 223, .09);
  --line-2: rgba(239, 232, 223, .18);
  --ink: #efe8df;
  --ink-2: #a9a9ad;
  --ink-3: #85858b;
  --rule: #6c6c71;
  --oxy: #ff4d5e;
  --oxy-soft: rgba(255, 77, 94, .14);
  --deoxy: #967aff;
  --deoxy-soft: rgba(150, 122, 255, .14);
  --grab: #ffb236;

  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --sans: 'Inter', 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-move: cubic-bezier(.65, 0, .35, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);

  --topbar: 52px;
  --pad: clamp(16px, 3.2vw, 44px);
  --radius: 18px;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 16px/1.6 var(--sans);
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
@media (min-width: 1100px) { body { font-size: 17px; } }

a { color: var(--ink); text-decoration-color: var(--ink-3); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
strong { font-weight: 600; color: var(--ink); }
em { font-style: italic; }
code { font: 500 .78em/1.4 var(--mono); color: var(--ink-2); word-break: break-all; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.small { font-size: .8rem; color: var(--ink-3); }

.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.noscript { margin: 24px var(--pad); padding: 12px 16px; border: 1px dashed var(--ink-3); border-radius: 10px; color: var(--ink-2); }

/* ---------- Atmosphere: vignette, grain, drifting motes ---------- */
.atmos { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.vignette { position: absolute; inset: 0; background:
  radial-gradient(120% 90% at 50% 20%, transparent 45%, rgba(0, 0, 0, .55) 100%); }
.grain {
  position: absolute; inset: 0; opacity: .06; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.motes i {
  position: absolute; width: 2px; height: 2px; border-radius: 50%;
  background: rgba(239, 232, 223, .32); opacity: .0;
  animation: mote 26s ease-in-out infinite alternate;
}
.motes i:nth-child(odd) { background: rgba(255, 77, 94, .35); }
.motes i:nth-child(3n) { background: rgba(150, 122, 255, .4); width: 3px; height: 3px; }
.motes i:nth-child(1) { left: 8%; top: 22%; animation-delay: -2s; }
.motes i:nth-child(2) { left: 18%; top: 70%; animation-delay: -9s; animation-duration: 31s; }
.motes i:nth-child(3) { left: 27%; top: 40%; animation-delay: -4s; }
.motes i:nth-child(4) { left: 36%; top: 85%; animation-delay: -15s; animation-duration: 34s; }
.motes i:nth-child(5) { left: 44%; top: 12%; animation-delay: -7s; }
.motes i:nth-child(6) { left: 53%; top: 58%; animation-delay: -20s; animation-duration: 29s; }
.motes i:nth-child(7) { left: 61%; top: 30%; animation-delay: -1s; }
.motes i:nth-child(8) { left: 69%; top: 76%; animation-delay: -12s; animation-duration: 33s; }
.motes i:nth-child(9) { left: 77%; top: 18%; animation-delay: -5s; }
.motes i:nth-child(10) { left: 84%; top: 48%; animation-delay: -18s; animation-duration: 27s; }
.motes i:nth-child(11) { left: 91%; top: 88%; animation-delay: -10s; }
.motes i:nth-child(12) { left: 13%; top: 50%; animation-delay: -22s; animation-duration: 36s; }
.motes i:nth-child(13) { left: 58%; top: 94%; animation-delay: -3s; }
.motes i:nth-child(14) { left: 96%; top: 8%; animation-delay: -14s; animation-duration: 30s; }
@keyframes mote {
  0% { transform: translate3d(0, 0, 0); opacity: 0; }
  20% { opacity: .9; }
  80% { opacity: .7; }
  100% { transform: translate3d(40px, -120px, 0); opacity: 0; }
}

main, .topbar, .site-footer { position: relative; z-index: 1; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 var(--pad);
  background: linear-gradient(to bottom, rgba(10, 10, 11, .92), rgba(10, 10, 11, .72));
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topnav { display: flex; gap: 22px; align-items: center; font-size: .82rem; }
.topnav a { color: var(--ink-2); text-decoration: none; transition: color .18s var(--ease-out); }
.topnav a:hover { color: var(--ink); }
.jump-peat { white-space: nowrap; }
.topbar-side { display: flex; align-items: center; gap: 16px; }
.badge-edu { margin: 0; font: 500 .72rem/1.3 var(--mono); letter-spacing: .04em; color: var(--ink-3); }
.pill {
  font: 500 .76rem/1 var(--sans); letter-spacing: .02em; color: var(--ink);
  background: transparent; border: 1px solid var(--line-2); border-radius: 999px;
  padding: 8px 14px; cursor: pointer;
  transition: transform .2s var(--spring), border-color .18s var(--ease-out), background .18s var(--ease-out);
}
.pill:hover { border-color: var(--ink-3); transform: translateY(-1px); }
.pill:active { transform: scale(.96); }
.pill[aria-pressed="true"] { background: rgba(239, 232, 223, .08); }
.badge-under { display: none; }

/* Compact title + icon buttons (phone header) */
.brand { display: none; font: 400 1.18rem/1 var(--serif); letter-spacing: -.015em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand em { font-weight: 300; background: linear-gradient(90deg, var(--oxy), var(--deoxy)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; padding-right: .06em; }
.icon-btn {
  display: none; place-items: center; width: 36px; height: 36px; padding: 0; flex: none;
  color: var(--ink); background: transparent; border: 1px solid var(--line-2); border-radius: 50%; cursor: pointer;
  transition: transform .2s var(--spring), border-color .18s var(--ease-out), background .18s var(--ease-out);
}
.icon-btn:hover { border-color: var(--ink-3); transform: translateY(-1px); }
.icon-btn:active { transform: scale(.94); }
.ico-menu { display: grid; gap: 3px; width: 14px; }
.ico-menu i { display: block; height: 1.5px; border-radius: 1px; background: currentColor; transition: transform .3s var(--spring), opacity .2s; }
.menu-btn[aria-expanded="true"] .ico-menu i:nth-child(1) { transform: translateY(4.5px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .ico-menu i:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] .ico-menu i:nth-child(3) { transform: translateY(-4.5px) rotate(-45deg); }
.motion-btn { display: inline-flex; align-items: center; gap: 8px; }
/* Pause = two bars; Play = a triangle (aria-pressed="true" means motion is paused). */
.ico-motion { position: relative; display: block; width: 10px; height: 10px; flex: none; }
.ico-motion::before, .ico-motion::after { content: ''; position: absolute; top: 0; bottom: 0; width: 3px; border-radius: 1px; background: currentColor; }
.ico-motion::before { left: 1px; }
.ico-motion::after { right: 1px; }
.motion-btn[aria-pressed="true"] .ico-motion::before { left: 1px; width: 0; height: 0; border-radius: 0; background: none; border-style: solid; border-width: 5px 0 5px 9px; border-color: transparent transparent transparent currentColor; }
.motion-btn[aria-pressed="true"] .ico-motion::after { display: none; }

/* ---------- Tags (source labels): ink tones, told apart by border style, weight, spacing ---------- */
.tag {
  display: inline-block;
  font: 600 .62rem/1.55 var(--sans);
  letter-spacing: .13em;
  padding: 0 .5em;
  border: 1px solid var(--ink-2);
  border-radius: 3px;
  color: var(--ink);
  vertical-align: .14em;
  white-space: nowrap;
}
.tag.text { border-style: solid; }
.tag.approx { border-style: dashed; color: var(--ink-2); }
.tag.guess { border-style: dotted; border-width: 1.5px; color: var(--ink-2); font-style: italic; font-weight: 500; letter-spacing: .09em; }
.tag.peat { border-color: var(--oxy); color: var(--ink); }
.tag.para { border: 3px double var(--ink-3); padding: 0 .45em; font-weight: 500; color: var(--ink-2); }
.tag.transcript { border-color: transparent; border-left: 3px solid var(--ink-2); border-radius: 0; font-weight: 500; letter-spacing: .18em; color: var(--ink-2); padding-left: .55em; white-space: normal; }

.eyebrow { margin: 0; font: 500 .72rem/1.2 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- HERO ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(296px, 24vw, 380px);
  gap: clamp(20px, 2.4vw, 40px);
  padding: 10px var(--pad) 14px;
  min-height: calc(100svh - var(--topbar));
}
/* Chart panel ≈ 860 × 724 px at 1280 × 800 → over 60% of the first screen. */
.hero-chart {
  position: relative;
  display: flex; flex-direction: column;
  height: calc(100svh - var(--topbar) - 24px);
  min-height: 460px;
}
.hero-chart::before, .hero-chart::after {
  content: ''; position: absolute; inset: 8% 6% 10% 10%; z-index: -1; border-radius: 50%;
  filter: blur(60px); opacity: 0; transition: opacity 1.2s var(--ease-out);
}
.hero-chart::before { background: radial-gradient(closest-side, rgba(150, 122, 255, .16), transparent); }
.hero-chart::after { background: radial-gradient(closest-side, rgba(255, 77, 94, .13), transparent); }
body[data-shift="right"] .hero-chart::before { opacity: 1; }
body[data-shift="left"] .hero-chart::after, body[data-shift="neutral"] .hero-chart::after { opacity: .7; }

.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0 2px; }
.shift {
  margin: 0; font: 500 .8rem/1 var(--sans); letter-spacing: .02em;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2);
  transition: color .4s var(--ease-out), border-color .4s var(--ease-out), background .4s var(--ease-out);
}
.shift.right { color: var(--deoxy); border-color: rgba(150, 122, 255, .55); background: var(--deoxy-soft); }
.shift.left { color: var(--oxy); border-color: rgba(255, 77, 94, .55); background: var(--oxy-soft); }

.chart-wrap { position: relative; flex: 1; min-height: 0; }
#chart, #chart2 { display: block; width: 100%; height: 100%; overflow: visible; }
#chart { touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#chart.is-near { cursor: grab; }
#chart.is-dragging, #chart.is-dragging * { cursor: grabbing; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: .78rem; color: var(--ink-2); padding-top: 4px; }
.legend .sw { display: inline-block; width: 22px; height: 0; margin-right: 8px; vertical-align: middle; }
.legend .sw.ref { border-top: 2px dashed var(--rule); }
.legend .sw.cur { border-top: 3px solid var(--oxy); border-radius: 2px; box-shadow: 0 0 8px rgba(255, 77, 94, .6); }
body[data-shift="right"] .legend .sw.cur { border-color: var(--deoxy); box-shadow: 0 0 8px rgba(150, 122, 255, .6); }

/* SVG chart parts */
.grid { stroke: rgba(239, 232, 223, .055); stroke-width: 1; }
.axis { stroke: var(--rule); stroke-width: 1; }
.tick { fill: var(--ink-3); font: 400 11px var(--mono); }
.axis-title { fill: var(--ink-2); font: 500 12px var(--sans); letter-spacing: .02em; }
.guide { stroke-width: 1; stroke-dasharray: 2 5; }
.guide.tissue { stroke: rgba(150, 122, 255, .75); }
.guide.lung { stroke: rgba(255, 77, 94, .75); }
.guide-label { font: 500 11px var(--mono); letter-spacing: .06em; }
.guide-label.tissue { fill: var(--deoxy); }
.guide-label.lung { fill: var(--oxy); }
.shift-fill { stroke: none; }
.curve-ref { fill: none; stroke: var(--rule); stroke-width: 1.6; stroke-dasharray: 6 6; }
.curve-cur { fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.curve-glow { fill: none; stroke-width: 10; stroke-linecap: round; opacity: .32; animation: glowPulse 3.8s ease-in-out infinite; }
@keyframes glowPulse { 0%, 100% { opacity: .2; } 50% { opacity: .45; } }
.p50-line { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 2 4; }
.p50-label { fill: var(--ink-2); font: 500 11px var(--mono); }
.arrow { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.arrow-label { font: 600 12px var(--sans); letter-spacing: .02em; }
.pt-ref { fill: var(--bg); stroke: var(--rule); stroke-width: 1.5; }
.pt-cur { stroke: var(--bg); stroke-width: 2; pointer-events: none; }
.pt-label { fill: var(--ink); font: 500 11px var(--mono); paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.probe-line { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 3 3; }
.probe-ref { fill: var(--bg); stroke: var(--ink-2); stroke-width: 1.5; }
.probe-cur { fill: var(--ink); }
.is-narrow .tick, .is-narrow .p50-label, .is-narrow .pt-label, .is-narrow .guide-label { font-size: 11.5px; }
.is-narrow .axis-title { font-size: 11px; }

.handle { cursor: grab; outline: none; }
.handle-hit { fill: transparent; }
.handle-inner { transform-box: fill-box; transform-origin: center; transition: transform .5s var(--spring); }
.handle-halo { opacity: .5; transform-box: fill-box; transform-origin: center; animation: halo 2.6s ease-in-out infinite; }
@keyframes halo { 0%, 100% { transform: scale(.85); opacity: .35; } 50% { transform: scale(1.25); opacity: .7; } }
.handle-ring { fill: rgba(10, 10, 11, .6); stroke-width: 2; }
.handle-core { stroke: none; }
.handle:hover .handle-inner, #chart.is-near .handle-inner { transform: scale(1.12); }
#chart.is-dragging .handle-inner { transform: scale(1.32); }
.handle:focus-visible .handle-ring { stroke: var(--ink) !important; stroke-width: 3; }
/* Handle on top of the tissue point (P50 ≈ 36–41): the halo steps back so the point reads. */
.handle.is-crowded .handle-halo { animation: none; opacity: .2; transform: none; }
.is-static .handle { cursor: default; }
.is-static .handle-hit { display: none; }
.is-static .handle-halo { display: none; animation: none; }
.is-static .handle-inner { transform: none !important; }
#chart.is-dragging .curve-cur { stroke-width: 4.5; }
#chart.is-dragging .handle-ring { stroke-dasharray: 3 3; }

.probe {
  position: absolute; left: 0; top: 0; margin: 0; z-index: 3;
  font: 500 12px/1 var(--mono); white-space: pre; color: var(--ink);
  background: rgba(10, 10, 11, .88); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 8px 10px; pointer-events: none;
}
/* Shown only while a drag is pegged at the sliders' ends, so it takes the grab colour. */
.limit-tip { padding: 6px 9px; font-size: 11.5px; color: var(--grab); border-color: rgba(255, 178, 54, .55); }

.drag-hint {
  position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none;
  opacity: 0; animation: hintIn .6s var(--ease-out) 1.1s forwards;
  transition: opacity .45s var(--ease-out);
}
.drag-hint > * { position: relative; }
.drag-hint-icon, .drag-hint-text { display: block; transform: translate(-50%, 22px); text-align: center; }
.drag-hint-icon { display: flex; align-items: center; gap: 6px; width: max-content; font: 600 18px/1 var(--sans); color: var(--ink); }
.drag-hint-icon .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 12px rgba(239, 232, 223, .8); animation: hintDot 1.6s var(--ease-move) infinite; }
.drag-hint-icon .chev.l { animation: chevL 1.6s var(--ease-move) infinite; }
.drag-hint-icon .chev.r { animation: chevR 1.6s var(--ease-move) infinite; }
.drag-hint-text { margin-top: 6px; width: max-content; font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); background: rgba(10, 10, 11, .8); padding: 5px 8px; border-radius: 4px; }
/* Above the handle while the shift arrow + label occupy the space below it (icon 18 + gap 6 + text 21 + 22 clear). */
.drag-hint.is-above .drag-hint-icon, .drag-hint.is-above .drag-hint-text { transform: translate(-50%, -67px); }
.drag-hint.is-gone { opacity: 0 !important; animation: none; }
@keyframes hintIn { to { opacity: 1; } }
@keyframes hintDot { 0%, 100% { transform: translateX(-6px); } 50% { transform: translateX(6px); } }
@keyframes chevL { 0%, 100% { transform: translateX(0); opacity: 1; } 50% { transform: translateX(-4px); opacity: .4; } }
@keyframes chevR { 0%, 100% { transform: translateX(0); opacity: .4; } 50% { transform: translateX(4px); opacity: 1; } }

/* ---------- Rail: title + controls ---------- */
.hero-rail { display: flex; flex-direction: column; gap: clamp(14px, 2.2vh, 26px); padding-top: clamp(4px, 1.6vh, 20px); min-width: 0; }
.headline {
  margin: 0;
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 340;
  font-size: clamp(3.3rem, 5.2vw, 6.2rem);
  line-height: .9;
  letter-spacing: -.03em;
  font-variation-settings: 'SOFT' 50, 'WONK' 0;
}
.headline .line { display: block; overflow: hidden; padding-bottom: .06em; }
.headline .line > span { display: inline-block; }
.headline em { font-style: italic; font-weight: 300; color: var(--ink); background: linear-gradient(90deg, var(--oxy), var(--deoxy)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; padding-right: .06em; }
.tagline { margin: 14px 0 0; color: var(--ink-2); font-size: 1rem; line-height: 1.5; max-width: 34ch; }

.controls { display: flex; flex-direction: column; gap: clamp(10px, 1.6vh, 18px); }
.ctrl-row { display: flex; align-items: center; gap: 10px; }
.ctrl-row label { font: 600 .9rem/1.2 var(--sans); letter-spacing: .01em; }
.ctrl-row .unit { font-weight: 400; color: var(--ink-3); font-size: .8rem; margin-left: 2px; }
.ctrl-row output { margin-left: auto; font: 500 1.25rem/1 var(--mono); font-variant-numeric: tabular-nums; }
.info {
  width: 20px; height: 20px; flex: none; padding: 0; border-radius: 50%;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-2);
  font: italic 600 11px/1 var(--serif); cursor: pointer;
  transition: transform .2s var(--spring), border-color .18s, color .18s, background .18s;
}
.info:hover { color: var(--ink); border-color: var(--ink-3); transform: translateY(-1px); }
.info:active { transform: scale(.92); }
.info[aria-expanded="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.cap { margin: 8px 0 0; font-size: .84rem; line-height: 1.55; color: var(--ink-2); }
.cap.cap-in { animation: capIn .35s var(--ease-out); }
@keyframes capIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Custom slider */
.slider { position: relative; height: 40px; margin-top: 14px; } /* room for the value bubble above the thumb, see .s-bubble */
.slider input[type=range] {
  position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: pointer; -webkit-appearance: none; appearance: none; background: transparent;
  touch-action: pan-y;
}
.slider input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 22px; height: 40px; cursor: grab; }
.slider input[type=range]::-moz-range-thumb { width: 22px; height: 40px; border: 0; cursor: grab; }
.slider input[type=range]:active::-webkit-slider-thumb { cursor: grabbing; }
.slider-vis { position: absolute; inset: 0; pointer-events: none; }
.s-track { position: absolute; left: 0; right: 0; top: 50%; height: 8px; margin-top: -4px; border-radius: 8px; background: rgba(239, 232, 223, .07); box-shadow: inset 0 0 0 1px var(--line); }
.s-fill { position: absolute; top: 50%; height: 8px; margin-top: -4px; border-radius: 8px; background: transparent; transition: background .25s var(--ease-out); }
.slider[data-dir="right"] .s-fill { background: linear-gradient(90deg, rgba(150, 122, 255, .55), var(--deoxy)); box-shadow: 0 0 14px rgba(150, 122, 255, .35); }
.slider[data-dir="left"] .s-fill { background: linear-gradient(90deg, var(--oxy), rgba(255, 77, 94, .55)); box-shadow: 0 0 14px rgba(255, 77, 94, .35); }
.slider.is-grabbed .s-fill { background: var(--grab); box-shadow: 0 0 16px rgba(255, 178, 54, .45); }
.s-ref { position: absolute; top: 50%; width: 2px; height: 18px; margin: -9px 0 0 -1px; background: var(--ink-3); border-radius: 1px; }
.s-thumb { position: absolute; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; transition: transform .5s var(--spring); }
.s-thumb-core { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 4px rgba(10, 10, 11, .95), 0 2px 10px rgba(0, 0, 0, .6); transition: background .2s var(--ease-out), box-shadow .2s var(--ease-out); }
.slider:hover .s-thumb { transform: scale(1.1); }
.slider.is-grabbed .s-thumb { transform: scale(1.38); transition: transform .18s var(--ease-out); }
.slider.is-grabbed .s-thumb-core { background: var(--grab); box-shadow: 0 0 0 4px rgba(10, 10, 11, .95), 0 0 22px rgba(255, 178, 54, .75); }
.slider input:focus-visible + .slider-vis .s-thumb-core { box-shadow: 0 0 0 4px rgba(10, 10, 11, .95), 0 0 0 6px var(--ink); }
.slider.snapped .s-thumb-core { animation: snapBounce .42s var(--spring); }
@keyframes snapBounce { 0% { transform: scale(1); } 35% { transform: scale(.78); } 100% { transform: scale(1); } }
/* Bubble sits just above the (grown) thumb: ~17 px tall, its top ~13 px above the slider box,
   so a 14 px slider margin on desktop keeps it off the label row. */
.s-bubble {
  position: absolute; bottom: calc(50% + 16px); left: 0;
  transform: translate(-50%, 6px) scale(.85); opacity: 0;
  font: 600 11px/1 var(--mono); color: var(--bg); background: var(--ink);
  padding: 3px 7px; border-radius: 5px; white-space: nowrap;
  transition: opacity .16s var(--ease-out), transform .35s var(--spring), background .2s;
}
.s-bubble::after { content: ''; position: absolute; left: 50%; bottom: -3px; margin-left: -3px; border: 3px solid transparent; border-bottom: 0; border-top-color: var(--ink); }
.slider:hover .s-bubble, .slider.is-grabbed .s-bubble, .slider input:focus-visible + .slider-vis .s-bubble { opacity: 1; transform: translate(-50%, 0) scale(1); }
.slider.is-grabbed .s-bubble { background: var(--grab); }
.slider.is-grabbed .s-bubble::after { border-top-color: var(--grab); }
/* Preset flash: same rise as the grab bubble, desktop hover-capable pointers only. */
@media (min-width: 900px) and (hover: hover) {
  .slider.show-bubble .s-bubble { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* Switch */
.switch { position: relative; display: flex; align-items: center; gap: 10px; cursor: pointer; font: 500 .84rem/1.3 var(--sans) !important; flex: 1; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; flex: none; width: 38px; height: 22px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(239, 232, 223, .04); transition: background .25s var(--ease-out), border-color .25s; }
.switch-knob { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink-3); transition: transform .45s var(--spring), background .2s; }
.switch input:checked + .switch-track { background: rgba(239, 232, 223, .14); border-color: var(--ink-3); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(16px); background: var(--ink); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--ink); outline-offset: 3px; }
.switch:active .switch-knob { width: 18px; }

/* Presets */
.presets-h { display: block; font: 500 .72rem/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.presets-h .tag { margin-left: 6px; text-transform: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: 500 .8rem/1 var(--sans); color: var(--ink);
  background: rgba(239, 232, 223, .02); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 8px 12px; cursor: pointer;
  transition: transform .22s var(--spring), border-color .18s var(--ease-out), background .18s var(--ease-out), color .18s, box-shadow .25s var(--ease-out);
}
.chip:hover { transform: translateY(-2px); border-color: var(--ink-3); box-shadow: 0 6px 18px rgba(0, 0, 0, .45); }
.chip:active { transform: scale(.96); transition-duration: .08s; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.ghost { border-style: dashed; color: var(--ink-2); }
.preset-note { margin: 10px 0 0; min-height: 2.6em; font-size: .8rem; line-height: 1.5; color: var(--ink-2); }
.hint { margin: 0; font-size: .74rem; color: var(--ink-3); }

/* ---------- Readouts: instrument ---------- */
.readouts { padding: clamp(24px, 5vh, 56px) var(--pad) clamp(40px, 8vh, 96px); }
.legend-strip { list-style: none; margin: 0 0 clamp(24px, 4vh, 40px); padding: 14px 0; display: flex; flex-wrap: wrap; gap: 10px 26px; font-size: .78rem; color: var(--ink-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.legend-strip li { white-space: nowrap; }
.legend-strip .tag { margin-right: 6px; }

.instrument {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(28px, 3vw, 40px);
  align-items: stretch;
}
.instrument > * { min-width: 0; }
@media (min-width: 900px) {
  .instrument { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
}
.inst-side { display: flex; flex-direction: column; gap: clamp(14px, 2vh, 22px); min-width: 0; }

.instrument .k {
  display: block;
  font: 500 .72rem/1.35 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* Focal unloading gauge */
.gauge-panel {
  container: readout / inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(16px, 2vw, 36px);
  background:
    radial-gradient(420px 340px at 26% 58%, rgba(150, 122, 255, .15), transparent 68%),
    radial-gradient(360px 280px at 18% 42%, rgba(255, 77, 94, .08), transparent 64%),
    linear-gradient(180deg, rgba(239, 232, 223, .045), rgba(239, 232, 223, .012));
}
.g-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(16px, 2vw, 28px);
  align-items: center;
  align-content: center;
  flex: 1;
  margin-top: clamp(16px, 2.2vh, 26px);
  min-width: 0;
}
@container readout (min-width: 400px) {
  .g-body {
    grid-template-columns: minmax(0, 1fr) minmax(8.8rem, 36%);
    gap: 12px;
  }
}

.gauge {
  --l: .972;
  --t: .747;
  --l0: .972;
  --t0: .747;
  display: grid;
  grid-template-columns: 3.3em 56px minmax(0, 1fr);
  column-gap: 6px;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  height: 220px;
}
@media (min-width: 641px) {
  .gauge { height: clamp(260px, 36vh, 320px); }
}
@media (min-width: 900px) {
  .gauge { height: clamp(300px, 34vh, 360px); }
  .gauge-panel .g-body .g-read { align-self: center; }
}
.g-scale { position: relative; height: 100%; min-width: 0; }
.g-scale span {
  position: absolute;
  right: 0;
  bottom: calc(var(--s) * 100%);
  transform: translateY(50%);
  font: 500 .66rem/1 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
.g-col {
  position: relative;
  height: 100%;
  border-radius: 999px;
  background: rgba(239, 232, 223, .045);
  box-shadow: inset 0 0 0 1px var(--line);
}
.g-band,
.g-band-glow,
.g-ghost {
  position: absolute;
  left: 8px;
  right: 8px;
  border-radius: 999px;
  pointer-events: none;
}
.g-band,
.g-band-glow {
  bottom: calc(var(--t) * 100%);
  height: calc((var(--l) - var(--t)) * 100%);
  background: linear-gradient(to top, var(--deoxy), var(--oxy));
}
.g-band { z-index: 1; }
.g-band-glow {
  z-index: 0;
  filter: blur(14px);
  opacity: .4;
  animation: gaugeBreath 4.6s ease-in-out infinite;
}
@keyframes gaugeBreath {
  0%, 100% { opacity: .28; }
  50% { opacity: .62; }
}
.g-ghost {
  z-index: 2;
  bottom: calc(var(--t0) * 100%);
  height: calc((var(--l0) - var(--t0)) * 100%);
}
.g-ghost::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px dashed var(--ink-3);
  border-radius: inherit;
  opacity: .5;
}
.g-ghost-label {
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  font: 500 .6rem/1 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  white-space: nowrap;
}
.g-mark {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 3;
  height: 0;
  pointer-events: none;
}
.g-mark.lung { bottom: calc(var(--l) * 100%); }
.g-mark.tissue { bottom: calc(var(--t) * 100%); }
.g-line {
  position: absolute;
  left: -10px;
  right: -14px;
  top: 0;
  height: 2px;
  transform: translateY(-50%);
  border-radius: 2px;
}
.g-mark.lung .g-line { background: var(--oxy); box-shadow: 0 0 10px rgba(255, 77, 94, .75); }
.g-mark.tissue .g-line { background: var(--deoxy); box-shadow: 0 0 10px rgba(150, 122, 255, .75); }
.g-tag {
  position: absolute;
  left: calc(100% + 14px);
  font: 500 .72rem/1.35 var(--sans);
  color: var(--ink-2);
  white-space: nowrap;
}
.g-mark.lung .g-tag { bottom: 7px; }
.g-mark.tissue .g-tag { top: 7px; }
.g-mark.lung .g-tag b { color: var(--oxy); font-weight: 600; }
.g-mark.tissue .g-tag b { color: var(--deoxy); font-weight: 600; }

.g-read { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.g-read .big {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(3.4rem, 6vw, 5.6rem);
  line-height: .88;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.045em;
  color: var(--ink);
  text-shadow: 0 0 28px rgba(239, 232, 223, .28);
}
.g-read .unit { display: block; margin-top: 6px; font-size: .8rem; color: var(--ink-3); }
.g-vs {
  display: block;
  margin-top: 10px;
  font: 500 .82rem/1.35 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  transition: color .35s var(--ease-out);
}
.gauge-panel[data-dir="release"] .g-vs { color: var(--deoxy); }
.gauge-panel[data-dir="hold"] .g-vs { color: var(--oxy); }
.g-read small {
  display: block;
  margin-top: 12px;
  max-width: 30ch;
  font-size: .84rem;
  line-height: 1.5;
  color: var(--ink-2);
}

/* G-2 multiplier bars, centred on ×1.00 */
.mult-panel,
.table-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(16px, 2vw, 22px);
  background: linear-gradient(180deg, rgba(239, 232, 223, .03), rgba(239, 232, 223, .008));
}
.parts { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 14px; }
.parts li.mb { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 0; }
.mb-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  min-width: 0;
  font-size: .88rem;
}
.mb-text .pk { font-weight: 600; }
.mb-text .num { font-size: 1.02rem; }
.mb-text .pw { color: var(--ink-3); font-size: .78rem; }
.mb-track {
  position: relative;
  display: block;
  height: 10px;
  border-radius: 999px;
  background: rgba(239, 232, 223, .06);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.mb-track::before {
  content: "";
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  margin-left: -.5px;
  background: var(--ink-3);
}
.mb-bar {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 0;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  border-radius: 0 999px 999px 0;
  background: transparent;
  transition: transform .35s var(--ease-out);
}
li.mb[data-dir="up"] .mb-bar { background: var(--deoxy); }
li.mb[data-dir="down"] .mb-bar { background: var(--oxy); }
li.mb[data-dir="none"] .mb-bar { background: transparent; }
li.mb.thermal {
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-2);
}
li.mb.thermal[data-dir="up"] .mb-bar,
li.mb.thermal[data-dir="down"] .mb-bar {
  background-image: repeating-linear-gradient(-45deg, transparent 0 3px, rgba(10, 10, 11, .45) 3px 5.5px);
}
li.mb.thermal[data-dir="up"] .mb-bar { background-color: var(--deoxy); }
li.mb.thermal[data-dir="down"] .mb-bar { background-color: var(--oxy); }
li.mb.thermal[data-dir="none"] .mb-bar { background-color: transparent; background-image: none; }
.mb-axis {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  margin-top: 8px;
  font: 500 .64rem/1.3 var(--mono);
  color: var(--ink-3);
}
.mb-axis span:nth-child(2) { text-align: center; }
.mb-axis span:last-child { text-align: right; }

/* Δ table */
.readout { width: 100%; border-collapse: collapse; font-size: .9rem; }
.readout caption { text-align: left; font: 500 .72rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding-bottom: 12px; }
.readout caption .tag { text-transform: none; letter-spacing: .13em; }
.readout th,
.readout td,
.dchip { white-space: nowrap; font-variant-numeric: tabular-nums; }
.readout th, .readout td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
.readout thead th { font: 500 .7rem/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.readout tbody th { text-align: left; font-weight: 500; color: var(--ink-2); }
.readout th:first-child { text-align: left; padding-left: 0; }
.readout td { font-size: 1rem; color: var(--ink-3); }
.readout td.cur { color: var(--ink); font-size: 1.25rem; font-weight: 600; line-height: 1.1; }
.dchip {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: .01em;
}
.dchip[data-tone="release"] {
  color: var(--deoxy);
  border-color: color-mix(in srgb, var(--deoxy) 55%, transparent);
  background: color-mix(in srgb, var(--deoxy) 16%, transparent);
}
.dchip[data-tone="hold"] {
  color: var(--oxy);
  border-color: color-mix(in srgb, var(--oxy) 55%, transparent);
  background: color-mix(in srgb, var(--oxy) 16%, transparent);
}

/* HCO₃⁻ disclosure — quiet, secondary */
.hco3-more { min-width: 0; border-top: 1px solid var(--line); }
.hco3-more summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  padding: 10px 2px;
  list-style: none;
  cursor: pointer;
}
.hco3-more summary::-webkit-details-marker { display: none; }
.hco3-more summary::marker { content: ""; }
.hco3-more summary .k { display: inline; }
.hco3-more summary .num { font-size: 1.15rem; font-weight: 500; color: var(--ink); }
.hco3-more summary .unit { font-size: .78rem; color: var(--ink-3); }
.hco3-more summary output { font: inherit; color: inherit; }
.hco3-more .hm-hint {
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 1.5px solid var(--ink-3);
  border-bottom: 1.5px solid var(--ink-3);
  transform: rotate(45deg) translateY(-1px);
  transition: transform .35s var(--ease-out);
  flex: none;
  align-self: center;
}
.hco3-more[open] .hm-hint { transform: rotate(225deg) translateY(-1px); }
.hco3-more .cap { margin: 2px 0 8px; max-width: 62ch; font-size: .82rem; }

/* ---------- Sections ---------- */
.sec-head { margin-bottom: clamp(18px, 3vh, 32px); }
.sec-title { margin: 6px 0 0; font: 360 clamp(2.2rem, 4.6vw, 4.2rem)/1 var(--serif); letter-spacing: -.025em; }
.sec-title .tag { font-family: var(--sans); vertical-align: .9em; }

/* ---------- Scene ---------- */
.scene-sec { padding: clamp(40px, 8vh, 96px) var(--pad); }
.scene-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: clamp(20px, 3vw, 44px); align-items: start; }
.scene { position: relative; aspect-ratio: 360 / 260; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: radial-gradient(120% 100% at 50% 0%, #141216, #0b0b0c 70%); }
.scene canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene-labels { position: absolute; inset: 0; opacity: 0; transition: opacity .8s var(--ease-out); pointer-events: none; }
.scene-labels.is-on { opacity: 1; }
.sl { position: absolute; left: 14px; font: 500 12px/1.3 var(--mono); letter-spacing: .03em; color: var(--ink); background: rgba(10, 10, 11, .62); padding: 4px 9px; border-radius: 5px; border: 1px solid var(--line); }
.sl.top { top: 12px; }
.sl.bottom { bottom: 10px; color: var(--ink-2); }
.scene-labels.lung .sl.top { border-color: rgba(255, 77, 94, .45); }
.scene-labels.tissue .sl.top { border-color: rgba(150, 122, 255, .5); }
.scene-side { display: flex; flex-direction: column; gap: 22px; }
.context { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.context legend { padding: 0; margin-bottom: 10px; font: 500 .72rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border: 1px solid var(--line-2); border-radius: 999px; }
.seg button { position: relative; z-index: 1; font: 500 .84rem/1 var(--sans); color: var(--ink-2); background: transparent; border: 0; border-radius: 999px; padding: 11px 10px; cursor: pointer; transition: color .3s var(--ease-out), transform .2s var(--spring); }
.seg button:active { transform: scale(.96); }
.seg button[aria-pressed="true"] { color: var(--bg); }
.seg-ind { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: var(--oxy); transition: transform .55s var(--spring), background .4s var(--ease-out); }
.seg[data-on="tissue"] .seg-ind { transform: translateX(100%); background: var(--deoxy); }
.check { display: flex; align-items: center; gap: 10px; font-size: .84rem; color: var(--ink-2); cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-box { width: 18px; height: 18px; flex: none; border: 1px solid var(--ink-3); border-radius: 5px; position: relative; transition: background .2s, border-color .2s; }
.check-box::after { content: ''; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid var(--bg); border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); transition: transform .3s var(--spring); }
.check input:checked + .check-box { background: var(--ink); border-color: var(--ink); }
.check input:checked + .check-box::after { transform: rotate(45deg) scale(1); }
.check input:focus-visible + .check-box { outline: 2px solid var(--ink); outline-offset: 3px; }
.undo-chip { align-self: flex-start; animation: capIn .3s var(--ease-out); }
.scene-stats { display: grid; gap: 0; border-top: 1px solid var(--line); }
.scene-stats > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.scene-stats .k { font-size: .82rem; color: var(--ink-2); }
.scene-stats .v { font-size: 1rem; text-align: right; white-space: nowrap; }

/* ---------- Journey (pinned, scrubbed) ---------- */
.journey { position: relative; }
.journey-pin {
  height: 100svh; box-sizing: border-box;
  padding: calc(var(--topbar) + 18px) var(--pad) 22px;
  display: flex; flex-direction: column; gap: 14px;
  background: radial-gradient(90% 70% at 30% 40%, rgba(255, 255, 255, .02), transparent), var(--bg);
  border-top: 1px solid var(--line);
}
.journey.is-fallback { height: 400svh; }
.journey.is-fallback .journey-pin { position: sticky; top: 0; }
.journey-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.journey-track { display: flex; align-items: center; gap: 12px; font-size: .82rem; color: var(--ink-2); flex: 1; max-width: 640px; }
.jt-end { display: flex; flex-direction: column; gap: 2px; white-space: nowrap; }
.jt-end small { font-size: .7rem; color: var(--ink-3); }
.jt-bar { position: relative; flex: 1; height: 4px; min-width: 60px; border-radius: 4px; background: rgba(239, 232, 223, .08); overflow: hidden; }
.jt-fill { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--oxy), var(--deoxy)); }
.jt-switch { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--ink-3); }
.journey-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr); gap: clamp(18px, 3vw, 44px); }
.journey-chart { min-height: 0; position: relative; }
.journey-side { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.journey-cell { position: relative; aspect-ratio: 360 / 220; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: radial-gradient(120% 100% at 50% 0%, #141216, #0b0b0c 70%); flex: none; }
.journey-cell canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.jc-label { position: absolute; left: 10px; top: 8px; font: 500 11px/1.3 var(--mono); color: var(--ink); background: rgba(10, 10, 11, .62); padding: 3px 8px; border-radius: 4px; }
.journey-nums { display: grid; grid-template-columns: repeat(5, auto); justify-content: space-between; gap: 8px; margin: 0; }
.journey-nums div { display: flex; flex-direction: column; gap: 3px; }
.journey-nums dt { font: 500 .62rem/1.2 var(--mono); letter-spacing: .04em; text-transform: none; color: var(--ink-3); }
.journey-nums dd { margin: 0; font-size: 1.05rem; }
.journey-steps { list-style: none; margin: 0; padding: 0; position: relative; flex: 1; min-height: 150px; }
.journey-steps li { position: absolute; inset: 0 0 auto 0; opacity: 0; transform: translateY(18px); transition: opacity .55s var(--ease-out), transform .7s var(--ease-out); }
.journey-steps li.is-active { opacity: 1; transform: none; }
.journey-steps h3 { margin: 0 0 6px; font: 500 .72rem/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.journey-steps p { margin: 0; font: 380 clamp(1.15rem, 1.7vw, 1.55rem)/1.4 var(--serif); letter-spacing: -.005em; }
html.no-js .journey-steps li { position: static; opacity: 1; transform: none; margin-bottom: 16px; }

/* ---------- Explainer ---------- */
.explainer { padding: clamp(48px, 10vh, 120px) var(--pad) 40px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px); align-items: start; }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 2.4vw, 34px); background: linear-gradient(180deg, rgba(239, 232, 223, .028), rgba(239, 232, 223, .006)); min-width: 0; }
.card h2 { margin: 0 0 18px; font: 400 clamp(1.5rem, 2.2vw, 2rem)/1.1 var(--serif); letter-spacing: -.015em; }
.card h3 { margin: 0 0 10px; font: 600 .78rem/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.card ul { margin: 0; padding-left: 1.1em; }
.card li { margin-bottom: 10px; line-height: 1.55; }
.card li::marker { color: var(--ink-3); }
.isnot { display: grid; gap: 18px; }
h3.is { color: var(--ink); }
h3.isnt { color: var(--ink-3); }
.tvl { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tvl-col { padding: 14px 14px 4px; border-radius: 12px; border: 1px solid var(--line); }
.tvl-col.tissue { border-color: rgba(150, 122, 255, .35); background: rgba(150, 122, 255, .05); }
.tvl-col.lung { border-color: rgba(255, 77, 94, .35); background: rgba(255, 77, 94, .04); }
.tvl-col.tissue h3 { color: var(--deoxy); }
.tvl-col.lung h3 { color: var(--oxy); }
.tvl-col p { margin: 0 0 10px; font-size: .92rem; }
.note { margin: 16px 0 0; color: var(--ink-2); font-size: .92rem; }
.sources { list-style: none; padding: 0 !important; }
.sources li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.sources .tag { margin-right: 6px; }

.model-notes { grid-column: 1 / -1; padding: 0; }
.model-notes summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 20px clamp(20px, 2.4vw, 34px); }
.model-notes summary::-webkit-details-marker { display: none; }
.mn-title { font: 400 clamp(1.4rem, 2vw, 1.8rem)/1 var(--serif); }
.mn-hint { font: 500 .7rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.mn-hint::after { content: '+'; font-size: 1.2rem; color: var(--ink); transition: transform .4s var(--spring); }
.model-notes[open] .mn-hint::after { transform: rotate(45deg); }
.model-notes summary:hover .mn-hint { color: var(--ink); }
.mn-body { padding: 0 clamp(20px, 2.4vw, 34px) 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 36px; }
.mn-body p { margin: 0 0 14px; font-size: .9rem; color: var(--ink-2); line-height: 1.6; }
.mn-body .tag { margin-right: 6px; }
.model-line { grid-column: 1 / -1; font-family: var(--mono); font-size: .76rem !important; padding-top: 12px; border-top: 1px solid var(--line); }
.model-notes[open] .mn-body { animation: capIn .45s var(--ease-out); }

/* ---------- Ray Peat lens ---------- */
.peat-lens { padding: clamp(56px, 10vh, 120px) var(--pad) 40px; }
.peat-head { max-width: 920px; margin-bottom: clamp(24px, 4vh, 40px); }
.peat-sub { color: var(--ink-2); margin: 16px 0 0; font-size: 1rem; }
.peat-top { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: clamp(14px, 2vw, 24px); align-items: start; margin-bottom: clamp(14px, 2vw, 24px); }
.peat-top h3 { margin: 0 0 14px; font: 400 1.3rem/1.2 var(--serif); letter-spacing: -.01em; color: var(--ink); text-transform: none; }
.peat-try { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.peat-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 14px; }
.peat-stats div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.peat-stats dt { font: 500 .66rem/1.3 var(--mono); letter-spacing: .04em; text-transform: none; color: var(--ink-3); }
.peat-stats dd { margin: 6px 0 0; font-size: 1.1rem; }
.peat-live-text { margin: 0 0 12px; padding-left: 14px; border-left: 2px solid var(--line-2); font-size: .92rem; transition: border-color .4s; }
.peat-live-text.right { border-left-color: var(--deoxy); }
.peat-live-text.left { border-left-color: var(--oxy); }
.peat-para .para-text { font: 380 1.08rem/1.6 var(--serif); margin: 0 0 12px; }
.peat-caveats ul { padding-left: 1.1em; }
.peat-caveats li { font-size: .9rem; }
.peat-groups { column-count: 2; column-gap: clamp(14px, 2vw, 24px); }
.peat-group { break-inside: avoid; margin-bottom: clamp(14px, 2vw, 24px); display: inline-block; width: 100%; }
.peat-group h3 { margin: 0 0 6px; font: 400 1.35rem/1.2 var(--serif); letter-spacing: -.01em; color: var(--ink); text-transform: none; }
.pq { margin: 0; padding: 18px 0 16px 18px; border-top: 1px solid var(--line); position: relative; transition: background .5s var(--ease-out); }
.pq::before { content: ''; position: absolute; left: 0; top: 18px; bottom: 16px; width: 2px; background: var(--line-2); transition: background .5s var(--ease-out), box-shadow .5s; }
.pq blockquote { margin: 0 0 10px; font: italic 360 1.08rem/1.55 var(--serif); color: var(--ink); }
.pq figcaption { font-size: .78rem; color: var(--ink-2); line-height: 1.6; }
.pq figcaption .tag { margin-right: 4px; }
.pq .maps { margin: 10px 0 0; font-size: .86rem; color: var(--ink-2); }
.pq .maps .tag { margin-right: 4px; }
.pq-lead { margin: 0 0 6px; font-size: .82rem; color: var(--ink-3); }
.pq.is-live { background: linear-gradient(90deg, rgba(150, 122, 255, .09), transparent 70%); }
.pq.is-live::before { background: var(--deoxy); box-shadow: 0 0 12px rgba(150, 122, 255, .6); }
.pq.is-live.left { background: linear-gradient(90deg, rgba(255, 77, 94, .08), transparent 70%); }
.pq.is-live.left::before { background: var(--oxy); box-shadow: 0 0 12px rgba(255, 77, 94, .6); }

/* ---------- Footer ---------- */
.site-footer { padding: 40px var(--pad) 64px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: .86rem; max-width: 1100px; }
.site-footer p { margin: 0 0 10px; }
.site-footer .small { font-family: var(--mono); font-size: .74rem; }

/* ---------- Reveal on enter (fade + rise) ---------- */
html.js .reveal { opacity: 0; transform: translate3d(0, 28px, 0); transition: opacity .8s var(--ease-out), transform .9s var(--ease-out); transition-delay: calc(var(--d, 0) * 70ms); }
html.js .reveal.is-in { opacity: 1; transform: none; }
html.js .reveal:focus-within { opacity: 1; transform: none; transition: none; }

/* ---------- Load sequence (< 1 s) ---------- */
/* Hidden start state applies only until .is-loaded lands, so it never outranks the end state. */
html.js:not(.is-loaded):not(.no-intro):not(.force-still) .headline .line > span { transform: translateY(108%); animation: failsafeHead 0s linear 1.2s forwards; }
html.js:not(.is-loaded):not(.no-intro):not(.force-still) .tagline,
html.js:not(.is-loaded):not(.no-intro):not(.force-still) .stagger,
html.js:not(.is-loaded):not(.no-intro):not(.force-still) .chart-head,
html.js:not(.is-loaded):not(.no-intro):not(.force-still) .legend { opacity: 0; transform: translateY(14px); animation: failsafeShow 0s linear 1.2s forwards; }
html.js:not(.is-loaded):not(.no-intro):not(.force-still) .c-static { opacity: 0; animation: failsafeShow 0s linear 1.2s forwards; }
/* .is-loaded lands after the web fonts settle (main.js, capped at 700 ms), so the main-thread
   stroke-dashoffset draw isn't eaten by the font-swap relayout. Timings are tight (~0.85 s)
   so the whole intro still ends about 1 s after first paint on a fast machine. */
html.js.is-loaded .headline .line > span { transform: none; transition: transform .66s var(--ease-out); }
html.js.is-loaded .headline .line:nth-child(2) > span { transition-delay: .07s; }
html.js.is-loaded .tagline,
html.js.is-loaded .chart-head,
html.js.is-loaded .legend,
html.js.is-loaded .stagger { opacity: 1; transform: none; transition: opacity .4s var(--ease-out), transform .4s var(--ease-out); }
html.js.is-loaded .tagline { transition-delay: .18s; }
html.js.is-loaded .chart-head { transition-delay: .08s; }
html.js.is-loaded .legend { transition-delay: .42s; }
html.js.is-loaded .c-static { opacity: 1; transition: opacity .45s var(--ease-out); }
html.js.is-loaded .controls > .stagger:nth-child(1) { transition-delay: .2s; }
html.js.is-loaded .controls > .stagger:nth-child(2) { transition-delay: .24s; }
html.js.is-loaded .controls > .stagger:nth-child(3) { transition-delay: .28s; }
html.js.is-loaded .controls > .stagger:nth-child(4) { transition-delay: .32s; }
html.js.is-loaded .controls > .stagger:nth-child(5) { transition-delay: .36s; }
html.js.is-loaded .controls > .stagger:nth-child(6) { transition-delay: .4s; }
html.js.is-loaded .controls > .stagger:nth-child(7) { transition-delay: .44s; }
html.js:not(.is-loaded):not(.no-intro):not(.force-still) #chart .curve-cur { stroke-dasharray: 1; stroke-dashoffset: 1; animation: failsafeDraw 0s linear 1.2s forwards; }
html.js:not(.is-loaded):not(.no-intro):not(.force-still) #chart .curve-glow { opacity: 0; animation: failsafeGlow 0s linear 1.2s forwards; }
html.js:not(.is-loaded):not(.no-intro):not(.force-still) #chart .handle { opacity: 0; animation: failsafeShow 0s linear 1.2s forwards; }
html.js.is-loaded:not(.no-intro):not(.force-still) #chart .curve-cur { stroke-dasharray: 1; animation: drawIn .68s var(--ease-move) .06s both; }
html.js.is-loaded:not(.no-intro):not(.force-still) #chart .handle { transition: opacity .3s var(--ease-out) .5s; }
html.js.is-loaded:not(.no-intro):not(.force-still) #chart .curve-glow { animation: glowIn .35s var(--ease-out) .45s both, glowPulse 3.8s ease-in-out .8s infinite; }
@keyframes drawIn { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes glowIn { from { opacity: 0; } to { opacity: .32; } }
@keyframes failsafeShow { to { opacity: 1; transform: none; } }
@keyframes failsafeHead { to { transform: none; } }
@keyframes failsafeDraw { to { stroke-dashoffset: 0; } }
@keyframes failsafeGlow { to { opacity: .32; } }

/* ---------- Still mode: keep the information, drop the movement ---------- */
html.is-still *, html.is-still *::before, html.is-still *::after { animation: none !important; transition: none !important; }
html.is-still .reveal { opacity: 1; transform: none; }
html.is-still .motes { display: none; }
html.is-still .drag-hint { opacity: 1; }
html.is-still .drag-hint.is-gone { opacity: 0; }
html.is-still #chart .curve-cur { stroke-dasharray: none !important; stroke-dashoffset: 0 !important; }
html.is-still #chart .curve-glow { opacity: .3 !important; }
html.is-still #chart .handle { opacity: 1 !important; }
html.is-still .headline .line > span, html.is-still .stagger, html.is-still .tagline,
html.is-still .chart-head, html.is-still .legend, html.is-still .c-static { opacity: 1 !important; transform: none !important; }
html.is-still .g-band-glow { animation: none; }
html.is-still .mb-bar { transition: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .explainer { grid-template-columns: 1fr 1fr; }
  .explainer > .card:nth-child(3) { grid-column: 1 / -1; }
  .peat-top { grid-template-columns: 1fr 1fr; }
  .peat-live { grid-column: 1 / -1; }
  .readout tbody th { white-space: normal; line-height: 1.25; }
  .readout th, .readout td { padding: 7px 4px; }
  .readout thead th { font-size: .62rem; letter-spacing: .04em; }
  .readout td.cur { font-size: 1.08rem; }
  .dchip { font-size: .66rem; padding: 2px 6px; }
}
@media (max-width: 900px) {
  :root { --topbar: 48px; }
  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 6px; gap: 18px; }
  .hero-chart { height: auto; min-height: 0; align-self: start; }
  .chart-wrap { flex: none; aspect-ratio: 4 / 3; max-height: 42svh; width: 100%; }
  .hero-rail { padding-top: 0; }
  .headline { font-size: clamp(3.1rem, 14vw, 4.4rem); }
  /* The title would sit between the pinned chart and the sliders: hide it visually (the h1
     stays for screen readers) so the curve and all three sliders share the screen. The load
     intro still runs on the headline/tagline inside, but the clip keeps it invisible. */
  .title-block {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  .scene-grid { grid-template-columns: 1fr; }
  .scene { aspect-ratio: 360 / 420; }
  .sl { font-size: 13px; }
  .journey-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; gap: 10px; }
  .journey-chart { min-height: 0; }
  .journey-cell { aspect-ratio: 360 / 180; }
  .journey-side { gap: 8px; }
  .journey-steps { min-height: 128px; flex: none; }
  .journey-steps p { font-size: 1.04rem; }
  .journey-head { gap: 8px; }
  .journey-head .sec-title { font-size: 1.9rem; }
  .journey-track { max-width: none; width: 100%; font-size: .74rem; }
  .jt-end small { display: none; }
  .journey-nums dd { font-size: .92rem; }
  .journey-nums dt { font-size: .7rem; }
  .peat-groups { column-count: 1; }
  .mn-body { grid-template-columns: 1fr; }

  /* Header through 900px: brand, section menu, all four links in the dropdown. */
  .brand { display: block; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .topbar-side { flex: none; gap: 8px; }
  .topbar-side .badge-edu { display: none; }
  .badge-under {
    display: block;
    max-width: none;
    margin: 8px 0 0;
    text-align: left;
    font-size: .7rem;
    line-height: 1.35;
    white-space: nowrap;
  }
  #menu-btn { display: grid; }
  .ico-menu i { height: 2px; }
  .menu-btn[aria-expanded="true"] .ico-menu i:nth-child(1) { transform: translateY(5px) rotate(45deg); }
  .menu-btn[aria-expanded="true"] .ico-menu i:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }
  #topnav {
    position: absolute;
    top: calc(100% - 1px);
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 4px var(--pad) 10px;
    background: rgba(10, 10, 11, .96);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity .2s var(--ease-out), transform .28s var(--ease-out), visibility .2s;
  }
  #topnav.is-open {
    z-index: 80;
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .6);
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
  }
  #topnav a,
  #topnav a:not(.jump-peat) {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    color: var(--ink-2);
    white-space: normal;
  }
  #topnav a:last-child { border-bottom: 0; }
  #topnav a:hover { color: var(--ink); }
  .motion-btn {
    position: relative;
    width: 36px;
    height: 36px;
    padding: 0;
    gap: 0;
    border-radius: 50%;
    justify-content: center;
  }
  .motion-btn .mo-label {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
}
/* Phone and tablet, when there's height for it: the curve stays pinned under the topbar while
   the controls scroll beneath it, so the chart and the slider being moved are on screen together. */
@media (max-width: 900px) and (min-height: 560px) {
  .hero-chart {
    position: sticky;
    top: var(--topbar);
    z-index: 5;
    background: var(--bg);
    overflow: hidden;
    box-shadow: 0 1px 0 rgba(239, 232, 223, .16), 0 16px 22px -14px rgba(0, 0, 0, .85);
  }
  /* Keyboard focus lands below the pinned chart, not behind it (--chart-h is set in main.js). */
  .hero-rail :is(input, button, a, summary, [tabindex]) {
    scroll-margin-top: calc(var(--topbar) + var(--chart-h, 0px) + 8px);
  }
}
/* Phone held sideways: chart and rail side by side, the chart pinned at full height and the
   rail scrolling beside it, so every slider sits next to the curve. */
@media (max-height: 500px) and (orientation: landscape) {
  .hero { grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; min-height: 0; padding-top: 6px; }
  .hero-chart {
    position: sticky;
    top: var(--topbar);
    align-self: start;
    height: calc(100svh - var(--topbar) - 12px);
    min-height: 0;
  }
  .chart-head { padding: 2px 0 0; }
  .shift { padding: 5px 12px; }
  .chart-wrap { flex: 1 1 auto; min-height: 0; aspect-ratio: auto; max-height: none; }
  .legend { flex-wrap: nowrap; gap: 2px 10px; font-size: 11px; line-height: 1.2; padding-top: 2px; }
  .badge-under { margin-top: 2px; line-height: 1.25; }
  .hero-rail { padding-top: 0; }
  .controls { gap: 6px; }
  /* The title stays visually hidden (h1 kept for screen readers) so pH is on the first screen. */
  .title-block {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
}
@media (max-width: 640px) {
  .explainer { grid-template-columns: 1fr; }
  .peat-top { grid-template-columns: 1fr; }
  .tvl { grid-template-columns: 1fr; }
  .peat-stats { gap: 6px; }
  .peat-stats dd { font-size: .95rem; }
  .readout { font-size: .78rem; }
  .readout th, .readout td { padding: 6px 3px; }
  .readout thead th { font-size: .7rem; letter-spacing: .03em; }
  .readout tbody th { font-size: .74rem; white-space: normal; line-height: 1.25; }
  .readout td.cur { font-size: 1.02rem; }
  .dchip { font-size: .72rem; padding: 2px 5px; }
  .tag { font-size: .7rem; }
  .g-ghost-label { font-size: .7rem; }
  .mb-axis { font-size: .7rem; }
  code { font-size: max(.72rem, .78em); }
  .legend-strip { gap: 8px 16px; }
  .legend-strip li { white-space: normal; }
  .g-tag, .g-scale span { font-size: .7rem; }
  .journey-pin { padding-top: calc(var(--topbar) + 10px); padding-bottom: 12px; }
  .journey-track { flex-wrap: wrap; row-gap: 4px; }
  .journey-nums dt { font-size: .72rem; }

  /* Phone: curve + three sliders on the first screen (sticky chart and hidden title from the
     ≤900 block). */
  .hero { padding-top: 4px; gap: 10px; }
  .chart-head { min-height: 52px; align-items: flex-start; padding-top: 2px; padding-bottom: 0; }
  .legend {
    flex-wrap: nowrap;
    gap: 2px 8px;
    font-size: 11px;
    line-height: 1.2;
    padding-top: 2px;
  }
  .legend .sw { width: 14px; margin-right: 4px; }
  .badge-under { margin-top: 2px; font-size: .7rem; line-height: 1.25; }
  .controls { gap: 6px; }
}
@media (max-width: 420px) {
  .peat-stats { grid-template-columns: 1fr 1fr; }
  .peat-stats div:nth-child(3) { grid-column: 1 / -1; }
}
@media (min-width: 901px) and (max-height: 860px) {
  .hero { padding-top: 6px; padding-bottom: 8px; }
  .hero-rail { gap: 8px; padding-top: 0; }
  .headline { font-size: clamp(2.55rem, 3.5vw, 3.2rem); }
  .tagline { margin-top: 6px; font-size: .92rem; line-height: 1.35; }
  .controls { gap: 6px; }
  .presets-h { margin-bottom: 6px; }
  .chips { gap: 6px; }
  .chip { padding: 5px 10px; font-size: .75rem; }
  .preset-note { margin-top: 6px; line-height: 1.4; }
}
@media (pointer: coarse) {
  .info { position: relative; }
  .info::before { content: ''; position: absolute; inset: -12px; }
  .chip { min-height: 44px; padding: 12px 14px; }
  .icon-btn, .motion-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
  .motion-btn { gap: 0; justify-content: center; }
  .switch, .check { min-height: 44px; }
  .seg button { padding: 15px 10px; }
  .slider { height: 44px; }
  /* Visually hidden, still read: the motion label, and the keyboard hint (it is the sliders'
     aria-describedby). */
  .motion-btn .mo-label,
  .hint {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .g-band-glow { animation: none; }
  .mb-bar { transition: none; }
}
