:root {
  --bg: #0b0d10;
  --surface: #14171c;
  --surface-2: #1a1e25;
  --border: #252a33;
  --text: #e7e9ee;
  --text-dim: #9aa3b2;
  --text-muted: #6b7280;
  --accent: #4f8cff;
  --accent-dim: #2c5fb3;
  --success: #34d399;
  --warning: #fbbf24;
  --serif: "Charter", "Iowan Old Style", "Georgia", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Menlo", monospace;
  --max-w: 880px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color 150ms; }
a:hover { color: #79a8ff; }

/* layout */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

aside.nav {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 32px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

aside.nav .brand {
  display: block;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

aside.nav .brand-sub {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 28px;
  display: block;
}

aside.nav nav ol {
  list-style: none;
  counter-reset: section;
}

aside.nav nav ol li {
  counter-increment: section;
  margin-bottom: 2px;
}

aside.nav nav a {
  display: block;
  padding: 8px 12px;
  color: var(--text-dim);
  border-radius: 6px;
  font-size: 14px;
  position: relative;
  border-left: 2px solid transparent;
}

aside.nav nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

aside.nav nav a.active {
  background: var(--surface-2);
  color: var(--text);
  border-left-color: var(--accent);
}

aside.nav nav a::before {
  content: counter(section, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 10px;
}

aside.nav .footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

main {
  padding: 80px 64px;
  max-width: calc(var(--max-w) + 128px);
}

article {
  max-width: var(--max-w);
}

/* typography */
.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 16px;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 1.6rem + 1.8vw, 3.2rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  font-weight: 600;
}

h2 {
  font-family: var(--serif);
  font-size: 1.6rem;
  margin-top: 56px;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

h3 {
  font-size: 1.15rem;
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--text);
  font-weight: 600;
}

h4 {
  font-size: 0.95rem;
  margin-top: 20px;
  margin-bottom: 8px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

p { margin-bottom: 16px; color: var(--text-dim); }
article p strong { color: var(--text); font-weight: 600; }

ul, ol { margin: 0 0 20px 24px; }
li { margin-bottom: 8px; color: var(--text-dim); }
li strong { color: var(--text); }

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: #c9d4e6;
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  overflow-x: auto;
  margin: 20px 0;
  font-size: 13px;
}
pre code { background: none; border: none; padding: 0; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

/* lead paragraph */
.lead {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 32px;
  font-family: var(--serif);
  letter-spacing: -0.005em;
}

/* tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
}

th {
  text-align: left;
  padding: 12px 14px;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--text);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  vertical-align: top;
}

tbody tr:hover { background: var(--surface); }

/* cards / grids */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  transition: all 200ms;
}

.card:hover {
  border-color: var(--accent-dim);
  background: var(--surface-2);
  transform: translateY(-2px);
}

.card h3 { margin-top: 0; font-size: 1rem; }
.card p { font-size: 14px; margin-bottom: 0; }

.card-link {
  display: block;
  color: inherit;
}

.card-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

/* stats row */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin: 32px 0;
}

.stat {
  background: var(--surface);
  padding: 24px 20px;
}

.stat .num {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat .label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 6px;
}

/* badges */
.badge {
  display: inline-block;
  font-size: 11px;
  font-family: var(--mono);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge.ok { color: var(--success); border-color: rgba(52, 211, 153, 0.3); }
.badge.warn { color: var(--warning); border-color: rgba(251, 191, 36, 0.3); }

/* download buttons */
.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: all 150ms;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--text);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn.primary:hover { background: #6ba0ff; color: white; }

/* page footer nav */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 80px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

.page-nav a {
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
}

.page-nav a:hover { color: var(--text); }
.page-nav .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.page-nav .next { text-align: right; margin-left: auto; }

/* hero on landing */
.hero {
  padding: 40px 0 60px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.hero .meta {
  display: flex;
  gap: 24px;
  margin-top: 28px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.hero .meta span { display: flex; align-items: center; gap: 6px; }

/* responsive */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  aside.nav { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  main { padding: 40px 24px; }
}

/* prose tweaks */
article ul li::marker { color: var(--accent); }
article ol li::marker { color: var(--text-muted); font-family: var(--mono); font-size: 0.85em; }

blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 16px;
  margin: 20px 0;
  color: var(--text-dim);
  font-style: italic;
  background: var(--surface);
}
