/* Aurora research, lab-notebook style: graph paper, IBM Plex Sans and Plex Mono,
   the text grid as the motif, a rail at the left on wide screens and a top bar
   with progress on phones. Used by the main page and the appendix (pilot/).
   Light and dark themes: prefers-color-scheme, or the theme button. */
/* IBM Plex Sans and Plex Mono, 400 and 600, latin subset, served from fonts/
   (SIL Open Font License 1.1: fonts/OFL-IBM-Plex-Sans.txt, fonts/OFL-IBM-Plex-Mono.txt). */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --bg: #f7f4ec; --ink: #1d1d1f; --muted: #55534d; --rule: #d8d2c2; --panel: #efeadd;
  --card: rgba(255, 255, 255, .55); --grid: rgba(31, 78, 140, .07);
  --link: #1f4e8c; --focus: #1f4e8c; --mark: #a23b16;
  --a1: #5a6b2e; --a2: #6a3d8f; --a3: #7a5600; --a4: #1d6658; --a5: #a23b16; --a6: #1f4e8c;
  --tag-bg: #ebe6d8; --tag-ink: #3b382f; --tag-rule: #d0c9b5;
  --code-bg: #e9e3d3; --th-bg: #ebe5d6;
  --btn-bg: #fbf9f3; --btn-border: #8a8578; --radius: 2px; --tip-bg: #1d1d1f; --tip-ink: #f7f4ec;
  --track-bg: rgba(247, 244, 236, .96); --shadow: rgba(29, 29, 31, .18); --gridframe: #000;
  --pin-top: 24px; --rail: 200px;
  --body: "IBM Plex Sans", system-ui, sans-serif; --display: var(--body);
  --mono: "IBM Plex Mono", ui-monospace, "DejaVu Sans Mono", monospace; --ui: var(--mono);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a2029; --ink: #ede5d5; --muted: #b5ae9f; --rule: #3b4554; --panel: #222a35;
    --card: rgba(255, 255, 255, .035); --grid: rgba(190, 210, 235, .06);
    --link: #93bbef; --focus: #93bbef; --mark: #f29e78;
    --a1: #b8c97a; --a2: #c9a8ea; --a3: #e2bb5e; --a4: #72cdb7; --a5: #f29e78; --a6: #93bbef;
    --tag-bg: #283140; --tag-ink: #e2dacb; --tag-rule: #46516282;
    --code-bg: #141920; --th-bg: #262f3b;
    --btn-bg: #222a35; --btn-border: #7f8999; --tip-bg: #ede5d5; --tip-ink: #1a2029;
    --track-bg: rgba(26, 32, 41, .96); --shadow: rgba(0, 0, 0, .45); --gridframe: #4a5566;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a2029; --ink: #ede5d5; --muted: #b5ae9f; --rule: #3b4554; --panel: #222a35;
  --card: rgba(255, 255, 255, .035); --grid: rgba(190, 210, 235, .06);
  --link: #93bbef; --focus: #93bbef; --mark: #f29e78;
  --a1: #b8c97a; --a2: #c9a8ea; --a3: #e2bb5e; --a4: #72cdb7; --a5: #f29e78; --a6: #93bbef;
  --tag-bg: #283140; --tag-ink: #e2dacb; --tag-rule: #46516282;
  --code-bg: #141920; --th-bg: #262f3b;
  --btn-bg: #222a35; --btn-border: #7f8999; --tip-bg: #ede5d5; --tip-ink: #1a2029;
  --track-bg: rgba(26, 32, 41, .96); --shadow: rgba(0, 0, 0, .45); --gridframe: #4a5566;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.65;
  overflow-wrap: break-word; overflow-x: clip;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
}
a { color: var(--link); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--bg); color: var(--ink); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 16px; }
.sr { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 760px) { .wrap { padding: 0 40px; } }
img, canvas { max-width: 100%; }
p { margin: 0 0 18px; }
h1, h2, h3, h4 { font-family: var(--display); }
code, .tag { font-family: var(--mono); font-size: 12.5px; background: var(--tag-bg); color: var(--tag-ink); border: 1px solid var(--tag-rule); border-radius: 2px; padding: 0 5px; white-space: nowrap; }
.btn { font: inherit; font-family: var(--mono); font-size: 13px; background: var(--btn-bg); color: var(--ink); border: 1px solid var(--btn-border); border-radius: var(--radius); padding: 6px 14px; min-height: 40px; min-width: 44px; cursor: pointer; }
.btn:hover { border-color: var(--ink); }
.themebtn { position: absolute; top: 10px; right: 12px; z-index: 25; min-height: 36px; padding: 4px 10px; font-size: 12px; color: var(--muted); }
@media (min-width: 1280px) {
  .hero, main, footer, .ahead, .abar { margin-left: var(--rail); }
  .wrap { max-width: 1320px; }
}

/* ---------- Hero: the text grid replaying, cursor highlighted ---------- */
.hero { position: relative; padding: 56px 0 40px; border-bottom: 1px solid var(--rule); }
.hero-in { display: grid; gap: 32px; }
@media (min-width: 1000px) { .hero-in { grid-template-columns: minmax(0, 1fr) minmax(0, 520px); align-items: center; } }
.kicker { font-family: var(--mono); font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.kicker::before { content: "# "; color: var(--mark); }
.draft { font-family: var(--mono); border: 1px solid var(--mark); color: var(--mark); padding: 0 6px; margin-left: 6px; font-size: 11px; text-transform: uppercase; }
.hero h1 { font-size: clamp(32px, 4.4vw, 54px); line-height: 1.1; font-weight: 600; letter-spacing: -.01em; margin: 0 0 18px; }
.hero .dek { font-size: 19px; margin: 0 0 18px; }
.question { border-left: 3px solid var(--mark); padding-left: 14px; }
.question b { font-family: var(--mono); font-size: 12px; text-transform: uppercase; color: var(--mark); margin-right: 6px; }
.byline { font-family: var(--mono); font-size: 13px; color: var(--muted); margin: 0; }
.byline strong { color: var(--ink); }
.hero-fig { margin: 0; }
.hero-fig .asciiwrap { padding: 10px; background: #0b0b0d; border: 1px solid var(--gridframe); box-shadow: 4px 4px 0 var(--shadow); }
.hero-ctl { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.hero-cap { flex-basis: 100%; }

/* ---------- Rail on wide screens, top bar with progress on phones ---------- */
.track { position: sticky; top: 0; z-index: 20; background: var(--track-bg); border-bottom: 1px solid var(--rule); }
.track ol { position: relative; list-style: none; margin: 0; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.track a { display: block; white-space: nowrap; text-decoration: none; color: var(--muted); font-family: var(--mono); font-size: 13px; padding: 10px 8px; border-bottom: 3px solid transparent; }
.track a:hover { color: var(--ink); }
.track a.current { color: var(--ink); border-bottom-color: var(--accent-cur, var(--mark)); }
.track .td { display: none; }
.track .tag { font-size: 11px; padding: 0 4px; }
.track a[data-ch=c1] { --accent-cur: var(--a1); } .track a[data-ch=c2] { --accent-cur: var(--a2); } .track a[data-ch=c3] { --accent-cur: var(--a3); }
.track a[data-ch=c4] { --accent-cur: var(--a4); } .track a[data-ch=c5] { --accent-cur: var(--a5); } .track a[data-ch=c6] { --accent-cur: var(--a6); }
.track .prog { height: 4px; background: var(--rule); }
.track .prog i { display: block; height: 100%; width: calc(var(--progress, 0) * 100%); background: var(--mark); }
@media (min-width: 1280px) {
  .track { position: fixed; left: 0; top: 0; bottom: 0; width: var(--rail); border-right: 1px solid var(--rule); border-bottom: 0; padding: 28px 0 0 20px; background: var(--bg); overflow-y: auto; scrollbar-width: thin; }
  .track ol { flex-direction: column; gap: 0; padding: 0 12px 0 14px; border-left: 2px solid var(--rule); overflow: visible; }
  .track a { white-space: normal; border-bottom: 0; padding: 7px 0 8px; font-size: 13px; line-height: 1.35; position: relative; }
  .track a::before { content: ""; position: absolute; left: -21px; top: 11px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--rule); }
  .track a.current { font-weight: 600; }
  .track a.current::before { background: var(--accent-cur, var(--mark)); border-color: var(--accent-cur, var(--mark)); box-shadow: 0 0 0 4px var(--grid); }
  .track .td { display: block; font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 2px; }
  .track li.extra:not(.extra ~ .extra) { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--rule); }
  .track li.extra a { font-size: 12px; padding: 4px 0 5px; }
  .track li.extra a::before { top: 8px; width: 8px; height: 8px; left: -19px; }
  .track .prog { position: absolute; left: 20px; top: 28px; bottom: 28px; width: 2px; height: auto; background: transparent; }
  .track .prog i { width: 2px; height: calc(var(--progress, 0) * 100%); }
}

/* ---------- Sections ---------- */
.keys { padding: 48px 0 0; }
.keys h2, .tlsec h2, .plain h2 { font-family: var(--mono); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 14px; }
.keys h2::before, .tlsec h2::before, .plain h2::before { content: "## "; color: var(--mark); }
.keys ul { max-width: 860px; padding-left: 20px; margin: 0; }
.keys li { margin-bottom: 10px; }
.tlsec { padding: 48px 0 16px; }
.plain { padding: 40px 0 8px; }
.plain .wrap > p, .plain .wrap > dl { max-width: 860px; }
.plain + .plain { border-top: 1px dashed var(--rule); }

/* Version timeline: an axis of dates on wide screens, a list on phones */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.tl .d { display: block; font-family: var(--mono); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl .lab { font-family: var(--mono); font-size: 13px; }
.tl a { color: var(--ink); }
.tl .bar { display: none; }
.tl .axis { display: none; }
@media (min-width: 900px) {
  .tl { position: relative; height: calc(var(--rows) * 46px + 40px); border-bottom: 1px solid var(--rule); }
  .tl li { position: absolute; left: 0; right: 0; top: calc(var(--row) * 46px); height: 46px; border: 0; padding: 0; }
  .tl .bar { display: block; position: absolute; top: 10px; height: 8px; left: var(--x0); width: max(8px, var(--w)); border-radius: 4px; background: var(--accent, var(--ink)); }
  .tl li.side .bar { background: repeating-linear-gradient(90deg, var(--muted) 0 6px, transparent 6px 10px); }
  .tl .lab { position: absolute; top: 20px; left: var(--x0); white-space: nowrap; }
  .tl li.flip .lab { left: auto; right: calc(100% - var(--x1)); text-align: right; }
  .tl .d { display: inline; margin-right: 8px; }
  .tl .axis { display: block; position: absolute; bottom: 0; left: 0; right: 0; height: 30px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
  .tl .axis span { position: absolute; left: var(--x); transform: translateX(-50%); bottom: 4px; white-space: nowrap; }
  .tl .axis span:first-child { transform: none; }
  .tl .axis span:last-child { transform: translateX(-100%); }
}
.tl-more { list-style: none; margin: 14px 0 0; padding: 0; font-family: var(--mono); font-size: 13px; }
.tl-more li { padding: 4px 0; }
.tl-more .d { display: inline-block; min-width: 6em; color: var(--muted); }

/* Terms */
dl.terms { font-size: 15px; line-height: 1.5; margin: 0 0 8px; display: grid; grid-template-columns: 15em 1fr; gap: 8px 16px; }
dl.terms dt { font-family: var(--mono); font-size: 13.5px; font-weight: 600; padding-top: 1px; }
dl.terms dd { margin: 0; color: var(--muted); }
@media (max-width: 560px) { dl.terms { grid-template-columns: 1fr; gap: 0; } dl.terms dd { margin-bottom: 10px; } }

/* Stats (counters), inside their chapters */
.stats { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0 0 24px; padding: 14px 16px; list-style: none; border: 1px solid var(--rule); background: var(--card); max-width: 760px; }
.stats li { margin: 0; }
.stats .num { display: block; font-family: var(--mono); font-size: clamp(28px, 3.4vw, 40px); font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--accent, var(--ink)); }
.stats .what { display: block; font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------- Chapters ---------- */
.chapter { padding: 56px 0 32px; border-top: 2px solid var(--ink); margin-top: 24px; }
.chapter .head { max-width: 760px; }
.when { font-family: var(--mono); font-size: 14px; color: var(--muted); margin: 0 0 6px; }
.when::before { content: "> "; color: var(--accent); }
.when b { color: var(--accent); }
.chapter h2 { font-size: clamp(28px, 3.4vw, 42px); line-height: 1.15; margin: 0 0 16px; font-weight: 600; }
.lede { font-size: 19px; background: var(--card); border: 1px solid var(--rule); padding: 12px 14px; }
.lede strong { font-family: var(--mono); font-size: 14px; text-transform: uppercase; color: var(--accent); }
h3 { font-size: 20px; margin: 30px 0 6px; }
.split > * { min-width: 0; }
@media (min-width: 1000px) {
  .split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: start; }
  .split .text { max-width: 640px; grid-column: 1; grid-row: 1; }
  .split .pin { grid-column: 2; grid-row: 1; }
}
@media (min-width: 1000px) and (prefers-reduced-motion: no-preference) {
  .split .pin { position: sticky; top: var(--pin-top); }
}
figure { margin: 28px 0 32px; }
figure img { display: block; height: auto; }
figure.canvas img { background: #000; image-rendering: pixelated; }
figcaption { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; color: var(--muted); margin-top: 10px; }
figcaption b { color: var(--ink); }
.note, .evidence { font-family: var(--mono); line-height: 1.55; color: var(--muted); }
.note { font-size: 13.5px; border-left: 3px solid var(--accent, var(--rule)); background: var(--card); padding: 6px 10px 6px 14px; }
.note b, .evidence b { color: var(--ink); }
.evidence { font-size: 13px; border-top: 1px solid var(--rule); padding-top: 14px; margin-top: 28px; }
.evidence code, .evidence .tag { font-size: 12px; }
.findings { list-style: none; padding: 0; margin: 10px 0 18px; counter-reset: f; }
.findings > li { counter-increment: f; padding: 16px 0 6px 46px; position: relative; border-top: 1px solid var(--rule); }
.findings > li::before { content: counter(f); position: absolute; left: 0; top: 16px; font-family: var(--mono); font-size: 13px; width: 28px; height: 28px; border: 1px solid var(--muted); border-radius: 2px; text-align: center; line-height: 26px; color: var(--muted); }
.findings h4 { margin: 0 0 6px; font-size: 18px; line-height: 1.3; }
.findings p { margin: 0 0 10px; }
span.n { font-family: var(--mono); font-size: 12.5px; color: var(--muted); display: inline-block; }
.prelim { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--mark); font-weight: 600; background: var(--grid); padding: 0 4px; }
.sub { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin: 4px 0 12px; }
blockquote.title-q { font-style: italic; margin: 0 0 4px; padding-left: 14px; border-left: 2px solid var(--accent, var(--rule)); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid3 img { width: 100%; }
@media (max-width: 640px) { .grid3 { grid-template-columns: 1fr; } }

/* Margin notes on wide screens */
@media (min-width: 1280px) {
  .split { grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 40px; }
  .split .text { padding-right: 210px; max-width: none; }
  .split .text > *:not(.note) { max-width: 600px; }
  .split .text .note { float: right; clear: right; width: 190px; margin: 4px -210px 12px 0; }
  .split .text > h3, .split .text > .findings, .split .text > figure, .split .text > .evidence { clear: none; }
}

/* ---------- Replay player ---------- */
.player { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; }
.player .views { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 560px) { .player .views { grid-template-columns: 1fr; } }
.player canvas { display: block; width: 100%; aspect-ratio: 1; background: #000; image-rendering: pixelated; }
.player .lab { font-family: var(--mono); font-size: 12px; line-height: 1.4; color: var(--muted); margin: 0 0 6px; min-height: 2.8em; }
.asciiwrap { container-type: inline-size; width: 100%; }
pre.ascii { margin: 0; background: #0b0b0d; color: #70707a; padding: .3cqw 0 0; font-family: var(--mono); font-size: 1.64cqw; line-height: 1cqw; letter-spacing: 0; overflow: hidden; aspect-ratio: 1; white-space: pre; }
pre.ascii.zoom { font-size: 7.8cqw; line-height: 4.76cqw; padding-top: 0; }
pre.ascii .c { color: #e8e8ea; }
pre.ascii .cR { color: #ff4a40; } pre.ascii .cO { color: #ff9a2e; } pre.ascii .cY { color: #ffe040; }
pre.ascii .cG { color: #3fdc5a; } pre.ascii .cC { color: #33e0e6; } pre.ascii .cB { color: #5f92ff; }
pre.ascii .cP { color: #b46bff; } pre.ascii .cK { color: #ff9ec8; } pre.ascii .cW { color: #f2f2f2; }
pre.ascii .cA { color: #9a9a9a; } pre.ascii .cN { color: #c27e4a; } pre.ascii .cM { color: #ff40ff; }
pre.ascii .cL { color: #b8ff3a; } pre.ascii .cV { color: #7890e6; } pre.ascii .cX { color: #8a8a8a; }
pre.ascii .h { color: #000; background: #fff; }
.player .readout { font-family: var(--mono); font-size: 14px; margin-top: 12px; display: flex; gap: 6px 18px; flex-wrap: wrap; }
.player .readout b { font-family: var(--mono); font-weight: 600; }
.player .bar { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.player .bar button, .animbtn { font: inherit; font-family: var(--mono); font-size: 13px; background: var(--btn-bg); color: var(--ink); border: 1px solid var(--btn-border); border-radius: var(--radius); padding: 5px 12px; cursor: pointer; min-width: 44px; min-height: 40px; }
.animbtn { margin-top: 10px; }
.player input[type=range] { flex: 1 1 160px; min-width: 0; accent-color: var(--accent, var(--link)); min-height: 40px; }

/* ---------- Compare slider (chapter 6) ---------- */
.cmp { position: relative; aspect-ratio: 1; width: 100%; max-width: 560px; background: #000; overflow: hidden; touch-action: pan-y; border: 1px solid var(--gridframe); }
.cmp-base, .cmp-top { position: absolute; inset: 0; background-repeat: no-repeat; image-rendering: pixelated; }
.cmp-handle { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px #000; pointer-events: none; }
.cmp-handle::after { content: ""; position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: #fff; border: 2px solid #000; }
.cmp-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.cmp:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.cmp-tag { position: absolute; bottom: 8px; font-family: var(--mono); font-size: 12px; background: rgba(0,0,0,.78); color: #fff; padding: 2px 8px; border-radius: 2px; pointer-events: none; }
.cmp-tag.l { left: 8px; } .cmp-tag.r { right: 8px; }
.cmp-ctl { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-family: var(--mono); font-size: 13px; }
.cmp-ctl select { font: inherit; background: var(--btn-bg); color: var(--ink); border: 1px solid var(--btn-border); border-radius: var(--radius); padding: 6px 8px; min-height: 40px; max-width: 100%; }

/* ---------- Defined terms: definition on hover and focus ---------- */
.term { text-decoration: underline dotted; text-decoration-thickness: 1.5px; text-underline-offset: 4px; cursor: help; position: relative; }
.term .tip { display: none; position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; width: max-content; max-width: min(320px, 80vw); font-family: var(--mono); font-size: 13px; font-style: normal; font-weight: 400; line-height: 1.45; letter-spacing: 0; text-transform: none; padding: 8px 10px; border-radius: 2px; background: var(--tip-bg); color: var(--tip-ink); box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.term:hover .tip, .term:focus .tip { display: block; }
.term.tip-off .tip { display: none; }

footer { border-top: 2px solid var(--ink); padding: 32px 0 64px; margin-top: 32px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
footer p { margin: 0 0 8px; }

/* ---------- Appendix (pilot/): a dense report on the same paper ---------- */
.appendix .ahead, .appendix main, .appendix footer { max-width: 1080px; margin-left: auto; margin-right: auto; padding-left: 16px; padding-right: 16px; }
@media (min-width: 760px) { .appendix .ahead, .appendix main, .appendix footer { padding-left: 40px; padding-right: 40px; } }
@media (min-width: 1280px) { .appendix .ahead, .appendix main, .appendix footer { margin-left: calc(var(--rail) + max(0px, (100vw - var(--rail) - 1080px) / 2)); } }
.appendix .ahead { padding-top: 40px; padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
.appendix .ahead-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 22px; }
.appendix .back { font-family: var(--mono); font-size: 14px; margin: 0; }
.appendix .themebtn { position: static; }
.appendix .back a { display: inline-block; padding: 6px 12px; border: 1px solid var(--btn-border); background: var(--btn-bg); text-decoration: none; color: var(--ink); }
.appendix .back a:hover { border-color: var(--ink); }
.appendix h1 { font-size: clamp(26px, 3.2vw, 38px); line-height: 1.18; font-weight: 600; margin: 0 0 12px; max-width: 900px; }
.appendix .byline { font-size: 14px; margin: 0 0 4px; }
.appendix .meta { font-family: var(--mono); font-size: 13px; color: var(--muted); margin: 4px 0; max-width: 860px; }
.appendix main p, .appendix main li, .appendix main dl { max-width: 46rem; }
.appendix main { font-size: 16px; line-height: 1.6; }
.appendix h2 { font-size: 24px; font-weight: 600; margin: 56px 0 14px; padding-top: 18px; border-top: 2px solid var(--ink); }
.appendix h3 { font-size: 18px; margin: 30px 0 8px; }
.secnum { font-family: var(--mono); font-size: .62em; font-weight: 600; vertical-align: .22em; background: var(--tag-bg); color: var(--tag-ink); border: 1px solid var(--tag-rule); border-radius: 2px; padding: 1px 6px; margin-right: 6px; }
.appendix nav[aria-label="Contents"] ol { padding-left: 1.4rem; columns: 2; column-gap: 2rem; font-family: var(--mono); font-size: 14px; max-width: 46rem; }
@media (max-width: 34rem) { .appendix nav[aria-label="Contents"] ol { columns: 1; } }
.appendix nav[aria-label="Contents"] h2::before { content: "## "; color: var(--mark); }
.appendix nav[aria-label="Contents"] h2 { font-family: var(--mono); font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.abstract { background: var(--card); border: 1px solid var(--rule); padding: 4px 20px 12px; margin-top: 28px; max-width: 52rem; }
.abstract h2 { border-top: 0; margin-top: 14px; padding-top: 0; font-family: var(--mono); font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
dl.glossary { background: var(--card); border: 1px solid var(--rule); padding: 14px 20px; max-width: 52rem; }
dl.glossary dt { font-weight: 600; margin-top: 12px; }
dl.glossary dt:first-child { margin-top: 0; }
dl.glossary dd { margin: 3px 0 0 0; color: var(--muted); }
.appendix .term { font-variant: small-caps; letter-spacing: .02em; text-decoration: none; cursor: auto; position: static; }
.appendix code { font-size: 12.5px; }
.appendix figure { margin: 24px 0; max-width: 52rem; }
.appendix figure img { width: 100%; height: auto; border: 1px solid var(--rule); background: #fff; }
.appendix figcaption { font-size: 12.5px; }
.canvas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 16px 0 8px; max-width: 52rem; }
.canvas-grid figure { margin: 0; }
.canvas-grid img { background: #000 !important; image-rendering: pixelated; }
ol.obs { padding-left: 1.6rem; }
ol.obs > li { margin-bottom: 18px; }
ol.obs > li::marker { font-family: var(--mono); font-size: 13px; color: var(--mark); }
.caveat { display: block; font-family: var(--mono); font-size: 13px; line-height: 1.5; color: var(--muted); margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--rule); }
.caveat::before { content: "Caveat: "; font-weight: 600; color: var(--mark); }
.status { font-family: var(--mono); font-size: 12.5px; font-weight: 600; white-space: nowrap; }

/* Tables: mono numbers, right-aligned numeric columns, a sticky header row.
   Below 1280px each table scrolls inside its own frame (both ways), so the
   header stays in view; on wide screens it sticks to the top of the window. */
.table-wrap { margin: 18px 0 24px; border: 1px solid var(--rule); background: var(--bg); position: relative; }
.table-wrap table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; line-height: 1.45; }
.table-wrap caption { text-align: left; caption-side: top; padding: 9px 12px; font-family: var(--mono); font-size: 13px; font-weight: 600; background: var(--card); border-bottom: 1px solid var(--rule); }
.table-wrap th, .table-wrap td { padding: 7px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.table-wrap tbody tr:last-child td { border-bottom: 0; }
.table-wrap th { position: sticky; top: 0; z-index: 2; background: var(--th-bg); font-family: var(--mono); font-size: 12px; font-weight: 600; line-height: 1.35; box-shadow: 0 1px 0 var(--rule); border-bottom: 0; }
.table-wrap td.n, .table-wrap th.n { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap td.n { font-family: var(--mono); font-size: 13px; white-space: normal; overflow-wrap: normal; min-width: 4.5em; }  /* a number has no spaces, so it stays on one line */
.table-wrap tbody tr:nth-child(even) td { background: var(--card); }
@media (max-width: 1279px) {
  .table-wrap { overflow: auto; max-height: 78vh; overscroll-behavior: contain; }
  .table-wrap caption { position: sticky; left: 0; }
}
@media (min-width: 1280px) { .table-wrap { overflow: visible; } }

/* Code blocks (copy button; scroll inside the block) */
pre.code { font-family: var(--mono); font-size: 13px; line-height: 1.5; background: var(--code-bg); color: var(--ink); border: 1px solid var(--rule); padding: 12px 14px; overflow-x: auto; white-space: pre; margin: 6px 0 20px; }
.copybtn { float: right; margin: 0 0 4px 8px; min-height: 32px; padding: 2px 10px; font-size: 12px; }

/* The appendix rail: a way back first, section numbers as tags */
.track .railback { font-weight: 600; color: var(--link); }
@media (min-width: 1280px) {
  .track .railback { margin-bottom: 8px; }
  .track .railback::before { display: none; }
}
.appendix footer { border-top: 2px solid var(--ink); }
.appendix .abar { position: relative; z-index: 21; }

/* Chapter 4: one canvas large, thumbnails to switch (all three show without script) */
@media (min-width: 1000px) {
  .split.wide-pin { grid-template-columns: minmax(0, 1fr) minmax(480px, 520px); }
}
@media (min-width: 1280px) { .split.wide-pin .text { padding-right: 0; } }
.switcher .sw-panel img { display: block; width: 100%; height: auto; background: #000; image-rendering: pixelated; border: 1px solid var(--gridframe); }
.switcher .sw-panel .sub { margin: 8px 0 14px; }
.switcher.js-on .sw-panel:not(.on) { display: none; }
.sw-thumbs { display: flex; gap: 10px; margin: 2px 0 6px; }
.sw-thumb { padding: 0; width: 84px; height: 84px; background: #000; border: 2px solid var(--rule); border-radius: var(--radius); cursor: pointer; }
.sw-thumb img { display: block; width: 100%; height: 100%; image-rendering: pixelated; opacity: .7; }
.sw-thumb:hover img, .sw-thumb[aria-pressed="true"] img { opacity: 1; }
.sw-thumb[aria-pressed="true"] { border-color: var(--accent, var(--ink)); box-shadow: 0 0 0 2px var(--accent, var(--ink)); }

/* Appendix charts as pasted-in printouts: light paper in both themes, charts not recolored */
.appendix figure.printout { position: relative; background: #fdfcf8; border: 1px solid #cfc8b6; box-shadow: 5px 5px 0 var(--shadow); padding: 34px 16px 12px; margin: 28px 6px 30px 0; max-width: 46rem; }
.appendix figure.printout img { border: 0; background: #fff; }
.appendix figure.printout figcaption { color: #4c4a44; }
.appendix figure.printout figcaption b { color: #1d1d1f; }
.appendix figure.printout .figtag { position: absolute; top: 10px; left: 16px; background: #ebe6d8; color: #3b382f; border-color: #d0c9b5; }

/* Appendix queries: collapsed under what they produced */
details.query { margin: -14px 0 24px; max-width: 100%; }
details.query summary { display: inline-block; cursor: pointer; font-family: var(--mono); font-size: 12.5px; color: var(--link); padding: 6px 10px; border: 1px solid var(--rule); background: var(--card); list-style: none; }
details.query summary::-webkit-details-marker { display: none; }
details.query summary::before { content: "+ "; color: var(--mark); }
details.query[open] summary::before { content: "- "; }
details.query summary:hover { border-color: var(--btn-border); }
details.query[open] { border-left: 2px solid var(--rule); padding-left: 10px; }
details.query .copybtn { float: none; margin: 8px 0 0; }
details.query pre.code { margin-top: 8px; max-height: 480px; overflow: auto; }
li details.query { margin-top: 0; }
pre.code code { white-space: inherit; background: none; border: 0; padding: 0; font-size: inherit; color: inherit; border-radius: 0; }
.canvas-grid + details.query { margin-top: 6px; }
