/* ============ TOKENS (shared with goaxon.net) ============ */
:root {
  --bg: #0a0d12;
  --bg-raised: #0e1218;
  --surface: #12161d;
  --surface-2: #171c24;
  --border: #232935;
  --border-bright: #313a4a;
  --ink: #e8eaee;
  --ink-dim: #97a0b2;
  --ink-faint: #5c6577;
  --pulse: #5b8cff;
  --pulse-dim: #2c3a5e;
  --pulse-glow: rgba(91, 140, 255, 0.35);
  --warn: #e8a23d;
  --good: #4fd1a5;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

img, svg { max-width: 100%; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--pulse); outline-offset: 2px; }

code, pre, .mono { font-family: var(--mono); }

h1, h2, h3, h4 {
  font-family: var(--mono);
  font-weight: 600;
  text-wrap: balance;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* ============ TOP BAR ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(10, 13, 18, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 20px; min-width: 0; }
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}
.brand svg { width: 22px; height: 22px; }
.brand .tag {
  font-size: 11px;
  color: var(--ink-faint);
  font-weight: 500;
  border-left: 1px solid var(--border-bright);
  padding-left: 9px;
  margin-left: 1px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  color: var(--ink);
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 7px;
  text-decoration: none;
  border: 1px solid var(--border-bright);
  color: var(--ink);
  background: transparent;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.btn:hover { border-color: var(--pulse); background: var(--surface); }
.btn-primary {
  background: var(--pulse);
  border-color: var(--pulse);
  color: #06090f;
}
.btn-primary:hover { background: #4c7cf0; border-color: #4c7cf0; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 11px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-faint);
  width: 220px;
  flex-shrink: 1;
  min-width: 0;
}
.search-box kbd {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  border: 1px solid var(--border-bright);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--ink-faint);
  flex-shrink: 0;
}

/* ============ LAYOUT ============ */
.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  max-width: 1360px;
  margin-inline: auto;
}
.shell.with-toc { grid-template-columns: 248px minmax(0, 1fr) 220px; }

@media (max-width: 1100px) {
  .shell.with-toc { grid-template-columns: 248px minmax(0, 1fr); }
  .toc-rail { display: none; }
}

@media (max-width: 860px) {
  .shell, .shell.with-toc { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-flex; }
  .search-box { display: none; }
}

/* ============ SIDEBAR ============ */
.sidebar {
  position: sticky;
  top: 61px;
  align-self: start;
  height: calc(100vh - 61px);
  overflow-y: auto;
  padding: 28px 18px 40px;
  border-right: 1px solid var(--border);
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 8px; }

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: 61px;
    left: 0;
    bottom: 0;
    width: 260px;
    background: var(--bg);
    z-index: 39;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 24px 0 48px -24px rgba(0,0,0,0.6); }
}

.nav-group { margin-bottom: 22px; }
.nav-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0 10px;
  margin-bottom: 6px;
}
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list a {
  display: block;
  font-size: 13.8px;
  color: var(--ink-dim);
  text-decoration: none;
  padding: 7px 10px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: background 0.12s, color 0.12s;
}
.nav-list a:hover { color: var(--ink); background: var(--surface); }
.nav-list a.active {
  color: var(--ink);
  background: var(--surface);
  border-left-color: var(--pulse);
  font-weight: 500;
}

/* ============ CONTENT ============ */
.content {
  padding: 40px 48px 100px;
  min-width: 0;
  max-width: 780px;
}
@media (max-width: 860px) {
  .content { padding: 32px 22px 80px; }
}

.crumb {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-faint);
  margin-bottom: 14px;
}
.crumb a { text-decoration: none; color: var(--ink-faint); }
.crumb a:hover { color: var(--ink-dim); }

.content h1 {
  font-size: clamp(26px, 4vw, 34px);
  margin: 0 0 10px;
}
.content .dek {
  font-size: 16px;
  color: var(--ink-dim);
  margin: 0 0 36px;
  max-width: 62ch;
  line-height: 1.6;
}

.content h2 {
  font-size: 21px;
  margin: 48px 0 14px;
  padding-top: 4px;
  scroll-margin-top: 76px;
}
.content h2:first-of-type { margin-top: 0; }
.content h3 {
  font-size: 16px;
  margin: 28px 0 10px;
  scroll-margin-top: 76px;
}
.content p { margin: 0 0 16px; color: var(--ink-dim); }
.content p code, .content li code, .content td code, .content th code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.87em;
  color: var(--ink);
}
.content strong { color: var(--ink); font-weight: 600; }
.content ul, .content ol { margin: 0 0 16px; padding-left: 22px; color: var(--ink-dim); }
.content li { margin-bottom: 6px; }
.content li::marker { color: var(--ink-faint); }

.content a.inline-link {
  color: var(--pulse);
  text-decoration: none;
  border-bottom: 1px solid var(--pulse-dim);
}
.content a.inline-link:hover { border-bottom-color: var(--pulse); }

/* ============ CODE BLOCKS ============ */
.code-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 0 22px;
}
.code-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-faint);
  letter-spacing: 0.03em;
}
pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13.2px;
  line-height: 1.7;
}
pre code { font-family: inherit; color: var(--ink-dim); }
.tok-kw { color: #c792ea; }
.tok-type { color: #82aaff; }
.tok-str { color: #c3e88d; }
.tok-fn { color: var(--pulse); }
.tok-com { color: var(--ink-faint); font-style: italic; }
.tok-prop { color: #f78c6c; }
.tok-num { color: #f78c6c; }
.tok-punc { color: var(--ink-faint); }

/* ============ TABLES ============ */
.table-wrap { overflow-x: auto; margin: 0 0 22px; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13.8px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
th {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  font-weight: 500;
  background: var(--bg-raised);
}
td { color: var(--ink-dim); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td:first-child { color: var(--ink); font-family: var(--mono); font-size: 13px; white-space: nowrap; }

/* ============ CALLOUTS ============ */
.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  margin: 0 0 22px;
  font-size: 14px;
  color: var(--ink-dim);
}
.callout .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.callout-note .dot { background: var(--pulse); box-shadow: 0 0 0 3px var(--pulse-dim); }
.callout-warn .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(232,162,61,0.18); }
.callout p:last-child { margin-bottom: 0; }

/* ============ API REFERENCE ============ */
.api-kind {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pulse);
  background: rgba(91,140,255,0.1);
  border: 1px solid rgba(91,140,255,0.25);
  border-radius: 100px;
  padding: 3px 10px;
  margin-bottom: 12px;
}
.api-kind .admin-badge {
  color: var(--warn);
  border-left: 1px solid rgba(91,140,255,0.25);
  padding-left: 8px;
  margin-left: -1px;
}
.api-sig {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-faint);
  margin-bottom: 4px;
}
.member {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  background: var(--surface);
}
.member-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.member-name { font-family: var(--mono); font-size: 15px; color: var(--ink); font-weight: 600; }
.member-type {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
}
.member p { margin-bottom: 8px; font-size: 14px; }
.member p:last-child { margin-bottom: 0; }
.param-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.param-list li { font-size: 13.5px; color: var(--ink-dim); }
.param-list .pname { font-family: var(--mono); color: var(--ink); }
.param-list .ptype { font-family: var(--mono); color: var(--ink-faint); font-size: 12px; }

.pkg-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  background: var(--surface);
  margin-bottom: 14px;
}
.pkg-card .pkg-name { font-family: var(--mono); font-size: 15px; color: var(--ink); font-weight: 600; }
.pkg-card .pkg-nuget { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); margin-top: 3px; }
.pkg-card p { margin-top: 10px; margin-bottom: 0; font-size: 14px; }
.pkg-card .pkg-members { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.pkg-card .pkg-members a {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--pulse);
  text-decoration: none;
  background: rgba(91,140,255,0.08);
  border: 1px solid rgba(91,140,255,0.2);
  border-radius: 5px;
  padding: 3px 9px;
}
.pkg-card .pkg-members a:hover { background: rgba(91,140,255,0.16); }

/* ============ TOC RAIL ============ */
.toc-rail {
  position: sticky;
  top: 61px;
  align-self: start;
  height: calc(100vh - 61px);
  overflow-y: auto;
  padding: 40px 20px 40px 0;
}
.toc-rail .toc-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 10px;
}
.toc-rail ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.toc-rail a {
  font-size: 13px;
  color: var(--ink-faint);
  text-decoration: none;
  display: block;
  border-left: 2px solid var(--border);
  padding-left: 10px;
}
.toc-rail a:hover { color: var(--ink-dim); border-left-color: var(--border-bright); }

/* ============ PREV/NEXT ============ */
.pagenav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.pagenav a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.15s;
}
.pagenav a:hover { border-color: var(--border-bright); }
.pagenav .dir { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.pagenav .pname { font-size: 14.5px; color: var(--ink); font-weight: 500; }
.pagenav .next { text-align: right; align-items: flex-end; grid-column: 2; }
.pagenav .prev { grid-column: 1; }

/* ============ OVERLAY (mobile sidebar) ============ */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 38;
}
.overlay.open { display: block; }
