:root {
  --app: 246 246 247; --surface: 255 255 255; --sunken: 241 241 243; --line: 226 226 230; --line-strong: 201 201 208;
  --fg: 26 26 28; --fg-muted: 92 95 98; --fg-subtle: 127 130 136; --accent: 88 82 216; --accent-fg: 72 66 200; --accent-soft: 238 238 253; --accent-border: 199 198 246;
}
@media (prefers-color-scheme: dark) {
  :root { --app: 9 9 11; --surface: 17 17 20; --sunken: 13 13 16; --line: 38 38 45; --line-strong: 55 55 64; --fg: 244 244 246; --fg-muted: 158 158 170; --fg-subtle: 122 122 134; --accent: 111 105 245; --accent-fg: 165 161 251; --accent-soft: 32 30 62; --accent-border: 62 58 112; }
}
@font-face { font-family: 'Inter Variable'; font-weight: 100 900; src: url(fonts/inter-latin-wght-normal.woff2) format('woff2-variations'); }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body { margin: 0; background: rgb(var(--app)); color: rgb(var(--fg)); font: 440 15px/24px 'Inter Variable', Inter, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
header { position: sticky; top: 0; z-index: 5; height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 18px; background: rgb(var(--surface)); border-bottom: 1px solid rgb(var(--line)); }
header .back { color: rgb(var(--accent-fg)); text-decoration: none; font-weight: 510; font-size: 14px; }
header .back:hover { text-decoration: underline; }
.sep { width: 1px; height: 16px; background: rgb(var(--line-strong)); }
.sub { color: rgb(var(--fg-muted)); font-size: 14px; }
.wrap { display: flex; gap: 32px; max-width: 1280px; margin: 0 auto; padding: 24px 18px 80px; }
nav { flex: none; width: 260px; position: sticky; top: 72px; align-self: flex-start; max-height: calc(100vh - 90px); overflow: auto; font-size: 13px; line-height: 18px; }
nav a { display: block; color: rgb(var(--fg-muted)); text-decoration: none; padding: 4px 8px; border-radius: 6px; }
nav a:hover { background: rgb(var(--sunken)); color: rgb(var(--fg)); }
nav a.l2 { font-weight: 570; color: rgb(var(--fg)); margin-top: 8px; }
nav a.l3 { padding-left: 18px; }
main { flex: 1; min-width: 0; background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); border-radius: 12px; padding: 28px 36px 40px; }
h1 { font-size: 30px; line-height: 38px; letter-spacing: -.02em; margin: 0 0 12px; }
h2 { font-size: 23px; line-height: 30px; letter-spacing: -.015em; margin: 44px 0 12px; padding-top: 28px; border-top: 1px solid rgb(var(--line)); }
h3 { font-size: 18px; line-height: 26px; margin: 30px 0 8px; }
h4 { font-size: 15.5px; line-height: 22px; margin: 22px 0 6px; padding: 6px 10px; background: rgb(var(--accent-soft)); border-radius: 8px; box-shadow: inset 0 0 0 1px rgb(var(--accent-border)); }
p { margin: 0 0 12px; } ul, ol { margin: 0 0 14px; padding-left: 22px; } li { margin-bottom: 5px; }
li ul { margin-top: 5px; margin-bottom: 0; }
a { color: rgb(var(--accent-fg)); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; background: rgb(var(--sunken)); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
pre { background: rgb(var(--sunken)); border: 1px solid rgb(var(--line)); border-radius: 8px; padding: 14px 16px; overflow: auto; font-size: 12.5px; line-height: 19px; }
pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid rgb(var(--line)); margin: 28px 0; }
blockquote { margin: 0 0 14px; padding: 8px 14px; border-left: 3px solid rgb(var(--accent)); background: rgb(var(--accent-soft)); border-radius: 0 8px 8px 0; }
.tw { overflow-x: auto; margin: 0 0 16px; border: 1px solid rgb(var(--line)); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; line-height: 19px; }
th { text-align: left; background: rgb(var(--sunken)); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: rgb(var(--fg-subtle)); padding: 8px 12px; border-bottom: 1px solid rgb(var(--line)); white-space: nowrap; }
td { padding: 8px 12px; border-bottom: 1px solid rgb(var(--line)); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
@media (max-width: 900px) { nav { display: none; } main { padding: 20px 16px 32px; } .wrap { padding: 12px 10px 60px; } }

/* slim themed scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgb(var(--fg) / .22) transparent; }
*:hover { scrollbar-color: rgb(var(--fg) / .38) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background: rgb(var(--fg) / .22); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgb(var(--fg) / .4); background-clip: content-box; }
::-webkit-scrollbar-button { display: none; }

/* scrollspy: active section */
nav a { position: relative; transition: background .12s, color .12s; }
nav a.active { background: rgb(var(--accent-soft)); color: rgb(var(--accent-fg)); font-weight: 570; }
nav a.active::before { content: ''; position: absolute; left: 0; top: 5px; bottom: 5px; width: 3px; border-radius: 2px; background: rgb(var(--accent)); }

/* collapsible groups */
nav .gh { display: flex; align-items: flex-start; gap: 2px; margin-top: 6px; }
nav .tg { flex: none; width: 22px; height: 26px; padding: 0; border: 0; background: none; color: rgb(var(--fg-subtle)); display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 6px; }
nav button.tg:hover { background: rgb(var(--sunken)); color: rgb(var(--fg)); }
nav .tg svg { transition: transform .2s; }
nav .grp.open .tg svg { transform: rotate(90deg); }
nav a.l2 { flex: 1; margin-top: 0; }
nav a.l3 { margin-left: 24px; padding-left: 10px; border-left: 1px solid rgb(var(--line)); border-radius: 0 6px 6px 0; }
nav a.l3.active::before { left: -1px; }
nav .subs { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
nav .subs > div { overflow: hidden; min-height: 0; }
nav .grp.open .subs { grid-template-rows: 1fr; }
