:root {
  --bg: #f6f4ef;
  --bg-raised: #fffdf9;
  --bg-sunken: #eeebe4;
  --ink: #1d1e20;
  --ink-soft: #4a4c50;
  --ink-faint: #75777c;
  --line: #dedad1;
  --line-strong: #c9c4b8;
  --accent: #b8621b;
  --accent-strong: #9a4f12;
  --accent-wash: #f6e6d4;
  --link: #1f5f7a;
  --code-bg: #1d1e20;
  --code-ink: #e9e6df;
  --code-faint: #8f9197;
  --code-str: #e8b46a;
  --code-kw: #8cc7d9;
  --code-label: #b9d58c;
  --code-cmt: #8f9197;
  --inline-code-bg: #ebe7de;
  --radius: 10px;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.03), 0 8px 24px -12px rgba(30, 25, 15, 0.18);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --max: 1120px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141517;
    --bg-raised: #1b1c1f;
    --bg-sunken: #101113;
    --ink: #ebe8e2;
    --ink-soft: #b9b7b1;
    --ink-faint: #8a8a88;
    --line: #2c2d31;
    --line-strong: #3a3b40;
    --accent: #ec9a4c;
    --accent-strong: #f3ae6b;
    --accent-wash: #2d2216;
    --link: #8cc7d9;
    --code-bg: #0e0f10;
    --inline-code-bg: #25262a;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

img, svg { max-width: 100%; }

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 0.6em; font-weight: 650; }
h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

code, pre, kbd { font-family: var(--mono); font-size: 0.88em; }
:not(pre) > code {
  background: var(--inline-code-bg);
  padding: 0.1em 0.38em;
  border-radius: 5px;
  overflow-wrap: anywhere;
}

pre {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 18px 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.55;
  font-size: 0.84rem;
  margin: 0 0 1.4em;
  tab-size: 2;
}
pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.tok-str { color: var(--code-str); }
.tok-kw { color: var(--code-kw); }
.tok-label { color: var(--code-label); }
.tok-cmt { color: var(--code-cmt); font-style: italic; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 100; background: var(--bg-raised); padding: 8px 12px; border-radius: 6px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 12px 28px; min-height: 64px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 680; letter-spacing: -0.01em; font-size: 1.04rem; margin-right: auto; }
.brand svg { width: 28px; height: 28px; flex: none; }
.nav { display: flex; gap: 4px 20px; flex-wrap: wrap; font-size: 0.94rem; }
.nav a { color: var(--ink-soft); text-decoration: none; padding: 4px 0; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 8px;
  font-weight: 600; font-size: 0.96rem; text-decoration: none; line-height: 1.2;
  border: 1px solid var(--line-strong); color: var(--ink); background: var(--bg-raised);
}
.btn:hover { border-color: var(--ink-faint); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn svg { width: 16px; height: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.note { color: var(--ink-faint); font-size: 0.9rem; }

/* Sections */
.hero { padding: 84px 0 64px; border-bottom: 1px solid var(--line); }
.hero .lede { font-size: clamp(1.08rem, 1.8vw, 1.25rem); color: var(--ink-soft); max-width: 44em; margin-bottom: 1.6em; }
.eyebrow { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }
.section { padding: 72px 0; border-bottom: 1px solid var(--line); }
.section:last-of-type { border-bottom: 0; }
.section-head { max-width: 46em; margin-bottom: 36px; }
.section-head p { color: var(--ink-soft); }
.prose { max-width: 46em; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }

.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px;
  box-shadow: var(--shadow);
}
.card h3 { margin-bottom: 0.4em; }
.card p:last-child { margin-bottom: 0; }
.card-plain { box-shadow: none; background: transparent; }

.product-card { display: flex; flex-direction: column; gap: 14px; padding: 30px; }
.product-card h3 { font-size: 1.35rem; margin: 0; }
.product-card .tag { align-self: flex-start; font-family: var(--mono); font-size: 0.75rem; padding: 3px 9px; border-radius: 999px; background: var(--accent-wash); color: var(--accent-strong); }
.product-card pre { margin: 4px 0 6px; font-size: 0.78rem; }
.product-card .actions { margin-top: auto; }
.price { font-weight: 600; }
.price small { font-weight: 400; color: var(--ink-faint); }

.feature h3 { display: flex; align-items: center; gap: 10px; }
.feature .icon { width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--accent-wash); color: var(--accent-strong); flex: none; }
.feature .icon svg { width: 17px; height: 17px; }
.feature p { color: var(--ink-soft); font-size: 0.97rem; }

.checklist { list-style: none; padding: 0; margin: 0 0 1em; }
.checklist li { position: relative; padding-left: 28px; margin-bottom: 0.55em; }
.checklist li::before { content: ""; position: absolute; left: 4px; top: 0.55em; width: 10px; height: 6px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.steps li { counter-increment: step; background: var(--bg-raised); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--bg); font-weight: 650; font-size: 0.9rem; margin-bottom: 12px; }
.steps strong { display: block; margin-bottom: 4px; }
.steps p { margin: 0; color: var(--ink-soft); font-size: 0.97rem; }

.split { display: grid; gap: 40px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; }

.code-frame { border-radius: 14px; overflow: hidden; background: var(--code-bg); box-shadow: var(--shadow); min-width: 0; }
.code-frame .bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid #2a2b2f; color: var(--code-faint); font-family: var(--mono); font-size: 0.78rem; }
.code-frame .bar span:first-child { color: var(--code-ink); }
.code-frame .bar a { margin-left: auto; color: var(--code-faint); }
.code-frame pre { margin: 0; border-radius: 0; }

.table-wrap { overflow-x: auto; margin: 0 0 1.4em; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised); }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
th { font-weight: 620; background: var(--bg-sunken); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td code { overflow-wrap: normal; }
.spec-table td:first-child { font-weight: 600; width: 30%; min-width: 140px; }

.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq details:first-child { border-top: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: 16px 32px 16px 0; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 13px; font-size: 1.3rem; font-weight: 400; color: var(--ink-faint); }
.faq details[open] summary::after { content: "\2212"; }
.faq details > div { padding: 0 0 18px; color: var(--ink-soft); max-width: 46em; }
.faq details > div p:last-child { margin-bottom: 0; }

.callout { border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--bg-raised); border-radius: var(--radius); padding: 18px 22px; margin: 0 0 1.4em; }
.callout p:last-child { margin-bottom: 0; }

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pill-row li { font-size: 0.86rem; padding: 4px 11px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink-soft); background: var(--bg-raised); }

.cta-band { background: var(--ink); color: var(--bg); border-radius: 18px; padding: 44px; display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between; }
.cta-band h2 { margin: 0 0 6px; }
.cta-band p { margin: 0; opacity: 0.8; }
.cta-band .btn-primary { background: var(--bg); color: var(--ink); border-color: var(--bg); }
.cta-band .btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.cta-band .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 40%, transparent); }

/* Docs */
.docs-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 56px; padding-top: 40px; padding-bottom: 80px; }
.docnav { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 110px); overflow-y: auto; font-size: 0.92rem; padding-right: 6px; }
.docnav summary { display: none; }
.docnav h4 { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); margin: 22px 0 8px; font-weight: 500; }
.docnav h4:first-of-type { margin-top: 0; }
.docnav ul { list-style: none; margin: 0; padding: 0; }
.docnav li a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--ink-soft); text-decoration: none; overflow-wrap: anywhere; }
.docnav li a:hover { background: var(--bg-sunken); color: var(--ink); }
.docnav li a[aria-current="page"] { background: var(--accent-wash); color: var(--accent-strong); font-weight: 600; }
.docnav ul ul { margin-left: 10px; border-left: 1px solid var(--line); padding-left: 6px; }

.doc { min-width: 0; max-width: 820px; }
.doc h1 { font-size: clamp(1.8rem, 3.4vw, 2.4rem); }
.doc h2 { margin-top: 1.9em; padding-top: 0.2em; font-size: 1.45rem; }
.doc h3 { margin-top: 1.5em; }
.doc h1 + p, .doc .doc-meta { color: var(--ink-soft); }
.doc ul, .doc ol { padding-left: 1.4em; }
.doc li { margin-bottom: 0.35em; }
.doc .heading-anchor { color: var(--ink-faint); text-decoration: none; margin-left: 8px; opacity: 0; font-weight: 400; }
.doc h2:hover .heading-anchor, .doc h3:hover .heading-anchor { opacity: 1; }
.doc-banner { font-size: 0.9rem; color: var(--ink-soft); background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 28px; }
.doc-banner code { font-size: 0.85em; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager a { text-decoration: none; display: flex; flex-direction: column; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); min-width: 180px; }
.pager a span { font-size: 0.8rem; color: var(--ink-faint); }
.pager a.next { margin-left: auto; text-align: right; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 44px 0 56px; color: var(--ink-faint); font-size: 0.9rem; background: var(--bg-sunken); }
.site-footer .wrap { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.site-footer h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); margin-bottom: 10px; font-weight: 600; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--ink-soft); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }
.site-footer .fine { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 20px; }

.notfound { padding: 120px 0; text-align: left; }
.notfound .code { font-family: var(--mono); color: var(--accent); }

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; gap: 20px; padding-top: 24px; }
  .docnav { position: static; max-height: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised); padding: 0; }
  .docnav summary { display: block; cursor: pointer; padding: 12px 16px; font-weight: 600; }
  .docnav[open] summary { border-bottom: 1px solid var(--line); }
  .docnav .docnav-body { padding: 16px; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .hero { padding: 52px 0 44px; }
  .section { padding: 52px 0; }
  .card, .product-card { padding: 22px; }
  .cta-band { padding: 28px 22px; }
  .nav { gap: 2px 16px; font-size: 0.9rem; }
  pre { padding: 14px 16px; font-size: 0.78rem; }
  th, td { padding: 8px 10px; }
}
