:root {
  color-scheme: light;
  --bg: #fcfcfb;
  --fg: #0b0b0b;
  --muted: #52514e;
  --rule: #dcdbd6;
  --code-bg: #f3f2ee;
  --link: #1f5fae;
  --accent: #2a78d6;
  --pass: #008300;
  --none: #6b6a65;
  --pending: #8e5c00;
  --grid: #e8e7e2;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #1a1a19;
    --fg: #f0efec;
    --muted: #c3c2b7;
    --rule: #3a3a37;
    --code-bg: #242422;
    --link: #7fb2f0;
    --accent: #3987e5;
    --pass: #0ca30c;
    --none: #9a9992;
    --pending: #d39a20;
    --grid: #2e2e2c;
  }
}

* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  line-height: 1.55;
}
main { max-width: 50rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
a { color: var(--link); }
h1 { font-size: 1.7rem; line-height: 1.25; margin: 0 0 0.5rem; }
h2 {
  font-size: 1.3rem;
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--rule);
}
h3 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }
.meta { color: var(--muted); font-size: 0.9rem; }
p, li { overflow-wrap: anywhere; }
nav.toc { font-size: 0.9rem; margin: 1rem 0 0; }
nav.toc a { margin-right: 0.9rem; white-space: nowrap; }

figure { margin: 1.5rem 0; }
figure img { display: block; width: 100%; height: auto; border-radius: 4px; }
figcaption { color: var(--muted); font-size: 0.85rem; margin-top: 0.4rem; }

code, pre, .mono {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
}
code { background: var(--code-bg); padding: 0.05rem 0.25rem; border-radius: 3px; }
pre {
  background: var(--code-bg);
  padding: 0.8rem 1rem;
  border-radius: 4px;
  overflow-x: auto;
  line-height: 1.45;
}
pre code { background: none; padding: 0; }

table { border-collapse: collapse; width: 100%; margin: 0.75rem 0; font-size: 0.92rem; }
th, td { text-align: left; vertical-align: top; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; color: var(--muted); font-size: 0.85rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hash { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.75rem; word-break: break-all; }
.table-scroll { overflow-x: auto; }

.status { font-weight: 600; white-space: nowrap; }
.status.pass { color: var(--pass); }
.status.none { color: var(--none); }
.status.pending { color: var(--pending); }

.bar-cell { width: 30%; }
.bar { height: 0.7rem; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }

.chart { position: relative; margin: 1rem 0 0.25rem; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--muted); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.chart .label { fill: var(--fg); font-size: 11px; }
.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.35rem 0.55rem;
  font-size: 0.8rem;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.12);
  display: none;
}
.tooltip .muted { color: var(--muted); }

ul.caveats li, ul.refs li { margin-bottom: 0.45rem; }
footer { margin-top: 3rem; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--rule); padding-top: 1rem; }
figure img.hero { max-height: 280px; object-fit: cover; }

/* Lean syntax highlighting (lean-highlight.js) */
:root {
  --tok-keyword: #a3239c;
  --tok-name: #1f5fae;
  --tok-type: #0b7a62;
  --tok-sort: #b04a00;
  --tok-number: #b04a00;
  --tok-op: #6b6a65;
  --tok-string: #2f7d1a;
  --tok-comment: #65645e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --tok-keyword: #e08fd8;
    --tok-name: #82b8f5;
    --tok-type: #5fd0b0;
    --tok-sort: #f0a868;
    --tok-number: #f0a868;
    --tok-op: #a9a89f;
    --tok-string: #9ad27c;
    --tok-comment: #8e8d86;
  }
}
.tok-keyword { color: var(--tok-keyword); font-weight: 600; }
.tok-name { color: var(--tok-name); font-weight: 600; }
.tok-type { color: var(--tok-type); }
.tok-sort { color: var(--tok-sort); }
.tok-number { color: var(--tok-number); }
.tok-op { color: var(--tok-op); }
.tok-string { color: var(--tok-string); }
.tok-comment { color: var(--tok-comment); font-style: italic; }

figure video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: #0d0e14; border-radius: 4px; }
.videos { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0 1.25rem; }
