:root {
  color-scheme: dark;
  /* The same material as the landing page, quieter: a documentation surface
     is a surface you read, not one you look at. */
  --bg: #070a11;
  --bg: oklch(0.142 0.016 268);
  --surface: #131a24;
  --surface: oklch(0.215 0.022 258);
  --surface-2: #1a242e;
  --surface-2: oklch(0.255 0.024 252);
  --border: oklch(0.38 0.022 262 / 0.36);
  --border-hi: oklch(0.5 0.026 258 / 0.58);
  --fg: #f9f7ef;
  --fg: oklch(0.975 0.01 96);
  --dim: #ccd3dc;
  --dim: oklch(0.865 0.014 252);
  --dimmer: #9199a3;
  --dimmer: oklch(0.68 0.018 254);
  --accent: #ffd60f;
  --accent: oklch(0.885 0.18 95);
  --accent-soft: oklch(0.885 0.18 95 / 0.13);
  --radius: 12px;
  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-feature-settings: "ss01", "cv11";
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: #0b0b0d; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #14140c;
  font-weight: 650;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.16s ease;
}
.skip-link:focus { transform: none; }

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #26262c; border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 12, 0.78);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(150%) blur(18px);
  -webkit-backdrop-filter: saturate(150%) blur(18px);
}

.topbar nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--fg);
  text-decoration: none;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.012em;
}

.brand .logo {
  width: 30px;
  height: 30px;
  display: block;
  border-radius: 7px;
}

.links { display: flex; gap: 4px; flex-wrap: wrap; }

.links a {
  color: var(--dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}

.links a:hover { color: var(--fg); background: rgba(255, 255, 255, 0.04); }

.links a.active {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.06);
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
}

.sidebar {
  position: sticky;
  top: 78px;
  align-self: start;
  padding: 36px 0;
  border-right: 1px solid var(--border);
}

.sidebar .doc-title {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--dim);
  margin-bottom: 16px;
  padding-left: 12px;
}

.sidebar a {
  display: block;
  color: var(--dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 7px 12px;
  margin: 1px 0;
  border-left: 1px solid transparent;
  border-radius: 0 8px 8px 0;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.sidebar a:hover { color: var(--fg); background: rgba(255, 255, 255, 0.03); }

.sidebar a.active {
  color: var(--fg);
  border-left-color: var(--fg);
  background: rgba(255, 255, 255, 0.04);
}

main.doc:focus { outline: none; }

main.doc { padding: 44px 8px 90px; min-width: 0; }

main.doc > * + * { margin-top: 18px; }

h1 {
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 650;
  letter-spacing: -0.028em;
  line-height: 1.2;
}

h2 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 40px 0 14px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}

h3 { font-size: 16px; font-weight: 600; margin: 26px 0 10px; }

p { color: var(--dim); font-size: 15px; line-height: 1.7; }

p strong, li strong { color: var(--fg); font-weight: 600; }

a { color: var(--fg); text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.18); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); color: var(--accent); }

ul, ol { padding-left: 22px; color: var(--dim); font-size: 15px; line-height: 1.7; }

li { margin: 6px 0; }

code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 7px;
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--fg);
}

pre {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 0;
  overflow-x: auto;
  margin: 16px 0;
}

pre::before {
  content: "";
  display: block;
  height: 38px;
  margin-bottom: 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

pre code {
  display: block;
  padding: 0 22px;
  background: none;
  border: none;
  color: #e8e7e3;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.85;
  white-space: pre;
}

.copy {
  position: absolute;
  top: 9px;
  right: 10px;
  z-index: 2;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--dim);
  border-radius: 6px;
  padding: 3px 11px;
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.copy:hover, .copy.done { color: var(--fg); border-color: var(--border-hi); }

.copy-status {
  position: absolute;
  top: 15px;
  right: 78px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
  pointer-events: none;
}
.copy-status:empty { display: none; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 16px 0;
}

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

th {
  color: var(--dim);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.1em;
}

tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

.note {
  border: 1px solid var(--border);
  border-left: 2px solid var(--border-hi);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--dim);
  font-size: 13.5px;
}

.callout {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  background: var(--surface);
  color: var(--dim);
  font-size: 14.5px;
  margin-top: 34px;
}

.callout strong { color: var(--fg); }
.callout a { color: var(--fg); }

.doc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.doc-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--fg);
  text-decoration: none;
  background: var(--surface);
  transition: border-color 0.18s, transform 0.18s;
}

.doc-card:hover { border-color: var(--border-hi); transform: translateY(-2px); text-decoration: none; }

.doc-card .dc-title { font-weight: 600; font-size: 14.5px; }

.doc-card p { font-size: 13px; margin-top: 6px; line-height: 1.6; }

footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 28px 24px;
  color: var(--dim);
  font-size: 13px;
  background: var(--surface);
}

/* Same progressive-enhancement pattern as the main site: animation
   only fires when the inline script in <head> has set html.js-ready.
   Without JS, .reveal is at its natural visible state — no
   invisible content ever, no matter how the IntersectionObserver
   behaves. */
html.js-ready .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

html.js-ready .reveal.in-view { opacity: 1; transform: none; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  .sidebar { position: static; border-right: none; border-bottom: 1px solid var(--border); padding: 16px 0; }
  .sidebar .doc-title { margin-bottom: 8px; }
  .sidebar a { display: inline-block; padding: 5px 10px; margin: 0 4px 4px 0; border-left: none; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; }
  .sidebar a.active { border-color: var(--fg); }
  main.doc table { display: block; overflow-x: auto; }
  main.doc table:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
}

@media (max-width: 620px) {
  .topbar nav { flex-wrap: wrap; justify-content: flex-start; }
  .links { width: 100%; gap: 2px; }
  .links a { padding: 6px 9px; font-size: 13px; }
  main.doc { padding-top: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html.js-ready .reveal { opacity: 1; transform: none; }
}
