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

:root {
  --bg:         #0f1117;
  --surface:    #1a1d27;
  --surface2:   #22263a;
  --border:     #2e3248;
  --accent:     #5b8dee;
  --accent2:    #3ecfa0;
  --brand:      #e8a020;
  --text:       #d4d8f0;
  --text-muted: #6b7294;
  --radius:     8px;
  --font:       'Segoe UI', system-ui, sans-serif;
  --sidebar-w:  240px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

nav.topnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-logo {
  font-weight: 700;
  font-size: 17px;
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 8px;
}

.topnav-links { display: flex; gap: 24px; font-size: 13px; }
.topnav-links a { color: var(--text-muted); }
.topnav-links a:hover { color: var(--text); text-decoration: none; }

.layout { display: flex; flex: 1; }

aside {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
}

.sidebar-section {
  padding: 0 20px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  margin-top: 16px;
}

aside ul { list-style: none; }
aside ul li a {
  display: block;
  padding: 7px 20px;
  font-size: 13px;
  color: var(--text-muted);
  border-left: 2px solid transparent;
}
aside ul li a:hover { color: var(--text); text-decoration: none; }
aside ul li a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--surface2);
}

main {
  flex: 1;
  padding: 48px 56px;
  max-width: 820px;
}

h1 { font-size: 32px; font-weight: 800; margin-bottom: 8px; letter-spacing: -.5px; }
.page-sub { color: var(--text-muted); margin-bottom: 40px; font-size: 16px; }

h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 40px 0 12px;
  color: var(--text);
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
h2:first-of-type { border-top: none; margin-top: 0; }

h3 { font-size: 15px; font-weight: 700; margin: 24px 0 8px; color: var(--text); }

p { margin-bottom: 14px; }

ul.topic-list {
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 2;
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 12.5px;
  color: var(--accent2);
  overflow-x: auto;
  line-height: 1.65;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  margin: 12px 0;
  white-space: pre;
}

code {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: monospace;
  font-size: 13px;
  color: var(--accent2);
}

.callout {
  background: var(--surface);
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 13.5px;
}
.callout strong { color: var(--brand); }

.callout.stub-notice {
  border-left-color: var(--text-muted);
}
.callout.stub-notice strong { color: var(--text-muted); }

.next-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.next-link {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: block;
  color: var(--text);
  font-size: 13px;
  transition: border-color .15s;
}
.next-link:hover { border-color: var(--accent); text-decoration: none; }
.next-link .link-label { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.next-link .link-title { font-weight: 600; margin-top: 4px; }

table.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 16px 0;
}
table.ref-table th {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
table.ref-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.ref-table tr:last-child td { border-bottom: none; }
table.ref-table tr:hover td { background: var(--surface2); }

@media (max-width: 720px) {
  nav.topnav { padding: 0 16px; }
  aside { display: none; }
  main { padding: 32px 20px; }
}
