:root {
  color-scheme: dark;
  --radius: 0.625rem;
  --background: oklch(0.17 0.031 259);
  --foreground: oklch(0.97 0.006 250);
  --surface: oklch(0.21 0.032 257);
  --card: oklch(0.215 0.032 257);
  --primary: oklch(0.79 0.132 210);
  --primary-foreground: oklch(0.17 0.031 259);
  --secondary: oklch(0.26 0.033 256);
  --muted-foreground: oklch(0.71 0.024 254);
  --accent: oklch(0.28 0.045 250);
  --success: oklch(0.74 0.15 160);
  --warning: oklch(0.8 0.14 78);
  --border: oklch(0.3 0.032 256);
  --sidebar: oklch(0.148 0.03 259);
  --sidebar-accent: oklch(0.24 0.032 256);
  --gradient-hero: radial-gradient(120% 120% at 50% 0%, oklch(0.32 0.08 240 / 0.55) 0%, oklch(0.17 0.031 259 / 0) 65%);
  --gradient-accent: linear-gradient(100deg, oklch(0.79 0.132 210), oklch(0.72 0.11 230));
  --shadow-elevated: 0 24px 60px -30px oklch(0.05 0.03 259 / 0.9);
  --shadow-glow: 0 0 0 1px oklch(0.79 0.132 210 / 0.25), 0 12px 40px -18px oklch(0.79 0.132 210 / 0.35);
  --font-sans: "Poppins", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  /* lucide arrow-up-right, the same glyph the console uses on links that leave
     the page. Used as a mask, so only its alpha matters. */
  --external-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 7h10v10'/%3E%3Cpath d='M7 17 17 7'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 6rem; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
body.drawer-open { overflow: hidden; }
::selection { background: oklch(0.79 0.132 210 / 0.3); }
a { color: inherit; text-decoration: none; }
button, input { color: inherit; font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  border-radius: 0.5rem;
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 0.65rem 1rem;
  font-weight: 600;
}
.skip-link:focus { top: 0.75rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: oklch(0.17 0.031 259 / 0.86);
  backdrop-filter: blur(18px);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: min(95rem, 100%);
  height: 4rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.logo { display: inline-flex; align-items: center; gap: 0.65rem; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.025em; white-space: nowrap; }
.logo-mark { display: block; height: 1.6rem; width: auto; }
.docs-badge {
  padding: 0.14rem 0.38rem;
  vertical-align: 0.12rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  color: var(--muted-foreground);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.header-actions { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 0.75rem; width: 1rem; height: 1rem; fill: none; stroke: var(--muted-foreground); stroke-width: 2; pointer-events: none; }
.search input {
  width: 16rem;
  height: 2.25rem;
  padding: 0 2.35rem 0 2.25rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  outline: none;
  background: oklch(0.26 0.033 256 / 0.5);
  color: var(--foreground);
  font-size: 0.84rem;
  transition: border-color 150ms, box-shadow 150ms;
}
.search input::placeholder { color: var(--muted-foreground); }
.search input:focus { border-color: oklch(0.79 0.132 210 / 0.65); box-shadow: 0 0 0 3px oklch(0.79 0.132 210 / 0.14); }
.search kbd { position: absolute; right: 0.55rem; color: var(--muted-foreground); font: 0.68rem var(--font-mono); }
.site-link, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.4rem;
  border-radius: 0.55rem;
  font-size: 0.82rem;
  font-weight: 600;
  transition: opacity 150ms, border-color 150ms, background 150ms, color 150ms;
}
.site-link { padding: 0 1rem; background: var(--primary); color: var(--primary-foreground); }
.site-link:hover, .primary-button:hover { opacity: 0.88; }
.site-link svg, .button svg, .pager-link svg { width: 0.9rem; height: 0.9rem; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; padding: 0.5rem; border: 0; border-radius: 0.4rem; background: transparent; color: var(--muted-foreground); }
.icon-button:hover { background: var(--secondary); color: var(--foreground); }
.icon-button svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.mobile-menu-button { display: none; }

.layout { display: flex; width: min(95rem, 100%); margin: 0 auto; padding: 0 1.5rem; }
.sidebar {
  position: sticky;
  top: 4rem;
  flex: 0 0 16rem;
  height: calc(100vh - 4rem);
  padding: 2rem 1.5rem 3rem 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.nav-tree { padding-bottom: 1rem; }
.nav-section { margin-bottom: 1.75rem; }
.nav-label {
  margin: 0 0 0.5rem;
  padding: 0 0.75rem;
  color: var(--muted-foreground);
  font: 0.65rem var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.nav-section ul { margin: 0; padding: 0; list-style: none; }
.nav-section li { margin: 0.12rem 0; }
.nav-link {
  display: block;
  padding: 0.42rem 0.75rem;
  border-left: 2px solid transparent;
  border-radius: 0.35rem;
  color: var(--muted-foreground);
  font-size: 0.83rem;
  line-height: 1.5;
  transition: color 150ms, background 150ms, border-color 150ms;
}
.nav-link:hover { border-left-color: var(--border); background: oklch(0.24 0.032 256 / 0.6); color: var(--foreground); }
.nav-link.active { border-left-color: var(--primary); background: var(--sidebar-accent); color: var(--primary); font-weight: 500; }
.no-results { padding: 1rem 0.75rem; color: var(--muted-foreground); font-size: 0.82rem; line-height: 1.6; }

.main-content { min-width: 0; flex: 1; padding: 2.5rem 0 4rem 2.5rem; border-left: 1px solid var(--border); }
.article { width: min(100%, 48rem); }
.page-header { margin-bottom: 3rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.eyebrow { margin: 0 0 0.75rem; color: var(--primary); font: 0.72rem var(--font-mono); letter-spacing: 0.2em; text-transform: uppercase; }
.page-header h1, .home-hero h1 { margin: 0; font-size: clamp(2rem, 4vw, 2.55rem); line-height: 1.15; letter-spacing: -0.035em; }
.lead { max-width: 42rem; margin: 1rem 0 0; color: var(--muted-foreground); font-size: 0.98rem; line-height: 1.75; }
.home-hero {
  margin: 0 -1rem 3rem;
  padding: 3.1rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background-image: var(--gradient-hero);
  box-shadow: var(--shadow-elevated);
}
.home-hero h1 { max-width: 42rem; }
.gradient-text { background: var(--gradient-accent); color: transparent; background-clip: text; -webkit-background-clip: text; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.button { padding: 0.55rem 1.2rem; border: 1px solid transparent; }
.primary-button { background: var(--primary); color: var(--primary-foreground); }
.secondary-button { border-color: var(--border); background: var(--card); color: var(--foreground); }
.secondary-button:hover { border-color: oklch(0.79 0.132 210 / 0.45); }

.doc-content { color: var(--muted-foreground); font-size: 0.94rem; line-height: 1.8; }
.doc-content > :first-child { margin-top: 0; }
.doc-content h2, .doc-content h3, .doc-content h4 { color: var(--foreground); scroll-margin-top: 6rem; letter-spacing: -0.025em; }
.doc-content h2 { margin: 3.4rem 0 1rem; font-size: 1.45rem; line-height: 1.35; }
.doc-content h3 { margin: 2.3rem 0 0.75rem; font-size: 1.05rem; line-height: 1.45; }
.doc-content h4 { margin: 2rem 0 0.65rem; font-size: 0.95rem; }
.doc-content p { margin: 0.9rem 0; }
.doc-content strong { color: var(--foreground); font-weight: 600; }
.doc-content a { color: var(--primary); text-decoration: underline; text-decoration-color: oklch(0.79 0.132 210 / 0.35); text-underline-offset: 0.18em; }
.doc-content a:hover { text-decoration-color: currentColor; }

/* Links that leave the documentation - the console, mostly - carry the
   arrow-up-right the console itself uses for the same job, so "this opens
   somewhere else" reads the same in both places. The glyph is a mask rather
   than an image so it takes the link's colour, including on hover. */
.doc-content a.external::after {
  content: "";
  display: inline-block;
  width: 0.68em;
  height: 0.68em;
  margin-left: 0.22em;
  vertical-align: -0.01em;
  background-color: currentColor;
  -webkit-mask: var(--external-arrow) no-repeat center / contain;
  mask: var(--external-arrow) no-repeat center / contain;
}
.doc-content ul, .doc-content ol { margin: 1rem 0; padding-left: 1.45rem; }
.doc-content li { margin: 0.45rem 0; padding-left: 0.25rem; }
.doc-content li::marker { color: var(--primary); }
.doc-content hr { margin: 3rem 0; border: 0; border-top: 1px solid var(--border); }
.doc-content :not(pre) > code {
  padding: 0.12rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  background: oklch(0.26 0.033 256 / 0.7);
  color: var(--primary);
  font: 0.83em var(--font-mono);
  overflow-wrap: anywhere;
}
.doc-content pre {
  position: relative;
  margin: 1.25rem 0;
  padding: 1.2rem 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--sidebar);
  box-shadow: var(--shadow-elevated);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.doc-content pre code { color: oklch(0.91 0.01 250); font: 0.8rem/1.75 var(--font-mono); }
.doc-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.6rem 0;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--sidebar);
  cursor: zoom-in;
  transition: border-color 0.15s ease;
}
.doc-content img:hover, .doc-content img:focus-visible {
  border-color: var(--primary);
  outline: none;
}
/* An image is already its own block, so the paragraph goldmark wraps it in
   should not add a second set of vertical margins around it. */
.doc-content p:has(> img:only-child) { margin: 0; }

body.lightbox-open { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
}
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: oklch(0.1 0.025 259 / 0.88);
  backdrop-filter: blur(4px);
  cursor: zoom-out;
}
.lightbox-figure {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: min(92vw, 1400px);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.lightbox-image {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-elevated);
  cursor: zoom-out;
}
.lightbox-caption {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.85rem;
  text-align: center;
}
.lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--foreground);
  font-size: 1.1rem;
  line-height: 1;
}
.lightbox-close:hover, .lightbox-close:focus-visible { color: var(--primary); border-color: var(--primary); }
.copy-button {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  padding: 0.28rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  background: var(--secondary);
  color: var(--muted-foreground);
  font: 0.67rem var(--font-mono);
  opacity: 0;
  transition: opacity 150ms, color 150ms;
}
.doc-content pre:hover .copy-button, .copy-button:focus { opacity: 1; }
.copy-button:hover { color: var(--foreground); }
.doc-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid oklch(0.79 0.132 210 / 0.3);
  border-left: 3px solid var(--primary);
  border-radius: 0.65rem;
  background: oklch(0.79 0.132 210 / 0.055);
}
.doc-content blockquote p { margin: 0.35rem 0; }
.doc-content blockquote strong:first-child { color: var(--primary); }
.doc-content .table-scroll { margin: 1.35rem 0; overflow-x: auto; border-radius: 0.7rem; }
.doc-content table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--border); border-radius: 0.7rem; font-size: 0.82rem; line-height: 1.55; }
.doc-content thead { background: oklch(0.26 0.033 256 / 0.65); }
.doc-content th { color: var(--foreground); font-weight: 600; text-align: left; }
.doc-content th, .doc-content td { padding: 0.72rem 0.85rem; vertical-align: top; border-bottom: 1px solid var(--border); }
.doc-content th + th, .doc-content td + td { border-left: 1px solid var(--border); }
.doc-content tr:last-child td { border-bottom: 0; }
.overview-content h2:first-child { margin-top: 0; }
.faq-content h2 { padding-top: 0.2rem; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.pager-link { min-width: 0; padding: 1rem; border: 1px solid var(--border); border-radius: 0.75rem; background: var(--card); transition: border-color 150ms; }
.pager-link:hover { border-color: oklch(0.79 0.132 210 / 0.45); }
.pager-link span { display: flex; align-items: center; gap: 0.35rem; color: var(--muted-foreground); font: 0.7rem var(--font-mono); }
.pager-link strong { display: block; margin-top: 0.35rem; overflow: hidden; color: var(--foreground); font-size: 0.84rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.pager-link:hover strong { color: var(--primary); }
.pager-link.next { grid-column: 2; text-align: right; }
.pager-link.next span { justify-content: flex-end; }
.docs-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); color: var(--muted-foreground); font-size: 0.72rem; }

.mobile-drawer { position: fixed; inset: 0; z-index: 60; }
.drawer-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: oklch(0.1 0.025 259 / 0.8); backdrop-filter: blur(4px); }
.drawer-panel { position: absolute; inset: 0 auto 0 0; width: min(19rem, 86vw); padding: 1rem; overflow-y: auto; border-right: 1px solid var(--border); background: var(--sidebar); box-shadow: var(--shadow-elevated); }
.drawer-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.35rem; }
.mobile-search { margin-bottom: 1.5rem; }
.mobile-search input { width: 100%; }

.error-page { display: grid; min-height: 100vh; place-items: center; padding: 1rem; }
.error-card { max-width: 29rem; text-align: center; }
.error-code { margin: 0; color: var(--primary); font: 4rem/1 var(--font-mono); }
.error-card h1 { margin: 1rem 0 0.5rem; font-size: 1.7rem; }
.error-card p:not(.error-code) { margin: 0 0 1.5rem; color: var(--muted-foreground); line-height: 1.7; }

@media (max-width: 900px) {
  .mobile-menu-button { display: inline-flex; }
  .desktop-sidebar { display: none; }
  .main-content { padding-left: 0; border-left: 0; }
  .article { margin: 0 auto; }
}
@media (max-width: 700px) {
  .desktop-search { display: none; }
  .header-inner, .layout { padding-left: 1rem; padding-right: 1rem; }
  .site-link { width: 2.35rem; padding: 0; font-size: 0; }
  .site-link svg { width: 1rem; height: 1rem; }
  .main-content { padding-top: 1.75rem; }
  .home-hero { margin-left: 0; margin-right: 0; padding: 2rem 1.35rem; }
  .home-hero h1, .page-header h1 { font-size: 1.9rem; }
  .pager { grid-template-columns: 1fr; }
  .pager-link.next { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
