:root {
  --bg: #f6f8fc;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-muted: #eef2f8;
  --text: #172033;
  --muted: #60708a;
  --faint: #8794a8;
  --border: rgba(71, 85, 105, 0.16);
  --border-strong: rgba(71, 85, 105, 0.28);
  --brand: #2157d5;
  --brand-2: #6d55d9;
  --brand-soft: rgba(33, 87, 213, 0.10);
  --success: #147a58;
  --warning: #9b6412;
  --danger: #b53d50;
  --code-bg: #101827;
  --code-text: #e7edf8;
  --shadow-sm: 0 8px 22px rgba(20, 35, 65, 0.07);
  --shadow-md: 0 18px 54px rgba(20, 35, 65, 0.10);
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --header-h: 72px;
  --content-max: 1440px;
  --reading-max: 820px;
}

html[data-theme="dark"] {
  --bg: #090e18;
  --surface: rgba(18, 26, 43, 0.84);
  --surface-solid: #111a2a;
  --surface-muted: #162238;
  --text: #edf3ff;
  --muted: #a5b3c9;
  --faint: #7e8ca3;
  --border: rgba(185, 204, 232, 0.14);
  --border-strong: rgba(185, 204, 232, 0.26);
  --brand: #7da2ff;
  --brand-2: #a892ff;
  --brand-soft: rgba(125, 162, 255, 0.14);
  --success: #67d3aa;
  --warning: #f0be66;
  --danger: #ff8ca0;
  --code-bg: #060a12;
  --code-text: #eef4ff;
  --shadow-sm: 0 12px 30px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 24px 70px rgba(0, 0, 0, 0.34);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg: #090e18;
    --surface: rgba(18, 26, 43, 0.84);
    --surface-solid: #111a2a;
    --surface-muted: #162238;
    --text: #edf3ff;
    --muted: #a5b3c9;
    --faint: #7e8ca3;
    --border: rgba(185, 204, 232, 0.14);
    --border-strong: rgba(185, 204, 232, 0.26);
    --brand: #7da2ff;
    --brand-2: #a892ff;
    --brand-soft: rgba(125, 162, 255, 0.14);
    --success: #67d3aa;
    --warning: #f0be66;
    --danger: #ff8ca0;
    --code-bg: #060a12;
    --code-text: #eef4ff;
    --shadow-sm: 0 12px 30px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 24px 70px rgba(0, 0, 0, 0.34);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 0%, rgba(61, 104, 224, 0.10), transparent 30rem),
    radial-gradient(circle at 95% 8%, rgba(118, 82, 207, 0.10), transparent 28rem),
    var(--bg);
  color: var(--text);
  font: 16px/1.65 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
button, input { font: inherit; }
::selection { background: var(--brand-soft); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--header-h);
  background: color-mix(in srgb, var(--surface-solid) 74%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
}
.header-inner {
  width: min(calc(100% - 32px), var(--content-max));
  min-height: var(--header-h);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  flex: 0 0 auto;
}
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: white;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #2459d9, #7457d8);
  box-shadow: 0 10px 24px rgba(52, 82, 190, 0.24);
}
.brand-copy { display: grid; line-height: 1.05; }
.brand-copy strong { font-size: 0.99rem; letter-spacing: -0.02em; }
.brand-copy span { margin-top: 4px; font-size: 0.69rem; color: var(--muted); }

.top-nav {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}
.top-nav a,
.icon-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 620;
  padding: 8px 10px;
  border-radius: 9px;
}
.top-nav a:hover,
.icon-link:hover { color: var(--text); background: var(--surface-muted); }
.header-actions { display: flex; align-items: center; gap: 7px; }
.version-badge {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font: 700 0.72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface);
}
.theme-toggle,
.menu-toggle {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
}
.theme-toggle:hover,
.menu-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.menu-toggle { display: none; }
.mobile-menu {
  width: min(calc(100% - 32px), var(--content-max));
  margin: 0 auto 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
}
.mobile-menu a { display: block; padding: 9px 10px; color: var(--text); text-decoration: none; border-radius: 8px; }
.mobile-menu a:hover { background: var(--surface-muted); }

.landing-main { min-height: 65vh; }
.hero-wrap {
  width: min(calc(100% - 32px), 1260px);
  margin: 0 auto;
  padding: 88px 0 48px;
}
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(34px, 6vw, 72px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(33, 87, 213, 0.11), transparent 45%),
    linear-gradient(330deg, rgba(109, 85, 217, 0.11), transparent 42%),
    var(--surface);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto -8% -40% auto;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(33, 87, 213, 0.16), transparent 67%);
  pointer-events: none;
}
.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: clamp(28px, 6vw, 76px);
  align-items: center;
}
.eyebrow,
.page-kicker {
  margin: 0 0 14px;
  color: var(--brand);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.hero h1 {
  max-width: 800px;
  margin: 0;
  font-size: clamp(2.7rem, 7vw, 5.5rem);
  line-height: 0.98;
  letter-spacing: -0.065em;
}
.gradient-text {
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-lede {
  max-width: 740px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.65;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 30px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 750;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
}
.button.primary { color: white; border-color: transparent; background: linear-gradient(135deg, #2459d9, #6f56d8); }
.button:hover { transform: translateY(-1px); text-decoration: none; }

.hero-panel {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface-solid) 82%, transparent);
  box-shadow: var(--shadow-sm);
}
.hero-panel .terminal-label { color: var(--faint); font: 700 0.72rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.hero-panel pre { margin: 14px 0 0; }

.section {
  width: min(calc(100% - 32px), 1180px);
  margin: 0 auto;
  padding: 56px 0;
}
.section.narrow { max-width: 900px; }
.section-heading { max-width: 760px; margin-bottom: 28px; }
.section-heading h2 { margin: 0; font-size: clamp(1.9rem, 4vw, 2.9rem); letter-spacing: -0.045em; line-height: 1.08; }
.section-heading p { margin: 14px 0 0; color: var(--muted); font-size: 1.04rem; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card,
.feature-card,
.metric-card,
.status-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card,
.feature-card { padding: 24px; }
.feature-card h3,
.card h3 { margin: 7px 0 8px; font-size: 1.05rem; letter-spacing: -0.02em; }
.feature-card p,
.card p { color: var(--muted); margin: 0; }
.card-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 900;
}

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { padding: 19px 20px; }
.metric-card strong { display: block; font-size: 1.3rem; letter-spacing: -0.035em; }
.metric-card span { color: var(--muted); font-size: 0.82rem; }

.status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.status-card { padding: 22px; }
.status-card .status { display: inline-flex; align-items: center; gap: 7px; font-size: 0.73rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.status-card .status::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: currentColor; }
.status-card h3 { margin: 12px 0 7px; }
.status-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.status.incomplete { color: var(--warning); }
.status.robust { color: var(--success); }
.status.fragile { color: var(--danger); }

.plot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.plot-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.plot-card img { display: block; width: 100%; border-radius: 12px; background: var(--surface-solid); }
.plot-card figcaption { color: var(--muted); font-size: 0.84rem; padding: 11px 5px 2px; }

.docs-shell {
  width: min(calc(100% - 30px), var(--content-max));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr) 220px;
  gap: 42px;
  align-items: start;
  padding: 42px 0 72px;
}
.docs-sidebar,
.toc { min-width: 0; }
.sidebar-sticky,
.toc-sticky { position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 46px); overflow: auto; }
.nav-filter {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.nav-filter:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.docs-nav { margin-top: 18px; }
.docs-nav a {
  display: block;
  padding: 7px 10px;
  margin: 2px 0;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
}
.docs-nav a:hover,
.docs-nav a[aria-current="page"] { color: var(--text); background: var(--surface-muted); }
.nav-label { margin: 18px 10px 6px; color: var(--faint); font-size: 0.69rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.docs-main { min-width: 0; }
.doc-article {
  max-width: var(--reading-max);
  margin: 0 auto;
  padding: clamp(25px, 4vw, 48px);
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.doc-article > :first-child { margin-top: 0; }
.doc-article h1 {
  margin: 0 0 22px;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.03;
  letter-spacing: -0.055em;
}
.doc-article h2 { margin: 46px 0 15px; padding-top: 5px; font-size: 1.65rem; letter-spacing: -0.035em; line-height: 1.16; }
.doc-article h3 { margin: 30px 0 10px; font-size: 1.18rem; letter-spacing: -0.02em; }
.doc-article p,
.doc-article li { color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
.doc-article strong { color: var(--text); }
.doc-article blockquote {
  margin: 24px 0;
  padding: 14px 18px;
  border-left: 3px solid var(--brand);
  border-radius: 0 10px 10px 0;
  background: var(--brand-soft);
  color: var(--muted);
}
.doc-article hr { border: 0; border-top: 1px solid var(--border); margin: 38px 0; }
.doc-article table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; margin: 20px 0; font-size: 0.88rem; }
.doc-article th,
.doc-article td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.doc-article th { color: var(--text); background: var(--surface-muted); }

pre {
  position: relative;
  overflow: auto;
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: var(--code-bg);
  color: var(--code-text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  font: 0.86rem/1.62 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
:not(pre) > code {
  padding: 0.13em 0.38em;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 0.9em;
}
.copy-code {
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 5px 8px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 7px;
  background: rgba(255,255,255,.07);
  color: #cbd6ea;
  font-size: 0.72rem;
  cursor: pointer;
}

.callout {
  margin: 22px 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-muted);
}
.callout strong { display: block; margin-bottom: 3px; }
.callout.info { border-left: 4px solid var(--brand); }
.callout.success { border-left: 4px solid var(--success); }
.callout.warning { border-left: 4px solid var(--warning); }

.workflow-steps { counter-reset: step; display: grid; gap: 13px; margin: 24px 0; }
.workflow-step {
  position: relative;
  padding: 17px 18px 17px 58px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-solid);
}
.workflow-step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 17px;
  top: 16px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, #2459d9, #6f56d8);
  font-weight: 800;
  font-size: 0.78rem;
}
.workflow-step strong { display: block; }
.workflow-step p { margin: 4px 0 0; font-size: 0.9rem; color: var(--muted); }

.toc-title { margin: 0 0 9px; color: var(--faint); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.toc nav a { display: block; padding: 5px 0; color: var(--muted); text-decoration: none; font-size: 0.82rem; line-height: 1.35; }
.toc nav a[data-level="3"] { padding-left: 12px; font-size: 0.78rem; }
.toc nav a:hover { color: var(--text); }

.site-footer { border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface-solid) 70%, transparent); }
.footer-inner {
  width: min(calc(100% - 32px), var(--content-max));
  margin: 0 auto;
  padding: 34px 0;
  display: flex;
  justify-content: space-between;
  gap: 30px;
  color: var(--muted);
  font-size: 0.84rem;
}
.footer-inner strong { color: var(--text); }
.footer-inner p { margin: 4px 0 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: flex-end; }
.footer-links a { color: var(--muted); }

@media (max-width: 1160px) {
  .docs-shell { grid-template-columns: 215px minmax(0, 1fr); gap: 28px; }
  .toc { display: none; }
  .top-nav { display: none; }
  .menu-toggle { display: inline-grid; place-items: center; }
}

@media (max-width: 820px) {
  .header-inner { gap: 10px; }
  .brand-copy span, .version-badge, .icon-link { display: none; }
  .header-actions { margin-left: auto; }
  .hero-wrap { padding-top: 38px; }
  .hero-grid { grid-template-columns: 1fr; }
  .card-grid, .metrics-grid, .status-grid, .plot-grid { grid-template-columns: 1fr; }
  .docs-shell { display: block; width: min(calc(100% - 24px), 900px); padding-top: 20px; }
  .docs-sidebar { margin-bottom: 18px; }
  .sidebar-sticky { position: static; max-height: none; }
  .sidebar-search-wrap { display: none; }
  .docs-nav { display: flex; gap: 8px; overflow-x: auto; margin: 0; padding: 2px 1px 10px; scrollbar-width: thin; }
  .docs-nav .nav-label { display: none; }
  .docs-nav a { flex: 0 0 auto; border: 1px solid var(--border); background: var(--surface); }
  .doc-article { padding: 26px 22px; border-radius: 18px; }
  .footer-inner { display: grid; }
  .footer-links { justify-content: flex-start; }
}

@media (max-width: 520px) {
  :root { --header-h: 64px; }
  .header-inner { width: min(calc(100% - 20px), var(--content-max)); }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .hero-wrap, .section { width: min(calc(100% - 22px), 1180px); }
  .hero { padding: 30px 22px; border-radius: 20px; }
  .hero h1 { font-size: clamp(2.4rem, 14vw, 4rem); }
  .hero-actions { display: grid; }
  .button { width: 100%; }
  .doc-article h1 { font-size: 2.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .button:hover { transform: none; }
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 65%, transparent);
  outline-offset: 3px;
}
