:root {
  --bg: #0f1117;
  --bg-card: #161922;
  --bg-code: #1c1f2b;
  --border: #2a2e3d;
  --text: #e1e4ed;
  --text-muted: #8b8fa3;
  --accent: #6c8cff;
  --accent-dim: #6c8cff22;
  --green: #4ade80;
  --red: #f87171;
  --yellow: #fbbf24;
  --orange: #fb923c;
  --nav-w: 220px;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-heading: 'Space Grotesk', var(--font-body);
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8f9fc;
    --bg-card: #ffffff;
    --bg-code: #f0f1f5;
    --border: #d4d7e0;
    --text: #1a1d2b;
    --text-muted: #6b6f82;
    --accent: #4a6cf7;
    --accent-dim: #4a6cf722;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 2rem; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
}

/* ── Sidebar ─────────────────────────── */

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--nav-w);
  height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  overflow-y: auto;
  z-index: 100;
}

.sidebar h2 {
  font-family: var(--font-heading);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: .75rem;
}

.sidebar a {
  display: block;
  padding: .35rem .6rem;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .82rem;
  transition: all .15s;
}

.sidebar a:hover,
.sidebar a.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.sidebar .section-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-top: 1rem;
  margin-bottom: .3rem;
  padding-left: .6rem;
  opacity: .7;
}

/* ── Main ────────────────────────────── */

.main {
  margin-left: var(--nav-w);
  max-width: 820px;
  padding: 2.5rem 3rem 5rem;
}

/* ── Section blocks ──────────────────── */

.section {
  margin-bottom: 3.5rem;
  scroll-margin-top: 1.5rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: 1rem;
}

.pr-link {
  font-size: .65em;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  opacity: .8;
}
.pr-link:hover { opacity: 1; text-decoration: underline; }

.section-num {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--accent);
  opacity: .6;
  min-width: 1.5rem;
}

.section h2 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 600;
}

.section p { margin-bottom: .75rem; }

/* ── Cards ───────────────────────────── */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  transition: border-color .2s;
}

.card:hover { border-color: var(--accent); }

.card-eyebrow {
  font-family: var(--font-mono);
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin-bottom: .4rem;
}

.card h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  margin-bottom: .5rem;
}

.card .meta {
  font-size: .78rem;
  color: var(--text-muted);
}

.card .meta a { color: var(--accent); text-decoration: none; }
.card .meta a:hover { text-decoration: underline; }

/* ── Tables ──────────────────────────── */

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
  border-radius: 8px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

th {
  background: var(--bg-code);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-align: left;
  padding: .6rem .8rem;
  color: var(--text-muted);
}

td {
  padding: .55rem .8rem;
  border-top: 1px solid var(--border);
  vertical-align: top;
}

tr:hover td { background: var(--accent-dim); }

/* ── Code blocks ─────────────────────── */

pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: .75rem 0;
  font-size: .78rem;
  line-height: 1.6;
}

code {
  font-family: var(--font-mono);
  font-size: .82em;
}

pre code { font-size: inherit; }

:not(pre) > code {
  background: var(--bg-code);
  padding: .15em .4em;
  border-radius: 4px;
  font-size: .82em;
}

/* ── Syntax colors ───────────────────── */

.kw  { color: #c792ea; }  /* keyword */
.typ { color: #82aaff; }  /* type */
.str { color: #c3e88d; }  /* string */
.cmt { color: #546e7a; }  /* comment */
.num { color: #f78c6c; }  /* number */
.del { color: var(--red); background: #f8717122; }
.add { color: var(--green); background: #4ade8022; }
.fn  { color: #82aaff; }  /* function */

/* ── Badges ──────────────────────────── */

.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .65rem;
  font-weight: 600;
  padding: .15em .5em;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-high   { background: #f8717133; color: var(--red); }
.badge-medium { background: #fbbf2433; color: var(--yellow); }
.badge-low    { background: #4ade8033; color: var(--green); }
.badge-pass   { background: #4ade8033; color: var(--green); }
.badge-skip   { background: #8b8fa333; color: var(--text-muted); }

/* ── Callout ─────────────────────────── */

.callout {
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: .8rem 1rem;
  margin: 1rem 0;
  font-size: .85rem;
}

.callout strong { color: var(--accent); }

/* ── Details (collapsible) ───────────── */

details {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: .75rem 0;
  font-size: .85rem;
}

details summary {
  padding: .6rem 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: .82rem;
  color: var(--text-muted);
}

details summary:hover { color: var(--accent); }

details[open] summary { border-bottom: 1px solid var(--border); }

details .inner { padding: .8rem 1rem; }

/* ── Links ───────────────────────────── */

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Responsive ──────────────────────── */

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 1.5rem 1.25rem; }
  .card-grid { grid-template-columns: 1fr; }
}

/* ── Separator ───────────────────────── */

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ── Hero ────────────────────────────── */

.hero {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  margin-bottom: .5rem;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: .75rem;
}

.hero-sub {
  color: var(--text-muted);
  font-size: .95rem;
  max-width: 560px;
}

.hero-meta {
  display: flex;
  gap: .5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.chip {
  font-family: var(--font-mono);
  font-size: .65rem;
  padding: .25em .6em;
  border-radius: 5px;
  background: var(--bg-code);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
