/* Docs styling — shares the design tokens used by website/index.html. */
:root {
  --bg: #000000;
  --surface: #111111;
  --surface-elevated: #1a1a1a;
  --surface-hover: #1f1f1f;
  --text: #fafafa;
  --text-secondary: #a1a1a1;
  --text-tertiary: #737373;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --accent: #6366f1;
  --accent-strong: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --success: #10b981;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 24px var(--accent-glow);
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  background:
    radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.07), transparent 700px),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

.doc-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}

/* Header — matches the landing page */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 14px;
  transition: opacity var(--transition);
}
.brand:hover { opacity: 0.7; }
.brand-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent) 0%, transparent 100%), var(--surface-elevated);
  background-blend-mode: soft-light;
  color: var(--accent-strong);
  font: 700 15px ui-monospace, monospace;
  box-shadow: var(--shadow-sm), inset 0 1px 1px rgba(255, 255, 255, 0.05);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  font-size: 13px;
  color: var(--text-secondary);
}
.nav-links a { transition: color var(--transition); }
.nav-links a:hover { color: var(--text); }
.btn {
  padding: 0 20px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.btn:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-md), var(--shadow-glow);
}
.btn-primary:hover { background: var(--accent-strong); box-shadow: var(--shadow-lg), var(--shadow-glow); }

/* Layout */
.doc-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 200px;
  gap: 48px;
  align-items: start;
  padding-top: 48px;
  padding-bottom: 80px;
}
.doc-nav,
.doc-toc {
  position: sticky;
  top: 104px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  font-size: 13.5px;
}
.doc-nav-title {
  margin: 24px 0 8px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.doc-nav-title:first-child { margin-top: 0; }
.doc-nav ul,
.doc-toc ul { list-style: none; }
.doc-nav a,
.doc-toc a {
  display: block;
  padding: 5px 12px;
  margin-left: -12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.doc-nav a:hover,
.doc-toc a:hover { background: var(--surface); color: var(--text); }
.doc-nav a.current {
  background: var(--surface-elevated);
  color: var(--accent-strong);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}
.doc-toc { border-left: 1px solid var(--border); padding-left: 20px; }
.doc-toc a { padding: 4px 8px; margin-left: -8px; font-size: 13px; }

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

/* Article typography */
.doc-article { max-width: 760px; }
.doc-article h1 {
  margin-bottom: 24px;
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
}
.doc-article h2 {
  margin: 56px 0 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.doc-article h3 { margin: 36px 0 12px; font-size: 19px; font-weight: 600; }
.doc-article h4 { margin: 28px 0 10px; font-size: 16px; font-weight: 600; color: var(--text-secondary); }
.doc-article p { margin: 16px 0; color: var(--text-secondary); }
.doc-article strong { color: var(--text); font-weight: 600; }
.doc-article a:not(.headerlink) {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(129, 140, 248, 0.4);
  transition: text-decoration-color var(--transition);
}
.doc-article a:not(.headerlink):hover { text-decoration-color: var(--accent-strong); }

.headerlink {
  margin-left: 10px;
  color: var(--text-tertiary);
  opacity: 0;
  font-weight: 400;
  transition: opacity var(--transition);
}
h1:hover .headerlink,
h2:hover .headerlink,
h3:hover .headerlink,
h4:hover .headerlink { opacity: 1; }

.doc-article ul,
.doc-article ol { margin: 16px 0 16px 24px; color: var(--text-secondary); }
.doc-article li { margin: 8px 0; }
.doc-article li::marker { color: var(--text-tertiary); }

.doc-article code {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-elevated);
  color: var(--accent-strong);
  font: 0.875em ui-monospace, SFMono-Regular, Menlo, monospace;
}
.doc-article pre {
  margin: 20px 0;
  padding: 18px 20px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.doc-article pre code {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.65;
}

.doc-article blockquote {
  margin: 20px 0;
  padding: 4px 20px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}

.doc-article table {
  width: 100%;
  margin: 24px 0;
  border-collapse: collapse;
  font-size: 14px;
}
.doc-article table :is(th, td) {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.doc-article th {
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.doc-article td { color: var(--text-secondary); }
.doc-article tbody tr:hover td { background: var(--surface); }
/* Wide reference tables scroll instead of pushing the page sideways. */
.doc-article > table { display: block; overflow-x: auto; }

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

/* Pager + source link */
.doc-pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 64px;
  max-width: 760px;
}
.pager-link {
  flex: 1;
  max-width: 320px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: all var(--transition);
}
.pager-link:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.pager-link.next { text-align: right; }
.pager-link small { display: block; color: var(--text-tertiary); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.pager-link strong { font-size: 15px; font-weight: 600; }
.doc-source { margin-top: 32px; font-size: 13px; color: var(--text-tertiary); }
.doc-source a { text-decoration: underline; text-underline-offset: 3px; }
.doc-source a:hover { color: var(--text-secondary); }

/* Docs index */
.doc-hero { max-width: 720px; margin-bottom: 64px; }
.eyebrow {
  margin-bottom: 12px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.doc-hero h1 { margin-bottom: 16px; font-size: clamp(36px, 5vw, 52px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.doc-hero p { color: var(--text-secondary); font-size: 17px; }
.doc-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.doc-group { margin-bottom: 48px; }
.doc-group h2 { margin-bottom: 16px; font-size: 20px; font-weight: 650; letter-spacing: -0.02em; }
.doc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.doc-card {
  display: block;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: all var(--transition);
}
.doc-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.doc-card strong { display: block; margin-bottom: 6px; font-size: 15px; font-weight: 600; }
.doc-card span { color: var(--text-secondary); font-size: 13.5px; line-height: 1.55; }

/* Footer */
.footer {
  padding: 48px 0 40px;
  border-top: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: 13px;
  text-align: center;
}
.footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 24px; margin-bottom: 20px; }
.footer-links a { transition: color var(--transition); }
.footer-links a:hover { color: var(--text-secondary); }

@media (max-width: 1100px) {
  .doc-layout { grid-template-columns: 220px minmax(0, 1fr); gap: 40px; }
  .doc-toc { display: none; }
}
@media (max-width: 820px) {
  .doc-shell { padding: 0 20px; }
  .nav { height: auto; padding: 14px 0; gap: 14px; flex-wrap: wrap; justify-content: center; }
  .nav-links { gap: 20px; }
  .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-top: 32px; }
  .doc-nav {
    position: static;
    max-height: none;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
  }
  .doc-nav ul { display: flex; flex-wrap: wrap; gap: 6px; }
  .doc-nav a { margin-left: 0; border: 1px solid var(--border); }
  .doc-pager { flex-direction: column; }
  .pager-link, .pager-link.next { max-width: none; text-align: left; }
}
