:root {
  --bg: #0c1527;
  --bg-elev: #111a2e;
  --border: rgba(255,255,255,.08);
  --text: #c4c4ca;
  --text-muted: #a2a2a6;
  --heading: #f1f1f4;
  --primary: #8b7fff;
  --primary-light: #a99ff9;
  --primary-dim: rgba(139,127,255,.12);
}

html[data-theme="light"] {
  --bg: #ffffff;
  --bg-elev: #f7f7f9;
  --border: rgba(15,17,23,.1);
  --text: #3f3f46;
  --text-muted: #6b6b73;
  --heading: #0f1117;
  --primary: #6b5fef;
  --primary-light: #6b5fef;
  --primary-dim: rgba(107,95,239,.1);
}

*, ::before, ::after { box-sizing: border-box; margin: 0; padding: 0; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }

.outer { max-width: 90rem; margin: 0 auto; padding: 0 2rem; }

.topbar {
  position: sticky; top: 0; height: 64px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px); z-index: 30;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 2rem;
}
.topbar-logo { display: flex; align-items: center; gap: .75rem; text-decoration: none; flex-shrink: 0; }
.topbar-logo img { height: 28px; width: auto; }
.topbar-wordmark { font-size: 11px; font-weight: 600; letter-spacing: .2em; line-height: 1.1; color: var(--heading); text-transform: uppercase; }
.topbar-search { position: relative; width: 28rem; }
.topbar-search input { width: 100%; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); font: 14px Inter, system-ui, sans-serif; padding: 0 5rem 0 2.5rem; outline: none; }
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search .search-icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.topbar-search .search-kbd { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text-muted); pointer-events: none; border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; }
.search-results { position: absolute; top: 44px; left: 0; width: 100%; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; list-style: none; padding: .5rem; z-index: 40; }
.search-results li a { display: block; padding: .5rem .75rem; border-radius: .5rem; color: var(--text); }
.search-results li a:hover { background: var(--primary-dim); }
.search-results .sr-section { font-size: 12px; color: var(--text-muted); }
.search-results .sr-title { font-size: 14px; color: var(--heading); }
.topbar-right { grid-column: 3; display: flex; align-items: center; gap: 1.5rem; justify-self: end; }
.website-link { font-size: 14px; color: var(--text-muted); white-space: nowrap; }
.website-link:hover { color: var(--heading); }
.theme-toggle { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; }
.theme-toggle:hover { color: var(--heading); }
.icon-sun { display: none; }
html[data-theme="light"] .icon-moon { display: none; }
html[data-theme="light"] .icon-sun { display: block; }
.hamburger { display: none; background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; }
.hamburger:hover { color: var(--heading); }

.docs-grid { display: grid; grid-template-columns: 16rem minmax(0, 1fr) 16rem; gap: 4rem; }

.sidebar { position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; padding: 2.5rem 0; }
.sidebar-group { margin-bottom: 1.5rem; }
.sidebar-heading { font-size: 14px; font-weight: 600; color: var(--heading); margin-bottom: .5rem; padding: 0 .75rem; }
.sidebar a { display: block; font-size: 14px; color: var(--text-muted); padding: .45rem .75rem; border-radius: .5rem; margin: 2px 0; }
.sidebar a:hover { color: var(--heading); background: var(--bg-elev); }
.sidebar a[aria-current="page"] { color: var(--primary-light); background: var(--primary-dim); font-weight: 500; }
.sidebar-overlay { display: none; }

main { max-width: 45rem; padding: 2.5rem 0 4rem; }
main .eyebrow { font-size: 14px; font-weight: 600; color: var(--primary-light); }
main h1 { font-size: 36px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; color: var(--heading); margin: .5rem 0 .75rem; }
main .description { font-size: 18px; color: var(--text-muted); margin-bottom: 2rem; }
main h2 { font-size: 24px; font-weight: 600; color: var(--heading); margin: 3rem 0 1rem; scroll-margin-top: 6rem; }
main h3 { font-size: 18px; font-weight: 600; color: var(--heading); margin: 2rem 0 .75rem; scroll-margin-top: 6rem; }
main p { margin: 0 0 1.25rem; }
main a { color: var(--primary-light); }
main a:hover { text-decoration: underline; }
main code { font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace; font-size: 14px; padding: .1em .4em; border-radius: 6px; background: var(--bg-elev); border: 1px solid var(--border); }
main ol, main ul { padding-left: 1.5rem; margin: 0 0 1.25rem; }
main li { margin: .35rem 0; }
main table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 0 0 1.25rem; }
main th { text-align: left; font-weight: 600; color: var(--heading); padding: .6rem .75rem; border-bottom: 1px solid var(--border); }
main td { padding: .75rem; border-bottom: 1px solid var(--border); color: var(--text-muted); }
main hr { border: none; height: 1px; background: var(--border); margin: 2.5rem 0; }

.note { display: flex; gap: .75rem; padding: 1rem 1.25rem; border-radius: .75rem; border: 1px solid rgba(139,127,255,.35); background: var(--primary-dim); margin: 0 0 1.25rem; }
.note svg { flex-shrink: 0; color: var(--primary-light); }
.note p { margin: 0; }

.code-block { position: relative; margin: 0 0 1.25rem; }
.code-block pre { overflow-x: auto; padding: 1.25rem; font: 13.5px/1.7 ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace; background: #0b0c0e; color: #d4d4d4; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; }
.code-block code { font: inherit; padding: 0; border: none; background: none; border-radius: 0; }
.code-copy { position: absolute; top: .75rem; right: .75rem; background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; }
.code-copy:hover { color: var(--heading); }
.tk-kw { color: #c586c0; }
.tk-mod { color: #569cd6; }
.tk-type { color: #569cd6; }
.tk-ctype { color: #4ec9b0; }
.tk-fn { color: #dcdcaa; }
.tk-id { color: #9cdcfe; }
.tk-modname { color: #dcdcaa; }

.pagination { display: flex; justify-content: space-between; margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.pagination a { font-size: 14px; font-weight: 600; color: var(--heading); }
.pagination a:hover { color: var(--primary); text-decoration: none; }

.docs-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; font-size: 14px; color: var(--text-muted); }
.docs-footer a { color: var(--text-muted); }
.docs-footer a:hover { color: var(--heading); text-decoration: none; }

.toc { position: sticky; top: 64px; padding: 2.5rem 0; font-size: 14px; }
.toc-header { display: flex; align-items: center; gap: .5rem; font-size: 13px; font-weight: 600; color: var(--heading); margin-bottom: .75rem; }
.toc a { display: block; padding: .25rem 0; color: var(--text-muted); }
.toc a:hover { color: var(--heading); }
.toc a.is-active { color: var(--primary-light); font-weight: 500; }
.toc a.toc-h3 { padding-left: 1rem; }

@media (max-width: 1279px) {
  .docs-grid { grid-template-columns: 16rem minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 1023px) {
  .docs-grid { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 64px; left: 0; width: 18rem; height: calc(100vh - 64px); background: var(--bg); border-right: 1px solid var(--border); z-index: 25; transform: translateX(-100%); transition: transform .2s ease; padding: 2.5rem 1.5rem; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-overlay.is-open { display: block; position: fixed; inset: 0; top: 64px; background: rgba(0,0,0,.5); z-index: 24; }
  .hamburger { display: block; }
}

@media (max-width: 767px) {
  .topbar-search { display: none; }
  .website-link { display: none; }
}
