:root {
  --surface: #0d1117;
  --surface-raised: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #9198a1;
  --accent: #58a6ff;
  --band-low: #3fb950;
  --band-med: #d29922;
  --band-high: #f85149;
  --measure: 68ch;
  --step--1: clamp(0.82rem, 0.79rem + 0.14vw, 0.9rem);
  --step-0: clamp(1rem, 0.95rem + 0.22vw, 1.12rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.45vw, 1.45rem);
  --step-2: clamp(1.5rem, 1.3rem + 0.9vw, 2rem);
  --step-3: clamp(2rem, 1.6rem + 1.9vw, 3.25rem);
}

@media (prefers-color-scheme: light) {
  :root {
    --surface: #ffffff;
    --surface-raised: #f6f8fa;
    --border: #d0d7de;
    --text: #1f2328;
    --text-muted: #59636e;
    --accent: #0969da;
    --band-low: #1a7f37;
    --band-med: #9a6700;
    --band-high: #cf222e;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: var(--step-0);
  line-height: 1.65;
}

.wrap {
  width: 100%;
  max-width: 76rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

p, li, dd, dt, figcaption { max-width: var(--measure); }

a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 10;
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.6rem 1rem;
  border-radius: 6px;
  transition: top 120ms ease;
}
.skip-link:focus { top: 0.5rem; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.hero {
  border-bottom: 1px solid var(--border);
  padding-block: clamp(3rem, 9vw, 6rem) clamp(2.5rem, 6vw, 4rem);
}

h1 {
  font-size: var(--step-3);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  font-weight: 650;
}

.lede { font-size: var(--step-1); color: var(--text-muted); margin: 0 0 2rem; }

h2 {
  font-size: var(--step-2);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
  font-weight: 620;
}

h3 {
  font-size: var(--step-1);
  margin: 2rem 0 0.6rem;
  font-weight: 600;
}

code, pre, .codeblock-label {
  font-family: ui-monospace, "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

p code, li code {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.08em 0.35em;
  font-size: 0.9em;
}

.codeblock {
  max-width: var(--measure);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-raised);
  margin: 0 0 2rem;
  overflow: hidden;
}

.codeblock-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0.5rem 0.4rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.codeblock-label {
  font-size: var(--step--1);
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.codeblock-bar button {
  font: inherit;
  font-size: var(--step--1);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  transition: border-color 120ms ease;
}
.codeblock-bar button:hover { border-color: var(--accent); }

pre {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  font-size: var(--step--1);
  line-height: 1.55;
}
pre code { white-space: pre; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1.25rem;
  max-width: var(--measure);
  margin: 0 0 2rem;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--border);
}
.facts dt {
  font-size: var(--step--1);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0 0 0.2rem;
}
.facts dd { margin: 0; font-weight: 600; }

.cta { margin: 0; }
.button {
  display: inline-block;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.6rem 1.3rem;
  text-decoration: none;
  font-weight: 600;
}
.button:hover { background: var(--surface-raised); }

.layout { display: block; }

.toc {
  border-bottom: 1px solid var(--border);
  padding-block: 1.5rem;
}
.toc summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: var(--step--1);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.6rem;
  padding: 0.35rem 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after {
  content: "";
  width: 0.55em;
  height: 0.55em;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(-0.15em) rotate(45deg);
  transition: transform 120ms ease;
}
.toc-disclosure[open] > summary::after {
  transform: translateY(0.1em) rotate(-135deg);
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc a {
  display: block;
  padding: 0.35rem 0.75rem;
  border-radius: 0 4px 4px 0;
  text-decoration: none;
  color: var(--text-muted);
  font-size: var(--step--1);
  transition: color 120ms ease, background-color 120ms ease,
    border-color 120ms ease;
}
@media (hover: hover) {
  .toc a:hover { color: var(--text); background: var(--surface-raised); }
}
.toc a[aria-current="true"] {
  color: var(--accent);
  font-weight: 600;
}

main { padding-block: 1rem 3rem; }

.feature-section {
  padding-block: clamp(2.5rem, 6vw, 4rem);
  border-top: 1px solid var(--border);
}
.feature-section:first-child { border-top: 0; }
main section:focus { outline: none; }

.prose-list { max-width: var(--measure); padding-left: 1.2rem; }
.prose-list li { margin-bottom: 0.7rem; }

.scale-figure { margin: 2rem 0; max-width: 46rem; }
.scale { width: 100%; height: auto; display: block; }
.scale text { fill: var(--text); font-family: inherit; font-size: 15px; }
.band-label { font-size: 15px; font-weight: 600; fill: var(--surface); }
.tick text { fill: var(--text-muted); font-size: 14px; text-anchor: middle; }
.plot-note { fill: var(--text-muted); font-size: 13px; text-anchor: middle; }
.never { fill: var(--text-muted); font-size: 14px; text-anchor: middle; }
.legend text { fill: var(--text-muted); font-size: 13px; }
.band-label { text-anchor: middle; }

.band-low-fill { fill: var(--band-low); }
.band-med-fill { fill: var(--band-med); }
.band-high-fill { fill: var(--band-high); opacity: 0.35; }

.dot-legit { fill: none; stroke: var(--text); stroke-width: 2; }
.dot-susp { fill: var(--text); }

figcaption {
  font-size: var(--step--1);
  color: var(--text-muted);
  margin-top: 0.9rem;
}

.table-scroll { overflow-x: auto; margin: 2rem 0; }
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;
  font-size: var(--step--1);
}
caption {
  text-align: left;
  color: var(--text-muted);
  font-size: var(--step--1);
  padding-bottom: 0.7rem;
}
th, td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
thead th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
tbody th { font-weight: 600; }

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.05em 0.6em;
  font-size: 0.85em;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid currentColor;
}
.pill-low { color: var(--band-low); }
.pill-med { color: var(--band-med); }
.pill-high { color: var(--band-high); }

footer {
  border-top: 1px solid var(--border);
  padding-block: 2.5rem 3.5rem;
  color: var(--text-muted);
  font-size: var(--step--1);
}

@media (max-width: 40rem) {
  table { min-width: 0; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr {
    display: block;
    border-bottom: 1px solid var(--border);
    padding-block: 0.6rem;
  }
  tbody th, tbody td {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    border-bottom: 0;
    padding: 0.25rem 0;
  }
  tbody th::before, tbody td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-weight: 600;
    flex: 0 0 auto;
  }
}

@media (min-width: 34rem) and (max-width: 63.999rem) {
  .toc ol {
    columns: 2;
    column-gap: 2rem;
  }
}

@media (min-width: 64rem) {
  .layout {
    display: grid;
    grid-template-columns: 14rem minmax(0, var(--measure));
    gap: clamp(2rem, 5vw, 4rem);
    justify-content: center;
    align-items: start;
  }
  .toc {
    position: sticky;
    top: 2rem;
    border-bottom: 0;
    border-right: 1px solid var(--border);
    padding: 2.5rem 1.5rem 2.5rem 0;
  }
  .toc ol { border-left: 1px solid var(--border); }
  .toc a {
    margin-left: -1px;
    border-left: 3px solid transparent;
  }
  .toc a[aria-current="true"] {
    border-left-color: var(--accent);
    background: var(--surface-raised);
  }
  .toc summary { cursor: default; }
  .toc summary::after { display: none; }
  .toc-disclosure > ol { display: block; }
  main { padding-block: 0 3rem; }
  .feature-section:first-child { padding-top: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
