/* Layout: a plain site header and a short hero on the home page. Inner pages have a contents list on the left, a 68ch reading column, and previous and next links. */
:root {
  --bg: #fafaf7;
  --surface: #f1f0ea;
  --fg: #1d1e20;
  --muted: #5f6064;
  --rule: #deddd5;
  --accent: #f5de7a;          /* pastel yellow: fills, highlights, underlines */
  --accent-soft: #fbf1c4;
  --accent-ink: #7a6200;      /* readable yellow-family text on light */
  --on-accent: #1d1e20;
  --sans: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --measure: 68ch;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151617; --surface: #1e1f21; --fg: #e9e7e0; --muted: #a2a19b; --rule: #2e2f31;
    --accent: #f0d86c; --accent-soft: #3a3421; --accent-ink: #f0d86c; --on-accent: #1d1e20; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151617; --surface: #1e1f21; --fg: #e9e7e0; --muted: #a2a19b; --rule: #2e2f31;
  --accent: #f0d86c; --accent-soft: #3a3421; --accent-ink: #f0d86c; --on-accent: #1d1e20; color-scheme: dark;
}
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.62 var(--sans); padding-inline: 16px; -webkit-text-size-adjust: 100%; }
img { max-width: 100%; }
a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 3px; }
a:hover { background: var(--accent-soft); }
a:focus-visible, input:focus-visible, summary:focus-visible, button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; border-radius: 2px; }
.wrap { max-width: 1120px; margin-inline: auto; }

.top { border-bottom: 1px solid var(--rule); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; padding-block: 14px; }
.brand { font-family: var(--mono); font-weight: 500; font-size: 15px; text-decoration: none; }
.brand b { font-weight: 500; background: var(--accent); color: var(--on-accent); padding: 0 3px; border-radius: 2px; }
.brand:hover { background: none; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 15px; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--fg); background: none; }
.top nav a[aria-current="page"] { color: var(--fg); box-shadow: inset 0 -3px 0 var(--accent); }

.hero { padding-block: 56px 44px; border-bottom: 1px solid var(--rule); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px 56px; align-items: start; }
.hero h1 { font-size: clamp(34px, 5vw, 50px); line-height: 1.06; letter-spacing: -0.02em; margin: 0 0 18px; font-weight: 700; text-wrap: balance; }
.lede { font-size: 20px; margin: 0 0 14px; max-width: 32em; }
.sub { color: var(--muted); margin: 0 0 24px; max-width: 34em; }
.facts { font-family: var(--mono); font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 28px; padding: 0; list-style: none; }
.facts b { color: var(--fg); font-weight: 500; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { display: inline-block; padding: 9px 16px; border: 1.5px solid var(--fg); border-radius: 4px; text-decoration: none; font-weight: 600; font-size: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent); filter: brightness(0.96); }
.index-h, .toc-h { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 6px 0 10px; }
.index { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.index li { border-bottom: 1px solid var(--rule); }
.index a { display: grid; grid-template-columns: 2.4em minmax(0, 1fr) auto; gap: 12px; padding: 6px 4px; text-decoration: none; font-size: 16px; }
.index .pn, .index .pm { font-family: var(--mono); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 3px; }

.home-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 40px 56px; padding-block: 44px 72px; }
.home-body h2 { font-size: 22px; margin: 0 0 16px; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cards a { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 14px 16px; border: 1px solid var(--rule); border-radius: 4px; text-decoration: none; }
.cards a:hover { border-color: var(--accent); background: var(--accent-soft); }
.card-t { font-weight: 600; }
.card-d { color: var(--muted); font-size: 15px; line-height: 1.45; }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 56px; padding-block: 36px 72px; }
.toc { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 20px); align-self: start; max-height: calc(100vh - 40px); overflow-y: auto; font-size: 14.5px; }
.toc-h:first-child { margin-top: 0; }
.toc ol, .toc-mobile ol { list-style: none; margin: 0 0 18px; padding: 0; }
.toc a, .toc-mobile a { display: block; padding: 3px 0 3px 10px; border-left: 3px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc a:hover, .toc-mobile a:hover { color: var(--fg); background: none; }
.toc a[aria-current="page"], .toc-mobile a[aria-current="page"] { color: var(--fg); border-left-color: var(--accent); font-weight: 600; }
.tn { font-family: var(--mono); font-size: 12px; display: inline-block; width: 2em; color: var(--muted); font-weight: 400; }
.toc-mobile { display: none; }

main { min-width: 0; }
article { max-width: var(--measure); }
.eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: 0.03em; margin: 0 0 8px; color: var(--muted); }
.eyebrow::before { content: ""; display: inline-block; width: 10px; height: 10px; background: var(--accent); border-radius: 2px; margin-right: 8px; vertical-align: -1px; }
article h1 { font-size: clamp(28px, 4vw, 38px); line-height: 1.15; letter-spacing: -0.015em; margin: 0 0 22px; font-weight: 700; text-wrap: balance; }
article h2 { font-size: 20px; margin: 34px 0 8px; font-weight: 700; text-wrap: balance; }
article p { margin: 0 0 14px; }
article ul { margin: 0 0 16px; padding-left: 22px; }
article ol { margin: 0 0 16px; padding-left: 24px; }
article ol li::marker { font-family: var(--mono); font-size: 14px; color: var(--muted); }
code { font-family: var(--mono); font-size: 0.88em; background: var(--surface); padding: 1px 4px; border-radius: 3px; }
article li { margin-bottom: 6px; }
strong { font-weight: 700; }

.note { background: var(--accent-soft); padding: 14px 18px; margin: 18px 0 24px; border-radius: 4px; }
.note p { margin: 0; }
.note .note-title { font-weight: 700; margin-bottom: 4px; }

.table-wrap { overflow-x: auto; margin: 18px 0 24px; border: 1px solid var(--rule); border-radius: 4px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.45; min-width: 560px; }
th, td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--rule); }
thead th { background: var(--surface); font-family: var(--mono); font-weight: 500; font-size: 13px; }
tbody th { font-weight: 600; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }

.checklist { margin: 8px 0 20px; }
.check-count { font-family: var(--mono); font-size: 13px; color: var(--muted); margin: 0 0 8px !important; font-variant-numeric: tabular-nums; }
.checks { list-style: none; padding: 0 !important; margin: 0; }
.checks li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; align-items: start; }
.checks input { width: 17px; height: 17px; margin: 4px 0 0; accent-color: var(--accent); cursor: pointer; }
.checks label { cursor: pointer; }
.checks input:checked + label { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--muted); }

.pager { max-width: var(--measure); display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--rule); }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 4px; text-decoration: none; font-weight: 600; }
.pager a:hover { border-color: var(--accent); background: var(--accent-soft); }
.pager a span { font-family: var(--mono); font-size: 12.5px; font-weight: 400; color: var(--muted); }
.pager .next { text-align: right; grid-column: 2; }

footer { border-top: 1px solid var(--rule); padding-block: 28px 40px; color: var(--muted); font-size: 14.5px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 32px; justify-content: space-between; }
footer p { margin: 0; max-width: 60ch; }
.progress { margin: 28px 0 32px; padding: 18px 20px; border: 1px solid var(--rule); border-radius: 4px; }
.progress h2 { margin: 0 0 6px; font-size: 18px; }
.progress-count { font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; margin: 0 0 8px !important; }
.bar { height: 8px; background: var(--surface); border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
@media (prefers-reduced-motion: reduce) { .bar span { transition: none; } }
.progress-note { color: var(--muted); font-size: 15px; }
.btn.confirm { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--fg); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 3px; cursor: pointer; }

@media (max-width: 860px) {
  .hero-grid, .home-body { grid-template-columns: minmax(0, 1fr); }
  .hero { padding-block: 36px 28px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 20px; }
  .toc { display: none; }
  .toc-mobile { display: block; margin-bottom: 24px; border: 1px solid var(--rule); border-radius: 4px; padding: 10px 14px; font-size: 15px; }
  .toc-mobile summary { cursor: pointer; font-family: var(--mono); font-size: 13px; color: var(--muted); }
  .toc-mobile[open] summary { margin-bottom: 10px; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager .next { grid-column: 1; }
}
