/* field-guide: an industrial field manual. Steel-grey surfaces, condensed display type,
   mono labels, one bold device (the hazard tape), and colour that always means something. */
:root {
  --bg: #E8EBED;
  --surface: #F7F8F9;
  --surface-2: #DCE2E6;
  --ink: #141A1F;
  --muted: #55616A;
  --line: #C4CDD3;
  --accent: #1D56C2;
  --accent-soft: #D6E2F7;
  --tape: #EFBC2A;
  --ok: #1E8A5A;
  --warn: #A86C12;
  --crit: #C2362F;
  --rack: #2B3238;
  --pwr: #C2410C;
  --cool: #0E8FA0;
  --n2: #7C3AED;
  --n3: #2F855A;
  --n4: #A16207;
  --f-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1317; --surface: #161C21; --surface-2: #222A31; --ink: #E3E8EC; --muted: #8E9AA4;
    --line: #2D3740; --accent: #7CA4F2; --accent-soft: #1D2B45; --tape: #E3B32A;
    --ok: #4CC38A; --warn: #E0A84A; --crit: #F0716A; --rack: #46515B; --pwr: #F0834A; --cool: #3CC6D6;
    --n2: #A78BFA; --n3: #5CC98A; --n4: #E3B32A; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1317; --surface: #161C21; --surface-2: #222A31; --ink: #E3E8EC; --muted: #8E9AA4;
  --line: #2D3740; --accent: #7CA4F2; --accent-soft: #1D2B45; --tape: #E3B32A;
  --ok: #4CC38A; --warn: #E0A84A; --crit: #F0716A; --rack: #46515B; --pwr: #F0834A; --cool: #3CC6D6;
  --n2: #A78BFA; --n3: #5CC98A; --n4: #E3B32A; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.55; }
a { color: var(--accent); }
img { max-width: 100%; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; letter-spacing: .01em; line-height: 1.05; text-wrap: balance; margin: 0; }
h2 { font-size: clamp(30px, 4.2vw, 42px); }
h3 { font-size: 22px; font-weight: 600; }
p { margin: 0; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.eyebrow { font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lede { color: var(--muted); max-width: 68ch; }
.small { font-size: 13px; color: var(--muted); }
.tape { height: 10px; background: repeating-linear-gradient(-45deg, var(--tape) 0 14px, var(--ink) 14px 28px); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.badge { display: inline-block; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; border: 1px solid currentColor; }
.b-conf { color: var(--ok); } .b-rep { color: var(--warn); } .b-unv { color: var(--crit); } .b-post, .b-own { color: var(--accent); } .b-guess { color: var(--muted); }

/* hero */
header.hero { background: var(--surface); border-bottom: 1px solid var(--line); }
.hero-in { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; padding-block: 44px 36px; align-items: end; }
.hero-in.solo { grid-template-columns: 1fr; }
.hero h1 { font-size: clamp(42px, 7vw, 76px); text-transform: uppercase; letter-spacing: -.005em; margin-top: 10px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lede { margin-top: 18px; font-size: 16.5px; }
.roles { display: grid; gap: 10px; }
.role { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; background: var(--bg); display: grid; gap: 4px; }
.role.you { border-color: var(--accent); }
.role .tag { font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.role.you .tag { color: var(--accent); }
.role.them .tag { color: var(--warn); }
.role b { font-family: var(--f-display); font-size: 22px; font-weight: 600; }
.role .meta { color: var(--muted); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--line); }
.stat { padding: 16px 16px 18px; display: grid; gap: 2px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: none; padding-left: 0; }
.stat .n { font-family: var(--f-display); font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .l { font-size: 13px; color: var(--muted); }

/* rail */
nav.rail { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.rail-in { display: flex; gap: 4px; align-items: center; padding-block: 8px; }
.rail-links { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.rail a { font-family: var(--f-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 4px; white-space: nowrap; }
.rail a:hover, .rail a.on { color: var(--ink); background: var(--surface-2); }
.rail .tool { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 4px; padding: 5px 10px; cursor: pointer; font-family: var(--f-mono); font-size: 12px; white-space: nowrap; }
.rail .tool:hover { border-color: var(--accent); }

section { padding-block: 56px 8px; scroll-margin-top: 56px; }
.sec-head { display: grid; gap: 10px; margin-bottom: 24px; }
.bh { margin-top: 28px; margin-bottom: 8px; }
.blk + .blk { margin-top: 14px; }
.bsub { margin-bottom: 8px; }
.note { margin-top: 14px; color: var(--muted); font-size: 14px; }
.ptext { max-width: 72ch; }
.ptext + .ptext { margin-top: 10px; }
footer { padding-block: 40px 60px; color: var(--muted); font-size: 13px; }

/* chain: who serves whom */
.chain { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.link { background: var(--surface); border: 1px solid var(--line); padding: 18px; display: grid; gap: 12px; align-content: start; position: relative; min-width: 0; }
.link + .link { border-left: none; }
.link:first-child { border-radius: var(--r) 0 0 var(--r); }
.link:last-child { border-radius: 0 var(--r) var(--r) 0; }
.link.me { background: var(--accent-soft); }
.link .who { font-family: var(--f-display); font-size: 24px; font-weight: 600; line-height: 1.1; }
.link dl { margin: 0; display: grid; gap: 8px; }
.link dt { font-family: var(--f-mono); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.link dd { margin: 0; font-size: 14px; }
.link .arrow { position: absolute; right: -13px; top: 22px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-size: 13px; z-index: 2; }

/* stages: a clickable line with a detail panel */
.ends { display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.line { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; }
.st { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 4px; padding: 10px 8px 12px; text-align: left; cursor: pointer; display: grid; gap: 4px; position: relative; min-width: 0; }
.st::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; border-radius: 0 0 4px 4px; background: var(--fill); }
.st .k { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.st .nm { font-family: var(--f-display); font-size: 18px; font-weight: 600; line-height: 1.05; }
.st:hover { border-color: var(--accent); }
.st[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.st.loop { grid-column: 1 / -1; border-style: dashed; display: flex; align-items: center; gap: 12px; padding: 8px 12px; }
.detail { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); display: grid; grid-template-columns: 1fr 1fr; }
.detail.one { grid-template-columns: 1fr; }
.detail > div { padding: 20px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.detail > div + div { border-left: 1px solid var(--line); }
.detail .you-box { background: var(--accent-soft); border-radius: 0 var(--r) var(--r) 0; }
.detail ul, .detail ol { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--f-mono); font-size: 11.5px; border: 1px solid var(--line); border-radius: 3px; padding: 2px 7px; color: var(--muted); background: var(--bg); }
.signal { font-family: var(--f-mono); font-size: 13px; border-left: 3px solid var(--tape); padding-left: 10px; }
.btn { border: 1px solid var(--ink); background: var(--ink); color: var(--bg); padding: 6px 12px; border-radius: 4px; cursor: pointer; font-weight: 500; font-size: 13px; justify-self: start; }

/* ladder: zoom levels, each with a diagram and clickable parts */
.ladder { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; margin-bottom: 12px; }
.ladder button { appearance: none; text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 4px; padding: 8px 10px; cursor: pointer; display: grid; gap: 2px; min-width: 0; }
.ladder button:hover { border-color: var(--accent); }
.ladder button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.ladder .k { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.ladder b { font-family: var(--f-display); font-size: 20px; font-weight: 600; line-height: 1; }
.ladder .sc { font-size: 12px; color: var(--muted); }
.phys { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.phys.noviz { grid-template-columns: 1fr; }
.phys.wide { grid-template-columns: 1fr; }
.phys.wide .viz { border-right: none; border-bottom: 1px solid var(--line); }
.phys.wide .pside { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px; }
.phys.wide .pside .thesis, .phys.wide .pside > .small { grid-column: 1 / -1; }
.phys.wide .viz svg { max-height: 460px; }
.phys.wide .pside .plist { align-self: start; align-items: flex-start; align-content: flex-start; }
.phys.wide .pside .plist button { align-self: flex-start; }
.viz { padding: 12px; border-right: 1px solid var(--line); min-width: 0; overflow-x: auto; }
.viz svg, .figure svg { display: block; width: 100%; height: auto; min-width: 480px; }
.pside { padding: 18px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.thesis { font-family: var(--f-display); font-size: 22px; font-weight: 600; line-height: 1.15; }
.plist { display: flex; flex-wrap: wrap; gap: 6px; }
.plist button, .filters button, .checks button { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.plist button[aria-pressed="true"], .filters button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pdetail { border-left: 3px solid var(--accent); padding-left: 12px; display: grid; gap: 4px; min-height: 64px; align-content: start; }
.pdetail b { font-family: var(--f-display); font-size: 19px; font-weight: 600; }
.pdetail .ce { font-size: 13.5px; color: var(--muted); }

/* svg diagram vocabulary (author diagrams with these classes; they follow the theme) */
.sv text { font-family: var(--f-mono); font-size: 11px; fill: var(--muted); }
.sv text.tk { font-family: var(--f-body); font-size: 13px; fill: var(--ink); font-weight: 600; }
.sv text.ti { font-size: 10px; fill: var(--ink); }
.sv text.on { font-family: var(--f-body); font-size: 13px; fill: var(--bg); font-weight: 600; }
.sv .box { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.sv .bg2 { fill: var(--surface-2); }
.sv .ink { fill: var(--ink); }
.sv .ln { stroke: var(--line); fill: none; stroke-width: 1.5; }
.sv .mu { stroke: var(--muted); fill: none; }
.sv .dash { stroke-dasharray: 6 5; }
.sv .w2 { stroke-width: 2; } .sv .w3 { stroke-width: 3; } .sv .w4 { stroke-width: 4; }
.sv .f-acc { fill: var(--accent); } .sv .f-accs { fill: var(--accent-soft); } .sv .s-acc { stroke: var(--accent); fill: none; }
.sv .f-ok { fill: var(--ok); } .sv .s-ok { stroke: var(--ok); fill: none; }
.sv .f-warn { fill: var(--warn); } .sv .s-warn { stroke: var(--warn); fill: none; }
.sv .f-crit { fill: var(--crit); } .sv .s-crit { stroke: var(--crit); fill: none; }
.sv .f-tape { fill: var(--tape); } .sv .s-tape { stroke: var(--tape); fill: none; }
.sv .f-pwr { fill: var(--pwr); } .sv .s-pwr { stroke: var(--pwr); fill: none; }
.sv .f-cool { fill: var(--cool); } .sv .s-cool { stroke: var(--cool); fill: none; }
.sv .f-n2 { fill: var(--n2); } .sv .s-n2 { stroke: var(--n2); fill: none; }
.sv .f-n3 { fill: var(--n3); } .sv .s-n3 { stroke: var(--n3); fill: none; }
.sv .f-n4 { fill: var(--n4); } .sv .s-n4 { stroke: var(--n4); fill: none; }
.sv [data-part] { cursor: pointer; transition: opacity .15s; }
.sv.sel [data-part]:not(.on) { opacity: .3; }
.sv [data-part].on .box { stroke: var(--accent); stroke-width: 2.5; }
.figure svg { max-height: 420px; }
.figure { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; overflow-x: auto; }
.figure figcaption { margin-top: 8px; }
figure { margin: 0; }

/* cards: severity bar, optional filters */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.cards { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 12px; }
.wc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 16px 16px 20px; display: grid; gap: 8px; align-content: start; position: relative; overflow: hidden; }
.wc::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--sev); }
.wc .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.wc .who { font-family: var(--f-mono); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.wc .sev { font-family: var(--f-mono); font-size: 11px; color: var(--sev); }
.wc h3 { font-size: 21px; }
.wc p { font-size: 14px; }
.wc .help { font-size: 13.5px; border-top: 1px dashed var(--line); padding-top: 8px; }
.wc .help b { color: var(--accent); font-weight: 600; }

/* loop: proportional segments with a column panel */
.loop { display: flex; gap: 4px; margin-bottom: 12px; }
.loop button { flex: var(--w) 1 0; min-width: 0; appearance: none; text-align: left; border: 1px solid var(--line); border-top: 4px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 4px; padding: 8px 10px; cursor: pointer; display: grid; gap: 2px; }
.loop button.flag { border-top-color: var(--warn); }
.loop button:hover { border-color: var(--accent); }
.loop button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.loop .k { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.loop b { font-family: var(--f-display); font-size: 18px; font-weight: 600; line-height: 1.1; }
.loop .sc { font-size: 12px; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.panel > div { padding: 16px 18px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.panel > div + div { border-left: 1px solid var(--line); }
.panel ul, .panel ol { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
.flagt { color: var(--warn); font-family: var(--f-mono); font-size: 12px; }

/* phases + principles */
.phases { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.ph { padding: 20px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.ph + .ph { border-left: 1px solid var(--line); }
.ph .d { font-family: var(--f-display); font-size: 44px; font-weight: 700; color: var(--accent); line-height: 1; }
.ph ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
.principles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.pr { border-top: 3px solid var(--ink); padding-top: 10px; display: grid; gap: 4px; font-size: 14px; }
.pr b { font-family: var(--f-display); font-size: 19px; font-weight: 600; }

/* notes: prompt rows with a saved textarea */
.vals { display: grid; gap: 10px; }
.val { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); display: grid; grid-template-columns: 200px minmax(0, 1fr) minmax(0, 1.1fr); }
.val > div { padding: 16px 18px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.val > div + div { border-left: 1px solid var(--line); }
.val .vn { font-family: var(--f-display); font-size: 26px; font-weight: 700; line-height: 1; text-transform: uppercase; }
textarea { width: 100%; min-height: 92px; resize: vertical; font: inherit; font-size: 14px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; }
.hint { font-size: 12.5px; color: var(--muted); }
.saved { font-family: var(--f-mono); font-size: 11px; color: var(--ok); min-height: 1em; }

/* stories */
.stories { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 10px; }
.story { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.story b { font-family: var(--f-display); font-size: 20px; font-weight: 600; }
.story .pr2 { display: flex; flex-wrap: wrap; gap: 4px; }
.story .pr2 span { font-family: var(--f-mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; }
.story textarea { min-height: 110px; }

/* prompts accordion */
details.q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
details.q + details.q { margin-top: 8px; }
details.q summary { cursor: pointer; padding: 14px 16px; font-weight: 500; list-style: none; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
details.q summary::-webkit-details-marker { display: none; }
details.q summary::after { content: "+"; font-family: var(--f-mono); color: var(--muted); }
details.q[open] summary::after { content: "–"; }
details.q .body { padding: 0 16px 16px; display: grid; gap: 8px; font-size: 14px; }
details.q .chk { font-family: var(--f-mono); font-size: 12px; color: var(--warn); }
details.q ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

/* checklist */
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.checks > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 8px; align-content: start; }
.checks .row { display: flex; flex-wrap: wrap; gap: 6px; }
.checks button[aria-pressed="true"] { background: var(--ok); color: var(--bg); border-color: var(--ok); }
.checks button[aria-pressed="true"]::before { content: "✓ "; }
.cnt { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }

/* flows: arrow chains */
.flows { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.flow { display: grid; gap: 8px; align-content: start; --edge: var(--accent); }
.chain2 { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chain2 li { display: flex; align-items: center; gap: 6px; }
.chain2 li:not(:last-child)::after { content: "→"; color: var(--muted); }
.chain2 li > div { display: grid; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--edge); border-radius: 4px; padding: 5px 9px; font-size: 13px; }
.chain2 li b { font-weight: 600; }
.chain2 li span { font-family: var(--f-mono); font-size: 11.5px; color: var(--muted); }

/* tiles, gloss, stats, bars */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.tiles div { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; display: grid; gap: 3px; font-size: 13.5px; }
.tiles b { font-weight: 600; }
.gloss { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.gt { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; display: grid; gap: 3px; font-size: 13.5px; }
.gt b { font-family: var(--f-mono); font-size: 13px; font-weight: 500; color: var(--accent); }
.readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.ro { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; display: grid; }
.ro .n { font-family: var(--f-display); font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.05; }
.ro.acc .n { color: var(--accent); }
.ro .l { font-size: 12.5px; color: var(--muted); }
.bars { display: grid; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.cbar { display: grid; grid-template-columns: minmax(80px, 160px) 1fr 72px; gap: 10px; align-items: center; font-size: 13px; }
.cbar .track { height: 14px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.cbar .fill { height: 100%; background: var(--muted); }
.cbar.hl .fill { background: var(--accent); }
.cbar .v { font-family: var(--f-mono); font-variant-numeric: tabular-nums; text-align: right; }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 14px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--f-mono); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
td:first-child { font-weight: 500; }
tr:last-child td { border-bottom: none; }

/* present mode: one section per 16:9 slide, scaled to the window */
.pbar, .pnotes { display: none; }
body.present { overflow: hidden; }
body.present nav.rail, body.present .tape, body.present footer, body.present main > section, body.present header.hero { display: none; }
body.present .cur { display: block !important; position: fixed; left: 50%; top: 50%; width: 1280px; height: 720px; margin: 0; padding: 40px 64px 56px; transform: translate(-50%, -50%) scale(var(--s, 1)); background: var(--bg); overflow: hidden; border: none; }
body.present header.hero.cur { background: var(--surface); display: flex !important; flex-direction: column; justify-content: center; }
body.present .cur > .wrap { max-width: none; padding: 0; transform-origin: top left; }
body.present .cur .hero-in { padding-block: 40px 28px; }
body.present .pbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; align-items: center; gap: 12px; padding: 6px 16px; font-family: var(--f-mono); font-size: 12px; color: var(--muted); background: var(--surface); border-top: 1px solid var(--line); }
.pbar .prog { flex: 1; height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.pbar .prog i { display: block; height: 100%; background: var(--accent); }
.pbar button { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 4px; cursor: pointer; font-family: var(--f-mono); font-size: 12px; padding: 2px 8px; }
body.present.shownotes .pnotes { display: block; position: fixed; right: 16px; bottom: 44px; width: min(420px, 90vw); max-height: 60vh; overflow: auto; z-index: 21; background: var(--ink); color: var(--bg); border-radius: var(--r); padding: 14px 16px; font-size: 14px; }



/* extra SVG text styles for drawn artefacts (documents, UI mocks) */
.sv text.b { font-family: var(--f-body); font-size: 14px; fill: var(--ink); }
.sv text.bs { font-family: var(--f-body); font-size: 12.5px; fill: var(--ink); }
.sv text.bm { font-family: var(--f-body); font-size: 13px; fill: var(--muted); }
.sv text.bb { font-family: var(--f-body); font-size: 14px; fill: var(--ink); font-weight: 600; }
.sv text.big { font-family: var(--f-display); font-size: 24px; fill: var(--ink); font-weight: 700; }
.sv text.huge { font-family: var(--f-display); font-size: 40px; fill: var(--ink); font-weight: 700; }
.sv text.serif { font-family: Georgia, "Times New Roman", serif; font-size: 15px; fill: var(--ink); }
.sv text.serifb { font-family: Georgia, "Times New Roman", serif; font-size: 15px; fill: var(--ink); font-weight: 700; }
.sv text.lbl { font-family: var(--f-mono); font-size: 11.5px; fill: var(--muted); letter-spacing: .06em; }
.sv text.acc { fill: var(--accent); } .sv text.okc { fill: var(--ok); } .sv text.warnc { fill: var(--warn); } .sv text.critc { fill: var(--crit); }
.sv tspan.del { fill: var(--crit); text-decoration: line-through; }
.sv tspan.ins { fill: var(--accent); text-decoration: underline; }
.sv tspan.hl { fill: var(--ink); }
.sv .page { fill: var(--surface); stroke: var(--line); stroke-width: 1.2; }
.sv .paper { fill: #FBFAF7; stroke: #C9C4BA; stroke-width: 1.2; }
.sv .f-hl { fill: var(--tape); opacity: .45; }
.sv .f-oks { fill: var(--ok); opacity: .14; } .sv .f-warns { fill: var(--warn); opacity: .16; } .sv .f-crits { fill: var(--crit); opacity: .13; }
.sv .f-bg { fill: var(--bg); } .sv .f-surf { fill: var(--surface); } .sv .f-ink { fill: var(--ink); } .sv .f-mut { fill: var(--muted); } .sv .f-line { fill: var(--line); }
.sv .mk { fill: var(--muted); } .sv .mka { fill: var(--accent); }
.sv .s-ink { stroke: var(--ink); fill: none; } .sv .s-line { stroke: var(--line); fill: none; }
.sv .glow { stroke: var(--accent); stroke-width: 2.5; fill: none; }

/* stepper */
.stepper { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.stepper .stg { overflow-x: auto; }
.stepper .stg svg { display: block; width: 100%; min-width: 480px; max-height: 440px; }
.stepper .say { margin-top: 10px; min-height: 3.1em; max-width: 80ch; }
.stepper .say .k { display: block; font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; }
.sbar { display: flex; align-items: center; gap: 6px; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.sbar > button { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); min-width: 38px; height: 32px; cursor: pointer; font-size: 15px; }
.sbar > button:hover:not(:disabled) { border-color: var(--accent); }
.sbar > button:disabled { opacity: .35; cursor: default; }
.sbar .cnt { font-family: var(--f-mono); font-size: 12px; color: var(--muted); margin-left: auto; }
.sbar .dots { display: flex; gap: 5px; margin-left: 8px; }
.sbar .dots button { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--muted); background: transparent; padding: 0; cursor: pointer; }
.sbar .dots button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
/* review grid */
.rgrid { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.gtop { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.gtop .gcount b { color: var(--ink); font-family: var(--f-mono); }
.gtop button { margin-left: auto; font-family: var(--f-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); padding: 5px 9px; cursor: pointer; }
.gtop button + button { margin-left: 0; }
.gtop button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.gbody { display: grid; grid-template-columns: 1fr 270px; gap: 12px; }
.gwrap { overflow-x: auto; }
.gwrap table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 13px; }
.gwrap th { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); font-weight: 500; }
.gwrap tbody th { font-family: var(--f-body); font-size: 12.5px; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 600; white-space: nowrap; }
.gwrap td { border-bottom: 1px solid var(--line); padding: 3px; }
.gc { position: relative; display: flex; flex-direction: column; gap: 2px; width: 100%; min-height: 50px; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 4px; padding: 6px 26px 6px 8px; color: var(--ink); cursor: pointer; font-size: 13px; }
.gc:hover { border-color: var(--line); }
.gc.sel { border-color: var(--accent); background: var(--accent-soft); }
.gc.none > span:first-child, .gc.none > span:nth-child(2) { color: var(--muted); font-style: italic; }
.gc .ct { font-family: var(--f-mono); font-size: 10.5px; color: var(--accent); }
.gc .gst { position: absolute; right: 6px; top: 5px; display: flex; gap: 3px; font-style: normal; }
.gc .gst i { font-style: normal; font-size: 11px; width: 16px; height: 16px; border-radius: 3px; display: grid; place-items: center; color: var(--bg); }
.gc .gst .v { background: var(--ok); } .gc .gst .f { background: var(--warn); } .gc .gst .l { background: var(--muted); }
.gc.tri { box-shadow: inset 3px 0 0 var(--warn); }
.gc.tri.r2 { box-shadow: inset 3px 0 0 var(--crit); }
.gc .rk { font-family: var(--f-mono); font-size: 10px; color: var(--crit); }
.gside { border-left: 1px solid var(--line); padding-left: 12px; font-size: 13.5px; }
.gside b { display: block; margin: 2px 0 6px; }
.gside blockquote { margin: 0 0 8px; padding: 8px 10px; background: var(--bg); border-left: 3px solid var(--line); font-family: Georgia, "Times New Roman", serif; font-size: 14px; line-height: 1.5; }
.gside mark { background: var(--tape); color: #141A1F; padding: 0 2px; }
.gact { display: flex; gap: 6px; margin-top: 8px; }
.gact button { flex: 1; font-family: var(--f-mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 4px; cursor: pointer; }
.gact button[aria-pressed="true"][data-a="v"] { background: var(--ok); border-color: var(--ok); color: var(--bg); }
.gact button[aria-pressed="true"][data-a="f"] { background: var(--warn); border-color: var(--warn); color: var(--bg); }
.gact button[aria-pressed="true"][data-a="l"] { background: var(--muted); border-color: var(--muted); color: var(--bg); }
.gact button:disabled { opacity: .35; cursor: default; }
@media (max-width: 760px) { .gbody { grid-template-columns: 1fr; } .gside { border-left: 0; border-top: 1px solid var(--line); padding: 10px 0 0; } }

@media (max-width: 760px) {
  .hero-in { grid-template-columns: 1fr; gap: 20px; }
  .stat { border-left: none; padding-left: 0; }
  .chain { grid-template-columns: 1fr; }
  .link + .link { border-left: 1px solid var(--line); border-top: none; }
  .link:first-child { border-radius: var(--r) var(--r) 0 0; }
  .link:last-child { border-radius: 0 0 var(--r) var(--r); }
  .link .arrow { right: auto; left: 22px; top: auto; bottom: -13px; transform: rotate(-90deg); }
  .line, .ladder { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
  .detail, .phys, .panel, .phases, .stories, .val, .cards, .phys.wide .pside { grid-template-columns: 1fr; }
  .detail > div + div, .panel > div + div, .ph + .ph, .val > div + div { border-left: none; border-top: 1px solid var(--line); }
  .detail .you-box { border-radius: 0 0 var(--r) var(--r); }
  .viz { border-right: none; border-bottom: 1px solid var(--line); }
  .loop { flex-wrap: wrap; }
  .loop button { flex: 1 1 30%; }
  .rail .tool.pres { display: none; }
}
@media print {
  nav.rail, .pbar, .pnotes { display: none !important; }
  main > section { break-before: page; }
  body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* present mode: secondary blocks (noslide) stay in read mode; diagrams cap their height */
body.present .noslide { display: none !important; }
body.present .stepper .stg svg, body.present .phys.wide .viz svg, body.present .figure svg { max-height: 330px; }
body.present .stepper .say { min-height: 0; }
