:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #edeae1;
  --ink: #23211d;
  --ink-soft: #635f54;
  --muted: #8b8677;
  --line: #ddd8c9;
  --accent: #1f5f56;
  --accent-ink: #123b35;
  --accent-soft: #e2ede9;
  --gold: #92702a;
  --gold-soft: #f1e6cb;
  --rust: #9c4a3a;
  --rust-soft: #f3e1db;
  --ok: #3c7a5a;
  --ok-soft: #deebe3;
  --code-bg: #eef0ea;
  --shadow: 0 1px 2px rgba(35, 33, 29, 0.05), 0 8px 24px -12px rgba(35, 33, 29, 0.18);
  --sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17181a;
    --surface: #1f2123;
    --surface-2: #26282a;
    --ink: #e9e7e0;
    --ink-soft: #b3ae9f;
    --muted: #8b8677;
    --line: #34362f;
    --accent: #6fbfae;
    --accent-ink: #9adcc9;
    --accent-soft: #1c332e;
    --gold: #d2ac5c;
    --gold-soft: #3b301a;
    --rust: #d98d7b;
    --rust-soft: #3b241e;
    --ok: #7fbe9c;
    --ok-soft: #1e332a;
    --code-bg: #202220;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 30px -10px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  --bg: #17181a;
  --surface: #1f2123;
  --surface-2: #26282a;
  --ink: #e9e7e0;
  --ink-soft: #b3ae9f;
  --muted: #8b8677;
  --line: #34362f;
  --accent: #6fbfae;
  --accent-ink: #9adcc9;
  --accent-soft: #1c332e;
  --gold: #d2ac5c;
  --gold-soft: #3b301a;
  --rust: #d98d7b;
  --rust-soft: #3b241e;
  --ok: #7fbe9c;
  --ok-soft: #1e332a;
  --code-bg: #202220;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 30px -10px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent-ink); }

/* ---------- layout: sidebar + content ---------- */

.layout {
  display: flex;
  align-items: flex-start;
  max-width: 1360px;
  margin: 0 auto;
}

.sidebar {
  flex: 0 0 240px;
  width: 240px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 28px 20px 40px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: block;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 28px;
}
.brand span { color: var(--accent-ink); }

.nav-group { margin-bottom: 22px; }
.nav-group:last-child { margin-bottom: 0; }

.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.nav-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: none;
}

.nav-group li { margin-bottom: 0; }

.nav-group a {
  display: block;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13.5px;
  line-height: 1.4;
}
.nav-group a:hover { color: var(--accent-ink); }

@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: static;
    height: auto;
    width: auto;
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 20px 24px;
  }
  .nav-group ul { flex-direction: row; flex-wrap: wrap; gap: 4px 16px; }
  .brand { margin-bottom: 16px; }
}

/* ---------- page shell ---------- */

.page {
  flex: 1;
  min-width: 0;
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.page.wide { max-width: 980px; }

h1, h2, h3 { text-wrap: balance; }

h1.title {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.18;
  font-weight: 700;
  margin: 0 0 12px;
}

.lede {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 66ch;
  margin: 0 0 24px;
}

h2 {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  margin: 40px 0 12px;
}

h3 {
  font-size: 16.5px;
  font-weight: 700;
  margin: 22px 0 8px;
}

p { max-width: 72ch; margin: 0 0 14px; }
ul, ol { max-width: 68ch; margin: 0 0 14px; padding-left: 22px; }
li { margin-bottom: 6px; }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--code-bg);
  border-radius: 4px;
  padding: 0.1em 0.4em;
}

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

.table-wrap { overflow-x: auto; margin: 0 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
td code { white-space: nowrap; }

/* ---------- eyebrow / badges / status pills ---------- */

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.approved { background: var(--ok-soft); color: var(--ok); }
.pill.live { background: var(--gold-soft); color: var(--gold); }
.pill.proposal { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* ---------- version switcher ---------- */

.version-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 28px;
}
.version-switch a {
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink-soft);
  background: var(--surface);
}
.version-switch a.active {
  background: var(--accent);
  color: #fff;
}
.version-switch a:not(.active):hover { background: var(--surface-2); }

/* ---------- cards / callouts ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin: 0 0 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 0 0 16px;
}
@media (max-width: 620px) { .grid-2 { grid-template-columns: 1fr; } }

.callout {
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  box-shadow: var(--shadow);
  margin: 0 0 16px;
}
.callout .tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
}
.callout.warn { border-left-color: var(--rust); background: var(--rust-soft); }
.callout.warn .tag { color: var(--rust); }
.callout.future { border-left-color: var(--gold); background: var(--gold-soft); }
.callout.future .tag { color: var(--gold); }
.callout.good { border-left-color: var(--ok); }
.callout p:last-child { margin-bottom: 0; }

/* ---------- index page: category cards ---------- */

.category {
  margin-bottom: 44px;
}
.category-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.category-head h2 { margin: 0; }
.category-desc { color: var(--ink-soft); max-width: 68ch; margin-bottom: 16px; }

.topic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 700px) { .topic-grid { grid-template-columns: 1fr; } }

.topic-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
}
.topic-card:hover { border-color: var(--accent); }
.topic-card h3 { margin: 0 0 6px; font-size: 16px; }
.topic-card p { margin: 0; font-size: 13.5px; color: var(--ink-soft); max-width: none; }

footer.site-footer {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}
