:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-sunk: #f3f6f8;
  --surface-raised: #ffffff;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --fg: #27272a;
  --fg-strong: #18181b;
  --fg-muted: #71717a;
  --fg-subtle: #a1a1aa;
  --accent: #0e7490;
  --accent-strong: #155e75;
  --accent-weak: rgba(14, 116, 144, 0.1);
  --danger: #dc2626;
  --on-accent: #ffffff;
  --code-bg: #17181c;
  --code-fg: #eef2f5;
  --header-height: 64px;
  --sidebar-width: 268px;
  --toc-width: 224px;
  --content-width: 760px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-float: 0 24px 64px rgba(15, 23, 42, 0.18), 0 3px 12px rgba(15, 23, 42, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090b;
  --surface: #18181b;
  --surface-sunk: #222226;
  --surface-raised: #1d1d20;
  --border: #2b2b30;
  --border-strong: #45454d;
  --fg: #e4e4e7;
  --fg-strong: #fafafa;
  --fg-muted: #a1a1aa;
  --fg-subtle: #71717a;
  --accent: #22c1d6;
  --accent-strong: #67e8f9;
  --accent-weak: rgba(34, 193, 214, 0.14);
  --danger: #f87171;
  --on-accent: #061315;
  --code-bg: #111114;
  --code-fg: #f4f4f5;
  --shadow-float: 0 28px 72px rgba(0, 0, 0, 0.42), 0 3px 12px rgba(0, 0, 0, 0.2);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #09090b;
    --surface: #18181b;
    --surface-sunk: #222226;
    --surface-raised: #1d1d20;
    --border: #2b2b30;
    --border-strong: #45454d;
    --fg: #e4e4e7;
    --fg-strong: #fafafa;
    --fg-muted: #a1a1aa;
    --fg-subtle: #71717a;
    --accent: #22c1d6;
    --accent-strong: #67e8f9;
    --accent-weak: rgba(34, 193, 214, 0.14);
    --danger: #f87171;
    --on-accent: #061315;
    --code-bg: #111114;
    --code-fg: #f4f4f5;
    --shadow-float: 0 28px 72px rgba(0, 0, 0, 0.42), 0 3px 12px rgba(0, 0, 0, 0.2);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 78% -10%, var(--accent-weak), transparent 32rem),
    var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.65;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-strong);
}

:focus-visible {
  outline: 3px solid var(--accent-weak);
  outline-offset: 2px;
}

.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;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--header-height);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 91%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.site-header-inner {
  min-height: var(--header-height);
  max-width: 1500px;
  margin: 0 auto;
  padding: 9px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--fg-strong);
  font-weight: 760;
  letter-spacing: -0.025em;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--fg-strong);
}

.brand-mark {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-weak);
}

.brand-name {
  font-size: 16px;
}

.brand-context {
  padding-left: 9px;
  border-left: 1px solid var(--border-strong);
  color: var(--fg-muted);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-links a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.header-links a:hover {
  background: var(--surface-sunk);
  color: var(--fg);
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.search-button {
  appearance: none;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--fg-muted);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.icon-button:hover,
.search-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-sunk);
  color: var(--fg);
  transform: translateY(-1px);
}

.icon-button {
  width: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-size: 17px;
}

.search-button {
  min-width: 210px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px 7px 11px;
  text-align: left;
}

.search-button kbd {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-bottom-color: var(--border-strong);
  border-radius: 5px;
  background: var(--surface-sunk);
  color: var(--fg-subtle);
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  text-align: center;
}

.nav-toggle,
.sidebar-search-mobile {
  display: none;
}

.docs-layout {
  width: min(100%, 1500px);
  min-height: calc(100vh - var(--header-height));
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, var(--content-width)) var(--toc-width);
  justify-content: center;
  gap: clamp(28px, 4vw, 58px);
  padding: 0 22px;
}

.docs-sidebar,
.docs-toc {
  position: sticky;
  top: var(--header-height);
  align-self: start;
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
  scrollbar-width: thin;
}

.docs-sidebar {
  padding: 30px 10px 40px 2px;
}

.nav-section + .nav-section {
  margin-top: 25px;
}

.nav-section-title {
  margin: 0 0 7px;
  padding: 0 10px;
  color: var(--fg-subtle);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-list,
.toc-list,
.search-results {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 570;
  line-height: 1.35;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--surface-sunk);
  color: var(--fg);
}

.nav-link[aria-current="page"] {
  background: var(--accent-weak);
  color: var(--fg-strong);
  font-weight: 680;
  box-shadow: inset 3px 0 0 var(--accent);
}

.doc-main {
  min-width: 0;
  padding: 28px 0 64px;
}

.breadcrumbs {
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--fg-subtle);
  font-size: 12px;
}

.breadcrumbs a {
  color: var(--fg-muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.doc-hero {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.doc-eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.doc-hero h1 {
  max-width: 19ch;
  margin: 0;
  color: var(--fg-strong);
  font-size: clamp(34px, 5vw, 48px);
  font-weight: 770;
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.doc-description {
  max-width: 62ch;
  margin: 14px 0 0;
  color: var(--fg-muted);
  font-size: 17px;
  line-height: 1.55;
}

.doc-content {
  padding-top: 8px;
}

.doc-content h2,
.doc-content h3,
.doc-content h4 {
  position: relative;
  color: var(--fg-strong);
  line-height: 1.25;
  letter-spacing: -0.025em;
  scroll-margin-top: calc(var(--header-height) + 24px);
}

.doc-content h2 {
  margin: 42px 0 13px;
  font-size: 25px;
  font-weight: 740;
}

.doc-content h3 {
  margin: 30px 0 10px;
  font-size: 19px;
  font-weight: 710;
}

.doc-content h4 {
  margin: 24px 0 8px;
  font-size: 16px;
  font-weight: 700;
}

.heading-anchor {
  position: absolute;
  right: 100%;
  padding-right: 8px;
  color: var(--fg-subtle);
  font-weight: 500;
  text-decoration: none;
  opacity: 0;
}

.doc-content :is(h2, h3, h4):hover .heading-anchor,
.heading-anchor:focus {
  opacity: 1;
}

.doc-content p,
.doc-content ul,
.doc-content ol {
  margin-top: 14px;
  margin-bottom: 14px;
}

.doc-content ul,
.doc-content ol {
  padding-left: 24px;
}

.doc-content li + li {
  margin-top: 7px;
}

.doc-content strong {
  color: var(--fg-strong);
  font-weight: 700;
}

.doc-content a {
  font-weight: 570;
}

.external-mark {
  margin-left: 3px;
  font-size: 0.75em;
  text-decoration: none;
}

.doc-content blockquote {
  margin: 24px 0;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--border));
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--accent-weak);
  color: var(--fg);
}

.doc-content blockquote > :first-child {
  margin-top: 0;
}

.doc-content blockquote > :last-child {
  margin-bottom: 0;
}

.doc-content code {
  padding: 0.15em 0.38em;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-sunk);
  color: var(--fg-strong);
  font: 0.88em/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow-wrap: anywhere;
}

.code-frame {
  position: relative;
  margin: 22px 0;
}

.code-frame pre {
  margin: 0;
  overflow-x: auto;
  border: 1px solid color-mix(in srgb, var(--border) 52%, #000);
  border-radius: 12px;
  background: var(--code-bg);
  color: var(--code-fg);
  box-shadow: 0 12px 28px rgba(9, 9, 11, 0.14);
}

.code-frame pre code {
  display: block;
  min-width: max-content;
  padding: 18px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 12.5px;
  line-height: 1.65;
  overflow-wrap: normal;
}

.code-language {
  position: absolute;
  top: 8px;
  right: 48px;
  color: #a1a1aa;
  font: 10px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.copy-code {
  position: absolute;
  top: 7px;
  right: 8px;
  min-width: 32px;
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid #3f3f46;
  border-radius: 7px;
  background: #242428;
  color: #d4d4d8;
  font-size: 11px;
  cursor: pointer;
}

.copy-code:hover {
  background: #303036;
  color: #fff;
}

.table-wrap {
  margin: 24px 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.doc-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.doc-content th,
.doc-content td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.doc-content th {
  background: var(--surface-sunk);
  color: var(--fg-strong);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.doc-content tr:last-child td {
  border-bottom: 0;
}

.doc-content hr {
  margin: 34px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.page-navigation {
  margin-top: 50px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.page-navigation a {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--fg);
  text-decoration: none;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.page-navigation a:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(24, 24, 27, 0.07);
}

.page-navigation .next-link {
  text-align: right;
}

.page-nav-direction {
  display: block;
  color: var(--fg-subtle);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-nav-title {
  display: block;
  margin-top: 3px;
  color: var(--fg-strong);
  font-size: 13px;
  font-weight: 680;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-footer {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  color: var(--fg-subtle);
  font-size: 12px;
}

.doc-footer p {
  margin: 0;
}

.doc-footer a {
  color: var(--fg-muted);
}

.docs-toc {
  padding: 34px 0 40px;
}

.toc-title {
  margin: 0 0 10px;
  color: var(--fg-subtle);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.toc-link {
  display: block;
  padding: 4px 0 4px 12px;
  border-left: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 12px;
  line-height: 1.45;
  text-decoration: none;
}

.toc-link[data-depth="3"] {
  padding-left: 24px;
  font-size: 11px;
}

.toc-link:hover,
.toc-link.is-active {
  border-left-color: var(--accent);
  color: var(--accent);
}

.search-dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: min(720px, calc(100vh - 40px));
  margin: 9vh auto 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  color: var(--fg);
  box-shadow: var(--shadow-float);
}

.search-dialog::backdrop {
  background: rgba(9, 9, 11, 0.58);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.search-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 12px;
}

.search-dialog-head h2 {
  margin: 1px 0 0;
  color: var(--fg-strong);
  font-size: 20px;
  letter-spacing: -0.025em;
}

.search-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-field {
  margin: 0 20px;
  min-height: 48px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--surface-sunk);
  color: var(--fg-muted);
}

.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}

.search-field input {
  width: 100%;
  min-height: 46px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
}

.search-status {
  padding: 12px 20px 8px;
  color: var(--fg-subtle);
  font-size: 12px;
}

.search-results {
  max-height: 460px;
  padding: 0 10px 12px;
  overflow-y: auto;
}

.search-result-link {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--fg);
  text-decoration: none;
}

.search-result-link:hover,
.search-result-link:focus-visible {
  background: var(--surface-sunk);
  color: var(--fg);
}

.search-result-title {
  color: var(--fg-strong);
  font-size: 14px;
  font-weight: 690;
}

.search-result-meta {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.search-result-description {
  color: var(--fg-muted);
  font-size: 12px;
  line-height: 1.45;
}

.search-empty {
  margin: 6px 10px 12px;
  padding: 18px;
  border: 1px dashed var(--border-strong);
  border-radius: 11px;
  color: var(--fg-muted);
  text-align: center;
}

@media (max-width: 1120px) {
  .docs-layout {
    grid-template-columns: var(--sidebar-width) minmax(0, var(--content-width));
    gap: clamp(26px, 5vw, 52px);
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 780px) {
  :root {
    --header-height: 58px;
  }

  body.nav-open {
    overflow: hidden;
  }

  .site-header-inner {
    min-height: var(--header-height);
    padding: 8px 12px;
    gap: 10px;
  }

  .nav-toggle {
    display: inline-grid;
  }

  .brand-context,
  .header-links,
  .header-actions .search-button {
    display: none;
  }

  .header-actions {
    margin-left: auto;
  }

  .docs-layout {
    display: block;
    padding: 0 18px;
  }

  .docs-sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    z-index: 45;
    width: min(318px, 88vw);
    max-height: none;
    padding: 14px 12px 32px;
    border-right: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 16px 0 48px rgba(9, 9, 11, 0.22);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform 160ms ease, visibility 0s linear 160ms;
  }

  body.nav-open .docs-sidebar {
    transform: translateX(0);
    visibility: visible;
    transition: transform 160ms ease;
  }

  .nav-scrim {
    position: fixed;
    inset: var(--header-height) 0 0;
    z-index: 40;
    background: rgba(9, 9, 11, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
  }

  .nav-scrim:not([hidden]) {
    display: block;
  }

  .sidebar-search-mobile {
    display: block;
    margin-bottom: 16px;
  }

  .sidebar-search-mobile .search-button {
    width: 100%;
    min-width: 0;
  }

  .doc-main {
    padding-top: 20px;
  }

  .breadcrumbs {
    margin-bottom: 18px;
  }

  .doc-hero h1 {
    font-size: clamp(31px, 10vw, 42px);
  }

  .doc-description {
    font-size: 16px;
  }
}

@media (max-width: 520px) {
  .docs-layout {
    padding: 0 14px;
  }

  .doc-main {
    padding-bottom: 42px;
  }

  .doc-hero {
    padding-bottom: 22px;
  }

  .doc-content h2 {
    margin-top: 34px;
    font-size: 22px;
  }

  .heading-anchor {
    display: none;
  }

  .page-navigation {
    grid-template-columns: 1fr;
  }

  .page-navigation .next-link {
    text-align: left;
  }

  .search-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    margin-top: 8px;
    border-radius: 13px;
  }

  .search-dialog-head {
    padding: 16px 14px 10px;
  }

  .search-field {
    margin: 0 14px;
  }

  .search-status {
    padding-inline: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .site-header,
  .docs-sidebar,
  .docs-toc,
  .page-navigation,
  .doc-footer,
  .search-dialog,
  .nav-scrim {
    display: none !important;
  }

  .docs-layout {
    display: block;
    max-width: 780px;
    padding: 0;
  }

  .doc-main {
    padding: 0;
  }

  .doc-content a {
    color: inherit;
  }
}
