:root {
  --bg: #fbfaf7;
  --fg: #1d2421;
  --muted: #5b6662;
  --line: #dfe3e0;
  --card: #ffffff;
  --accent: #0b6b5f;
  --accent-fg: #ffffff;
  --code-bg: #f0f2f0;
  --warn: #8a5a00;
  --pass: #1f6b3a;
  --fail: #9b2c2c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141816;
    --fg: #e6ebe8;
    --muted: #a2ada8;
    --line: #2c3431;
    --card: #1b201e;
    --accent: #5cc4b2;
    --accent-fg: #0d1211;
    --code-bg: #222927;
    --warn: #e0b45c;
    --pass: #7fd19a;
    --fail: #f19a9a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-wrap: break-word;
}
a { color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.topnav { border-bottom: 1px solid var(--line); background: var(--card); }
.topnav div {
  max-width: 900px; margin: 0 auto; padding: 10px 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px;
}
.topnav .brand { font-weight: 700; color: var(--fg); text-decoration: none; margin-right: auto; }
.topnav a { text-decoration: none; font-size: 0.95rem; }
.topnav a[aria-current="page"] { color: var(--fg); font-weight: 600; }

main { max-width: 900px; margin: 0 auto; padding: 28px 16px 64px; }
h1 { font-size: 2.1rem; line-height: 1.2; margin: 8px 0 12px; }
h2 { font-size: 1.45rem; line-height: 1.3; margin: 52px 0 10px; padding-top: 18px; border-top: 1px solid var(--line); }
h3 { font-size: 1.12rem; margin: 28px 0 8px; }
p { margin: 0 0 14px; }
.lede { font-size: 1.15rem; }
.muted { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; color: var(--muted); font-weight: 600; margin: 0; }

.cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 8px; }
.cta a {
  display: inline-block; padding: 9px 16px; border: 1px solid var(--accent);
  border-radius: 6px; text-decoration: none; font-weight: 600;
}
.cta a.primary { background: var(--accent); color: var(--accent-fg); }

.note {
  border-left: 3px solid var(--warn); background: var(--card);
  padding: 10px 14px; margin: 18px 0; font-size: 0.95rem;
}
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 4px 16px 10px; margin: 18px 0; }
.panel h3 { margin-top: 14px; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 16px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
.card h3 { margin: 4px 0 6px; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.stat b { display: block; font-size: 1.25rem; }
.stat span { font-size: 0.85rem; color: var(--muted); }

ol.steps { list-style: none; counter-reset: step; padding-left: 0; }
ol.steps > li { counter-increment: step; position: relative; padding-left: 42px; margin-bottom: 14px; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-fg);
  font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; justify-content: center;
}

figure { margin: 18px 0 24px; }
figure img {
  display: block; max-width: 100%; height: auto; border-radius: 6px;
  border: 1px solid var(--line); background: #fff;
}
figure.wide img { width: 100%; }
figure.narrow img { width: 440px; }
figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 6px; }

.table-wrap { overflow-x: auto; margin: 12px 0 20px; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
.pass { color: var(--pass); font-weight: 600; }
.fail { color: var(--fail); font-weight: 600; }
.partial { color: var(--warn); font-weight: 600; }

pre {
  background: var(--code-bg); padding: 12px 14px; border-radius: 6px;
  overflow-x: auto; font-size: 0.85rem; line-height: 1.5;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; overflow-wrap: anywhere; }
pre code { overflow-wrap: normal; font-size: 1em; }
dl.flags { margin: 10px 0 18px; }
dl.flags dt { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; margin-top: 8px; overflow-wrap: anywhere; }
dl.flags dd { margin: 2px 0 0 18px; }
ol, ul { padding-left: 22px; }
li { margin-bottom: 4px; }
footer { margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }

figure.plot img { width: 100%; background: transparent; }
dl.glossary dt { font-weight: 700; margin-top: 12px; }
dl.glossary dd { margin: 2px 0 0 0; }
.example { margin-top: 8px; }
.example h3 { margin-top: 22px; }
.toc { columns: 2 220px; padding-left: 20px; }
