/* ============================================================
   mikaelbuilds.com V4 — «LIFE SUPPORT» design system · cinematic build
   Two worlds: the ward (dark, monitor light) and the chart (paper).
   DOM is truth. Canvas is atmosphere. Body text never moves.
   ============================================================ */

:root {
  /* the ward */
  --ward-0: oklch(14% 0.012 40);
  --ward-1: oklch(18% 0.014 40);
  --ward-line: oklch(30% 0.015 40);
  --bone: oklch(93% 0.008 85);
  --bone-dim: oklch(70% 0.01 85);
  /* monitor color grammar */
  --ecg: oklch(80% 0.155 150);
  --ecg-dim: oklch(55% 0.09 150);
  --spo2: oklch(80% 0.09 215);
  --resp: oklch(83% 0.115 85);
  --alarm: oklch(60% 0.21 27);
  /* the chart */
  --paper: oklch(95% 0.015 90);
  --paper-2: oklch(91% 0.02 88);
  --paper-line: oklch(82% 0.02 88);
  --ink: oklch(24% 0.02 50);
  --ink-dim: oklch(45% 0.015 50);
  --stamp: oklch(52% 0.19 27);
  /* ledger/legacy row compat (loop-appended rows reference these) */
  --vital: oklch(45% 0.12 150);
  --mono: "Martian Mono", ui-monospace, monospace;
  --sans: "Bricolage Grotesque", system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
/* native smooth scroll intentionally OFF: the rAF lerp smooths the visuals, anchors jump clean */
html { scroll-behavior: auto; }
body {
  background: var(--ward-0);
  color: var(--bone);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video, svg, canvas { max-width: 100%; display: block; }
a { color: inherit; }
::selection { background: var(--ecg); color: var(--ward-0); }

/* ---------- type scale ---------- */
h1, h2, h3 { font-weight: 800; line-height: 1.02; letter-spacing: -0.018em; text-wrap: balance; }
h2, .h2 { font-size: clamp(1.8rem, 3.6vw, 3rem); }
h3, .h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); font-weight: 600; }
p { max-width: 68ch; }
.lede { font-size: clamp(1.15rem, 1.8vw, 1.4rem); line-height: 1.55; font-weight: 400; }
.dim { color: var(--bone-dim); }
.mono, .tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
strong { font-weight: 600; }
.display { font-size: clamp(2.7rem, 7.5vw, 6.2rem); }

/* ---------- layout primitives ---------- */
.wrap { width: min(1240px, 94vw); margin-inline: auto; }
.wrap-narrow { width: min(780px, 92vw); margin-inline: auto; }
section { position: relative; }
.ward { background: var(--ward-0); color: var(--bone); padding-block: clamp(5rem, 13vh, 9.5rem); }
.chartland {
  background:
    repeating-linear-gradient(0deg, transparent 0 31px, oklch(85% 0.03 60 / 0.16) 31px 32px),
    var(--paper-2);
  color: var(--ink);
  padding-block: clamp(5rem, 13vh, 9.5rem);
}
.chartland p { color: var(--ink); }
.chartland .dim { color: var(--ink-dim); }

/* film grain over the ward */
.grain {
  position: fixed; inset: -60px; z-index: 4; pointer-events: none;
  opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

/* ---------- scroll progress: the life line ---------- */
#lifeline {
  position: fixed; left: 0; top: 0; bottom: 0; width: 3px;
  background: oklch(24% 0.014 40);
  z-index: 60;
}
#lifeline .fill {
  position: absolute; top: 0; left: 0; width: 100%; height: 0%;
  background: linear-gradient(180deg, var(--ecg) 92%, oklch(88% 0.17 150));
  box-shadow: 0 0 12px oklch(80% 0.155 150 / 0.55);
}
#lifeline .bleep {
  position: absolute; left: 50%; transform: translate(-50%, -50%);
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--ecg);
  box-shadow: 0 0 14px var(--ecg);
}

/* ---------- boot overlay ---------- */
#boot {
  position: fixed; inset: 0; z-index: 200;
  background: oklch(9% 0.01 40);
  display: grid; place-items: center;
  transition: opacity 0.5s var(--ease);
  cursor: pointer;
}
#boot .lines { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em; color: var(--ecg); min-height: 5.5em; }
#boot .lines div { animation: bootline 0.25s var(--ease) both; }
@keyframes bootline { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
#boot.flick { animation: flick 0.45s steps(2, end) both; }
@keyframes flick { 0% { opacity: 1; } 30% { opacity: 0.2; } 55% { opacity: 0.9; } 75% { opacity: 0.35; } 100% { opacity: 0; } }
#boot.done { opacity: 0; pointer-events: none; }
body.no-anim #boot, body.booted #boot { display: none; }
/* pure-CSS dead-man switch: even with every JS timer stalled, the overlay
   kills itself at 2.6s. The boot may fail; blinding the page may not. */
#boot { animation: bootkill 0.4s linear 2.6s forwards; }
@keyframes bootkill { to { opacity: 0; visibility: hidden; pointer-events: none; } }

/* ---------- top strip ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: oklch(14% 0.012 40 / 0.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid oklch(30% 0.015 40 / 0.5);
}
.topbar .in {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0.7rem 0;
}
.topbar .id { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; }
.topbar .id b { color: var(--ecg); font-weight: 600; }
.topbar nav { margin-left: auto; display: flex; gap: 1.4rem; align-items: center; }
.topbar nav a { text-decoration: none; font-size: 0.92rem; color: var(--bone-dim); }
.topbar nav a:hover { color: var(--bone); }
.topbar nav a.pill {
  color: var(--ward-0); background: var(--ecg);
  padding: 0.42rem 0.95rem; border-radius: 999px; font-weight: 600;
}
.topbar nav a.pill:hover { background: oklch(87% 0.16 150); color: var(--ward-0); }

/* ============================================================
   HERO — the room. Full-viewport canvas scene; type + the clock
   monument share the first fold. Everything fits above the fold.
   ============================================================ */
.hero {
  position: relative;
  height: calc(100svh - 52px);
  min-height: 560px;
  overflow: clip;
  background: #0f0d0b;
}
#scene { position: absolute; inset: 0; width: 100%; height: 100%; }
#hero-stage {
  position: relative; z-index: 2;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
  will-change: transform, opacity;
}
.hero-main {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: end;
  gap: clamp(1.5rem, 4vw, 4rem);
  padding-bottom: clamp(1.2rem, 3.5vh, 2.6rem);
}
.hero-copy .kicker {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--bone-dim);
  display: inline-flex; align-items: center; gap: 0.55rem;
  margin-bottom: clamp(0.8rem, 2vh, 1.4rem);
}
.hero-copy .kicker::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ecg); box-shadow: 0 0 10px var(--ecg);
  animation: blip 1.6s ease-in-out infinite;
}
@keyframes blip { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.hline {
  display: block;
  font-weight: 800;
  font-size: clamp(2.6rem, min(6.3vw, 11.5vh), 7.6rem);
  line-height: 0.99;
  letter-spacing: -0.022em;
  text-wrap: none;
  white-space: nowrap;
}
.hline i { font-style: normal; display: inline-block; }
body.js.booted .hline i { animation: riseIn 0.9s var(--ease) both; animation-delay: calc(var(--d) * 60ms + 0.15s); }
body.js:not(.booted) .hline i { opacity: 0; }
@keyframes riseIn { from { opacity: 0; transform: translateY(0.45em); } to { opacity: 1; transform: none; } }
.hero-sub {
  margin-top: clamp(0.9rem, 2.2vh, 1.5rem);
  max-width: 52ch;
  color: var(--bone-dim);
  font-size: clamp(1rem, 1.3vw, 1.2rem);
  line-height: 1.55;
}
body.js.booted .hero-sub, body.js.booted .hero-ctas { animation: riseIn 0.9s var(--ease) both; animation-delay: 0.7s; }
body.js:not(.booted) .hero-sub, body.js:not(.booted) .hero-ctas { opacity: 0; }
.hero-ctas { display: flex; gap: 0.9rem; flex-wrap: wrap; margin-top: clamp(1rem, 2.6vh, 1.8rem); }

/* the clock monument */
.clockmon { text-align: right; justify-self: end; }
.clockmon .label {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--alarm); margin-bottom: 0.5rem;
}
.clockmon .clock {
  font-family: var(--mono); font-weight: 600;
  font-size: clamp(1.5rem, 2.9vw, 3.3rem);
  letter-spacing: -0.01em; line-height: 1;
  white-space: nowrap;
  color: var(--bone); font-variant-numeric: tabular-nums;
  text-shadow: 0 0 34px oklch(80% 0.155 150 / 0.25);
  transition: transform 0.18s var(--ease);
}
.clockmon.beat .clock { transform: scale(1.014); }
.clockmon .clock span.unit { font-size: 0.5em; color: var(--bone-dim); font-weight: 400; }
.clockmon .date {
  margin-top: 0.55rem;
  font-family: var(--mono); font-size: clamp(0.85rem, 1.2vw, 1.05rem); letter-spacing: 0.1em;
  color: var(--alarm);
}
.clockmon .date b { font-weight: 600; }
body.js.booted .clockmon { animation: riseIn 1s var(--ease) both; animation-delay: 0.5s; }
body.js:not(.booted) .clockmon { opacity: 0; }

/* vitals strip across the bottom of the fold */
.vitals-strip {
  position: relative; z-index: 2;
  border-top: 1px solid oklch(30% 0.015 40 / 0.7);
  background: oklch(11% 0.012 40 / 0.55);
  backdrop-filter: blur(4px);
}
.vitals-strip .in {
  display: flex; flex-wrap: wrap; gap: 0.5rem clamp(1.2rem, 3vw, 2.8rem);
  align-items: baseline;
  padding: 0.75rem 0;
  font-family: var(--mono); font-size: clamp(0.68rem, 0.9vw, 0.8rem); letter-spacing: 0.1em; text-transform: uppercase;
}
.vitals-strip .k { color: var(--bone-dim); margin-right: 0.5rem; }
.vitals-strip .n { font-weight: 600; font-variant-numeric: tabular-nums; }
.vitals-strip .green .n { color: var(--ecg); }
.vitals-strip .cyan .n { color: var(--spo2); }
.vitals-strip .amber .n { color: var(--resp); }
.vitals-strip .red .n { color: var(--alarm); }
.vitals-strip .cue { margin-left: auto; color: var(--bone-dim); text-decoration: none; }
.vitals-strip .cue:hover { color: var(--ecg); }
body.js.booted .vitals-strip .in > * { animation: riseIn 0.8s var(--ease) both; animation-delay: calc(var(--d, 0) * 70ms + 0.9s); }
body.js:not(.booted) .vitals-strip .in > * { opacity: 0; }

/* ---------- chart documents (paper) ---------- */
.doc {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--paper-line);
  box-shadow: 6px 8px 0 oklch(20% 0.02 50 / 0.16);
  padding: clamp(1.6rem, 3.5vw, 2.8rem);
  max-width: 860px;
}
.doc.tilt-l { transform: rotate(-0.4deg); }
.doc.tilt-r { transform: rotate(0.35deg); }
.doc + .doc { margin-top: clamp(2.5rem, 6vh, 4.5rem); }
.doc .dochead {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; justify-content: space-between;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 0.6rem; margin-bottom: 1.4rem;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-dim);
}
.doc .dochead b { color: var(--ink); font-weight: 600; }
.doc h2, .doc h3 { color: var(--ink); }
.doc .fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.9rem 1.6rem; margin: 1.4rem 0; }
.doc .fields .f .k { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); }
.doc .fields .f .val { font-weight: 600; margin-top: 0.15rem; }
.doc p + p { margin-top: 0.9rem; }

/* rubber stamp — slams in when its document reveals */
.stamp {
  display: inline-block;
  font-family: var(--mono); font-weight: 600; font-size: clamp(0.95rem, 1.6vw, 1.25rem);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--stamp);
  border: 3px solid var(--stamp);
  padding: 0.35rem 0.9rem;
  transform: rotate(-6deg);
  border-radius: 4px;
  opacity: 0.9;
  margin-top: 1.3rem;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='40'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.7'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .8 .3'/%3E%3C/filter%3E%3Crect width='120' height='40' filter='url(%23n)'/%3E%3C/svg%3E");
  mask-size: 120px 40px;
}
.stamp.ok { color: oklch(48% 0.12 150); border-color: oklch(48% 0.12 150); }
body.js .doc.rv .stamp { opacity: 0; }
body.js .doc.rv.in .stamp { animation: slam 0.5s cubic-bezier(0.2, 1.6, 0.35, 1) 0.45s both; }
@keyframes slam {
  0% { opacity: 0; transform: rotate(-14deg) scale(2.4); }
  60% { opacity: 1; transform: rotate(-5deg) scale(0.94); }
  100% { opacity: 0.9; transform: rotate(-6deg) scale(1); }
}

/* ecg strip inside chapters */
.strip { margin: 1.6rem 0 0.4rem; }
.strip svg { width: 100%; height: 54px; overflow: visible; }
.strip .trace { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ward .strip .trace { stroke: var(--ecg); filter: drop-shadow(0 0 6px oklch(80% 0.155 150 / 0.5)); }
.chartland .strip .trace { stroke: var(--stamp); opacity: 0.75; }
.strip.flat .trace { stroke: var(--alarm); }

/* chapter kicker (chart tab) */
.tab {
  display: inline-block;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.35rem 0.8rem; margin-bottom: 1.6rem;
}
.ward .tab { border: 1px solid var(--ward-line); color: var(--bone-dim); }
.chartland .tab { background: var(--ink); color: var(--paper); }

/* ---------- defib flash ---------- */
#defib {
  position: fixed; inset: 0; z-index: 100; pointer-events: none;
  background: var(--bone); opacity: 0;
}
#defib.fire { animation: defib 0.55s ease-out; }
@keyframes defib {
  0% { opacity: 0; } 12% { opacity: 0.95; background: var(--bone); }
  30% { opacity: 0.4; background: var(--alarm); } 100% { opacity: 0; }
}

/* ============================================================
   RESUSCITATION — pinned scrub scene (scroll drives the drama)
   ============================================================ */
#resus { height: 300vh; }
#resus .stick {
  position: sticky; top: 0; height: 100svh;
  display: grid; align-content: center;
  overflow: clip;
}
#resus .rline { position: absolute; left: 0; right: 0; top: 44%; height: 160px; pointer-events: none; }
#resus .rline svg { width: 100%; height: 100%; overflow: visible; }
#flatpath { stroke: var(--alarm); stroke-width: 2.5; fill: none; filter: drop-shadow(0 0 8px oklch(60% 0.21 27 / 0.6)); }
#rhythmpath { stroke: var(--ecg); stroke-width: 2.5; fill: none; filter: drop-shadow(0 0 8px oklch(80% 0.155 150 / 0.6)); }
#resus .rcopy { position: relative; z-index: 2; }
#resus .rcopy h2 { max-width: 14ch; }
#resus .rcopy .lede { margin-top: 1.2rem; }
.directives { margin-top: clamp(1.6rem, 4vh, 2.6rem); display: grid; gap: 0.8rem; max-width: 760px; }
body.js .directive { opacity: 0; }
body.no-anim .directive { opacity: 1 !important; transform: none !important; }
.directive p { max-width: none; }

/* ---------- prognosis fork ---------- */
.fork { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-top: 2.5rem; }
.outcome { border: 1px solid var(--ward-line); padding: clamp(1.4rem, 3vw, 2.2rem); border-radius: 10px; }
.outcome.dies { border-color: oklch(38% 0.12 27); background: oklch(16% 0.03 27 / 0.5); }
.outcome.lives { border-color: oklch(42% 0.09 150); background: oklch(16% 0.03 150 / 0.5); }
.outcome .tag { display: block; margin-bottom: 0.9rem; border: 0; padding: 0; }
.outcome.dies .tag { color: var(--alarm); }
.outcome.lives .tag { color: var(--ecg); }
.outcome .big { font-weight: 800; font-size: clamp(1.5rem, 3vw, 2.2rem); line-height: 1.1; margin-bottom: 0.8rem; }
.outcome p { font-size: 0.98rem; color: var(--bone-dim); }

/* ---------- treatments (order forms) ---------- */
.rx-grid { display: grid; gap: clamp(1.6rem, 3vw, 2.4rem); margin-top: 3rem; }
.rx {
  background: var(--paper);
  border: 1px solid var(--paper-line);
  box-shadow: 5px 7px 0 oklch(20% 0.02 50 / 0.15);
  padding: clamp(1.4rem, 3vw, 2.2rem);
  display: grid; gap: 1.1rem;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.rx:nth-child(odd) { transform: rotate(-0.3deg); }
.rx:nth-child(even) { transform: rotate(0.3deg); }
.rx:hover { transform: rotate(0deg) translateY(-3px); box-shadow: 7px 11px 0 oklch(20% 0.02 50 / 0.18); }
.rx .rxhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.2rem; border-bottom: 2px solid var(--ink); padding-bottom: 0.7rem; }
.rx .rxhead .no { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; color: var(--ink-dim); }
.rx h3 { font-size: clamp(1.35rem, 2.4vw, 1.8rem); font-weight: 800; }
.rx .price { margin-left: auto; font-family: var(--mono); font-weight: 600; font-size: clamp(1.05rem, 2vw, 1.4rem); color: var(--ink); white-space: nowrap; }
.rx .price small { color: var(--ink-dim); font-weight: 400; font-size: 0.7em; }
.rx p { font-size: 1rem; }
.rx .fine { font-size: 0.82rem; color: var(--ink-dim); max-width: none; }
.rx .ctas { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  text-decoration: none; cursor: pointer;
  border: none; border-radius: 8px;
  padding: 0.85rem 1.5rem;
  font-family: var(--sans); font-weight: 600; font-size: 1rem; line-height: 1.2;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.btn small { font-family: var(--mono); font-weight: 400; font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 0.3rem; opacity: 0.75; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-life { background: var(--ecg); color: var(--ward-0); box-shadow: 0 0 22px oklch(80% 0.155 150 / 0.25); }
.btn-life:hover { background: oklch(87% 0.16 150); box-shadow: 0 0 34px oklch(80% 0.155 150 / 0.4); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: oklch(32% 0.02 50); }
.btn-ghost { background: transparent; border: 1px solid var(--ward-line); color: var(--bone); }
.btn-ghost:hover { border-color: var(--ecg); color: var(--ecg); }
.btn-ghost-ink { background: transparent; border: 1.5px solid var(--ink); color: var(--ink); }
.btn-ghost-ink:hover { background: var(--ink); color: var(--paper); }

/* ---------- forms (paper intake) ---------- */
form.intake { display: grid; gap: 1.1rem; margin-top: 1.6rem; }
.intake label { display: grid; gap: 0.35rem; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; }
.intake input, .intake textarea, .intake select {
  font-family: var(--sans); font-size: 1rem; color: inherit;
  padding: 0.75rem 0.9rem; border-radius: 6px;
  width: 100%;
}
.chartland .intake input, .chartland .intake textarea, .chartland .intake select,
.doc .intake input, .doc .intake textarea, .doc .intake select {
  background: oklch(98% 0.008 90); border: 1.5px solid var(--ink-dim); color: var(--ink);
}
.ward .intake input, .ward .intake textarea, .ward .intake select {
  background: oklch(11% 0.012 40); border: 1px solid var(--ward-line); color: var(--bone);
}
.intake input:focus, .intake textarea:focus { outline: 2px solid var(--ecg); outline-offset: 1px; }
.doc .intake input:focus, .doc .intake textarea:focus, .chartland .intake input:focus, .chartland .intake textarea:focus { outline-color: var(--stamp); }
.intake textarea { min-height: 130px; resize: vertical; }
.intake .row { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.intake .consent { display: flex; gap: 0.6rem; align-items: flex-start; font-family: var(--sans); font-size: 0.9rem; text-transform: none; letter-spacing: 0; }
.intake .consent input { width: auto; margin-top: 0.25rem; }
.intake .hp { position: absolute; left: -6000px; opacity: 0; height: 0; overflow: hidden; }
.intake .status { font-size: 0.95rem; min-height: 1.4em; }
.intake .status.err { color: var(--alarm); }
.form-done { border: 2px solid oklch(48% 0.12 150); padding: 1.6rem; border-radius: 8px; }
.form-done .stamp { margin-top: 0; opacity: 0.9 !important; animation: none !important; }

/* ---------- ledger ---------- */
.ledger-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.ledger-table th {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase;
  text-align: left; color: var(--ink-dim);
  border-bottom: 2px solid var(--ink); padding: 0.6rem 0.75rem;
}
.ledger-table td { padding: 0.9rem 0.75rem; border-bottom: 1px solid var(--paper-line); vertical-align: top; }
.ledger-table td:first-child { font-family: var(--mono); font-size: 0.78rem; white-space: nowrap; color: var(--ink-dim); }
.amt-pos { color: oklch(45% 0.12 150); font-family: var(--mono); font-size: 0.85rem; white-space: nowrap; }
.amt-neg { color: var(--stamp); font-family: var(--mono); font-size: 0.85rem; white-space: nowrap; }
.bal { font-family: var(--mono); font-size: 0.85rem; white-space: nowrap; }
.tablewrap { overflow-x: auto; }

/* ---------- surgery ---------- */
.slab {
  border: 1px solid var(--ward-line); border-radius: 10px;
  background: oklch(11% 0.012 40 / 0.7);
  padding: clamp(1.4rem, 3vw, 2.2rem);
}
.oplog {
  font-family: var(--mono); font-size: 0.85rem; line-height: 1.9;
  color: var(--ecg);
  max-height: 460px; overflow-y: auto;
  padding: 1.1rem; border: 1px solid var(--ward-line); border-radius: 8px;
  background: oklch(9% 0.01 40);
}
.oplog .t { color: var(--bone-dim); margin-right: 0.8rem; }
.queue-list { display: grid; gap: 0.7rem; margin-top: 1.2rem; }
.queue-list .q {
  display: flex; gap: 1rem; align-items: baseline;
  border: 1px solid var(--ward-line); border-radius: 8px; padding: 0.8rem 1.1rem;
}
.queue-list .q .n { font-family: var(--mono); color: var(--resp); font-size: 0.8rem; }

/* ---------- faq ---------- */
.faq { display: grid; gap: 0; max-width: 860px; }
.faq details { border-bottom: 1px solid var(--paper-line); padding: 1.1rem 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 1.05rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--ink-dim); }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin-top: 0.7rem; font-size: 0.98rem; }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--ward-line); padding: 3rem 0 4rem; }
footer .cols { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
footer .mono { color: var(--bone-dim); text-transform: none; letter-spacing: 0.04em; }
footer a { color: var(--bone-dim); }
footer a:hover { color: var(--ecg); }

/* ---------- toast ---------- */
#toast {
  position: fixed; bottom: 1.4rem; left: 50%; transform: translate(-50%, 160%);
  visibility: hidden; opacity: 0;
  z-index: 90; max-width: min(480px, 92vw);
  background: var(--ecg); color: var(--ward-0);
  padding: 1rem 1.4rem; border-radius: 10px; font-weight: 600;
  transition: transform 0.5s var(--ease), opacity 0.5s var(--ease);
}
#toast.show { transform: translate(-50%, 0); visibility: visible; opacity: 1; }

/* ---------- reveals (fail-safe: hidden only when JS is alive; body.no-anim = stuck-renderer escape hatch) ---------- */
body.js .rv { opacity: 0; transform: translateY(16px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
body.js .rv.in { opacity: 1; transform: none; }
/* parallax sheets: JS drives transform every frame; transition only the fade */
body.js .rv[data-depth] { transform: none; transition: opacity 0.7s var(--ease); }
body.no-anim .rv, body.no-anim .rv.in { opacity: 1 !important; transform: none !important; transition: none !important; }
body.no-anim .hline i, body.no-anim .hero-sub, body.no-anim .hero-ctas,
body.no-anim .clockmon, body.no-anim .vitals-strip .in > * { opacity: 1 !important; animation: none !important; }
body.no-anim #hero-stage { transform: none !important; opacity: 1 !important; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero-main { grid-template-columns: 1fr; align-items: end; }
  .clockmon { text-align: left; justify-self: start; }
}
@media (max-width: 720px) {
  #lifeline { width: 2px; }
  .topbar nav a:not(.pill) { display: none; }
  .hero { height: auto; min-height: 100svh; }
  .hero-main { padding-top: 5.5rem; }
  .hline { white-space: normal; font-size: clamp(2.4rem, 11.5vw, 3.4rem); }
  .doc.tilt-l, .doc.tilt-r, .rx:nth-child(odd), .rx:nth-child(even) { transform: none; }
  #resus { height: 240vh; }
  .vitals-strip .cue { display: none; }
  .grain { display: none; }
}

/* ---------- reduced motion: full content parity, zero theatrics ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body.js .rv { opacity: 1; transform: none; transition: none; }
  .hero-copy .kicker::before { animation: none; }
  body.js .hline i, body.js .hero-sub, body.js .hero-ctas, body.js .clockmon, body.js .vitals-strip .in > * { opacity: 1 !important; animation: none !important; }
  body.js .doc.rv .stamp { opacity: 0.9; animation: none; }
  .directive { opacity: 1 !important; transform: none !important; }
  #flatpath, #rhythmpath { stroke-dasharray: none !important; stroke-dashoffset: 0 !important; }
  #resus { height: auto; }
  #resus .stick { position: static; height: auto; padding-block: clamp(5rem, 13vh, 9.5rem); }
  #defib, #boot { display: none; }
  .btn, #toast, .rx { transition: none; }
  .strip .trace { stroke-dashoffset: 0 !important; stroke-dasharray: none !important; }
  .grain { display: none; }
}
