:root {
  color-scheme: light;
  --docs-bg: oklch(0.975 0 0);
  --docs-panel: oklch(1 0 0);
  --docs-raised: oklch(0.955 0 0);
  --docs-line: oklch(0.82 0 0);
  --docs-line-soft: oklch(0.9 0 0);
  --docs-ink: oklch(0.17 0 0);
  --docs-muted: oklch(0.43 0 0);
  --docs-faint: oklch(0.58 0 0);
  --docs-accent: oklch(0.2 0 0);
  --docs-accent-hover: oklch(0.1 0 0);
  --docs-accent-ink: oklch(0.99 0 0);
  --docs-link: oklch(0.32 0 0);
  --docs-code: oklch(0.145 0 0);
  --docs-code-line: oklch(0.31 0 0);
  --docs-code-ink: oklch(0.95 0 0);
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --radius: 2px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --docs-bg: oklch(0.145 0 0);
    --docs-panel: oklch(0.185 0 0);
    --docs-raised: oklch(0.215 0 0);
    --docs-line: oklch(0.38 0 0);
    --docs-line-soft: oklch(0.29 0 0);
    --docs-ink: oklch(0.94 0 0);
    --docs-muted: oklch(0.74 0 0);
    --docs-faint: oklch(0.57 0 0);
    --docs-accent: oklch(0.86 0 0);
    --docs-accent-hover: oklch(0.94 0 0);
    --docs-accent-ink: oklch(0.14 0 0);
    --docs-link: oklch(0.82 0 0);
    --docs-code: oklch(0.12 0 0);
    --docs-code-line: oklch(0.29 0 0);
    --docs-code-ink: oklch(0.94 0 0);
  }
}

* { box-sizing: border-box; }

html {
  background: var(--docs-bg);
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--docs-bg);
  color: var(--docs-ink);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

body.nav-open { overflow: hidden; }

a { color: inherit; }
button { font: inherit; }

::selection {
  background: var(--docs-ink);
  color: var(--docs-panel);
}

:where(a, button):focus-visible {
  outline: 2px solid var(--docs-accent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: -4rem;
  left: 1rem;
  z-index: 50;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--docs-accent);
  border-radius: var(--radius);
  background: var(--docs-accent);
  color: var(--docs-accent-ink);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus { top: 0.75rem; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  height: 3.25rem;
  align-items: center;
  gap: 1rem;
  padding: 0 clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--docs-line-soft);
  background: color-mix(in srgb, var(--docs-panel) 94%, transparent);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.55rem;
  color: var(--docs-ink);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.brand svg { width: 6.65rem; height: 1.45rem; flex: 0 0 auto; fill: currentColor; }

.brand b {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  padding-left: 0.65rem;
  border-left: 1px solid var(--docs-line-soft);
  color: var(--docs-muted);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  margin-left: auto;
  color: var(--docs-muted);
  font-size: 0.7rem;
  font-weight: 500;
}

.topbar nav a {
  padding: 0.38rem 0.55rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease;
}

.topbar nav a:hover { color: var(--docs-ink); background: var(--docs-raised); }
.topbar nav .open { margin-left: 0.35rem; background: var(--docs-accent); color: var(--docs-accent-ink); }
.topbar nav .open:hover { background: var(--docs-accent-hover); color: var(--docs-accent-ink); }

.menu-button {
  display: none;
  margin-left: auto;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--docs-line);
  border-radius: var(--radius);
  background: var(--docs-panel);
  color: var(--docs-ink);
  font-size: 0.7rem;
  cursor: pointer;
}

.docs-grid {
  display: grid;
  grid-template-columns: 13.25rem minmax(0, 46rem) 11.5rem;
  gap: clamp(2rem, 4vw, 3.25rem);
  max-width: 86rem;
  min-height: calc(100vh - 3.25rem);
  margin: 0 auto;
  padding: 2.8rem clamp(1.25rem, 3vw, 2rem) 5.5rem;
}

.sidebar {
  position: sticky;
  top: 5.6rem;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-label {
  margin: 0 0.6rem 0.65rem;
  color: var(--docs-faint);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar > a + .sidebar-label { margin-top: 1.1rem; }

.sidebar > a {
  display: flex;
  min-height: 2rem;
  align-items: center;
  padding: 0.42rem 0.6rem;
  border-radius: var(--radius);
  color: var(--docs-muted);
  font-size: 0.74rem;
  font-weight: 400;
  line-height: 1.35;
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease;
}

.sidebar > a:hover { color: var(--docs-ink); background: var(--docs-raised); }
.sidebar > a[aria-current="page"] { background: var(--docs-raised); color: var(--docs-ink); font-weight: 600; }

.sidebar-help {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 1.8rem;
  padding: 1rem 0.6rem 0;
  border-top: 1px solid var(--docs-line-soft);
  color: var(--docs-faint);
  font-size: 0.68rem;
  line-height: 1.5;
}

.sidebar-help strong { color: var(--docs-muted); font-weight: 600; }
.sidebar-help a { margin-top: 0.2rem; color: var(--docs-link); text-underline-offset: 3px; }

.content { min-width: 0; }
article { max-width: 46rem; }
article > :first-child { margin-top: 0; }

article h1,
article h2,
article h3 { text-wrap: balance; }

article h1 {
  max-width: 40rem;
  margin: 0 0 1rem;
  font-size: 3rem;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.04em;
}

article h1 + p {
  max-width: 42rem;
  margin-top: 0;
  color: var(--docs-muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

article h2 {
  margin: 4rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--docs-line-soft);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

article h2:target { scroll-margin-top: 5.5rem; }
article h3 { margin: 2.25rem 0 0.65rem; font-size: 0.98rem; font-weight: 600; line-height: 1.35; letter-spacing: -0.015em; }
article p, article ul, article ol { margin: 0 0 1.15rem; }
article p, article li { max-width: 72ch; }
article ul, article ol { padding-left: 1.35rem; }
article li { margin: 0.45rem 0; padding-left: 0.2rem; }
article li::marker { color: var(--docs-faint); }

article a {
  color: var(--docs-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

article a:hover { color: var(--docs-ink); }
article strong { font-weight: 600; }

.anchor {
  margin-left: 0.55rem;
  color: var(--docs-faint);
  opacity: 0;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.8em;
  font-weight: 400;
  transition: opacity 160ms ease;
}

h2:hover .anchor,
h2:focus-within .anchor { opacity: 1; }

code {
  border: 1px solid var(--docs-line-soft);
  border-radius: var(--radius);
  background: var(--docs-raised);
  padding: 0.12em 0.34em;
  color: var(--docs-ink);
  font-family: var(--font-mono);
  font-size: 0.84em;
}

pre {
  position: relative;
  overflow-x: auto;
  margin: 1.45rem 0;
  border: 1px solid var(--docs-code-line);
  border-radius: var(--radius);
  background: var(--docs-code);
  padding: 1rem 1.1rem;
  color: var(--docs-code-ink);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.65;
  tab-size: 2;
}

pre code { border: 0; background: none; padding: 0; color: inherit; font-size: inherit; }

.copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.24rem 0.42rem;
  border: 1px solid var(--docs-code-line);
  border-radius: var(--radius);
  background: var(--docs-code);
  color: var(--docs-muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}

.copy:hover { border-color: var(--docs-faint); color: var(--docs-code-ink); }

blockquote {
  margin: 1.4rem 0;
  padding: 0.8rem 1rem;
  border: 1px solid var(--docs-line-soft);
  border-radius: var(--radius);
  background: var(--docs-raised);
  color: var(--docs-muted);
}

.table-wrap { overflow-x: auto; margin: 1.5rem 0; border: 1px solid var(--docs-line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.75rem; line-height: 1.55; }
th { background: var(--docs-raised); color: var(--docs-muted); font-family: var(--font-mono); font-size: 0.62rem; font-weight: 500; letter-spacing: 0.05em; text-align: left; text-transform: uppercase; }
th, td { padding: 0.68rem 0.78rem; border-bottom: 1px solid var(--docs-line-soft); vertical-align: top; }
td { color: var(--docs-muted); }
tr:last-child td { border-bottom: 0; }

.toc {
  position: sticky;
  top: 5.6rem;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 1px solid var(--docs-line-soft);
  color: var(--docs-faint);
  font-size: 0.65rem;
  line-height: 1.45;
}

.toc strong { margin-bottom: 0.2rem; color: var(--docs-muted); font-family: var(--font-mono); font-size: 0.6rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.toc a { color: inherit; text-decoration: none; }
.toc a:hover { color: var(--docs-ink); }

footer {
  display: flex;
  max-width: 86rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 auto;
  padding: 1.1rem clamp(1.25rem, 3vw, 2rem) 1.35rem;
  border-top: 1px solid var(--docs-line-soft);
  color: var(--docs-faint);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

footer a { text-decoration: none; }
footer a:hover { color: var(--docs-ink); }

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

@media (max-width: 720px) {
  .topbar { height: 3.1rem; padding-inline: 1rem; }
  .topbar nav { display: none; }
  .menu-button { display: block; }

  .docs-grid {
    display: block;
    min-height: calc(100vh - 3.1rem);
    padding: 2.2rem 1rem 4rem;
  }

  .sidebar {
    position: fixed;
    z-index: 15;
    top: 3.1rem;
    right: 0;
    bottom: 0;
    left: 0;
    display: none;
    overflow-y: auto;
    padding: 1.25rem 1rem 2rem;
    border-top: 1px solid var(--docs-line-soft);
    background: var(--docs-panel);
  }

  .nav-open .sidebar { display: flex; }
  .sidebar-label { margin-bottom: 0.55rem; }
  .sidebar > a { min-height: 2.4rem; padding-inline: 0.7rem; font-size: 0.8rem; }
  .sidebar-help { margin-top: 1.5rem; }
  article h1 { font-size: 2.35rem; }
  article h1 + p { font-size: 1rem; }
  article h2 { margin-top: 3rem; font-size: 1.2rem; }
  article h3 { margin-top: 1.8rem; }
  .table-wrap { margin-right: -1rem; margin-left: -1rem; border-right: 0; border-left: 0; border-radius: 0; }
  footer { padding-inline: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.001ms !important; }
}

@media print {
  .topbar, .sidebar, .toc, .copy, footer { display: none; }
  .docs-grid { display: block; max-width: none; padding: 0; }
  article { max-width: 72ch; }
}
