:root {
  --bg:        #FBFAF8;
  --surface:   #FFFFFF;
  --raise:     #F4F2EE;
  --fg:        #1A1917;
  --fg-mid:    #5A5751;
  --fg-dim:    #8A857D;
  --line:      #E4E0D8;
  --line-soft: #EEEBE4;
  --accent:    #A9660B;
  --accent-bg: #FBF2E3;
  --soon:      #1C6E63;
  --soon-bg:   #E6F2EF;
  --code-bg:   #F6F4F0;
  --sans: Archivo, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sidebar: 260px;
  --maxread: 760px;
  /* A scale rather than one radius on everything: big containers get the
     roundest corners, controls sit a step below them, and inline chips a step
     below that. Applying a single value everywhere is what makes a page look
     like it was assembled rather than designed. */
  --r-lg: 12px;
  --r-md: 9px;
  --r-sm: 6px;
}

/* Dark is a real palette, not the light one inverted. Warm greys rather than
   blue-blacks so it sits beside the marketing site rather than fighting it. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #17161A;
    --surface:   #1D1C21;
    --raise:     #232227;
    --fg:        #EDEAE4;
    --fg-mid:    #A8A399;
    --fg-dim:    #7C776E;
    --line:      #2E2C33;
    --line-soft: #26252A;
    --accent:    #E8A33D;
    --accent-bg: #2A2215;
    --soon:      #58C7B4;
    --soon-bg:   #142A28;
    --code-bg:   #201F24;
  }
}
:root[data-theme="dark"] {
  --bg:        #17161A;
  --surface:   #1D1C21;
  --raise:     #232227;
  --fg:        #EDEAE4;
  --fg-mid:    #A8A399;
  --fg-dim:    #7C776E;
  --line:      #2E2C33;
  --line-soft: #26252A;
  --accent:    #E8A33D;
  --accent-bg: #2A2215;
  --soon:      #58C7B4;
  --soon-bg:   #142A28;
  --code-bg:   #201F24;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-size: 15px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
img { max-width: 100%; }

/* ---- top bar ---------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 16px;
  height: 56px; padding: 0 20px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--fg); font-weight: 700; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 22px; height: 22px;
  border: 1.5px solid var(--fg); border-radius: var(--r-sm);
  font-family: var(--mono); font-size: 11px; font-weight: 700;
}
.brand-sep { color: var(--fg-dim); font-weight: 400; }
.brand-docs { color: var(--fg-mid); font-weight: 600; }
.brand-docs:hover { color: var(--fg); text-decoration: none; }
.topnav { display: flex; gap: 18px; margin-left: 12px; }
.topnav a { color: var(--fg-mid); font-size: 14px; font-weight: 500; }
.topnav a:hover { color: var(--fg); text-decoration: none; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.themetoggle {
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--fg-mid); cursor: pointer;
  font-family: var(--mono); font-size: 13px; line-height: 1;
}
.themetoggle:hover { color: var(--fg); border-color: var(--fg-dim); }
.navtoggle {
  display: none; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  color: var(--fg-mid); font-family: var(--sans); font-size: 13px;
  padding: 6px 10px; cursor: pointer;
}

/* ---- layout ----------------------------------------------------------- */
.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); align-items: start; }
.sidebar {
  position: sticky; top: 56px; align-self: start;
  height: calc(100vh - 56px); overflow-y: auto;
  padding: 22px 12px 60px 20px; border-right: 1px solid var(--line);
}
.searchwrap { position: relative; margin-bottom: 18px; }
.search {
  width: 100%; padding: 7px 10px; font-family: var(--sans); font-size: 13px;
  color: var(--fg); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); outline: none;
}
.search::placeholder { color: var(--fg-dim); }
.search:focus { border-color: var(--accent); }
.navgroup { margin-bottom: 20px; }
.navgroup-title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fg-dim); padding: 0 8px; margin-bottom: 7px;
}
.navlink {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px; border-radius: var(--r-sm);
  color: var(--fg-mid); font-size: 14px; line-height: 1.4;
}
.navlink:hover { background: var(--raise); color: var(--fg); text-decoration: none; }
.navlink[aria-current="page"] { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.navempty { padding: 6px 8px; color: var(--fg-dim); font-size: 13px; }

.main { min-width: 0; padding: 40px 40px 100px; }
.content { max-width: var(--maxread); }

/* ---- type ------------------------------------------------------------- */
.eyebrow {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--fg-dim);
  margin-bottom: 10px;
}
h1 { font-size: 38px; line-height: 1.12; letter-spacing: -.025em; font-weight: 700; margin: 0 0 14px; }
h2 {
  font-size: 22px; line-height: 1.3; letter-spacing: -.015em; font-weight: 600;
  margin: 44px 0 12px; padding-top: 22px; border-top: 1px solid var(--line-soft);
}
h3 { font-size: 16px; font-weight: 600; margin: 26px 0 8px; letter-spacing: -.005em; }
p { margin: 0 0 14px; color: var(--fg-mid); }
.lede { font-size: 17px; line-height: 1.6; color: var(--fg-mid); margin-bottom: 22px; }
strong { color: var(--fg); font-weight: 600; }
ul, ol { margin: 0 0 16px; padding-left: 20px; color: var(--fg-mid); }
li { margin-bottom: 6px; }
li::marker { color: var(--fg-dim); }

code {
  font-family: var(--mono); font-size: .88em;
  background: var(--code-bg); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 1px 4px; color: var(--fg);
}
pre {
  margin: 0 0 18px; padding: 14px 16px; overflow-x: auto;
  background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--r-lg);
}
pre code { background: none; border: 0; padding: 0; font-size: 12.5px; line-height: 1.7; }

table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { color: var(--fg); font-weight: 600; border-bottom: 1px solid var(--line); }
td { color: var(--fg-mid); }
.tablewrap { overflow-x: auto; }

/* ---- pieces ----------------------------------------------------------- */
.badge {
  display: inline-block; padding: 2px 7px; border-radius: var(--r-sm);
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; vertical-align: 2px;
}
.badge--soon { background: var(--soon-bg); color: var(--soon); border: 1px solid currentColor; }
.badge--live { background: var(--accent-bg); color: var(--accent); border: 1px solid currentColor; }
h1 .badge, h2 .badge, h3 .badge { margin-left: 8px; }
.navlink .badge { margin-left: auto; }

.note {
  margin: 0 0 20px; padding: 13px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.note p:last-child { margin-bottom: 0; }
.note-title { font-size: 13px; font-weight: 600; color: var(--fg); margin-bottom: 4px; }

.cardgrid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 22px; }
.card {
  display: block; padding: 16px 18px; border: 1px solid var(--line);
  border-radius: var(--r-lg); background: var(--surface); color: var(--fg);
}
.card:hover { border-color: var(--fg-dim); text-decoration: none; }
.card-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.card-body { font-size: 13.5px; color: var(--fg-mid); line-height: 1.55; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 20px; }
.steps > li { counter-increment: step; position: relative; padding-left: 34px; margin-bottom: 16px; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 1px;
  display: grid; place-items: center; width: 22px; height: 22px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--fg-mid);
}

.pagenav { display: flex; justify-content: space-between; gap: 14px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); }
.pagenav a { display: block; max-width: 48%; font-size: 14px; }
.pagenav-label { display: block; font-size: 11px; font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--fg-dim); margin-bottom: 2px; }

.footer { margin-top: 60px; padding-top: 18px; border-top: 1px solid var(--line-soft); color: var(--fg-dim); font-size: 13px; }

/* ---- home ------------------------------------------------------------- */
.home-hero { margin-bottom: 8px; }
.home-hero h1 { font-size: 46px; max-width: 12ch; }
.home-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 10px; }
.btn {
  display: inline-block; padding: 9px 16px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 600; border: 1px solid var(--fg);
  background: var(--fg); color: var(--bg);
}
.btn:hover { text-decoration: none; opacity: .88; }
.btn--ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--fg-dim); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .navtoggle { display: inline-flex; }
  .topnav { display: none; }
  .sidebar {
    position: fixed; inset: 56px auto 0 0; width: 280px; z-index: 30;
    background: var(--bg); height: calc(100vh - 56px);
  }
  .sidebar[hidden] { display: none; }
  .main { padding: 28px 20px 80px; }
  .cardgrid { grid-template-columns: 1fr; }
  .home-hero h1 { font-size: 34px; max-width: none; }
}
