:root {
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "Spline Sans Mono", ui-monospace, monospace;
  --color-bg: #fff;
  --color-bg-alt: #f6f6f6;
  --color-text: #1a1a2e;
  --color-text-muted: #666;
  --color-border: #e2e2e3;
  --color-link: #3451b2;
  --color-active: #5672cd;
  --color-code-bg: #f6f8fa;
  --sidebar-width: 272px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #1a1a2e;
    --color-bg-alt: #16213e;
    --color-text: #e0e0e0;
    --color-text-muted: #999;
    --color-border: #2e3a59;
    --color-link: #8da2fb;
    --color-active: #a8bbff;
    --color-code-bg: #161618;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

code,
pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

pre {
  padding: 1rem;
  overflow-x: auto;
  background: var(--color-bg-alt);
  border-radius: 6px;
  border: 1px solid var(--color-border);
}

a {
  color: var(--color-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout */
.doc-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  padding: 1.5rem 1rem;
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  background: var(--color-bg);
  font-size: 0.875rem;
}

.sidebar-header {
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-header a {
  color: var(--color-text);
  font-size: 1.125rem;
}

.sidebar ul {
  list-style: none;
  padding: 0;
}

.sidebar ul ul {
  padding-left: 0.75rem;
}

.sidebar-group-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0.375rem 0.5rem;
  border: none;
  background: none;
  color: var(--color-text);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  margin-top: 0.75rem;
}

.sidebar-chevron {
  font-size: 0.625rem;
}

.sidebar-link {
  display: block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  color: var(--color-text-muted);
  transition:
    color 0.15s,
    background 0.15s;
}

.sidebar-link:hover {
  color: var(--color-text);
  text-decoration: none;
}

.sidebar-link.active {
  color: var(--color-active);
  font-weight: 500;
}

/* Main content */
.doc-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  max-width: 800px;
  padding: 2rem 3rem;
}

.doc-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.doc-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--color-border);
}

.doc-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.doc-content p {
  margin-bottom: 1rem;
}

.doc-content ul,
.doc-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.doc-content li {
  margin-bottom: 0.25rem;
}

.doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.doc-content th,
.doc-content td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  text-align: left;
}

.doc-content th {
  background: var(--color-bg-alt);
  font-weight: 600;
}

/* Plot containers */
.plot {
  margin: 1rem 0;
  max-width: 100%;
  overflow-x: auto;
}

.plot svg {
  max-width: 100%;
  height: auto;
}

/* Code blocks, styled after the upstream VitePress docs: shiki-highlighted
   text on a soft background, a language label in the corner, and a copy
   button revealed on hover. */
.code-block {
  position: relative;
  margin: 1rem 0;
}
.code-block pre {
  margin: 0;
  padding: 1.25rem 1.5rem;
  border: none;
  border-radius: 8px;
  line-height: 1.7;
  background: var(--color-code-bg) !important;
}
.code-lang {
  position: absolute;
  top: 0.6rem;
  right: 0.85rem;
  z-index: 1;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: opacity 0.25s;
}
.code-block .code-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.25s;
}
.code-block:hover .code-copy,
.code-block .code-copy:focus-visible,
.code-block.copied .code-copy {
  opacity: 1;
}
.code-block:hover .code-lang,
.code-block.copied .code-lang {
  opacity: 0;
}

/* Shiki emits both palettes; switch to the dark one via its CSS variables. */
@media (prefers-color-scheme: dark) {
  .code-block .shiki,
  .code-block .shiki span {
    color: var(--shiki-dark) !important;
  }
}

/* Live example source, injected by remark-plot-source */
.plot-example-code {
  margin: 0.5rem 0 1.5rem;
}
.plot-example-code summary {
  cursor: pointer;
  color: #888;
  font-size: 0.85em;
}
.plot-example-code .code-block {
  margin: 0.5rem 0 0;
}

/* VitePress theme variables referenced by the docs prose and chart options
   (colored underlines, text halos via var(--vp-c-bg), figure borders). The
   values follow the VitePress default palette. */
:root {
  --vp-c-bg: #ffffff;
  --vp-c-bg-alt: #f6f6f7;
  --vp-c-red: #b8272c;
  --vp-c-green: #18794e;
  --vp-c-blue: #3451b2;
  --vp-c-text-2: rgba(60, 60, 67, 0.78);
  --vp-c-text-3: rgba(60, 60, 67, 0.56);
}
@media (prefers-color-scheme: dark) {
  :root {
    --vp-c-bg: #1b1b1f;
    --vp-c-bg-alt: #161618;
    --vp-c-red: #f66f81;
    --vp-c-green: #3dd68c;
    --vp-c-blue: #a8b1ff;
    --vp-c-text-2: rgba(235, 235, 245, 0.6);
    --vp-c-text-3: rgba(235, 235, 245, 0.38);
  }
}
