:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-muted: #eef2f6;
  --text: #10151f;
  --muted: #5e6a7d;
  --faint: #8792a3;
  --border: #dbe2ea;
  --border-strong: #bac6d4;
  --brand: #246bfe;
  --brand-strong: #174ec7;
  --green: #12845f;
  --amber: #a96005;
  --code-bg: #10151f;
  --code-text: #eef5ff;
  --shadow: 0 16px 50px rgba(16, 21, 31, 0.12);
  --header-height: 64px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121317;
  --surface: #191c22;
  --surface-muted: #222730;
  --text: #f4f6fb;
  --muted: #a5adba;
  --faint: #7c8797;
  --border: #303642;
  --border-strong: #465062;
  --brand: #78a6ff;
  --brand-strong: #a9c4ff;
  --green: #45c497;
  --amber: #e0a236;
  --code-bg: #080a0f;
  --code-text: #eef5ff;
  --shadow: 0 16px 50px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: calc(var(--header-height) + 20px);
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(36, 107, 254, 0.08), transparent 360px),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

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

a:hover {
  text-decoration: underline;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 30;
  transform: translateY(-160%);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 8px 10px;
}

.skip-link:focus {
  transform: translateY(0);
}

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

.header-inner {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr);
  align-items: center;
  gap: 20px;
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 12px 24px;
}

.brand,
.top-links {
  display: inline-flex;
  align-items: center;
}

.brand {
  gap: 10px;
  color: var(--text);
  font-weight: 750;
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  width: 24px;
  height: 24px;
  flex: none;
}

.top-links {
  justify-content: flex-end;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.top-links a {
  color: var(--muted);
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

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

.docs-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 760px) 230px;
  gap: 36px;
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 34px 24px 72px;
}

.sidebar,
.toc {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  align-self: start;
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow: auto;
}

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

.sidebar-nav h2,
.toc p {
  margin: 0 0 10px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav ul,
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav a,
.toc a {
  display: block;
  border-radius: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  padding: 8px 10px;
}

.sidebar-nav a[aria-current="page"] {
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand-strong);
  font-weight: 700;
}

.toc a {
  padding: 6px 0;
}

.toc-nested {
  padding-left: 14px;
}

.toc-empty {
  color: var(--faint);
  font-size: 14px;
}

.doc-main {
  min-width: 0;
}

.doc-article {
  width: 100%;
}

.eyebrow {
  margin-bottom: 12px;
  color: var(--green);
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  max-width: 780px;
  margin: 0;
  color: var(--text);
  font-size: clamp(38px, 6vw, 64px);
  line-height: 0.98;
  letter-spacing: 0;
}

.lead {
  max-width: 700px;
  margin: 18px 0 42px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.6;
}

.doc-article h2 {
  margin: 44px 0 14px;
  padding-top: 6px;
  color: var(--text);
  font-size: 26px;
  line-height: 1.18;
  letter-spacing: 0;
}

.doc-article h3 {
  margin: 30px 0 12px;
  color: var(--text);
  font-size: 19px;
  letter-spacing: 0;
}

.heading-anchor {
  color: inherit;
}

.heading-anchor:hover {
  text-decoration: none;
}

.doc-article p,
.doc-article li {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.78;
}

.doc-article p {
  margin: 14px 0;
}

.doc-article ul,
.doc-article ol {
  margin: 12px 0 22px;
  padding-left: 22px;
}

.doc-article li + li {
  margin-top: 6px;
}

.doc-article strong {
  color: var(--text);
}

.doc-article code {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-muted);
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  padding: 0.12em 0.35em;
}

blockquote {
  margin: 24px 0;
  border-left: 4px solid var(--amber);
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--amber) 9%, transparent);
  padding: 12px 18px;
}

blockquote p {
  margin: 0;
}

.code-block {
  position: relative;
  margin: 20px 0 28px;
  border-radius: 10px;
  background: var(--code-bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.code-block::before {
  content: attr(data-language);
  position: absolute;
  left: 16px;
  top: 12px;
  color: #8d99aa;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.copy-button {
  position: absolute;
  right: 10px;
  top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #dce7f7;
  cursor: pointer;
  font-size: 12px;
  padding: 6px 9px;
}

pre {
  margin: 0;
  overflow: auto;
  padding: 44px 18px 18px;
}

pre code {
  border: 0 !important;
  background: transparent !important;
  color: var(--code-text) !important;
  font-size: 13px !important;
  line-height: 1.7;
  padding: 0 !important;
}

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

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

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

th {
  background: var(--surface-muted);
  color: var(--text);
  font-size: 13px;
}

td {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 56px;
}

.pager-link {
  display: block;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 14px;
}

.pager-link span {
  display: block;
  color: var(--faint);
  font-size: 12px;
  text-transform: uppercase;
}

.pager-link strong {
  display: block;
  margin-top: 4px;
}

.pager-next {
  text-align: right;
}

@media (max-width: 1080px) {
  .header-inner {
    grid-template-columns: 1fr auto;
  }

  .docs-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 760px) {
  .header-inner {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 12px 16px;
  }

  .top-links a {
    display: none;
  }

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

  .docs-shell {
    display: block;
    padding: 26px 18px 56px;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(320px, 86vw);
    max-height: none;
    border-right: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    transform: translateX(-105%);
    transition: transform 160ms ease;
    padding: 18px;
  }

  body[data-nav-open="true"] .sidebar {
    transform: translateX(0);
  }

  .mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: none;
    background: rgba(10, 13, 18, 0.45);
  }

  body[data-nav-open="true"] .mobile-overlay {
    display: block;
  }

  .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    font-weight: 750;
  }

  h1 {
    font-size: 40px;
  }

  .lead {
    font-size: 17px;
  }

  .pager {
    grid-template-columns: 1fr;
  }
}
