:root {
  color-scheme: light dark;

  --bg: #0b0d10;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.70);
  --faint: rgba(255, 255, 255, 0.54);
  --border: rgba(255, 255, 255, 0.12);
  --accent: #7aa2f7;
  --accent-ink: #081020;

  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 12px 40px rgba(0,0,0,0.35);

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f7fb;
    --surface: rgba(0, 0, 0, 0.03);
    --surface-2: rgba(0, 0, 0, 0.06);
    --text: rgba(0, 0, 0, 0.90);
    --muted: rgba(0, 0, 0, 0.66);
    --faint: rgba(0, 0, 0, 0.50);
    --border: rgba(0, 0, 0, 0.12);
    --shadow: 0 12px 30px rgba(0,0,0,0.10);
    --accent: #3b6cf0;
    --accent-ink: #eef3ff;
  }
}

/* Manual theme overrides (set by /assets/js/theme.js) */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0b0d10;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.70);
  --faint: rgba(255, 255, 255, 0.54);
  --border: rgba(255, 255, 255, 0.12);
  --accent: #7aa2f7;
  --accent-ink: #081020;

  --shadow: 0 12px 40px rgba(0,0,0,0.35);
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f7f7fb;
  --surface: rgba(0, 0, 0, 0.03);
  --surface-2: rgba(0, 0, 0, 0.06);
  --text: rgba(0, 0, 0, 0.90);
  --muted: rgba(0, 0, 0, 0.66);
  --faint: rgba(0, 0, 0, 0.50);
  --border: rgba(0, 0, 0, 0.12);
  --accent: #3b6cf0;
  --accent-ink: #eef3ff;

  --shadow: 0 12px 30px rgba(0,0,0,0.10);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

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

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 55%, transparent), transparent 55%),
    var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--mono); }

/* Small utilities (kept minimal to avoid inline styles under CSP) */
.muted { color: var(--muted); }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }

.docs-search-form {
  display: flex;
  gap: 8px;
  flex: 1;
}

.container { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
}

.logo {
  width: 34px;
  height: 34px;
}

.logo-fallback {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-weight: 700;
}

.brand .name {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand .name strong {
  font-size: 15px;
  letter-spacing: 0.2px;
  color: inherit;
}
.brand .name span {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}

.navlinks {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}


.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.theme-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
}

.theme-btn:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

.theme-btn[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
}

.navlink {
  display: inline-flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: inherit;
  font-size: 13px;
  background: transparent;
}
.navlink:hover {
  text-decoration: none;
  background: var(--surface);
  border-color: var(--border);
}
.navlink.active {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  font-size: 13px;
  text-decoration: none;
  transition: transform 120ms ease, background 120ms ease;
}
.btn:hover { transform: translateY(-1px); background: var(--surface-2); text-decoration: none; }

.btn.primary {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
}

.hero {
  padding: 56px 0 22px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
}

.hero-main {
  padding: 26px;
  position: relative;
  overflow: hidden;
}

.hero h1 {
  position: relative;
  margin: 0;
  font-size: clamp(30px, 3.2vw, 46px);
  letter-spacing: -0.6px;
}

.hero p {
  position: relative;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  max-width: 72ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  position: relative;
}

.pillrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  position: relative;
}

.pill {
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  color: var(--muted);
}

.hero-side {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.callout {
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.callout b { display: block; font-size: 14px; margin-bottom: 6px; }
.callout span { color: var(--muted); font-size: 13px; line-height: 1.6; }

.section {
  padding: 12px 0 54px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 980px) {
  .grid-3 { grid-template-columns: 1fr; }
}

.feature { padding: 18px; }
.feature h3 { margin: 0 0 8px; font-size: 16px; }
.feature p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }

.page {
  padding: 34px 0 56px;
}

.page h1 {
  margin: 0 0 8px;
  font-size: clamp(24px, 2.6vw, 36px);
}

.page .sub {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.kv {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 18px;
}

.kv-item {
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.docs-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  align-items: start;
}
@media (max-width: 1100px) {
  .docs-shell { grid-template-columns: 280px 1fr; }
}
@media (max-width: 980px) {
  .docs-shell { grid-template-columns: 1fr; }
}

.sidebar {
  padding: 16px;
  position: sticky;
  top: 74px;
}
@media (max-width: 980px) {
  .sidebar { position: static; }
}

.sidebar h2 {
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin: 0 0 10px;
  color: var(--muted);
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

.search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  color: var(--text);
  outline: none;
}
.search input::placeholder { color: var(--faint); }
.search button {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  cursor: pointer;
}
.search button:hover { background: var(--surface-2); }

.sidebar a {
  display: block;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: inherit;
  font-size: 13px;
}
.sidebar a:hover { background: var(--surface); border-color: var(--border); text-decoration: none; }
.sidebar a.active { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }

.content { padding: 22px; }

.notice {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.content-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.markdown {
  line-height: 1.8;
}

.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
  margin: 22px 0 10px;
  line-height: 1.25;
  letter-spacing: -0.2px;
}
.markdown h2 { font-size: 20px; }
.markdown h3 { font-size: 16px; }
.markdown p { margin: 12px 0; color: var(--text); }
.markdown a { color: var(--accent); }

/* Permalinks on headings (shown on hover) */
.markdown .heading-anchor {
  opacity: 0;
  margin-left: 10px;
  font-size: 0.85em;
  text-decoration: none;
  color: color-mix(in oklab, var(--muted) 70%, var(--text) 30%);
}
.markdown h2:hover .heading-anchor,
.markdown h3:hover .heading-anchor,
.markdown h4:hover .heading-anchor,
.markdown h5:hover .heading-anchor,
.markdown h6:hover .heading-anchor {
  opacity: 1;
}

.markdown code {
  font-family: var(--mono);
  font-size: 0.95em;
  padding: 2px 6px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--border);
}

.markdown pre {
  overflow-x: auto;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}
.markdown pre code { background: transparent; border: 0; padding: 0; }

.markdown blockquote {
  margin: 14px 0;
  padding: 10px 14px;
  border-left: 3px solid color-mix(in srgb, var(--accent) 70%, transparent);
  background: var(--surface);
  border-radius: 12px;
  color: var(--muted);
}

.markdown ul, .markdown ol { margin: 10px 0 10px 20px; }
.markdown hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

.toc {
  padding: 0;
  position: static;
  top: auto;
  margin-top: 12px;
  max-height: 40vh;
  overflow: auto;
}


.toc h2 {
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin: 0 0 10px;
  color: var(--muted);
}

.toc a {
  display: block;
  color: var(--muted);
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 12px;
}
.toc a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.toc a.lvl-2 { padding-left: 14px; }
.toc a.lvl-3 { padding-left: 22px; }
.toc a.lvl-4 { padding-left: 30px; }

.download-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 980px) {
  .download-grid { grid-template-columns: 1fr; }
}

.platform { padding: 18px; }
.platform h3 { margin: 0 0 10px; font-size: 16px; }

.asset {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  margin-bottom: 10px;
}

.asset a {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
}

.asset span {
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
}

.small { font-size: 12px; color: var(--muted); }



/* --- Docs responsiveness: prevent long content from blowing out the grid --- */
.docs-shell > * { min-width: 0; }

/* Markdown content should wrap naturally inside the available width */
.markdown {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.markdown a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Media in docs should never overflow the content column */
.markdown img,
.markdown video,
.markdown iframe {
  max-width: 100%;
  height: auto;
}

/* Tables can be wider than the viewport; scroll instead of overflowing layout */
.markdown table {
  max-width: 100%;
  border-collapse: collapse;
}

.markdown .md-table {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.markdown .md-table table {
  width: max-content;
  min-width: 100%;
}

.markdown .md-table th,
.markdown .md-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: top;
}

.markdown .md-table th:last-child,
.markdown .md-table td:last-child {
  border-right: 0;
}

.markdown .md-table tr:last-child td {
  border-bottom: 0;
}

.markdown .md-table th {
  font-weight: 600;
  background: color-mix(in oklab, var(--surface) 80%, var(--text) 20%);
}

.markdown .table-align-left { text-align: left; }
.markdown .table-align-center { text-align: center; }
.markdown .table-align-right { text-align: right; }

/* Admonitions (Note/Tip/Warning style callouts) */
.markdown .admonition {
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.markdown .admonition-title {
  padding: 10px 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface) 85%, var(--text) 15%);
}

.markdown .admonition-content {
  padding: 10px 12px;
}

.markdown .admonition-note .admonition-title { border-left: 3px solid var(--accent); }
.markdown .admonition-tip .admonition-title { border-left: 3px solid color-mix(in oklab, var(--accent) 65%, #22c55e 35%); }
.markdown .admonition-important .admonition-title { border-left: 3px solid color-mix(in oklab, var(--accent) 65%, #a855f7 35%); }
.markdown .admonition-warning .admonition-title,
.markdown .admonition-caution .admonition-title,
.markdown .admonition-danger .admonition-title { border-left: 3px solid color-mix(in oklab, var(--accent) 55%, #f59e0b 45%); }

/* Details blocks */
.markdown details.details-block {
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.markdown details.details-block > summary {
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 600;
  list-style: none;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface) 85%, var(--text) 15%);
}

.markdown details.details-block[open] > summary {
  border-bottom: 1px solid var(--border);
}

.markdown .details-content {
  padding: 10px 12px;
}

/* Task lists */
.markdown li.task-list-item {
  list-style: none;
  margin-left: 0;
}

.markdown .task-list-checkbox {
  margin-right: 8px;
  transform: translateY(2px);
}

/* Keep block code scrollable without expanding the grid column */
.markdown pre {
  max-width: 100%;
}

/* Inline code can contain long tokens (hashes, paths, URLs) */
.markdown :not(pre) > code {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.footer {
  padding: 26px 0 40px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}
.footer a { color: var(--muted); }