/* Cognitive effects at the interfaces — web edition 1.0.0
   One stylesheet, no external fonts or frameworks.
   Layouts: drawers (wide screens, JS), accordion (narrow screens, JS),
   continuous essay (no JS), print. */

:root {
  --paper: #f5f1e8;
  --sheet: #fbf9f4;
  --sheet-2: #f1ece1;
  --ink: #1f1d1a;
  --ink-2: #4a463f;
  --muted: #77715f;
  --rule: #e2dccd;
  --rule-2: #d3cbb8;
  --spine: #ebe5d7;
  --spine-hover: #e3dccb;
  --shadow: 0 1px 2px rgba(40, 32, 18, 0.06), 0 8px 24px rgba(40, 32, 18, 0.08);

  --c-front: #3a372f;
  --c-frame: #2f5d8a;
  --c-evidence: #b5482a;
  --c-synthesis: #3f6e4d;
  --c-back: #7a7365;
  --accent: #b5482a;
  --link: #2f5d8a;

  --g-strong: #3f6e4d;
  --g-moderate: #2f5d8a;
  --g-suggestive: #8a6d1f;
  --g-contested: #b5482a;
  --g-open: #77715f;

  --serif: Georgia, "Iowan Old Style", "Charis SIL", "Noto Serif", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --spine-w: clamp(30px, 2.55vw, 46px);
  --top-h: 52px;
  --foot-h: 30px;
  --measure: 68ch;
  --fs: 1.0625rem;
  color-scheme: light;
}
[data-size="l"] { --fs: 1.1875rem; }
[data-size="xl"] { --fs: 1.3125rem; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131416; --sheet: #18191c; --sheet-2: #1f2024; --ink: #e9e4d8; --ink-2: #c9c3b5; --muted: #9a9384;
    --rule: #2b2c30; --rule-2: #3a3b40; --spine: #1c1d21; --spine-hover: #24252a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    --c-front: #cfc8b8; --c-frame: #7fa7d1; --c-evidence: #e08566; --c-synthesis: #87b493; --c-back: #a59e8e;
    --accent: #e08566; --link: #8fb4dc;
    --g-strong: #87b493; --g-moderate: #8fb4dc; --g-suggestive: #d6b25e; --g-contested: #e08566; --g-open: #a59e8e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #131416; --sheet: #18191c; --sheet-2: #1f2024; --ink: #e9e4d8; --ink-2: #c9c3b5; --muted: #9a9384;
  --rule: #2b2c30; --rule-2: #3a3b40; --spine: #1c1d21; --spine-hover: #24252a;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --c-front: #cfc8b8; --c-frame: #7fa7d1; --c-evidence: #e08566; --c-synthesis: #87b493; --c-back: #a59e8e;
  --accent: #e08566; --link: #8fb4dc;
  --g-strong: #87b493; --g-moderate: #8fb4dc; --g-suggestive: #d6b25e; --g-contested: #e08566; --g-open: #a59e8e;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--fs)/1.68 var(--serif);
  font-kerning: normal; text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
kbd { font: 600 0.78em var(--sans); border: 1px solid var(--rule-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 0.35em; background: var(--sheet); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--ink); color: var(--paper); padding: 6px 10px; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 0.9rem 0 1rem; background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
}
.topbar-left { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.back { flex: none; font: 600 0.78rem var(--sans); color: var(--muted); text-decoration: none; padding: 0.3rem 0.6rem 0.3rem 0; border-right: 1px solid var(--rule-2); }
.back:hover { color: var(--ink); }
@media (max-width: 560px) { .back { font-size: 0; padding-right: 0.5rem; } .back span { font-size: 0.95rem; } }
.brand { display: flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; min-width: 0; }
.brand-mark { width: 22px; height: 22px; flex: none; border-radius: 4px; background:
  linear-gradient(90deg, var(--c-frame) 0 25%, var(--c-evidence) 25% 50%, var(--c-synthesis) 50% 75%, var(--c-back) 75%); }
.brand-text { font: 600 0.92rem/1.2 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-tools { display: flex; align-items: center; gap: 0.4rem; flex: none; }
.zenodo { display: inline-flex; align-items: stretch; border: 1px solid var(--rule-2); border-radius: 4px; overflow: hidden;
  font-size: 0.72rem; text-decoration: none; color: var(--ink); line-height: 1; }
.zenodo-z { background: var(--c-frame); color: #fff; padding: 0.42rem 0.5rem; font-weight: 600; letter-spacing: 0.02em; }
.zenodo-doi { padding: 0.42rem 0.55rem; background: var(--sheet); font-family: var(--mono); font-size: 0.7rem; }
.tool { width: 34px; height: 34px; border-radius: 6px; border: 1px solid transparent; background: none; cursor: pointer;
  font: 600 0.82rem var(--serif); display: grid; place-items: center; color: var(--ink-2); }
.tool:hover { background: var(--sheet-2); border-color: var(--rule); }
.tool svg { width: 16px; height: 16px; fill: currentColor; }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.15s linear; }

/* ------------------------------------------------------------------ shelf: continuous essay (no JS, print) */
.shelf { display: block; }
.spine { display: none; }
.panel { border-bottom: 1px solid var(--rule); }
.panel-scroll { padding: 0 1.25rem 3rem; container-type: inline-size; }

/* ------------------------------------------------------------------ drawers (JS, wide screens) */
@media (min-width: 900px) {
  html.js, html.js body { height: 100%; overflow: hidden; }
  html.js .shelf {
    display: flex; height: calc(100vh - var(--top-h) - var(--foot-h)); height: calc(100dvh - var(--top-h) - var(--foot-h));
    overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
  }
  html.js .panel {
    display: flex; flex: 0 0 var(--spine-w); min-width: var(--spine-w); border: 0;
    transition: flex-grow 0.42s cubic-bezier(0.2, 0.7, 0.1, 1);
  }
  html.js .panel.open { flex: 1 1 var(--spine-w); min-width: calc(100vw - 18 * var(--spine-w)); }
  html.js .spine {
    display: flex; flex-direction: column; align-items: center; gap: 0.7rem;
    flex: 0 0 var(--spine-w); width: var(--spine-w); height: 100%; padding: 0.85rem 0 1rem;
    border: 0; border-right: 1px solid var(--rule-2); cursor: pointer;
    background: var(--spine); position: relative; font-family: var(--sans);
    box-shadow: inset -6px 0 10px -8px rgba(40, 32, 18, 0.18);
    transition: background 0.2s;
  }
  html.js .spine::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--part); opacity: 0.9; }
  html.js .spine:hover { background: var(--spine-hover); }
  html.js .spine-num { font: 700 0.95rem/1 var(--serif); color: var(--part); min-height: 1em; }
  html.js .spine-label {
    writing-mode: vertical-rl; transform: rotate(180deg);
    font-size: clamp(0.6rem, 0.48rem + 0.22vw, 0.7rem); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--muted); white-space: nowrap; transition: color 0.2s;
  }
  html.js .spine:hover .spine-label { color: var(--ink); }
  html.js .panel.open .spine { background: var(--part); }
  html.js .panel.open .spine-num, html.js .panel.open .spine-label { color: var(--sheet); }
  html.js .panel-body { flex: 1 1 auto; width: 0; overflow: hidden; background: var(--sheet); }
  html.js .panel.open .panel-body { box-shadow: var(--shadow); border-right: 1px solid var(--rule-2); }
  html.js .panel-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 0 2.2rem 4rem; opacity: 0; }
  html.js .panel.open .panel-scroll { opacity: 1; transition: opacity 0.35s 0.12s; }
  html.js .panel:not(.open) .panel-scroll { visibility: hidden; }
}

/* ------------------------------------------------------------------ accordion (JS, narrow screens) */
@media (max-width: 899px) {
  html.js .spine {
    display: flex; align-items: center; gap: 0.75rem; width: 100%; min-height: 48px; padding: 0.55rem 1rem;
    border: 0; border-top: 4px solid var(--part); background: var(--spine); text-align: left; cursor: pointer;
    font-family: var(--sans);
  }
  html.js .spine-num { font: 700 1rem var(--serif); color: var(--part); min-width: 1.4em; }
  html.js .spine-label { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
  html.js .panel-body { display: none; background: var(--sheet); }
  html.js .panel.open .panel-body { display: block; }
  html.js .panel.open .spine { background: var(--part); }
  html.js .panel.open .spine-num, html.js .panel.open .spine-label { color: var(--sheet); }
  .panel-scroll { padding: 0 1.1rem 2.5rem; }
  .topbar .zenodo-doi { display: none; }
}

.part-front { --part: var(--c-front); }
.part-frame { --part: var(--c-frame); }
.part-evidence { --part: var(--c-evidence); }
.part-synthesis { --part: var(--c-synthesis); }
.part-back { --part: var(--c-back); }

/* ------------------------------------------------------------------ footer */
.site-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.3rem 1rem;
  min-height: var(--foot-h); padding: 0.35rem 1rem; border-top: 1px solid var(--rule); background: var(--paper);
  font: 0.72rem/1.3 var(--sans); color: var(--muted);
}
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--ink); text-decoration: underline; }
@media (min-width: 900px) { html.js .site-foot { height: var(--foot-h); flex-wrap: nowrap; padding-block: 0; } }
.author-links { font: 0.86rem var(--sans); }

/* ------------------------------------------------------------------ panel head and art */
.panel-head { position: relative; margin: 0 -2.2rem 1.6rem; padding: 3.2rem 2.2rem 1.4rem; border-bottom: 1px solid var(--rule); overflow: hidden; }
@media (max-width: 899px) { .panel-head { margin: 0 -1.1rem 1.4rem; padding: 2.4rem 1.1rem 1.1rem; } }
.panel-art, .cover-art { position: absolute; inset: 0; z-index: 0; }
.panel-art img, .cover-art img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.1) sepia(0.25); opacity: 0.2; mix-blend-mode: multiply; }
:root[data-theme="dark"] .panel-art img, :root[data-theme="dark"] .cover-art img { mix-blend-mode: screen; opacity: 0.12; filter: grayscale(1) invert(1) contrast(1.1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .panel-art img, :root:not([data-theme="light"]) .cover-art img { mix-blend-mode: screen; opacity: 0.12; filter: grayscale(1) invert(1) contrast(1.1); } }
.panel-art::after, .cover-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, var(--sheet) 100%); }
.panel-head-text { position: relative; z-index: 1; max-width: var(--measure); margin: 0 auto; }
.panel-kicker { margin: 0 0 0.3rem; font: 600 0.72rem/1.3 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--part); }
.panel-head h2 { margin: 0; font: 400 clamp(1.7rem, 1.2rem + 1.6vw, 2.5rem)/1.12 var(--serif); letter-spacing: -0.01em; }
.art-credit { position: absolute; right: 0.8rem; bottom: 0.4rem; z-index: 1; margin: 0; font: 0.66rem var(--sans); color: var(--muted); }
.art-credit a { color: inherit; }

/* ------------------------------------------------------------------ prose */
.prose { max-width: var(--measure); margin: 0 auto; }
.prose > * + * { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose dl { margin: 0 0 1em; }
.prose h3 { font: 600 1.18em/1.3 var(--serif); margin: 2em 0 0.6em; color: var(--ink); }
.prose h3 + p { margin-top: 0; }
.prose strong { font-weight: 700; }
.prose li { margin: 0.3em 0; }
.prose li::marker { color: var(--muted); }
.prose blockquote { margin: 1.2em 0; padding-left: 1em; border-left: 3px solid var(--rule-2); color: var(--ink-2); }
.prose em { font-style: italic; }
.prose .intro { color: var(--ink-2); }

.table-wrap { overflow-x: auto; margin: 1.4em 0 1.6em; border: 1px solid var(--rule); border-radius: 6px; background: var(--sheet); }
@container (min-width: 980px) { .table-wrap { margin-left: -5rem; margin-right: -5rem; } }
@container (min-width: 1180px) { .table-wrap { margin-left: -9rem; margin-right: -9rem; } }
.prose table { border-collapse: collapse; width: 100%; font: 0.8em/1.45 var(--sans); }
.prose th, .prose td { padding: 0.55em 0.7em; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.prose thead th { background: var(--sheet-2); font-weight: 600; color: var(--ink-2); position: sticky; top: 0; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td em { font-family: var(--serif); font-size: 1.08em; }
.prose tbody tr:hover { background: color-mix(in srgb, var(--sheet-2) 60%, transparent); }

/* citations, cross-references, claims, glossary */
a.cite { color: var(--link); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--link) 35%, transparent); cursor: pointer; }
a.cite:hover, a.cite[aria-expanded="true"] { border-bottom-color: var(--link); background: color-mix(in srgb, var(--link) 8%, transparent); }
a.xref { color: inherit; text-decoration: underline; text-decoration-color: var(--rule-2); }
a.xref:hover { color: var(--link); text-decoration-color: currentColor; }
a.claim { font: 600 0.78em var(--sans); text-decoration: none; padding: 0.05em 0.35em; border-radius: 3px; border: 1px solid var(--rule-2); color: var(--ink-2); background: var(--sheet-2); white-space: nowrap; }
a.claim:hover { border-color: var(--accent); color: var(--accent); }
.gl { border-bottom: 1px dotted var(--muted); cursor: help; }
.gl:hover, .gl:focus { border-bottom-style: solid; border-bottom-color: var(--accent); outline: none; }
.demo { pointer-events: none; }

/* audio buttons */
.say { display: inline-grid; place-items: center; width: 1.45em; height: 1.45em; margin: 0 0.1em 0 0.25em; padding: 0; vertical-align: -0.28em;
  border: 1px solid var(--rule-2); border-radius: 50%; background: var(--sheet); color: var(--accent); cursor: pointer; }
.say svg { width: 0.85em; height: 0.85em; fill: currentColor; }
.say:hover { border-color: var(--accent); }
.say.playing { background: var(--accent); color: var(--sheet); border-color: var(--accent); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); } }

/* panel navigation */
.panel-nav { max-width: var(--measure); margin: 3rem auto 0; padding-top: 1.2rem; border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; gap: 1rem; font: 0.85rem var(--sans); }
.panel-nav a { color: var(--ink-2); text-decoration: none; }
.panel-nav a:hover { color: var(--accent); }
.panel-nav .next { text-align: right; }

/* ------------------------------------------------------------------ cover */
#cover .panel-scroll { position: relative; }
.cover-art { height: 340px; bottom: auto; margin: 0 -2.2rem; }
.cover-art img { opacity: 0.26; }
.cover-credit { top: 0.6rem; bottom: auto; right: 0.9rem; }
.cover-head { position: relative; z-index: 1; max-width: 62rem; margin: 0 auto; padding: 5.5rem 0 2rem; }
.cover-kicker { font: 600 0.74rem/1.4 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.9rem; }
.cover-head h1 { margin: 0; font: 400 clamp(2.4rem, 1.5rem + 3.4vw, 4.4rem)/1.02 var(--serif); letter-spacing: -0.02em; }
.cover-sub { margin: 0.8rem 0 0; max-width: 40rem; font: italic 400 clamp(1.1rem, 0.95rem + 0.6vw, 1.45rem)/1.35 var(--serif); color: var(--ink-2); }
.cover-by { margin: 1.1rem 0 0; font: 600 0.92rem var(--sans); color: var(--ink-2); }
.cover-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.8rem; }
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 0.95rem; border-radius: 6px; border: 1px solid var(--rule-2);
  background: var(--sheet); color: var(--ink); text-decoration: none; font: 600 0.86rem var(--sans); cursor: pointer; }
.btn:hover { border-color: var(--ink-2); }
.btn-primary { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.resume { margin: 1rem 0 0; font: 0.88rem var(--sans); }
.cover-grid { position: relative; z-index: 1; max-width: 62rem; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 3rem; }
@container (max-width: 820px) { .cover-grid { grid-template-columns: 1fr; gap: 1.5rem; } }
.label { font: 600 0.72rem/1.3 var(--sans) !important; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.7rem !important; }
.cover-abstract p { margin: 0 0 1em; }
.cover-abstract p:first-of-type::first-letter { float: left; font-size: 3.2em; line-height: 0.85; padding: 0.06em 0.08em 0 0; color: var(--accent); }
.cover-side { font: 0.86rem/1.55 var(--sans); color: var(--ink-2); }
.cover-side .label:not(:first-child) { margin-top: 1.6rem !important; }
.howto, .files { margin: 0; padding: 0; list-style: none; }
.howto li { margin: 0 0 0.6rem; }
.files li { margin: 0 0 0.25rem; }
.keywords { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0; padding: 0; list-style: none; }
.keywords li { padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--sheet-2); border: 1px solid var(--rule); font-size: 0.76rem; }
.doi { margin-top: 1.2rem; font-size: 0.78rem; }

/* ------------------------------------------------------------------ references, glossary, about */
ol.refs { padding-left: 2.2em; font-size: 0.92em; }
ol.refs li { margin: 0 0 0.7em; padding-left: 0.2em; }
ol.refs li:target, ol.refs li.flash { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 4px; }
.ref-link { font: 600 0.75rem var(--sans); text-decoration: none; white-space: nowrap; margin-left: 0.25em; }
.ref-search { color: var(--muted); }
dl.glossary { margin: 0; }
.gl-item { padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
.gl-item dt { font-weight: 700; }
.gl-item dd { margin: 0.15rem 0 0; color: var(--ink-2); }
.gl-item.flash { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.credits { font: 0.8rem/1.5 var(--sans); color: var(--ink-2); padding-left: 1.1em; }
.credit-what { color: var(--ink); }

/* ------------------------------------------------------------------ ledger rows */
tr[id^="claim-"].flash { background: color-mix(in srgb, var(--accent) 14%, transparent) !important; }
.grade { display: inline-block; font: 600 0.7rem/1 var(--sans); padding: 0.28em 0.5em; border-radius: 3px; color: #fff; letter-spacing: 0.02em; }
.grade-Strong { background: var(--g-strong); } .grade-Moderate { background: var(--g-moderate); } .grade-Suggestive { background: var(--g-suggestive); }
.grade-Contested { background: var(--g-contested); } .grade-Open { background: var(--g-open); }
:root[data-theme="dark"] .grade { color: #131416; }
.ledger-tools { margin: 1.5rem 0 0.5rem; font: 0.82rem var(--sans); }
.ledger-tools .row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-bottom: 0.45rem; }
.ledger-tools .row > span:first-child { min-width: 5.5em; color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
.chip { padding: 0.25rem 0.6rem; border-radius: 999px; border: 1px solid var(--rule-2); background: var(--sheet); cursor: pointer; font: 600 0.76rem var(--sans); color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.chip .n { font-weight: 400; opacity: 0.7; margin-left: 0.25em; }
.chip .dot { display: inline-block; width: 0.6em; height: 0.6em; border-radius: 50%; margin-right: 0.35em; vertical-align: 0; }
.ledger-tools input[type="search"] { padding: 0.3rem 0.6rem; border-radius: 6px; border: 1px solid var(--rule-2); background: var(--sheet); font: 0.82rem var(--sans); color: var(--ink); min-width: 14rem; }
.ledger-count { color: var(--muted); }
tr.hidden-row { display: none; }

/* ------------------------------------------------------------------ explorables */
figure.explore { margin: 2rem 0; border: 1px solid var(--rule-2); border-radius: 8px; background: var(--sheet-2); overflow: hidden; }
@container (min-width: 980px) { figure.explore { margin-left: -5rem; margin-right: -5rem; } }
@container (min-width: 1180px) { figure.explore { margin-left: -9rem; margin-right: -9rem; } }
figure.explore > figcaption { padding: 0.75rem 1rem; border-bottom: 1px solid var(--rule); font: 600 0.88rem/1.4 var(--sans); color: var(--ink); background: var(--sheet); }
.explore-tag { display: inline-block; font: 700 0.62rem/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; padding: 0.3em 0.55em; border-radius: 3px; background: var(--accent); color: var(--sheet); vertical-align: 0.12em; margin-right: 0.4em; }
.explore-body { padding: 1rem; font: 0.88rem/1.5 var(--sans); }
.explore-note { margin: 0 !important; padding: 0.55rem 1rem 0.75rem; font: 0.75rem/1.45 var(--sans); color: var(--muted); border-top: 1px dashed var(--rule-2); }
.seg { display: inline-flex; border: 1px solid var(--rule-2); border-radius: 7px; overflow: hidden; background: var(--sheet); }
.seg button { border: 0; background: none; padding: 0.4rem 0.85rem; cursor: pointer; font: 600 0.82rem var(--sans); color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--rule-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--sheet); }

/* number anatomy */
.anat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: 0.6rem; margin-top: 0.9rem; }
.anat-card { background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; padding: 0.7rem 0.8rem; position: relative; }
.anat-lang { font: 600 0.72rem var(--sans); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.anat-form { font: italic 1.35rem/1.25 var(--serif); margin: 0.2rem 0 0.1rem; color: var(--ink); }
.anat-gloss { font: 0.82rem var(--serif); color: var(--ink-2); min-height: 1.2em; }
.anat-order { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.55rem; font: 0.74rem var(--sans); color: var(--muted); }
.digits { display: inline-flex; gap: 2px; font: 700 1rem var(--mono); }
.digits span { display: grid; place-items: center; width: 1.4em; height: 1.6em; border-radius: 3px; background: var(--sheet-2); border: 1px solid var(--rule-2); }
.digits span.first { background: var(--accent); color: var(--sheet); border-color: var(--accent); }
.anat-tag { margin-left: auto; padding: 0.15em 0.45em; border-radius: 3px; font-weight: 600; font-size: 0.68rem; }
.tag-aligned { background: color-mix(in srgb, var(--g-strong) 18%, transparent); color: var(--g-strong); }
.tag-reversed { background: color-mix(in srgb, var(--g-contested) 18%, transparent); color: var(--g-contested); }
.tag-other { background: color-mix(in srgb, var(--g-suggestive) 20%, transparent); color: var(--g-suggestive); }
.anat-legend { margin-top: 0.8rem; font-size: 0.75rem; color: var(--muted); }

/* russian */
.ru-top { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; }
.ru-input { display: inline-flex; align-items: center; gap: 0.3rem; }
.ru-input input { width: 5.5rem; padding: 0.35rem 0.5rem; font: 600 1.1rem var(--mono); border: 1px solid var(--rule-2); border-radius: 6px; background: var(--sheet); color: var(--ink); text-align: center; }
.ru-input button { width: 2rem; height: 2rem; border-radius: 6px; border: 1px solid var(--rule-2); background: var(--sheet); cursor: pointer; font-weight: 700; }
.ru-out { font: 1.9rem/1.1 var(--serif); }
.ru-out .noun { color: var(--accent); }
.ru-why { margin: 0.6rem 0 0; color: var(--ink-2); }
.ru-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.4rem, 1fr)); gap: 3px; margin-top: 1rem; }
.ru-strip button { padding: 0.3rem 0; border-radius: 3px; border: 1px solid transparent; font: 600 0.78rem var(--mono); cursor: pointer; color: var(--ink); }
.ru-strip button.on { outline: 2px solid var(--ink); outline-offset: 1px; }
.f1 { background: color-mix(in srgb, var(--g-strong) 26%, var(--sheet)); }
.f2 { background: color-mix(in srgb, var(--g-moderate) 26%, var(--sheet)); }
.f3 { background: color-mix(in srgb, var(--g-contested) 22%, var(--sheet)); }
.ru-legend { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 0.6rem; font-size: 0.78rem; color: var(--ink-2); }
.ru-legend i { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 2px; margin-right: 0.35em; vertical-align: -0.05em; }

/* scope */
.scope-row { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 1rem 0 0.6rem; }
.student { display: grid; justify-items: center; gap: 0.35rem; font: 0.72rem var(--sans); color: var(--muted); }
.student svg { width: 34px; height: 34px; fill: var(--ink-2); }
.ticket { display: grid; place-items: center; min-width: 2.6rem; height: 1.9rem; padding: 0 0.4rem; border-radius: 4px; border: 1px dashed var(--accent);
  background: var(--sheet); font: 700 1rem var(--mono); color: var(--accent); transition: transform 0.3s; }
.ticket.flip { transform: rotateX(90deg); }
.scope-formula { font: 1.05rem var(--serif); margin-top: 0.4rem; }
.scope-formula code { font-family: var(--serif); background: none; }

/* chain */
.chain-svg { width: 100%; height: auto; display: block; }
.chain-svg .node rect { fill: var(--sheet); stroke: var(--rule-2); stroke-width: 1.2; transition: fill 0.2s, stroke 0.2s; }
.chain-svg .node text { font: 600 13px var(--sans); fill: var(--ink-2); pointer-events: none; }
.chain-svg .node { cursor: pointer; }
.chain-svg .node:hover rect { stroke: var(--ink-2); }
.chain-svg .node.on rect { fill: color-mix(in srgb, var(--accent) 14%, var(--sheet)); stroke: var(--accent); stroke-width: 2; }
.chain-svg .node.on text { fill: var(--ink); }
.chain-svg .edge { stroke: var(--rule-2); stroke-width: 1; opacity: 0.55; transition: stroke 0.2s, opacity 0.2s; }
.chain-svg .edge.on { stroke: var(--accent); stroke-width: 2.2; opacity: 1; }
.chain-svg .colhead { font: 700 12px var(--sans); letter-spacing: 0.12em; fill: var(--ink); }
.chain-svg .colsub { font: 12px var(--sans); fill: var(--muted); }
.chain-detail { margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px solid var(--rule); }
.chain-detail h4 { margin: 0 0 0.4rem; font: 600 0.95rem var(--serif); }
.chain-detail ul { margin: 0.4rem 0 0; padding: 0; list-style: none; }
.chain-detail li { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.35rem 0; border-bottom: 1px solid var(--rule); }
.chain-detail li:last-child { border-bottom: 0; }

/* notation figures: shared ink. A place that changed gets .new and draws itself in. */
.explore svg .ink { stroke: var(--ink); stroke-width: 7; stroke-linecap: round; fill: none; }
.explore svg .blob { fill: var(--ink); }
.explore svg .ink.shell { stroke-width: 3; }
.explore svg .gap { fill: none; stroke: var(--rule-2); stroke-width: 1.5; stroke-dasharray: 4 4; }
.explore svg .hit { fill: transparent; }
.explore svg .cell { fill: var(--sheet); stroke: var(--rule-2); stroke-width: 1; }
.explore svg .new .ink { stroke-dasharray: var(--len); animation: ink-draw 0.45s ease-out var(--d, 0s) backwards; }
.explore svg .new .blob { transform-box: fill-box; transform-origin: center; animation: ink-pop 0.3s ease-out var(--d, 0s) backwards; }
@keyframes ink-draw { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
@keyframes ink-pop { from { transform: scale(0); opacity: 0; } }

/* kaktovik */
.kak { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem; }
.kak > svg { height: 140px; flex: none; transition: width 0.25s; }
.kak input[type="range"] { width: min(22rem, 70vw); accent-color: var(--accent); }
.kak-n { font: 700 2.2rem var(--serif); }
.kak-sum { color: var(--ink-2); }
.kak-parts { color: var(--muted); font-size: 0.82em; }
.kak-hint { margin: 0.4rem 0 0; font-size: 0.78rem; color: var(--muted); max-width: 26rem; }

/* kaktovik long division */
.kd { display: flex; flex-wrap: wrap; gap: 1.2rem 2rem; align-items: flex-start; }
.kd > svg { max-width: 100%; height: auto; flex: none; }
.kd svg .ink { stroke-width: 9; }
.kd svg .cell { fill: none; stroke: none; }
.kd svg .cur .ink { stroke: var(--accent); }
.kd svg .frame, .kd svg .rule { fill: none; stroke: var(--ink-2); stroke-width: 1.5; }
.kd svg .minus { font: 600 16px var(--sans); fill: var(--muted); }
.kd-side { flex: 1 1 16rem; }
.kd-text { margin: 0 0 0.8rem; color: var(--ink-2); min-height: 6em; }
.kd-btns, .rot-btns { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.kd-btns button, .rot-btns button, .anat-dictate, .nt-count, .nt-presets button {
  padding: 0.4rem 0.75rem; border-radius: 6px; border: 1px solid var(--rule-2); background: var(--sheet); color: var(--ink); font: 600 0.8rem var(--sans); cursor: pointer; }
.kd-btns button:disabled, .rot-btns button:disabled { opacity: 0.4; cursor: default; }
.rot-btns button[aria-pressed="true"], .nt-count[aria-pressed="true"] { background: var(--ink); color: var(--sheet); border-color: var(--ink); }

/* anatomy: dictation */
.anat-dictate { margin-left: 0.6rem; vertical-align: top; }
.digits span.wait { color: transparent; background: none; border-style: dashed; }
.digits span.land { animation: digit-land 0.35s ease-out; }
.digits span.land-whole { animation: digit-land 0.35s ease-out; }
@keyframes digit-land { from { transform: translateY(-0.6em); opacity: 0; } }

/* notation: one number, five notations */
.nt-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; }
.nt-presets { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.nt-presets button { padding: 0.3rem 0.55rem; font-family: var(--mono); }
.nt-range { width: 100%; margin: 0.8rem 0 0.2rem; accent-color: var(--accent); }
.nt-hint { margin: 0 0 0.8rem; font-size: 0.78rem; color: var(--muted); }
.nt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.6rem; }
.nt-card { display: flex; flex-direction: column; background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; padding: 0.7rem 0.8rem; }
.nt-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.nt-name { font: 600 0.72rem var(--sans); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.nt-base { font: 600 0.7rem var(--mono); color: var(--accent); }
.nt-glyph { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 110px; padding: 0.6rem 0; overflow-x: auto; }
.nt-glyph svg { max-width: 100%; height: auto; }
.nt-card[data-sys="maya"] .nt-glyph svg { width: auto; max-width: none; }
.nt-glyph svg .bar { stroke-width: 8; }
.nt-glyph svg .sep { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 3 3; }
.nt-ha { display: flex; gap: 0.15rem; }
.nt-ha span { display: grid; justify-items: center; padding: 0.1rem 0.25rem; border-radius: 4px; }
.nt-ha b { font: 400 2.6rem/1 var(--serif); }
.nt-ha i { font: normal 1.1rem/1.4 var(--serif); color: var(--muted); }
.nt-ha .new b, .nt-ha .new i { animation: digit-land 0.3s ease-out; }
.nt-sum { font: 0.8rem/1.5 var(--mono); color: var(--ink-2); }
.nt-sum span, .nt-ha span, .nt-glyph g.place { transition: background 0.15s, opacity 0.15s; border-radius: 3px; }
.nt-card:has(.hl) .nt-glyph g.place:not(.hl) { opacity: 0.25; }
.nt-sum span.hl, .nt-ha span.hl { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.nt-note { margin-top: 0.3rem; font-size: 0.74rem; color: var(--muted); }
.nt-world { margin-top: 1rem; }
.nt-world .label { margin: 0 0 0.4rem; font: 600 0.7rem var(--sans); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.nt-world-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.nt-world figure { margin: 0; flex: 1 1 10rem; max-width: 15rem; }
.nt-world img { display: block; width: 100%; height: 7.5rem; object-fit: cover; border-radius: 4px; border: 1px solid var(--rule); }
.nt-world figcaption { margin-top: 0.3rem; font-size: 0.72rem; line-height: 1.4; color: var(--muted); }

/* rotation task */
.rot { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: flex-start; }
.rot > svg { width: min(100%, 26rem); height: auto; flex: none; }
.rot .table { fill: var(--sheet); stroke: var(--rule-2); stroke-width: 1.2; }
.rot .lbl { font: 11px var(--sans); fill: var(--muted); text-anchor: middle; }
.rot .ax { font-weight: 600; fill: var(--ink-2); }
.rot .axis { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 5 4; }
.rot marker path { fill: var(--muted); }
.rot .obj path { fill: var(--ink); }
.rot .o-sq path { fill: var(--accent); }
.rot .ghost { opacity: 0; transition: transform 0.9s cubic-bezier(.6,0,.2,1), opacity 0.4s; }
.rot .ghost.on { opacity: 1; }
.rot .viewer circle { fill: var(--sheet); stroke: var(--ink); stroke-width: 2; }
.rot .viewer .nose { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.rot .hand { font: 600 10px var(--sans); fill: var(--muted); text-anchor: middle; }
.rot .turn { transition: transform 0.9s cubic-bezier(.6,0,.2,1); }
.rot .turn.back { transform: rotate(180deg); }
.rot-side { flex: 1 1 15rem; }
.rot-text { margin: 0.8rem 0 0; color: var(--ink-2); min-height: 4.5em; }

/* ------------------------------------------------------------------ popover */
.popover {
  position: fixed; z-index: 40; width: min(26rem, calc(100vw - 1.5rem)); max-height: 60vh; overflow: auto;
  background: var(--sheet); border: 1px solid var(--rule-2); border-radius: 8px; box-shadow: var(--shadow), 0 16px 40px rgba(0,0,0,0.12);
  padding: 0.9rem 1rem; font: 0.86rem/1.5 var(--sans); color: var(--ink);
}
.popover .pop-kind { font: 600 0.66rem/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.45rem; }
.popover .pop-entry { font: 0.92rem/1.5 var(--serif); }
.popover .pop-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.popover .pop-actions a { font: 600 0.78rem var(--sans); padding: 0.35rem 0.65rem; border-radius: 5px; border: 1px solid var(--rule-2); text-decoration: none; color: var(--ink); }
.popover .pop-actions a.primary { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.popover .pop-note { margin-top: 0.5rem; font-size: 0.72rem; color: var(--muted); }
.popover dfn { font: 700 0.95rem var(--serif); font-style: normal; display: block; margin-bottom: 0.2rem; }
.popover .close { position: absolute; top: 0.35rem; right: 0.45rem; border: 0; background: none; font-size: 1.1rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 0.2rem 0.35rem; }

/* ------------------------------------------------------------------ no-JS and print */
html:not(.js) .panel-head { margin-left: -1.25rem; margin-right: -1.25rem; }
html:not(.js) .ledger-tools, html:not(.js) .say { display: none; }
@media print {
  @page { margin: 18mm 16mm; }
  html, body { height: auto !important; overflow: visible !important; background: #fff; color: #000; font-size: 10.5pt; }
  .topbar, .site-foot-links, .spine, .panel-nav, .popover, .say, .ledger-tools, figure.explore, .cover-actions, .resume, .skip, .art-credit, .panel-art, .cover-art { display: none !important; }
  .shelf { display: block !important; height: auto !important; overflow: visible !important; }
  .panel { display: block !important; break-before: page; }
  .panel-body { display: block !important; width: auto !important; box-shadow: none !important; }
  .panel-scroll { height: auto !important; overflow: visible !important; opacity: 1 !important; visibility: visible !important; padding: 0 !important; }
  .panel-head { margin: 0 0 1rem !important; padding: 0 0 0.6rem !important; }
  a { color: #000; text-decoration: none; }
  a.cite { border: 0; }
  .table-wrap { overflow: visible; margin: 1em 0 !important; border: 0; }
  tr.hidden-row { display: table-row !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------------ bookmark (added by the script) */
.bm-able { position: relative; }
.bm {
  position: absolute; left: -1.85rem; top: 0.1em; width: 1.35rem; height: 1.75rem; padding: 0.15rem 0.3rem;
  border: 0; border-radius: 4px; background: none; color: var(--muted); cursor: pointer;
  opacity: 0; transition: opacity 0.2s; user-select: none; -webkit-user-select: none;
}
.bm svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.bm-able:hover > .bm, .bm:focus-visible, .bm[aria-pressed="true"] { opacity: 1; }
.bm:hover, .bm:focus-visible { color: var(--accent); }
.bm:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.bm[aria-pressed="true"] { color: var(--accent); }
.bm[aria-pressed="true"] svg, .bm-on::before { fill: var(--accent); stroke: var(--accent); }
.bm-on::before {
  content: ""; position: absolute; left: -1.55rem; top: 0.25em; width: 0.75rem; height: 1.15rem; background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 75%, 0 100%);
}
.bm-on.flash { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 4px; transition: background 0.4s; }
.bm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bm-panel .spine::after {
  content: ""; position: absolute; width: 0.5rem; height: 0.7rem; background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 75%, 0 100%);
}
@media (min-width: 900px) { html.js .bm-panel .spine::after { top: 4px; left: 50%; margin-left: -0.25rem; } }
@media (max-width: 899px) {
  .bm-panel .spine { position: relative; }
  .bm-panel .spine::after { top: 0; right: 1rem; }
  .bm { left: -1.15rem; width: 1.1rem; padding: 0.15rem 0.15rem; }
  .bm-on::before { left: -0.95rem; width: 0.6rem; height: 0.95rem; }
}
.panel.open.bm-panel .spine::after { background: var(--sheet); }
@media print { .bm, .bm-on::before { display: none !important; } }
