/* The Rabbit Hole: an encyclopaedia of Riley.
   A modernist reference book: strict grid, hairline rules, numbered sections,
   marginal numbers, big confident serif against a clean grotesk. */

:root {
  --paper: #FBFBF8;
  --ink: #121212;
  --cobalt: #2747D9;
  --cobalt-deep: #1A33A8;
  --hl: #F7E463;
  --grey: #E7E7E2;
  --ink-2: #474742;
  --ink-3: #6B6B65;
  --hair: rgba(18, 18, 18, 0.16);
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --pad: 20px;
  --bar: 54px;
  --dock: 70px;
  --ease: cubic-bezier(0.2, 0.85, 0.25, 1);
  --dur: 340ms;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }
html.hole-open { overflow: hidden; }
body {
  margin: 0;
  font: 400 17px/1.58 var(--sans);
  font-optical-sizing: auto;
  font-feature-settings: "cv11", "ss03";
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
:focus-visible { outline: 2.5px solid var(--cobalt); outline-offset: 3px; border-radius: 2px; }
[hidden] { display: none !important; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 14px; font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }
.noscript { padding: 24px; font-size: 18px; }

/* small caps labels */
.lab {
  font: 600 11.5px/1.25 var(--sans);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-feature-settings: "case", "tnum";
  color: var(--ink-2);
}

/* ---------- links ---------- */
.lnk {
  color: var(--cobalt);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.17em;
  text-decoration-color: rgba(39, 71, 217, 0.42);
  border-radius: 2px;
  transition: text-decoration-color 0.15s, background-color 0.3s;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.lnk:hover { text-decoration-color: currentColor; }
.lnk-w { text-decoration-style: dotted; text-decoration-thickness: 2px; text-decoration-color: rgba(39, 71, 217, 0.7); }
.nw { white-space: nowrap; }
.lnk-mark, .lnk-key {
  font: 600 0.62em/0 var(--sans);
  vertical-align: 0.42em;
  margin-left: 0.1em;
  text-decoration: none;
  display: inline-block;
}
.lnk.pressed { animation: pressed 0.6s ease-out; }
@keyframes pressed { 0% { background-color: var(--hl); } 100% { background-color: transparent; } }

/* footnote marks */
sup.fn { line-height: 0; font-size: 100%; vertical-align: baseline; }
sup.fn a {
  position: relative; top: -0.55em;
  font: 600 11px/1 var(--sans);
  font-feature-settings: "tnum";
  color: var(--cobalt);
  text-decoration: none;
  padding: 3px 2px 3px 2px;
  margin-left: 1px;
  border-radius: 3px;
}
sup.fn a::before { content: "["; opacity: 0.55; }
sup.fn a::after { content: "]"; opacity: 0.55; }
sup.fn-named a { font-style: italic; font-weight: 500; }
sup.fn-named a::before, sup.fn-named a::after { content: none; }
sup.fn a.on { background: var(--hl); color: var(--ink); }

/* ---------- the bar ---------- */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 60;
  height: calc(var(--bar) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) calc(var(--pad) - 6px) 0 var(--pad);
  display: flex; align-items: center; gap: 10px;
  background: rgba(251, 251, 248, 0.94);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s;
}
.bar.scrolled, .in-hole .bar { border-bottom-color: var(--ink); }
.bar-mark {
  font: 400 27px/1 var(--serif); letter-spacing: -0.02em; text-decoration: none;
  display: inline-flex; align-items: baseline;
  opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.25s var(--ease);
  pointer-events: none;
}
.bar.scrolled .bar-mark { opacity: 1; transform: none; pointer-events: auto; }
.in-hole .bar-mark { display: none; }
.bar-dot { display: inline-block; width: 0.22em; height: 0.22em; margin-left: 0.04em; }
.bar-dot svg { width: 100%; height: 100%; }
.crumbs { display: none; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.crumbs.over { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22px); mask-image: linear-gradient(90deg, transparent 0, #000 22px); }
.crumbs::-webkit-scrollbar { display: none; }
.in-hole .crumbs { display: block; }
.crumbs ol { display: flex; align-items: center; white-space: nowrap; padding-left: 4px; }
.crumbs li { display: flex; align-items: center; font: 500 13.5px/1 var(--sans); color: var(--ink-3); }
.crumbs li + li::before { content: "↘"; font-size: 10px; margin: 0 7px 0 6px; color: var(--ink-3); transform: translateY(1px); }
.crumbs button { padding: 10px 0; color: var(--ink-2); }
.crumbs button:hover { color: var(--cobalt); }
.crumbs li[aria-current] { color: var(--ink); font-weight: 650; }
.bar-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; flex: none; }
.bar-letter {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 13px 0 11px;
  border: 1.5px solid var(--ink);
  font: 600 14px/1 var(--sans);
  background: var(--paper);
  transition: background 0.2s, color 0.2s;
}
.bar-letter:hover, .bar-letter.is-here { background: var(--ink); color: var(--paper); }
.bar-letter:active { transform: translateY(1px); }
.bar-sound { width: 40px; height: 38px; display: grid; place-items: center; }
.ico { display: inline-grid; place-items: center; }
.ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico svg .fill { fill: currentColor; stroke: none; }
.bar-sound .ico svg { width: 23px; height: 23px; }

/* ======================================================================
   TITLE PAGE
   ====================================================================== */
.hero {
  position: relative;
  padding: calc(var(--bar) + env(safe-area-inset-top) + 14px) var(--pad) 44px;
}
.hero-meta { display: flex; justify-content: space-between; gap: 12px; border-top: 2.5px solid var(--ink); padding-top: 9px; }
.hero-meta span:last-child { text-align: right; }
.hero-head { position: relative; }
.hero-title {
  font: 400 min(45.5vw, 400px)/0.8 var(--serif);
  letter-spacing: -0.045em;
  margin: 0.13em 0 0 -0.055em;
  white-space: nowrap;
  display: flex; align-items: baseline;
  width: max-content;
}
.wilson-dot {
  width: 0.205em; height: 0.205em;
  margin-left: 0.03em;
  position: relative; top: 0.005em;
  flex: none;
  border-radius: 50%;
  touch-action: manipulation;
}
.wilson-dot::after { content: ""; position: absolute; inset: -40%; border-radius: 50%; }
.wilson-dot svg { width: 100%; height: 100%; overflow: visible; transform-origin: 50% 100%; }
.hero-ipa { display: flex; align-items: center; gap: 14px; margin-top: 18px; min-height: 30px; font: 400 15px/1.3 var(--sans); color: var(--ink-2); }
.ipa { font: 400 17px/1 var(--sans); color: var(--ink-2); border-bottom: 1.5px dotted var(--ink-3); padding: 4px 0; letter-spacing: 0.01em; }
.ipa.said { animation: pressed 0.9s ease-out; }
.ipa::before { content: ""; display: inline-block; width: 0; height: 0; border-left: 7px solid currentColor; border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; margin-right: 7px; transform: translateY(-1px); }
.hero-callout {
  position: absolute; left: var(--dot-x, 80%); top: 100%; transform: translateX(-50%);
  font: 500 12.5px/1 var(--sans); color: var(--ink-2); white-space: nowrap;
  display: flex; flex-direction: column; align-items: center;
}
.co-text { display: block; }
.hero-callout { pointer-events: auto; }
.co-line { display: block; width: 1px; height: var(--co-h, 16px); background: var(--ink); margin-bottom: 5px; transform: translateX(var(--co-shift, 0px)); }
.hero-callout a { color: var(--cobalt); text-decoration: none; border-bottom: 1px solid rgba(39, 71, 217, 0.4); }
.hero-lead { margin-top: 30px; }
.hero-lead p:first-child { font: 400 21px/1.45 var(--sans); letter-spacing: -0.014em; text-wrap: pretty; }
.hero-lead strong { font-weight: 700; }
.hero-more { margin-top: 14px; font: 500 15px/1.4 var(--sans); }
.hero-more .lnk::after { content: " →"; }
.hero-actions { display: grid; gap: 10px; margin-top: 30px; }
.cta {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-items: end;
  padding: 14px 16px 15px; min-height: 84px;
  text-decoration: none;
  border: 2px solid var(--ink);
  transition: transform 0.15s var(--ease), background 0.2s;
}
.cta:active { transform: scale(0.985); }
.cta-k { grid-column: 1; font: 600 11px/1.2 var(--sans); letter-spacing: 0.13em; text-transform: uppercase; opacity: 0.75; align-self: start; }
.cta-t { grid-column: 1; font: 400 29px/1 var(--serif); letter-spacing: -0.01em; margin-top: 10px; }
.cta-arrow { grid-column: 2; grid-row: 1 / span 2; align-self: center; font: 400 38px/1 var(--serif); }
.cta-ink { background: var(--ink); color: var(--paper); }
.cta-ink:hover { background: #000; }
.cta-line { color: var(--cobalt); border-color: var(--cobalt); background: var(--paper); }
.cta-line:hover { background: rgba(39, 71, 217, 0.05); }
.hero-how { margin-top: 26px; font: 400 15px/1.5 var(--sans); color: var(--ink-2); max-width: 36em; }
.hero-how .lab { display: block; margin-bottom: 6px; }
.hero-how a { color: var(--cobalt); }
.hero-ledger { display: none; }
.hero-margin { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 34px; border-top: 1px solid var(--hair); padding-top: 14px; }

/* maths doodles */
.doodle { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); border-radius: 4px; padding: 4px; transition: background 0.2s, transform 0.2s var(--ease); }
.doodle:active { transform: scale(0.96); background: rgba(247, 228, 99, 0.6); }
.doodle svg { width: 100%; height: auto; overflow: visible; }
.doodle .d-math { font: italic 400 34px/1 var(--serif); fill: var(--ink); }
.doodle .d-sup { font-size: 21px; }
.doodle .d-it { font: italic 400 22px/1 var(--serif); fill: var(--ink); }
.doodle .d-small { font: 500 12.5px/1 var(--sans); fill: var(--ink-2); }
.doodle .d-line { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.doodle .d-thin { fill: none; stroke: var(--ink-3); stroke-width: 0.9; }
.doodle-lab { font: 500 11px/1.25 var(--sans); color: var(--cobalt); }
.doodle-lab .lnk-mark { font-size: 9px; }
.draw { stroke-dasharray: 1; stroke-dashoffset: 0; }
.doodle:not(.drawn) .draw, [data-draw]:not(.drawn) .draw { stroke-dashoffset: 1; }
.doodle .draw, [data-draw] .draw { transition: stroke-dashoffset 1.4s cubic-bezier(0.6, 0, 0.3, 1) 0.15s; }

/* ======================================================================
   SECTIONS
   ====================================================================== */
.sec { position: relative; padding: 46px var(--pad) 58px; border-top: 1px solid var(--ink); }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 28px; }
.sec-head h2.lab { font: 600 11.5px/1.25 var(--sans); }
.sec-title { font: 400 52px/0.95 var(--serif); letter-spacing: -0.02em; }

/* ---------- preface ---------- */
.preface { transition: background-color 0.8s; }
.preface.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 30% { background-color: rgba(247, 228, 99, 0.35); } 100% { background-color: transparent; } }
.letter { position: relative; }
.letter-deck { font: italic 400 46px/0.98 var(--serif); letter-spacing: -0.015em; margin-bottom: 30px; }
.letter-greet { font: italic 400 31px/1.1 var(--serif); margin-bottom: 14px; }
.letter-text p { font: 400 24.5px/1.36 var(--serif); letter-spacing: 0.002em; text-wrap: pretty; hanging-punctuation: first; margin-bottom: 0.7em; }
.letter-text p.first::first-letter {
  float: left; font-size: 3.75em; line-height: 0.74; margin: 0.06em 0.07em -0.05em -0.02em; color: var(--ink);
}
.hl-mark {
  color: inherit;
  background: linear-gradient(104deg, transparent 0.25em, var(--hl) 0.35em, var(--hl) calc(100% - 0.25em), transparent 100%) no-repeat 0 0.14em / 0% 82%;
  transition: background-size 1.5s cubic-bezier(0.6, 0.05, 0.3, 1) 0.35s;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  padding: 0 0.12em; margin: 0 -0.12em;
}
.hl-mark.drawn, .hl-mark.on { background-size: 100% 82%; }
.letter-sign { margin-top: 26px; display: flex; flex-direction: column; }
.ls-off { font: italic 400 26px/1.1 var(--serif); }
.ls-name { font: italic 400 76px/0.95 var(--serif); letter-spacing: -0.02em; margin-top: 4px; }
.ls-name::after { content: ""; display: block; width: 2.1em; height: 2px; background: var(--ink); margin-top: 8px; }
.letter-cites { margin-top: 34px; border-top: 1px solid var(--hair); padding-top: 12px; }
.letter-cites ul { margin-top: 8px; display: grid; gap: 6px; }
.letter-cites li { font: 400 15px/1.35 var(--sans); }
.cf { font: italic 400 17px/1 var(--serif); color: var(--ink-3); margin-right: 2px; }
.cite-anchor { display: inline; }
.letter-imgs { display: flex; gap: 10px; margin-top: 24px; overflow-x: auto; }
.letter-img img { height: 180px; width: auto; border: 1px solid var(--ink); }
.letter-pending { position: relative; padding: 4px 0 8px; }
.lp-stamp { display: inline-block; margin: 0 0 22px; transform: rotate(-4deg); }
.lp-stamp span { display: inline-block; border: 2.5px solid var(--cobalt); color: var(--cobalt); font: 700 15px/1 var(--sans); letter-spacing: 0.24em; text-transform: uppercase; padding: 10px 12px 9px 15px; outline: 1px solid var(--cobalt); outline-offset: 3px; }
.lp-text { font: 400 22px/1.38 var(--serif); margin-bottom: 0.7em; max-width: 30em; color: var(--ink-2); }
.lp-text .lnk { color: var(--cobalt); }

/* ---------- did you know ---------- */
.dyk { background: var(--grey); border-top-color: var(--ink); }
.dyk-text { font: 400 30px/1.14 var(--serif); letter-spacing: -0.01em; text-wrap: pretty; min-height: 3.42em; transition: opacity 0.16s, transform 0.16s; }
.dyk-text.out { opacity: 0; transform: translateY(-6px); }
.dyk-text.in { opacity: 0; transform: translateY(8px); transition: none; }
.dyk-next { display: inline-flex; align-items: center; gap: 6px; font: 600 13px/1 var(--sans); padding: 9px 12px 9px 10px; border: 1.5px solid var(--ink); background: var(--paper); }
.dyk-next:active { transform: rotate(-2deg) scale(0.97); }
.dyk-next .ico svg { width: 17px; height: 17px; }

/* ---------- contents ---------- */
.toc { border-bottom: 1px solid var(--ink); }
.toc-row a {
  display: grid; grid-template-columns: 42px 1fr 22px; column-gap: 6px; align-items: baseline;
  padding: 14px 0 15px; border-top: 1px solid var(--hair);
  text-decoration: none; color: var(--ink);
  transition: background 0.2s;
}
.toc-row:first-child a { border-top-color: var(--ink); }
.toc-row a:active { background: rgba(247, 228, 99, 0.55); }
.toc-n { grid-column: 1; grid-row: 1; font: 600 12px/1 var(--sans); font-feature-settings: "tnum"; color: var(--ink-3); letter-spacing: 0.04em; transform: translateY(-3px); }
.toc-t { grid-column: 2; grid-row: 1; font: 400 33px/1 var(--serif); letter-spacing: -0.015em; color: var(--ink); transition: color 0.2s; }
.toc-row a:hover .toc-t { color: var(--cobalt); }
.toc-d { grid-column: 2; grid-row: 2; font: 400 14.5px/1.35 var(--sans); color: var(--ink-2); margin-top: 5px; }
.toc-check { grid-column: 3; grid-row: 1; align-self: center; width: 18px; height: 18px; border: 1.5px solid var(--hair); border-radius: 50%; }
.is-read .toc-check { border-color: var(--cobalt); background: var(--cobalt) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M5 9.4l2.6 2.6L13 6.6' fill='none' stroke='%23FBFBF8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat; }
.toc-front .toc-t, .toc-back .toc-t { font-style: italic; }
.toc-front .toc-n, .toc-back .toc-n { font-style: normal; }

/* ---------- reading room ---------- */
.room { background: var(--ink); color: var(--paper); border-top: 0; overflow: hidden; }
.room .lab { color: rgba(251, 251, 248, 0.7); }
.room-title { font: 400 64px/0.9 var(--serif); letter-spacing: -0.025em; margin-bottom: 18px; }
.room-title em { color: var(--hl); }
.room-text { font: 400 17px/1.55 var(--sans); color: rgba(251, 251, 248, 0.82); max-width: 32em; }
.room-go {
  position: relative; display: grid; place-items: center;
  width: 196px; height: 196px; margin: 34px auto 30px;
  border-radius: 50%; background: var(--hl); color: var(--ink); text-decoration: none;
  transition: transform 0.2s var(--ease);
  box-shadow: 0 0 0 0 rgba(247, 228, 99, 0.45);
  animation: breathe 2.8s ease-in-out infinite;
}
.room-go:active { transform: scale(0.95); }
.room-go-label { font: 400 33px/0.95 var(--serif); text-align: center; max-width: 4.5em; }
.room-go-ring { position: absolute; inset: -14px; border-radius: 50%; border: 1.5px dashed rgba(247, 228, 99, 0.6); animation: spin 26s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(247, 228, 99, 0.35); } 50% { box-shadow: 0 0 0 16px rgba(247, 228, 99, 0); } }
.room-tally, .reader-tally { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid rgba(251, 251, 248, 0.35); }
.room-tally div, .reader-tally div { padding: 12px 12px 0 0; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.room-tally div + div, .reader-tally div + div { border-left: 1px solid rgba(251, 251, 248, 0.35); padding-left: 12px; }
.room-tally dt, .reader-tally dt { font: 600 10.5px/1.3 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: rgba(251, 251, 248, 0.7); }
.room-tally dd, .reader-tally dd { font: 400 54px/0.9 var(--serif); color: var(--hl); font-feature-settings: "tnum"; }

/* ---------- pen trainer ---------- */
.pen-intro p { margin-top: 14px; max-width: 34em; color: var(--ink-2); }
.pen-intro .sec-title { margin-top: -6px; }
.pen-host { margin-top: 24px; }
.pen-stage {
  position: relative; height: 410px;
  border: 1.5px solid var(--ink);
  background-color: #fff;
  background-image: linear-gradient(rgba(18, 18, 18, 0.055) 1px, transparent 1px), linear-gradient(90deg, rgba(18, 18, 18, 0.055) 1px, transparent 1px);
  background-size: 20px 20px;
  background-position: -1px -1px;
  touch-action: none; user-select: none; -webkit-user-select: none;
  overflow: hidden; cursor: grab;
}
.pen-stage:active { cursor: grabbing; }
.pen-canvas { position: absolute; inset: 0; }
.pen-call {
  position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%) scale(0.9); opacity: 0;
  font: italic 400 38px/1 var(--serif); white-space: nowrap; text-align: center;
  padding: 4px 12px 6px; pointer-events: none;
  transition: opacity 0.2s, transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
  max-width: 92%; white-space: normal; width: max-content;
}
.pen-call.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.pen-call.good { background: var(--hl); }
.pen-call.bad { color: var(--ink-2); }
.pen-hint { position: absolute; left: 34px; top: 12px; right: 74px; font: 500 13px/1.35 var(--sans); color: var(--ink-2); transition: opacity 0.4s; pointer-events: none; }
.pen-hint-2 { display: block; color: var(--ink-3); }
.pen.tried .pen-hint { opacity: 0; }
.pen-fig { position: absolute; right: 10px; top: 12px; font: 600 10.5px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); pointer-events: none; }
.pen-under { display: flex; align-items: stretch; justify-content: space-between; gap: 10px; margin-top: 12px; }
.pen-stats { display: flex; gap: 0; flex: 1; }
.pen-stats div { flex: 1; padding-right: 10px; }
.pen-stats div + div { border-left: 1px solid var(--hair); padding-left: 10px; }
.pen-stats dt { font: 600 10.5px/1.2 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.pen-stats dd { font: 400 44px/0.95 var(--serif); font-feature-settings: "tnum"; margin-top: 4px; }
.pen-auto { flex: none; align-self: center; font: 600 13px/1.15 var(--sans); padding: 10px 12px; border: 1.5px solid var(--ink); max-width: 7.5em; text-align: left; background: var(--paper); }
.pen-auto:active { transform: translateY(1px); }
.pen-readout { margin-top: 10px; font: 500 12.5px/1.4 var(--sans); font-feature-settings: "tnum"; color: var(--ink-3); }

/* ---------- plates ---------- */
.plates-sec .plates {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad) 8px; scroll-padding: 0 var(--pad);
  scrollbar-width: none;
}
.plates-sec .plates::-webkit-scrollbar { display: none; }
.plate { flex: none; scroll-snap-align: start; }
.plates-sec .plate { width: calc(300px * var(--r)); max-width: 86vw; }
.plate-btn { display: block; width: 100%; aspect-ratio: var(--r); overflow: hidden; background: var(--grey); position: relative; }
.plate-btn img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.plate-btn:active img { transform: scale(0.98); }
.plate figcaption { font: 400 14px/1.4 var(--sans); color: var(--ink-2); margin-top: 8px; padding-right: 8px; }
.pl-n { font: 600 11px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); margin-right: 4px; }
.blk.plates { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.blk.plates .plate-btn { aspect-ratio: 1; }
.blk.plates figcaption { font-size: 13px; }

/* ---------- classes ---------- */
.classes { width: 100%; border-collapse: collapse; font-feature-settings: "tnum"; }
.classes th { text-align: left; font: 600 10.5px/1.2 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); padding: 0 8px 10px 0; border-bottom: 1.5px solid var(--ink); }
.classes td { padding: 13px 8px 13px 0; border-bottom: 1px solid var(--hair); vertical-align: baseline; font-size: 15px; }
.classes .c-n { font: 600 12px/1 var(--sans); color: var(--ink-3); width: 2.6em; }
.classes .c-name { font: 400 23px/1.05 var(--serif); }
.classes .c-year { white-space: nowrap; color: var(--ink-2); }
.classes .c-teacher { color: var(--ink-2); }

@media (max-width: 639px) {
  .classes thead { display: none; }
  .classes tr { display: grid; grid-template-columns: 38px 1fr; padding: 12px 0 13px; border-bottom: 1px solid var(--hair); }
  .classes tr:first-child { border-top: 1.5px solid var(--ink); }
  .classes td { border: 0; padding: 0; }
  .classes .c-n { grid-row: 1 / span 2; padding-top: 7px; }
  .classes .c-name { grid-column: 2; font-size: 27px; }
  .classes .c-year, .classes .c-teacher { grid-column: 2; display: inline; font-size: 14.5px; margin-top: 4px; }
  .classes .c-year { grid-row: 2; }
  .classes .c-teacher { grid-row: 3; margin-top: 0; }
}

/* ---------- index ---------- */
.index { columns: 2; column-gap: 22px; }
.ix-group { break-inside: avoid; margin-bottom: 20px; }
.ix-letter { font: 400 40px/1 var(--serif); border-bottom: 1px solid var(--ink); padding-bottom: 4px; margin-bottom: 8px; }
.ix-group li { font: 400 15px/1.3 var(--sans); padding: 4px 0; }
.ix-refs { font: 500 11.5px/1 var(--sans); color: var(--ink-3); font-feature-settings: "tnum"; white-space: nowrap; }
.lnk-key { color: var(--cobalt); font-size: 12px; vertical-align: 0.2em; margin: 0 2px 0 0; }

/* ---------- colophon ---------- */
.colophon { border-top: 2.5px solid var(--ink); padding: 34px var(--pad) calc(60px + env(safe-area-inset-bottom)); display: grid; gap: 22px; }
.colo-mark { font: 400 108px/0.8 var(--serif); letter-spacing: -0.045em; display: flex; align-items: baseline; }
.colo-mark .bar-dot { width: 0.205em; height: 0.205em; }
.colo-text p { font: 400 15px/1.55 var(--sans); color: var(--ink-2); max-width: 36em; }
.colo-text p + p { margin-top: 12px; }
.colo-text a { color: var(--cobalt); }
.colo-top { font-weight: 600; text-decoration: none; }

/* ======================================================================
   WILSON
   ====================================================================== */
.wilson { overflow: visible; }
.wilson .w-ball { fill: #fff; }
.wilson .w-shade { fill: rgba(18, 18, 18, 0.075); }
.wilson .w-seam { fill: none; stroke: #C9C9C0; stroke-width: 2.8; stroke-linecap: round; }
.wilson .w-rim { fill: none; stroke: var(--ink); stroke-width: 3.4; }
.wilson .w-eye { fill: none; stroke: var(--ink); stroke-width: 7; stroke-linecap: round; transform-box: fill-box; transform-origin: 50% 50%; transition: transform 0.08s; }
.wilson .w-mouth { fill: none; stroke: var(--ink); stroke-width: 5.4; stroke-linecap: round; }
.wilson .w-face { transition: transform 0.3s ease-out; }
.wilson .w-face.blink .w-eye { transform: scaleY(0.12); }
.wilson.is-mini .w-seam, .wilson.is-mini .w-shade { display: none; }
.wilson.is-mini .w-rim { stroke-width: 7; }
.wilson.is-mini .w-eye { stroke-width: 9; }
.wilson.is-mini .w-mouth { stroke-width: 8; }

.wilson-peek {
  position: absolute; right: 0; bottom: calc(var(--dock) + env(safe-area-inset-bottom) + 26px); z-index: 6;
  width: 76px; height: 76px;
  transform: translateX(120%) rotate(80deg);
  transition: transform 0.7s cubic-bezier(0.3, 1.5, 0.5, 1);
  pointer-events: none;
}
.wilson-peek.in { transform: translateX(34%) rotate(-14deg); pointer-events: auto; }
.wilson-peek svg { width: 100%; height: 100%; transform-origin: 50% 100%; }

.blk-wilson { position: relative; height: 250px; display: grid; place-items: end center; border: 1.5px solid var(--ink); background: #fff; overflow: hidden; }
.wb-ball { width: 118px; height: 118px; margin-bottom: 44px; position: relative; z-index: 1; touch-action: manipulation; }
.wb-ball svg { width: 100%; height: 100%; transform-origin: 50% 100%; }
.wb-floor { position: absolute; left: 0; right: 0; bottom: 43px; height: 1px; background: var(--ink); }
.wb-count { position: absolute; left: 12px; top: 12px; }
.wb-count b { font: 400 22px/1 var(--serif); letter-spacing: 0; color: var(--ink); text-transform: none; margin-left: 4px; }

/* ======================================================================
   THE RABBIT HOLE
   ====================================================================== */
.hole { position: fixed; inset: 0; z-index: 40; }
.hole-scrim { position: absolute; inset: 0; background: rgba(18, 18, 18, 0.3); opacity: 0; transition: opacity var(--dur) ease; }
.hole.open .hole-scrim { opacity: 1; }
.stack { position: absolute; inset: 0; }
.page {
  position: absolute; top: 0; bottom: 0; left: 0; width: 100%;
  background: var(--paper);
  transition: transform var(--dur) var(--ease);
  box-shadow: -1px 0 0 rgba(18, 18, 18, 0.12), -26px 0 44px -18px rgba(18, 18, 18, 0.35);
  will-change: transform;
  contain: layout;
}
.page-shade { position: absolute; inset: 0; background: var(--ink); opacity: calc(var(--shade, 0) * 0.22); pointer-events: none; transition: opacity var(--dur) ease; z-index: 2; }
.dragging .page, .dragging .page-shade { transition: none !important; }
.page-scroll {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: calc(var(--bar) + env(safe-area-inset-top) + 26px) var(--pad) calc(var(--dock) + env(safe-area-inset-bottom) + 56px);
}
.page-inner { max-width: 660px; margin: 0 auto; }
.page-spine { display: none; }

/* article head */
.art-head { border-bottom: 2.5px solid var(--ink); padding-bottom: 16px; margin-bottom: 22px; }
.art-kicker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.k-sec { color: var(--cobalt); }
.k-live { display: inline-flex; align-items: center; gap: 6px; background: var(--hl); color: var(--ink); padding: 4px 7px 3px; letter-spacing: 0.13em; }
.k-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); animation: live 1.6s ease-in-out infinite; }
.k-live.k-off { background: var(--grey); }
.k-live.k-off::before { animation: none; background: var(--ink-3); }
@keyframes live { 50% { opacity: 0.25; } }
.k-status { letter-spacing: 0.06em; text-transform: none; font-weight: 500; font-size: 12px; color: var(--ink-3); }
.art-title {
  font: 400 clamp(46px, 15vw, 82px)/0.92 var(--serif);
  letter-spacing: -0.025em;
  margin: 18px 0 0 -0.04em;
  overflow-wrap: anywhere; hyphens: auto;
  outline: none;
}
.art-title.it { font-style: italic; }
.art-deck { font: italic 400 23px/1.18 var(--serif); color: var(--ink-2); margin-top: 12px; text-wrap: pretty; }
.hatnote { font: italic 400 15px/1.5 var(--sans); color: var(--ink-2); border-left: 2.5px solid var(--grey); padding: 2px 0 2px 12px; margin-bottom: 24px; }

/* body with numbered paragraphs in the margin */
.art-body { counter-reset: none; }
.para { display: grid; grid-template-columns: 32px 1fr; column-gap: 6px; }
.pn { font: 600 10.5px/1 var(--sans); color: var(--ink-3); font-feature-settings: "tnum"; padding-top: 0.62em; letter-spacing: 0.02em; }
.para p { font: 400 17.5px/1.62 var(--sans); letter-spacing: -0.006em; margin-bottom: 1.05em; text-wrap: pretty; }
.art-body strong { font-weight: 700; }
.blk { margin: 30px 0 34px; }

/* figures */
.fig svg { width: 100%; height: auto; overflow: visible; }
.fig figcaption { font: 400 13.5px/1.45 var(--sans); color: var(--ink-2); margin-top: 10px; border-top: 1px solid var(--hair); padding-top: 8px; }
.fig-n { font-weight: 700; color: var(--ink); margin-right: 4px; font-feature-settings: "tnum"; }
.fig .ax path { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.fig .ax-head { fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
.fig .t-tick { font: 500 11px/1 var(--sans); fill: var(--ink-2); text-anchor: middle; }
.fig .t-lab { font: 500 12px/1 var(--sans); fill: var(--ink-2); }
.fig .t-cob { fill: var(--cobalt); font-weight: 700; }
.fig .t-big { font: 400 44px/1 var(--serif); fill: var(--ink); }
.five-limit { stroke: var(--cobalt); stroke-width: 1.4; stroke-dasharray: 4 4; }
.five-line { fill: none; stroke: var(--cobalt); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.five-dot { fill: var(--hl); stroke: var(--ink); stroke-width: 1.4; transform-box: fill-box; transform-origin: center; transform: scale(0); transition: transform 0.5s cubic-bezier(0.3, 1.8, 0.5, 1) 1.1s; }
.drawn .five-dot { transform: scale(1); }
.five-note rect { fill: var(--hl); }
.five-note, .five-lead { opacity: 0; transition: opacity 0.4s 1.3s; }
.drawn .five-note, .drawn .five-lead { opacity: 1; }
.five-lead { stroke: var(--ink); stroke-width: 1; }
.gauge-btn { display: block; width: 100%; border-radius: 6px; }
.gauge-btn:active { background: rgba(247, 228, 99, 0.25); }
.g-arc { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.fig-gauge path { stroke: var(--ink); stroke-width: 1.4; }
.g-zero { fill: none; stroke: var(--hl) !important; stroke-width: 10 !important; }
.g-needle { transform-origin: 160px 166px; }
.g-needle path { stroke: var(--cobalt) !important; stroke-width: 3 !important; stroke-linecap: round; }
.g-needle circle { fill: var(--ink); }
.drawn .g-needle { animation: twitch 3.6s ease-in-out 0.6s infinite; }
@keyframes twitch { 0%, 86%, 100% { transform: rotate(0); } 89% { transform: rotate(3deg); } 92% { transform: rotate(-0.5deg); } 95% { transform: rotate(1.2deg); } }
.isl { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.isl-fill { fill: url(#hatch); stroke: none; }
.hatch-line { stroke: var(--cobalt); stroke-width: 1.4; opacity: 0.55; }
.route { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 1; }
.fig-island .lead { stroke: var(--ink); stroke-width: 1; }
.fig-island:not(.drawn) .route { opacity: 0; }
.fig-island .route { transition: opacity 1.2s; }
.isl-wilson { transition: transform 1.2s; }
.tl { position: relative; padding-left: 26px; }
.tl::before { content: ""; position: absolute; left: 6px; top: 10px; bottom: 12px; width: 1.5px; background: var(--ink); }
.tl li { position: relative; display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--hair); align-items: baseline; }
.tl li::before { content: ""; position: absolute; left: -25px; top: 15px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--ink); }
.tl-when { font: 600 13px/1 var(--sans); font-feature-settings: "tnum"; letter-spacing: 0.04em; }
.tl-what { font: 400 21px/1.15 var(--serif); }
.tl-gap .tl-what { font-style: italic; color: var(--ink-2); font-size: 18px; }
.tl-gap::before { background: var(--hl) !important; border-style: dashed !important; }
.tl-end::before { background: var(--cobalt) !important; border-color: var(--cobalt) !important; }
.tl-end .tl-what { font-size: 26px; }
.doodle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fig-doodles .doodle { border: 1px solid var(--hair); padding: 10px; }
.fig-doodles .doodle-lab { font-size: 12.5px; }

/* stub, see also, notes */
.stub { display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: start; background: var(--grey); padding: 14px 16px 14px 12px; margin: 6px 0 28px; }
.stub-mark { font: 400 42px/0.8 var(--serif); color: var(--cobalt); }
.stub p { font: italic 400 15.5px/1.5 var(--sans); }
.art-see, .art-notes, .descent, .live-credit { border-top: 1px solid var(--ink); padding-top: 10px; margin-top: 30px; }
.art-see ul { margin-top: 10px; display: grid; gap: 2px; }
.art-see li { font: 400 17px/1.4 var(--sans); padding: 5px 0 5px 22px; position: relative; }
.art-see li::before { content: "→"; position: absolute; left: 0; color: var(--ink-3); }
.art-notes ol { margin-top: 10px; display: grid; gap: 8px; }
.art-notes li { display: grid; grid-template-columns: 34px 1fr; font: 400 14.5px/1.5 var(--sans); color: var(--ink-2); }
.nl { font: 600 12px/1.6 var(--sans); color: var(--cobalt); font-feature-settings: "tnum"; }
.descent ol { margin-top: 12px; }
.descent li { position: relative; margin-left: calc(min(var(--i), 10) * 16px); padding: 4px 0 4px 18px; border-left: 1.5px solid var(--ink); font: 400 14px/1.35 var(--sans); }
.descent li::before { content: ""; position: absolute; left: -5px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--ink); }
.descent li button { color: var(--ink-2); text-align: left; padding: 2px 0; text-decoration: underline; text-decoration-color: var(--hair); text-underline-offset: 3px; }
.descent li button:hover { color: var(--cobalt); }
.descent li.here { border-left-color: var(--cobalt); }
.descent li.here::before { background: var(--cobalt); border-color: var(--cobalt); }
.d-here { font-weight: 700; color: var(--ink); display: block; }
.d-note { display: block; font: italic 400 15px/1.3 var(--serif); color: var(--ink-3); }

/* live pages */
.live-skel { display: grid; gap: 11px; margin: 8px 0 30px; }
.live-skel i, .reader-skel i { display: block; height: 15px; background: linear-gradient(90deg, var(--grey) 0%, #f2f2ee 50%, var(--grey) 100%) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }
.live-skel i:nth-child(3n) { width: 82%; }
.live-skel i:last-child { width: 46%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.live-fig { margin: 0 0 22px; }
.live-fig img { width: 100%; max-height: 300px; object-fit: cover; filter: grayscale(1) contrast(1.06); mix-blend-mode: multiply; background: var(--grey); transition: filter 0.6s; }
.live-fig:active img, .live-fig:hover img { filter: none; }
.live-fig figcaption { font: 400 12px/1.4 var(--sans); color: var(--ink-3); margin-top: 6px; }
.live-fig figcaption a { color: var(--ink-2); }
.live-body p { font: 400 17.5px/1.62 var(--sans); margin-bottom: 1.05em; text-wrap: pretty; }
.live-body b { font-weight: 700; }
.live-list li { font: 400 16.5px/1.5 var(--sans); padding: 4px 0 4px 18px; position: relative; }
.live-list li::before { content: "·"; position: absolute; left: 4px; font-weight: 700; }
.live-more { font: 600 15px/1.4 var(--sans); margin-top: 4px; }
.live-more a { color: var(--ink); text-underline-offset: 3px; }
.live-credit p { font: 400 13.5px/1.5 var(--sans); color: var(--ink-2); }
.live-credit p + p, .live-credit .lab + p { margin-top: 6px; }
.live-credit a { color: var(--ink-2); }
.live-error > p:not(.lab) { font: 400 18px/1.55 var(--sans); }
.le-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 30px; }
.btn-line { display: inline-flex; align-items: center; gap: 6px; padding: 11px 14px; border: 1.5px solid var(--ink); font: 600 14.5px/1 var(--sans); text-decoration: none; color: var(--ink); background: var(--paper); }
.le-more { margin-top: 8px; display: grid; gap: 6px; }
.le-more li { font-size: 17px; }

/* letter inside the hole */
.page-letter .letter-deck { font-size: 36px; }

/* misc blocks */
.blk-timer { border: 1.5px solid var(--ink); padding: 14px 16px 16px; background: #fff; }
.tm-clock { font: 400 64px/1 var(--serif); font-feature-settings: "tnum"; margin: 8px 0 10px; }
.tm-of { font-size: 26px; color: var(--ink-3); }
.tm-bar { height: 6px; background: var(--grey); overflow: hidden; }
.tm-bar i { display: block; height: 100%; background: var(--cobalt); transform-origin: left; transform: scaleX(0); transition: transform 1s linear; }
.blk-timer.hit .tm-bar i { background: var(--hl); }
.tm-msg { margin-top: 10px; font: italic 400 20px/1.3 var(--serif); color: var(--ink-2); }
.stats-record { display: grid; grid-template-columns: 1fr 1fr; border-top: 1.5px solid var(--ink); }
.stats-record div { padding: 12px 10px 14px 0; border-bottom: 1px solid var(--hair); }
.stats-record div:nth-child(2n) { padding-left: 12px; border-left: 1px solid var(--hair); }
.stats-record dt { font: 600 10.5px/1.3 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.stats-record dd { font: 400 34px/1 var(--serif); margin-top: 6px; }
.blk-photo .plate-btn { aspect-ratio: var(--r); }
.blk-photo .plate { width: 100%; }

/* the reader (in the hole) */
.blk-reader { margin-top: 18px; }
.reader-card { background: var(--ink); color: var(--paper); padding: 18px 18px 18px; position: relative; }
.reader-card.swap { animation: swap 0.4s var(--ease); }
@keyframes swap { from { transform: translateY(6px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.reader-kicker { display: flex; align-items: center; gap: 8px; font: 600 11px/1 var(--sans); letter-spacing: 0.13em; text-transform: uppercase; color: rgba(251, 251, 248, 0.75); }
.reader-lamp { width: 9px; height: 9px; border-radius: 50%; background: rgba(251, 251, 248, 0.3); }
[data-state="reading"] .reader-lamp, [data-state="fetching"] .reader-lamp { background: var(--hl); box-shadow: 0 0 0 4px rgba(247, 228, 99, 0.2); animation: live 1s ease-in-out infinite; }
.reader-body { margin-top: 16px; }
.reader-opener, .reader-closer { font: italic 400 20px/1.2 var(--serif); color: var(--hl); }
.reader-closer { margin-top: 14px; }
.reader-title { font: 400 44px/0.96 var(--serif); letter-spacing: -0.02em; margin-top: 10px; overflow-wrap: anywhere; transition: color 0.3s; }
.reader-title.it { font-style: italic; }
.reader-title.speaking { color: var(--hl); }
.reader-desc { font: italic 400 19px/1.25 var(--serif); color: rgba(251, 251, 248, 0.72); margin-top: 8px; }
.reader-text { position: relative; margin-top: 16px; isolation: isolate; }
.rt { font: 400 18.5px/1.62 var(--sans); color: var(--paper); }
.rt .w { position: relative; transition: color 0.2s; }
.rt .w.said { color: rgba(251, 251, 248, 0.92); }
.rt .w.now { color: var(--ink); transition: none; }
.reader-hl { position: absolute; left: 0; top: 0; z-index: -1; background: var(--hl); border-radius: 2px; opacity: 0; transition: transform 0.13s cubic-bezier(0.3, 0.8, 0.3, 1), width 0.13s, opacity 0.2s; pointer-events: none; }
.reader-hl.on { opacity: 1; }
.reader-fig { margin-top: 16px; }
.reader-fig img { max-height: 200px; width: auto; filter: grayscale(1) contrast(1.05); }
.reader-fig figcaption { font: 400 11.5px/1.3 var(--sans); color: rgba(251, 251, 248, 0.55); margin-top: 6px; }
.reader-fig a, .reader-src a { color: inherit; }
.reader-src { font: 400 12.5px/1.45 var(--sans); color: rgba(251, 251, 248, 0.6); margin-top: 16px; border-top: 1px solid rgba(251, 251, 248, 0.25); padding-top: 10px; }
.reader-src .lnk { color: var(--hl); text-decoration-color: rgba(247, 228, 99, 0.5); }
.reader-skel { display: grid; gap: 10px; margin-top: 18px; }
.reader-skel i { background: linear-gradient(90deg, #2a2a28 0%, #3a3a37 50%, #2a2a28 100%) 0 0 / 200% 100%; height: 14px; }
.reader-skel i:first-child { height: 34px; width: 70%; margin-bottom: 6px; }
.reader-skel i:last-child { width: 55%; }
.reader-note { margin-top: 14px; font: 500 14.5px/1.45 var(--sans); background: var(--hl); color: var(--ink); padding: 10px 12px; }
.reader-controls { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.r-go { display: inline-flex; align-items: center; gap: 10px; background: var(--hl); color: var(--ink); padding: 14px 18px 14px 14px; font: 600 16px/1 var(--sans); flex: 1 1 auto; justify-content: center; min-height: 54px; transition: transform 0.15s; }
.r-go:active, .r-open:active { transform: scale(0.97); }
.r-go .ico svg { width: 18px; height: 18px; }
.r-open { padding: 14px 16px; border: 1.5px solid rgba(251, 251, 248, 0.6); color: var(--paper); font: 600 15px/1 var(--sans); min-height: 54px; }
.reader-tally { margin-top: 0; background: var(--ink); color: var(--paper); padding: 0 18px 16px; border-top-color: rgba(251, 251, 248, 0.25); }
.reader-tally dd { font-size: 44px; }
.r-count.bump { animation: bump 0.6s cubic-bezier(0.3, 1.8, 0.5, 1); display: inline-block; }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.4); } 100% { transform: scale(1); } }

/* ---------- the dock ---------- */
.dock {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  height: calc(var(--dock) + env(safe-area-inset-bottom));
  padding: 0 8px env(safe-area-inset-bottom);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px;
  background: var(--paper); border-top: 1px solid var(--ink);
  transform: translateY(105%); transition: transform var(--dur) var(--ease);
}
.hole.open .dock { transform: none; }
.dock-back, .dock-up { display: inline-flex; align-items: center; gap: 6px; height: 50px; padding: 0 12px; font: 600 15px/1 var(--sans); border-radius: 2px; }
.dock-back .ico svg { width: 24px; height: 24px; stroke-width: 2; }
.dock-up .ico svg { width: 20px; height: 20px; stroke-width: 2; }
.dock-back:active, .dock-up:active { background: var(--grey); }
.dock-depth { display: flex; align-items: center; justify-content: center; gap: 9px; min-width: 0; }
.dd-n { font: 400 46px/1 var(--serif); font-feature-settings: "tnum"; color: var(--cobalt); min-width: 0.55em; text-align: right; transform-origin: 50% 70%; }
.dock-depth.bump .dd-n { animation: bump 0.45s cubic-bezier(0.3, 1.8, 0.5, 1); }
.dd-t { display: flex; flex-direction: column; min-width: 0; }
.dd-t b { font: 600 10.5px/1.2 var(--sans); letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.dd-t i { font: italic 400 17.5px/1.15 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-depth.is-record i { background: var(--hl); padding: 0 3px; margin-left: -3px; }

/* ---------- note popover ---------- */
.note-pop { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; padding: 0 10px calc(10px + env(safe-area-inset-bottom)); pointer-events: none; }
.in-hole .note-pop { bottom: calc(var(--dock) + env(safe-area-inset-bottom) - 2px); padding-bottom: 8px; }
.np-card { pointer-events: auto; position: relative; max-width: 560px; margin: 0 auto; background: var(--ink); color: var(--paper); padding: 16px 54px 18px 18px; transform: translateY(calc(100% + 40px)); transition: transform 0.28s var(--ease); box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.45); }
.note-pop.show .np-card { transform: none; }
.np-h { color: var(--hl); margin-bottom: 6px; }
.np-text { font: 400 16.5px/1.5 var(--sans); }
.np-text .lnk { color: var(--paper); text-decoration-color: rgba(251, 251, 248, 0.5); }
.np-x { position: absolute; right: 6px; top: 6px; width: 44px; height: 44px; display: grid; place-items: center; color: var(--paper); }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(12, 12, 11, 0.95); display: grid; place-items: center; padding: 60px 14px 40px; opacity: 0; transition: opacity 0.22s; touch-action: none; }
.lightbox.show { opacity: 1; }
.lb-fig { max-width: 100%; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.lb-fig img { max-width: 100%; max-height: 76vh; width: auto; height: auto; object-fit: contain; }
.lb-fig figcaption { color: var(--paper); font: 400 15px/1.4 var(--sans); margin-top: 12px; text-align: center; }
.lb-fig .pl-n { color: var(--hl); }
.lb-btn { position: absolute; width: 48px; height: 48px; display: grid; place-items: center; color: var(--paper); border: 1.5px solid rgba(251, 251, 248, 0.5); background: rgba(18, 18, 18, 0.5); }
.lb-prev { left: 10px; top: 50%; }
.lb-next { right: 10px; top: 50%; }
.lb-next .ico { transform: scaleX(-1); }
.lb-x { right: 10px; top: calc(10px + env(safe-area-inset-top)); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 0; right: 0; top: calc(var(--bar) + env(safe-area-inset-top) + 10px); z-index: 75; display: grid; justify-items: center; padding: 0 12px; pointer-events: none; }
.toast-card { pointer-events: auto; max-width: 460px; background: var(--ink); color: var(--paper); font: 500 15px/1.45 var(--sans); padding: 12px 16px; transform: translateY(-14px); opacity: 0; transition: transform 0.3s var(--ease), opacity 0.25s; box-shadow: 0 14px 40px -12px rgba(0, 0, 0, 0.45); }
.toast.show .toast-card { transform: none; opacity: 1; }
.toast-card .lnk { color: var(--hl); text-decoration-color: rgba(247, 228, 99, 0.6); }
.toast-card.hl { background: var(--hl); color: var(--ink); }
.toast-card.hl .lnk { color: var(--cobalt); }
.toast-card .lab { display: block; color: inherit; opacity: 0.75; margin-bottom: 3px; }
.toast-card b { font-weight: 700; }

/* ======================================================================
   WIDER SCREENS
   ====================================================================== */
@media (min-width: 640px) {
  :root { --pad: 36px; }
  .hero-actions { grid-template-columns: 1fr 1fr; }
  .hero-margin { max-width: 640px; }
  .index { columns: 3; }
  .blk.plates { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 960px) {
  :root { --pad: 56px; --bar: 60px; }
  body { font-size: 18px; }
  .bar { padding-left: var(--pad); padding-right: calc(var(--pad) - 10px); }

  .hero { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; padding-bottom: 72px; }
  .hero > * { grid-column: 1 / -1; }
  .hero-title { font-size: min(31vw, 470px); margin-top: 0.08em; }
  .hero-ipa { margin-top: 14px; }
  .hero-lead { grid-column: 5 / 12; margin-top: 44px; }
  .hero-lead p:first-child { font-size: 27px; line-height: 1.4; letter-spacing: -0.018em; }
  .hero-more { font-size: 16px; }
  .hero-actions { grid-column: 5 / 13; margin-top: 36px; }
  .cta-t { font-size: 34px; }
  .hero-how { grid-column: 5 / 12; }
  .hero-head { grid-column: 1 / 10; grid-row: 2; }
  .hero-ledger { display: block; grid-column: 10 / 13; grid-row: 2; align-self: end; margin-bottom: 64px; border-top: 1.5px solid var(--ink); padding-top: 10px; }
  .hero-ledger dl { margin-top: 10px; }
  .hero-ledger div { display: grid; grid-template-columns: 52px 1fr; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--hair); }
  .hero-ledger dt { font: 400 34px/1 var(--serif); font-feature-settings: "tnum"; }
  .hero-ledger dd { font: 400 14.5px/1.35 var(--sans); color: var(--ink-2); }
  .hero-lead { grid-row: 3; }
  .hero-margin { grid-column: 1 / 4; grid-row: 3 / span 3; align-self: start; grid-template-columns: 1fr 1fr; gap: 18px 14px; margin-top: 52px; border-top: 1px solid var(--ink); padding-top: 14px; }

  .sec { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; padding: 64px var(--pad) 84px; }
  .sec > * { grid-column: 1 / -1; }
  .sec-head { margin-bottom: 40px; }

  .preface-body { grid-column: 1 / -1; }
  .letter { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; }
  .letter > * { grid-column: 4 / 11; }
  .letter-deck { grid-column: 1 / 4; grid-row: 1 / span 3; font-size: 52px; align-self: start; position: sticky; top: calc(var(--bar) + 30px); }
  .letter-greet { font-size: 40px; }
  .letter-text p { font-size: 31px; line-height: 1.34; }
  .ls-name { font-size: 96px; }
  .letter-cites { grid-column: 11 / 13; grid-row: 1 / span 4; margin-top: 0; border-top: 0; padding-top: 0; position: relative; }
  .letter-cites .lab { display: none; }
  .letter-cites ul { position: relative; margin: 0; height: 100%; }
  .letter-cites li { position: absolute; left: 0; right: 0; top: var(--y, 0); font-size: 13.5px; border-top: 1px solid var(--ink); padding-top: 6px; }
  .letter-pending { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; }
  .letter-pending > * { grid-column: 4 / 11; }
  .letter-pending .letter-deck { grid-column: 1 / 4; grid-row: 1 / span 3; position: static; }
  .letter-pending .lp-stamp { justify-self: start; margin-bottom: 30px; }
  .lp-text { font-size: 28px; }
  .page-letter .letter { display: block; }
  .page-letter .letter-deck { position: static; font-size: 40px; }
  .page-letter .letter-text p { font-size: 27px; }
  .page-letter .letter-cites { position: static; margin-top: 30px; border-top: 1px solid var(--hair); padding-top: 12px; }
  .page-letter .letter-cites .lab { display: block; }
  .page-letter .letter-cites li { position: static; border: 0; padding: 0; }

  .dyk-text { grid-column: 1 / 11; font-size: 46px; min-height: 2.3em; }
  .toc { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; column-gap: 48px; border-bottom: 0; }
  .toc-row a { border-top-color: var(--hair); }
  .toc-row:nth-child(-n + 2) a { border-top: 1px solid var(--ink); }
  .toc-row:nth-last-child(-n + 2) a { border-bottom: 1px solid var(--ink); }
  .toc-t { font-size: 38px; }

  .room { column-gap: 24px; }
  .room-title { grid-column: 1 / 8; font-size: 118px; }
  .room-text { grid-column: 1 / 7; font-size: 19px; }
  .room-go { grid-column: 9 / 13; grid-row: 2 / span 2; width: 240px; height: 240px; margin: 0 auto; align-self: center; }
  .room-go-label { font-size: 40px; }
  .room-tally { grid-column: 1 / 8; margin-top: 44px; }
  .room-tally dd { font-size: 72px; }

  .pen-intro { grid-column: 1 / 5; }
  .pen-intro .sec-title { font-size: 64px; }
  .pen-host { grid-column: 5 / 13; margin-top: 0; }
  .pen-stage { height: 500px; }

  .plates-sec .plates { grid-column: 1 / -1; overflow: visible; margin: 0; padding: 0; flex-wrap: wrap; gap: 18px; }
  .plates-sec .plate { flex: var(--r) 1 0; width: auto; max-width: none; }

  .classes-sec .classes { grid-column: 3 / 12; }
  .classes .c-name { font-size: 28px; }

  .index { grid-column: 1 / -1; columns: 4; column-gap: 36px; }

  .colophon { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; padding-top: 48px; }
  .colo-mark { grid-column: 1 / 7; font-size: 200px; }
  .colo-text { grid-column: 7 / 12; align-self: end; }

  /* the hole becomes a stack of cards with spines */
  .hole.desk .page { width: 860px; box-shadow: -1px 0 0 rgba(18, 18, 18, 0.25), -30px 0 60px -26px rgba(18, 18, 18, 0.45); }
  .hole.desk .page-scroll { padding: calc(var(--bar) + 44px) 72px 150px 76px; }
  .hole.desk .page-spine {
    display: none; position: absolute; inset: 0; z-index: 3; text-align: left;
    background: transparent; cursor: pointer;
  }
  .hole.desk .page[data-covered] .page-spine { display: block; }
  .hole.desk .page[data-covered] .page-spine:hover { background: rgba(39, 71, 217, 0.06); }
  .spine-n { position: absolute; left: 0; width: var(--spine); top: calc(var(--bar) + 18px); text-align: center; font: 400 26px/1 var(--serif); color: var(--cobalt); }
  .spine-t { position: absolute; left: 0; width: var(--spine); top: calc(var(--bar) + 58px); writing-mode: vertical-rl; display: flex; align-items: center; font: 600 12px/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; overflow: hidden; max-height: calc(100% - var(--bar) - 120px); }
  .hole.desk .page[data-covered] .page-scroll { overflow: hidden; }
  .hole.desk .dock { left: 50%; right: auto; bottom: 22px; transform: translate(-50%, 160%); width: 560px; border: 1.5px solid var(--ink); box-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.5); height: var(--dock); padding: 0 8px; }
  .hole.desk.open .dock { transform: translate(-50%, 0); }
  .hole.desk .wilson-peek { bottom: 120px; }
  .para { grid-template-columns: 52px 1fr; }
  .art-title { font-size: 92px; }
  .para p, .live-body p { font-size: 18.5px; }
  .in-hole .note-pop { bottom: 110px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .page { transition: opacity 0.16s ease !important; }
  .draw { transition: none !important; }
  .hl-mark { transition: background-size 0.01ms !important; }
  .room-go-ring { animation: none; }
  .wilson-peek { display: none; }
}
