/* Document pages: single reading column, same tokens and type as the portfolio. */
:root {
  --paper: #F6F7FA;
  --surface: #FFFFFF;
  --ink: #141B2D;
  --muted: #4F596D;
  --rule: #D8DCE6;
  --accent: #2340C8;
  --accent-soft: #E7EBFB;
  --dot: #D08F00;
  --kbd-bg: #EEF0F5;
  --font-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Atkinson Hyperlegible Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --measure: 68ch;
  --radius: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E1220; --surface: #161B2C; --ink: #E9ECF4; --muted: #A7AFC3;
    --rule: #2A3149; --accent: #9DAEFF; --accent-soft: #1E2649; --dot: #F0B73A; --kbd-bg: #232A40;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0E1220; --surface: #161B2C; --ink: #E9ECF4; --muted: #A7AFC3;
  --rule: #2A3149; --accent: #9DAEFF; --accent-soft: #1E2649; --dot: #F0B73A; --kbd-bg: #232A40;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.6; }
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 0.18em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 16px; }

.wrap { max-width: 52rem; margin-inline: auto; padding-inline: clamp(16px, 4vw, 40px); }
.topbar { border-bottom: 1px solid var(--rule); }
.topbar .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-block: 14px; }
.topbar a { font-weight: 600; text-decoration: none; }

.doc-head { padding-block: clamp(32px, 6vw, 64px) 24px; display: grid; gap: 14px; }
.label { font-family: var(--font-mono); font-size: 0.84rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0; }
h1, h2, h3, h4 { line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.01em; padding-top: 12px; }
h3 { font-size: 1.3rem; font-weight: 600; }
h4 { font-size: 1.1rem; font-weight: 600; }
p, ul, ol, dl { margin: 0; max-width: var(--measure); }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 52ch; }
.about-doc { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 8px; font-size: 0.97rem; }
.about-doc p { max-width: none; }

.doc { display: grid; gap: 22px; padding-block: 8px 72px; }
.doc section { display: grid; gap: 16px; }
.doc section + section { border-top: 1px solid var(--rule); padding-top: 28px; margin-top: 12px; }
.doc ul, .doc ol { padding-left: 1.4em; display: grid; gap: 6px; }
.doc li > ul, .doc li > ol { margin-top: 6px; }
ol.alpha { list-style: lower-alpha; }
ol.roman { list-style: lower-roman; }

nav.toc { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; }
nav.toc h2 { font-size: 1rem; padding: 0 0 6px; }
nav.toc ol { padding-left: 1.3em; display: grid; gap: 4px; margin: 0; }

/* Keystroke tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.98rem; }
caption { text-align: left; font-weight: 600; font-size: 1.1rem; padding-bottom: 8px; }
th, td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--rule); }
thead th { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
tbody th { font-weight: 400; }
td { min-width: 12ch; }
kbd { font-family: var(--font-mono); font-size: 0.86em; background: var(--kbd-bg); border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }

.filter { display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; }
.filter label { font-weight: 600; }
.filter input { font: inherit; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--paper); color: var(--ink); min-height: 44px; width: 100%; }
.filter p { color: var(--muted); font-size: 0.93rem; }

figure { margin: 0; display: grid; gap: 8px; }
figure img { border: 1px solid var(--rule); border-radius: var(--radius); background: #FFFFFF; }
figcaption { color: var(--muted); font-size: 0.93rem; }

.steps { counter-reset: s; list-style: none; padding-left: 0 !important; gap: 22px !important; max-width: none; }
.steps > li { counter-increment: s; display: grid; grid-template-columns: 2.2rem minmax(0, 1fr); gap: 4px 12px; }
.steps > li::before { content: counter(s); grid-row: 1 / span 3; width: 2rem; height: 2rem; border-radius: 50%; background: var(--accent); color: var(--paper); display: grid; place-items: center; font-weight: 800; }
.steps > li > * { grid-column: 2; min-width: 0; }
.note { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 14px; max-width: var(--measure); }
.box { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 8px; max-width: var(--measure); }
.box h4, .box h5 { margin: 0; }
.script { border-left: 3px solid var(--dot); padding-left: 14px; font-style: italic; }

.doc-foot { border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.93rem; }
.doc-foot .wrap { padding-block: 28px; display: grid; gap: 6px; }

@media print {
  .topbar, .filter, .skip, .doc-foot { display: none; }
  body { background: #FFFFFF; color: #000000; font-size: 11pt; }
  a { color: #000000; }
  section { break-inside: avoid-page; }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
dl.buttons { display: grid; gap: 10px; max-width: var(--measure); }
dl.buttons div { display: grid; grid-template-columns: minmax(9rem, 12rem) minmax(0, 1fr); gap: 4px 14px; border-bottom: 1px solid var(--rule); padding-bottom: 10px; }
dl.buttons dt { font-weight: 600; }
dl.buttons dd { margin: 0; }
@media (max-width: 560px) { dl.buttons div { grid-template-columns: minmax(0, 1fr); } }
table { table-layout: fixed; }
thead th:first-child { width: 55%; }
@media (max-width: 560px) { thead th:first-child { width: 50%; } }
.shots { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.shots img { border: 1px solid var(--rule); border-radius: 4px; background: #FFFFFF; }
.steps .note, .steps ol { margin-top: 2px; }
dl.ov { margin: 0; display: grid; gap: 8px; }
dl.ov div { display: grid; gap: 2px; }
dl.ov dt { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
dl.ov dd { margin: 0; }
.practice { border: 1px dashed var(--accent); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 6px; max-width: var(--measure); }
.practice h4 { color: var(--accent); }
.script ol { margin-top: 6px; }
div.script p { margin: 0; }
.callrecord { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; display: grid; gap: 12px; max-width: 40rem; }
.callrecord p { color: var(--muted); font-size: 0.93rem; }
.field { display: grid; grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr); gap: 6px 14px; align-items: center; }
.field label { font-weight: 600; }
.field input { font: inherit; padding: 8px 10px; min-height: 44px; border: 1px solid var(--rule); border-bottom: 2px solid var(--muted); border-radius: 4px; background: var(--paper); color: var(--ink); width: 100%; }
@media (max-width: 560px) { .field { grid-template-columns: minmax(0, 1fr); } }
ol.seq { padding-left: 1.3em; }
ol.seq > li { margin-bottom: 8px; }
.flow-fig { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; }
ol.flow { list-style: none; padding: 0 !important; margin: 0; display: grid; gap: 22px !important; max-width: none; }
ol.flow > li { position: relative; display: grid; gap: 10px; justify-items: start; }
ol.flow > li + li::before { content: "↓"; position: absolute; top: -21px; left: 18px; color: var(--muted); font-size: 1rem; line-height: 1; }
.node { display: inline-block; padding: 8px 12px; border-radius: 6px; border: 1px solid var(--rule); background: var(--paper); max-width: 34rem; }
.node.start { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 600; }
.node.mod { font-weight: 600; border-color: var(--accent); }
.node.q { border-style: dashed; border-color: var(--dot); }
a.node.lesson { color: var(--accent); background: var(--accent-soft); border-color: transparent; text-decoration: none; }
a.node.lesson:hover { text-decoration: underline; }
.branch { margin-left: 22px; padding-left: 16px; border-left: 2px solid var(--rule); display: grid; gap: 10px; justify-items: start; }
.branch ul { list-style: none; padding: 0 !important; margin: 0; display: grid; gap: 10px !important; }
.branch li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.yn { font-family: var(--font-mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); min-width: 2.2rem; }
dl.plan { margin: 0; display: grid; gap: 12px; max-width: var(--measure); }
dl.plan div { display: grid; gap: 2px; }
dl.plan dt { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
dl.plan dd { margin: 0; }
dl.plan ul { padding-left: 1.2em; }
table.events, table.rubric { table-layout: auto; }
table.events thead th:first-child { width: 8rem; }
table.rubric thead th:first-child { width: 2.5rem; }
table.events td p + p, table.events td p + ol, table.events td ol + p { margin-top: 8px; }
table.events td ol { padding-left: 1.2em; display: grid; gap: 4px; }
ol.check { padding-left: 1.3em; display: grid; gap: 10px; }
ul.opts { list-style: none; padding-left: 0 !important; display: flex !important; flex-wrap: wrap; gap: 6px 16px !important; color: var(--muted); font-size: 0.95rem; margin-top: 4px; }
ul.opts li::before { content: "☐ "; }
.pts { color: var(--muted); font-size: 0.9rem; }
.total { font-size: 1.05rem; }
h3 { padding-top: 8px; }
table.events thead th:nth-child(2) { width: 52%; }
table.rubric thead th:nth-child(2) { width: 38%; }
.muted { color: var(--muted); }
dl.result { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: var(--measure); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; }
dl.result dt { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
dl.result dd { margin: 2px 0 0; }
table.data, table.tasks, table.lesson, table.quest { table-layout: auto; }
table.data.narrow { max-width: 26rem; }
table.data.num td, table.data.narrow td { font-variant-numeric: tabular-nums; }
table.data thead th:first-child, table.tasks thead th:first-child, table.lesson thead th:first-child, table.quest thead th:first-child { width: auto; }
tfoot th, tfoot td { font-weight: 600; border-top: 2px solid var(--ink); }
table.tasks tbody th { font-weight: 600; width: 55%; }
table.tasks tbody th ol { font-weight: 400; padding-left: 1.3em; margin-top: 6px; display: grid; gap: 4px; }
table.tasks td ul { padding-left: 1.1em; display: grid; gap: 3px; margin-bottom: 8px; }
.grp { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
table.lesson { font-size: 0.93rem; }
table.lesson thead th:nth-child(1) { width: 17%; } table.lesson thead th:nth-child(2) { width: 38%; } table.lesson thead th:nth-child(3) { width: 25%; }
table.lesson tbody th { font-weight: 600; }
table.lesson td ol { padding-left: 1.2em; display: grid; gap: 3px; margin-top: 6px; }
ul.lesson-toc { padding-left: 1.2em; display: grid; gap: 4px; }
.doc h4[id^="m"] { font-size: 1.2rem; padding-top: 14px; border-top: 1px dashed var(--rule); }
.slides { display: grid; gap: 16px; }
.slide { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 10px; }
.slide ul { padding-left: 1.2em; display: grid; gap: 5px; }
.slide h4 { font-size: 1.15rem; }
.sn { display: block; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 400; margin-bottom: 2px; }
details.longdesc { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 16px; }
details.longdesc summary { font-weight: 600; cursor: pointer; }
ol.flowtext { padding-left: 1.3em; display: grid; gap: 10px; margin-top: 10px; }
ol.flowtext ul { padding-left: 1.1em; margin-top: 4px; display: grid; gap: 3px; }
table.quest { font-size: 0.95rem; }
table.quest tr.grp th { background: var(--accent-soft); font-weight: 600; text-transform: none; letter-spacing: 0; font-family: var(--font-body); font-size: 1rem; color: var(--ink); }
table.quest tbody th { font-weight: 400; }
table.quest td:first-child { width: 2.5rem; color: var(--muted); }
td.rate { white-space: nowrap; font-variant-numeric: tabular-nums; }
.dots { color: var(--accent); letter-spacing: 2px; margin-right: 4px; }
dl.qa { display: grid; gap: 10px; max-width: var(--measure); }
dl.qa dt { font-weight: 600; }
dl.qa dd { margin: 2px 0 0; }
.doc section h3 { font-size: 1.35rem; }
@media (max-width: 560px) { dl.result { grid-template-columns: minmax(0, 1fr); } }
table.quest thead th:nth-child(1) { width: 2.5rem; } table.quest thead th:nth-child(2) { width: 46%; } table.quest thead th:nth-child(3) { width: 9.5rem; }
