:root {
  --bg: #f8f9fa;
  --paper: #ffffff;
  --ink: #202122;
  --muted: #54595d;
  --link: #0645ad;
  --link-visited: #0b0080;
  --link-hover: #0645ad;
  --accent: #c2410c;
  --border: #a2a9b1;
  --border-light: #c8ccd1;
  --sidebar-bg: #f8f9fa;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-heading: "Linux Libertine", "Georgia", "Times", serif;
  --font-mono: "SF Mono", ui-monospace, "Cascadia Code", monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14.5px/1.65 var(--font-body);
}
a { color: var(--link); }
a:visited { color: var(--link-visited); }
a:hover { text-decoration: underline; }

/* ── Header ── */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--border-light);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  font: 700 22px/1 var(--font-heading);
  color: var(--ink);
  letter-spacing: -0.01em;
}
.brand a { color: inherit; text-decoration: none; }
.brand small {
  display: block;
  font: 400 11px/1.3 var(--font-body);
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-top: 2px;
}
.header-nav {
  display: flex;
  gap: 4px;
  align-items: center;
}
.header-nav a {
  padding: 6px 12px;
  font-size: 13px;
  color: var(--link);
  border-radius: 3px;
}
.header-nav a:hover { background: var(--bg); text-decoration: none; }

/* ── Layout ── */
.shell { max-width: 1320px; margin: 0 auto; display: flex; gap: 0; }

/* ── Sidebar ── */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-light);
  padding: 16px 14px 40px;
  font-size: 13px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar h2, .sidebar h3 {
  margin: 0;
  font: 700 11.5px/1.3 var(--font-body);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sidebar ul { list-style: none; padding: 0; margin: 0 0 4px; }
.sidebar li { margin: 0; }
.sidebar a {
  display: block;
  padding: 4px 8px;
  color: var(--link);
  border-radius: 3px;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.4;
}
.sidebar a:hover { background: #eaecf0; text-decoration: none; }
.sidebar a.current-page {
  font-weight: 700;
  color: var(--ink);
  background: #e0e3e7;
}
.nav-group { margin-top: 14px; }
.nav-group:first-of-type { margin-top: 4px; }
.nav-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  padding: 0 8px;
}
.badge {
  font: 600 10px/1 var(--font-mono);
  color: var(--muted);
  background: #e0e3e7;
  padding: 2px 6px;
  border-radius: 8px;
}
.searchbox {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font: inherit;
  font-size: 13px;
  margin-top: 8px;
  background: var(--paper);
}
.searchbox:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 2px rgba(6, 69, 173, 0.15);
}
.searchmeta { color: var(--muted); font-size: 11px; margin-top: 6px; }
.results ul { margin-top: 8px; }
.results li {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light);
  font-size: 12.5px;
}
.results li a { font-size: 13px; }
.result-path {
  color: var(--muted);
  font: 500 10px/1.2 var(--font-mono);
  margin-top: 2px;
}

/* ── Content ── */
.content {
  flex: 1;
  min-width: 0;
  background: var(--paper);
  padding: 24px 32px 64px;
  border-right: 1px solid var(--border-light);
}
.meta-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.meta-note {
  color: var(--muted);
  font-size: 12px;
}
.eyebrow {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}
.content header {
  margin: 0 0 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}
.content header h1 {
  margin: 4px 0 0;
  font: 400 28px/1.15 var(--font-heading);
  color: var(--ink);
  border: none;
}
.content p, .content li, .content blockquote { max-width: 80ch; }
.content h2 {
  margin: 24px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
  font: 400 22px/1.2 var(--font-heading);
  color: var(--ink);
}
.content h3 {
  margin: 20px 0 6px;
  font: 700 16px/1.3 var(--font-body);
  color: var(--ink);
}
.content ul, .content ol { padding-left: 24px; }
.content li { margin-bottom: 4px; }
.content code {
  background: #f8f9fa;
  border: 1px solid #eaecf0;
  padding: 1px 4px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.9em;
}
.content pre {
  overflow: auto;
  padding: 14px 16px;
  background: #f8f9fa;
  border: 1px solid var(--border-light);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
}
.content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}
.content blockquote {
  margin: 12px 0 12px 0;
  padding: 8px 16px;
  border-left: 3px solid var(--border);
  color: var(--muted);
  background: #f8f9fa;
}
.content table {
  border-collapse: collapse;
  width: 100%;
  max-width: 80ch;
  margin: 12px 0;
  font-size: 14px;
}
.content th, .content td {
  padding: 6px 12px;
  text-align: left;
  border: 1px solid var(--border-light);
}
.content th {
  background: #f8f9fa;
  font-weight: 700;
}

/* ── Related / See also ── */
.related {
  margin: 24px 0 16px;
  padding: 12px 16px;
  background: #f8f9fa;
  border: 1px solid var(--border-light);
  border-radius: 2px;
}
.related h2 {
  margin: 0 0 8px;
  font: 700 14px/1.3 var(--font-body);
  border: none;
  padding: 0;
}
.related ul { list-style: disc; padding-left: 20px; margin: 0; }
.related li {
  padding: 2px 0;
  font-size: 13.5px;
}

/* ── TOC ── */
.toc {
  float: right;
  margin: 0 0 16px 24px;
  padding: 10px 14px;
  background: #f8f9fa;
  border: 1px solid var(--border-light);
  font-size: 13px;
  max-width: 300px;
}
.toc-title {
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  font-size: 13px;
}
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin: 2px 0; line-height: 1.4; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    min-width: 0;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding: 12px 16px;
  }
  .content { padding: 16px 16px 48px; }
  .content header h1 { font-size: 24px; }
  .toc { float: none; max-width: 100%; margin: 0 0 16px; }
  .site-header { flex-direction: column; align-items: flex-start; }
}
