:root {
  color-scheme: light;
  --paper: #fbfaf7;
  --sidebar: #f2f0ea;
  --ink: #211f1d;
  --muted: #57544f;
  --rule: #d7d4cc;
  --accent: #9a3419;
  --accent-bg: #f9e7dc;
  --sans: "Inter", "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 5.25rem; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.6 var(--sans); -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, summary:focus-visible, [tabindex="0"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip { position: fixed; top: .5rem; left: .5rem; z-index: 12; background: var(--paper); padding: .6rem 1rem; transform: translateY(-170%); }
.skip:focus { transform: none; }
.topbar { position: sticky; z-index: 6; top: 0; background: var(--paper); border-bottom: 1px solid var(--ink); }
.topbar-inner { max-width: 91rem; min-height: 4.3rem; padding: .6rem clamp(1rem, 4.2vw, 4.75rem); margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .75rem; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.wordmark { font-size: 1.53rem; line-height: 1; font-weight: 780; letter-spacing: -.055em; }
.slash { color: var(--accent); font: 1.6rem/1 var(--mono); }
.main-link { display: inline-block; padding: .5rem .95rem; border-radius: .33rem; background: var(--ink); color: #fff; font-size: .9rem; font-weight: 620; text-decoration: none; white-space: nowrap; }
.main-link:hover { background: #443b35; }
.shell { display: grid; grid-template-columns: minmax(12rem, 14rem) minmax(0, 1fr) minmax(9rem, 12rem); column-gap: clamp(1.4rem, 3.6vw, 4.4rem); align-items: start; padding: 0 clamp(1rem, 4.2vw, 4.75rem); margin: auto; max-width: 91rem; }
.sidebar, .outline { position: sticky; top: 4.45rem; max-height: calc(100vh - 4.55rem); overflow: auto; scrollbar-width: thin; padding-top: 2.45rem; padding-bottom: 2rem; }
.sidebar { border-right: 1px solid var(--rule); padding-right: 1.05rem; }
.nav-title, .outline-title { color: var(--ink); margin: 0 0 1.15rem; font-size: .92rem; font-weight: 700; }
.nav-group + .nav-group { margin-top: 1.1rem; }
.group-label { margin: 0 0 .18rem; color: var(--muted); font: .79rem/1.5 var(--mono); }
.nav-group ul, .outline ul, .sources, .trail { list-style: none; padding: 0; margin: 0; }
.nav-group a { display: block; line-height: 1.4; padding: .37rem .62rem; margin-left: -.03rem; font-size: .94rem; color: var(--ink); text-decoration: none; border-inline-start: 2px solid transparent; }
.nav-group a:hover { background: var(--sidebar); }
.nav-group a[aria-current="page"] { background: var(--accent-bg); border-color: var(--accent); color: #762c17; font-weight: 670; }
.outline { padding-left: .8rem; }
.outline ul { border-left: 1px solid var(--rule); }
.outline a { color: var(--muted); text-decoration: none; display: block; padding: .35rem 0 .35rem .8rem; font-size: .875rem; line-height: 1.45; }
.outline a:hover { color: var(--accent); text-decoration: underline; }
.mobile-nav { display: none; }
main { min-width: 0; padding-top: 2.5rem; padding-bottom: 3rem; }
.crumb { font: .83rem/1.5 var(--mono); color: var(--muted); margin-bottom: 1.15rem; }
.crumb ol { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.crumb li + li::before { content: "/"; color: var(--accent); margin-right: .5rem; }
.crumb a { color: var(--muted); }
h1, h2, h3 { font-weight: 710; color: var(--ink); }
h1 { font-size: clamp(2.65rem, 4.8vw, 4.35rem); line-height: 1.02; letter-spacing: -.054em; margin: 0 0 1.1rem; text-wrap: balance; }
h2 { font-size: clamp(1.5rem, 2.5vw, 2.15rem); line-height: 1.15; letter-spacing: -.034em; margin: 0 0 .85rem; text-wrap: balance; }
h3 { font-size: 1.08rem; letter-spacing: -.012em; line-height: 1.35; margin: 0 0 .42rem; }
p { margin: 0 0 .78rem; }
.lead { color: #393631; font-size: clamp(1.06rem, 1.45vw, 1.25rem); line-height: 1.58; max-width: 66ch; }
.reviewed { font: .81rem/1.55 var(--mono); color: var(--muted); margin: .95rem 0 0; }
.doc-section { margin-top: 2.2rem; padding-top: 1.8rem; border-top: 1px solid var(--rule); }
.doc-section > p, .doc-section > ol { max-width: 75ch; }
.doc-section ol { padding-left: 1.4rem; }
.doc-section ol li { padding: .14rem 0 .3rem .35rem; }
.doc-section ol li::marker { color: var(--accent); font-weight: 690; }
.table-wrap { margin: 1rem 0 0; border: 1px solid var(--rule); border-radius: .35rem; max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; line-height: 1.47; }
thead { background: var(--sidebar); }
th, td { padding: .65rem .85rem; vertical-align: top; border-bottom: 1px solid var(--rule); }
thead th { color: var(--muted); font-size: .87rem; font-weight: 620; }
tbody th { font-weight: 625; }
tbody tr:last-child > * { border-bottom: 0; }
table code { overflow-wrap: anywhere; font: .91rem/1.46 var(--mono); }
table.wide { min-width: 31.5rem; }
.worked { margin: 1.15rem 0 .1rem; padding: 1rem 1.2rem; border-inline-start: 3px solid var(--accent); background: #f4eee5; }
.worked-label { color: var(--accent); font-weight: 680; font-size: .94rem; }
.formula { color: var(--ink); font: 600 clamp(.99rem, 1.55vw, 1.22rem)/1.55 var(--mono); margin: .42rem 0; overflow-wrap: anywhere; }
.worked p:last-child { margin: .4rem 0 0; }
.stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--rule); border-top: 2px solid var(--accent); border-radius: .3rem; overflow: hidden; margin-top: 1.1rem; }
.stage { display: block; padding: .95rem; color: var(--ink); text-decoration: none; background: #f3f0e9; }
.stage + .stage { border-left: 1px solid var(--rule); }
.stage strong, .topic-card strong { display: block; color: var(--ink); line-height: 1.3; }
.stage strong { font-size: 1.15rem; }
.stage span, .topic-card span { display: block; margin-top: .3rem; font-size: .95rem; line-height: 1.47; color: var(--muted); }
.stage:hover, .topic-card:hover { background: var(--accent-bg); }
.stage:hover strong, .topic-card:hover strong, .next-read a:hover { text-decoration: underline; }
.topic-list { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.topic-card { padding: .77rem .9rem; border: 1px solid var(--rule); border-radius: .3rem; color: var(--ink); text-decoration: none; }
.qa { padding: .85rem 0 .9rem; border-top: 1px solid var(--rule); }
.qa p { margin: 0; }
.qa:first-of-type { border-top: 0; padding-top: .2rem; }
.ref-title { font-weight: 610; }
.sources li { margin: 0 0 .65rem; }
.source-url { display: block; font: .82rem/1.4 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.next-read { display: flex; gap: .55rem 1.1rem; flex-wrap: wrap; align-items: baseline; border-top: 1px solid var(--rule); padding-top: 1.05rem; margin-top: 1.6rem; }
.next-read span { font-weight: 660; }
.next-read a { color: var(--accent); }
.footer { border-top: 1px solid var(--ink); }
.footer-inner { margin: auto; max-width: 91rem; display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .5rem; padding: 1.1rem clamp(1rem, 4.2vw, 4.75rem); font-size: .9rem; color: var(--muted); }
.footer-inner a { color: var(--ink); }
@media (max-width: 68rem) {
  .shell { grid-template-columns: 12rem minmax(0, 1fr); column-gap: 2rem; }
  .outline { display: none; }
}
@media (max-width: 48rem) {
  html { scroll-padding-top: 4.3rem; }
  .shell { display: block; max-width: 47rem; }
  .topbar-inner { min-height: 3.7rem; }
  .sidebar { display: none; }
  .mobile-nav { display: block; border-bottom: 1px solid var(--rule); }
  .mobile-nav summary { cursor: pointer; min-height: 2.8rem; padding: .62rem 0; color: var(--ink); font-weight: 630; }
  .mobile-nav summary::marker { color: var(--accent); }
  .mobile-nav nav { padding: .35rem 0 1.1rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
  .mobile-nav .nav-group { margin: 0; }
  .mobile-nav .nav-group a { padding: .47rem .4rem; }
  main { padding: 1.5rem 0 2rem; }
  .doc-section { margin-top: 1.65rem; padding-top: 1.4rem; }
  .table-wrap th, .table-wrap td { padding: .55rem .65rem; }
}
@media (max-width: 31rem) {
  .stages, .topic-list { grid-template-columns: 1fr; }
  .stage + .stage { border-left: 0; border-top: 1px solid var(--rule); }
  .stage { padding: .63rem .82rem; }
  .stage span { margin-top: .13rem; }
  .mobile-nav nav { column-gap: .5rem; }
  .brand { gap: .45rem; }
}
@media print {
  body { background: white; color: black; font-size: 10.5pt; }
  .topbar, .mobile-nav, .sidebar, .outline, .footer, .skip, .next-read { display: none; }
  .shell, main { display: block; padding: 0; }
  h1 { font-size: 27pt; }
  h2 { font-size: 17pt; }
  h2, h3 { break-after: avoid; }
  tr, .worked, .qa { break-inside: avoid; }
  .table-wrap { overflow: visible; }
  table.wide { min-width: 0; }
  .doc-section { margin-top: 12pt; padding-top: 8pt; }
}
