/* StateWeave docs. Tokens are the homepage's (site/index.html), so the docs read as the same site. */
:root {
  --bg: #f6f5f1; --surface: #ffffff; --surface-2: #faf9f6; --ink: #1c1b18; --ink-2: #3f3c36; --muted: #7a756c;
  --faint: #aaa59b; --line: #e4e1d9; --line-2: #eeebe5; --thread: #2f54eb; --nav-bg: rgba(246, 245, 241, 0.88);
  --code-bg: #f1efe9; --code-block: #1c1b18; --code-ink: #ece9e2; --code-muted: #8f8a80; --code-head: #26251f;
  --focus-ring: rgba(28, 27, 24, 0.32); --accent-soft: rgba(47, 84, 235, 0.08); --note: #2f54eb; --warn: #b4690e;
  --t-k: #c792ea; --t-s: #c3e88d; --t-c: #8f8a80; --t-n: #f78c6c; --t-f: #82aaff; --t-v: #ffcb6b; --t-o: #89ddff;
  --t-p: #82aaff;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --display: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --top: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161513; --surface: #1e1d1a; --surface-2: #232220; --ink: #f2f0eb; --ink-2: #d4d0c8; --muted: #9b968c;
    --faint: #6e6a62; --line: #2f2d29; --line-2: #262421; --nav-bg: rgba(22, 21, 19, 0.88); --code-bg: #262421;
    --code-block: #0f0e0d; --code-head: #1a1917; --focus-ring: rgba(242, 240, 235, 0.4);
    --accent-soft: rgba(110, 140, 255, 0.12); --note: #8aa2ff; --warn: #e2a04a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161513; --surface: #1e1d1a; --surface-2: #232220; --ink: #f2f0eb; --ink-2: #d4d0c8; --muted: #9b968c;
  --faint: #6e6a62; --line: #2f2d29; --line-2: #262421; --nav-bg: rgba(22, 21, 19, 0.88); --code-bg: #262421;
  --code-block: #0f0e0d; --code-head: #1a1917; --focus-ring: rgba(242, 240, 235, 0.4);
  --accent-soft: rgba(110, 140, 255, 0.12); --note: #8aa2ff; --warn: #e2a04a; color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.65 var(--font);
  -webkit-font-smoothing: antialiased; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 50; background: var(--surface); padding: 6px 10px; }

/* ------------------------------------------------------------------ top bar */
.top { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 14px;
  padding: 0 16px; background: var(--nav-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-2); }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; flex: none; }
.mark { width: 24px; height: 24px; flex: none; }
.mark .s { stroke: var(--ink); } .mark .t { stroke: var(--thread); }
.mark .sd { fill: var(--ink); } .mark .td { fill: var(--thread); }
.word { font: 400 1.1875rem/1 var(--display); letter-spacing: -0.04em; } .word b { font-weight: 700; }
.docs-home { font: 500 15px/1 var(--display); color: var(--muted); text-decoration: none; padding-left: 14px;
  border-left: 1px solid var(--line); }
.docs-home:hover { color: var(--ink); }
.top-links { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 14px; white-space: nowrap; }
.top-links a { text-decoration: none; color: var(--muted); }
.top-links a:hover { color: var(--ink); }
.theme { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line);
  background: var(--surface); border-radius: 8px; cursor: pointer; color: var(--ink-2); }
.theme svg { width: 15px; height: 15px; fill: currentColor; }
.menu { display: none; flex: none; width: 34px; height: 34px; border: 0; background: none; padding: 0; cursor: pointer;
  position: relative; color: var(--ink); }
.menu span, .menu span::before, .menu span::after { position: absolute; left: 8px; width: 18px; height: 1.6px;
  background: currentColor; border-radius: 2px; content: ""; transition: transform .2s; }
.menu span { top: 16px; } .menu span::before { left: 0; top: -6px; } .menu span::after { left: 0; top: 6px; }

/* ------------------------------------------------------------------ three columns */
.layout { display: grid; grid-template-columns: 252px minmax(0, 1fr) 220px; max-width: 1360px; margin: 0 auto; }
.sidebar { position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto;
  padding: 24px 12px 40px 20px; border-right: 1px solid var(--line-2); }
.nav-group { margin-bottom: 22px; }
.nav-title { font: 600 12px/1 var(--font); text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint);
  padding: 0 10px 8px; }
.sidebar a { display: block; padding: 6px 10px; border-radius: 7px; text-decoration: none; color: var(--ink-2);
  font-size: 14.5px; line-height: 1.35; }
.sidebar a:hover { background: var(--line-2); color: var(--ink); }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
main { min-width: 0; padding: 36px 48px 40px; }
article { max-width: 780px; }
.toc { position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; padding: 36px 20px 40px 8px;
  font-size: 13px; }
.toc-title { font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.toc a { display: block; text-decoration: none; color: var(--muted); padding: 4px 0 4px 10px; line-height: 1.4;
  border-left: 1px solid var(--line); }
.toc a.l3 { padding-left: 22px; }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--ink); border-left-color: var(--thread); }

/* ------------------------------------------------------------------ text */
.crumb { font-size: 13px; color: var(--thread); font-weight: 600; margin-bottom: 8px; }
h1 { font: 700 2.25rem/1.15 var(--display); letter-spacing: -0.03em; margin: 0 0 14px; text-wrap: balance; }
h2 { font: 600 1.45rem/1.3 var(--display); letter-spacing: -0.02em; margin: 48px 0 12px; padding-top: 8px; }
h3 { font: 600 1.1rem/1.35 var(--display); letter-spacing: -0.01em; margin: 32px 0 8px; }
h2, h3 { position: relative; }
.anchor { position: absolute; left: -1.1em; width: 1.1em; color: var(--faint); text-decoration: none; opacity: 0;
  font-weight: 400; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }
p { margin: 0 0 14px; color: var(--ink-2); }
.lede { font-size: 17.5px; line-height: 1.6; color: var(--muted); margin-bottom: 24px; }
strong { color: var(--ink); font-weight: 600; }
article a { color: var(--thread); text-decoration: none; }
article a:hover { text-decoration: underline; }
ul, ol { padding-left: 22px; color: var(--ink-2); margin: 0 0 16px; } li { margin: 5px 0; }
li > p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line-2); margin: 40px 0; }
code { font: 0.86em/1.5 var(--mono); font-variant-ligatures: none; background: var(--code-bg); padding: 1.5px 5px; border-radius: 5px;
  overflow-wrap: anywhere; }
kbd { font: 12px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; }

/* ------------------------------------------------------------------ code */
.code, .tabs { margin: 14px 0 20px; border-radius: 12px; overflow: hidden; background: var(--code-block);
  border: 1px solid var(--line); }
.tabs .code { margin: 0; border: 0; border-radius: 0; display: none; }
.tabs .code.on { display: block; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 38px;
  padding: 0 8px 0 14px; background: var(--code-head); color: var(--code-muted); font: 12px/1 var(--mono); }
.tab-list { display: flex; gap: 2px; margin-left: -6px; overflow-x: auto; }
.tab-list button { border: 0; background: none; color: var(--code-muted); font: 500 12.5px/1 var(--font);
  padding: 8px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.tab-list button:hover { color: var(--code-ink); }
.tab-list button[aria-selected="true"] { color: var(--code-ink); background: rgba(255, 255, 255, 0.08); }
.copy { border: 0; background: none; color: var(--code-muted); font: 500 12px/1 var(--font); padding: 7px 9px;
  border-radius: 6px; cursor: pointer; }
.copy:hover { color: var(--code-ink); background: rgba(255, 255, 255, 0.06); }
pre { margin: 0; padding: 14px 16px 16px; overflow-x: auto; color: var(--code-ink); font: 13px/1.65 var(--mono);
  tab-size: 4; font-variant-ligatures: none; }
pre code { background: none; padding: 0; font: inherit; color: inherit; overflow-wrap: normal; }
.t-k { color: var(--t-k); } .t-s { color: var(--t-s); } .t-c { color: var(--t-c); font-style: italic; }
.t-n { color: var(--t-n); } .t-f { color: var(--t-f); } .t-v { color: var(--t-v); } .t-o { color: var(--t-o); }
.t-p { color: var(--t-p); }

/* ------------------------------------------------------------------ tables, callouts, cards */
.table { overflow-x: auto; margin: 14px 0 22px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--surface-2); }
td:first-child { white-space: nowrap; }
td code { overflow-wrap: normal; }
td.wrap, td.wrap code { white-space: normal; overflow-wrap: anywhere; }
.note, .warn { margin: 16px 0 20px; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line);
  border-left: 3px solid var(--note); background: var(--surface); font-size: 14.5px; }
.warn { border-left-color: var(--warn); }
.note p:last-child, .warn p:last-child { margin: 0; }
.note b:first-child, .warn b:first-child { color: var(--ink); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 18px 0 26px; }
.card { display: block; padding: 16px 16px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); text-decoration: none !important; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--faint); transform: translateY(-1px); }
.card b { display: block; font: 600 15px/1.3 var(--display); color: var(--ink); margin-bottom: 4px; }
.card span { font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding-left: 40px; margin: 0 0 8px; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 1px; width: 26px; height: 26px;
  border-radius: 50%; background: var(--ink); color: var(--bg); font: 600 13px/26px var(--font); text-align: center; }
.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0 26px; }
.flow div { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.flow b { display: block; color: var(--ink); font: 600 14px/1.3 var(--display); margin-bottom: 4px; }
.flow i { font-style: normal; color: var(--thread); font: 600 12px/1 var(--mono); display: block; margin-bottom: 8px; }
.badge { display: inline-block; font: 600 11px/1 var(--font); padding: 3px 6px; border-radius: 5px;
  background: var(--code-bg); color: var(--muted); vertical-align: 1px; }
.endpoint { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 6px 0 12px; }
.endpoint code { font-size: 13.5px; }
.method { font: 700 11px/1 var(--mono); padding: 4px 7px; border-radius: 5px; color: #fff; background: #2f8a55; }
.method.post { background: var(--thread); }

/* ------------------------------------------------------------------ pager, footer */
.pager { max-width: 780px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; }
.pager a { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none;
  font: 600 15px/1.3 var(--display); background: var(--surface); }
.pager a:hover { border-color: var(--faint); }
.pager span { display: block; font: 400 12.5px/1.4 var(--font); color: var(--muted); margin-bottom: 3px; }
.pager .next { text-align: right; }
footer { max-width: 780px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line-2); font-size: 13px;
  color: var(--muted); }
footer a { color: inherit; }

/* ------------------------------------------------------------------ narrower screens */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .layout { display: block; }
  .menu { display: block; margin-left: -6px; }
  .docs-home { display: none; }
  .top-api { display: none; }  /* a class: Netlify rewrites the links' hrefs */
  .sidebar { position: fixed; z-index: 25; top: var(--top); left: 0; width: min(300px, 86vw); height: calc(100vh - var(--top));
    background: var(--bg); transform: translateX(-102%); transition: transform .22s ease; border-right: 1px solid var(--line); }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.25); }
  body.nav-open .menu span { transform: rotate(45deg); }
  body.nav-open .menu span::before { transform: translateY(6px) rotate(90deg); }
  body.nav-open .menu span::after { opacity: 0; }
  main { padding: 28px 16px 32px; }
  h1 { font-size: 1.85rem; }
  .flow { grid-template-columns: 1fr 1fr; }
  .anchor { display: none; }
}
@media (max-width: 480px) {
  .flow { grid-template-columns: 1fr; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
