/* Shared by docs.html and docs-*.html (generated by scripts/gen-docs.mjs).
   Tokens and fonts are the landing page's, so the two read as one site. */
@font-face { font-family: "Sansation"; font-weight: 300; font-style: normal; src: url(fonts/Sansation-Light.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Sansation"; font-weight: 400; font-style: normal; src: url(fonts/Sansation-Regular.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Sansation"; font-weight: 700; font-style: normal; src: url(fonts/Sansation-Bold.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "JetBrainsMonoNF"; font-weight: 400; font-style: normal; src: url(fonts/JetBrainsMonoNerdFont-Regular.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "JetBrainsMonoNF"; font-weight: 700; font-style: normal; src: url(fonts/JetBrainsMonoNerdFont-Bold.woff2) format("woff2"); font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0a0a0f;
  --bg-deep: rgba(0, 0, 0, 0.38);
  --card: #16161e;
  --muted: rgba(255, 255, 255, 0.06);
  --fg: #e8e8ea;
  --muted-fg: #9a9aaa;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #4cc2ff;
  --on-accent: #0a0a0f;
  --amber: #f0a040;
  --neon-cyan: #00f0ff;
  --mono: "JetBrainsMonoNF", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Sansation", system-ui, -apple-system, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.7 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
code, kbd, .mono { font-family: var(--mono); }
code, kbd { background: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: 0.875em; }
img { max-width: 100%; height: auto; display: block; border: 1px solid var(--border); margin: 24px 0; }
img.phone { max-width: 280px; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--accent); color: var(--on-accent); padding: 12px 16px; font-weight: 700; z-index: 100; }
.skip:focus { left: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 32px; }

header { position: sticky; top: 0; z-index: 50; background: rgba(10, 10, 16, 0.92); border-bottom: 1px solid var(--border); }
.bar { display: flex; align-items: center; gap: 24px; height: 62px; }
.brand { font-family: var(--mono); font-weight: 700; font-size: 1.05rem; color: var(--fg); display: flex; align-items: center; gap: 8px; }
.brand svg { color: var(--accent); }
.brand:hover { text-decoration: none; }
header nav { margin-left: auto; display: flex; gap: 20px; }
header nav a { color: var(--muted-fg); min-height: 44px; display: inline-flex; align-items: center; }
header nav a:hover, header nav a[aria-current] { color: var(--fg); text-decoration: none; }

.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 48px; padding-top: 40px; padding-bottom: 64px; }
.side { position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 100px); overflow-y: auto; }
.side-title { margin: 0 0 8px; font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-fg); }
.side-links { display: flex; flex-direction: column; border-left: 1px solid var(--border); }
.side-links a { color: var(--muted-fg); padding: 6px 14px; margin-left: -1px; border-left: 2px solid transparent; font-size: 0.95rem; }
.side-links a:hover { color: var(--fg); text-decoration: none; }
.side-links a[aria-current="page"] { color: var(--accent); border-left-color: var(--accent); }

main { min-width: 0; max-width: 760px; }
h1 { font-size: 2.2rem; line-height: 1.2; margin: 0 0 12px; font-weight: 700; }
h2 { font-size: 1.35rem; margin: 40px 0 12px; font-weight: 700; }
.lead { font-size: 1.15rem; color: var(--muted-fg); margin: 0 0 24px; }
p, li { margin: 0 0 12px; }
ul, ol { padding-left: 22px; margin: 0 0 16px; }
li::marker { color: var(--accent); }
strong { font-weight: 700; }
pre { background: var(--bg-deep); border: 1px solid var(--border); padding: 20px; overflow-x: auto; font: 0.85rem/1.65 var(--mono); margin: 0 0 20px; }
pre .c { color: var(--muted-fg); }
table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 0.95rem; display: block; overflow-x: auto; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted-fg); font-weight: 400; font-size: 0.85rem; }
.note { border: 1px solid var(--border); border-left: 3px solid var(--amber); background: var(--card); padding: 12px 16px; margin: 0 0 20px; }
.more { list-style: none; padding: 0; }
.more li { margin: 0 0 6px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 16px; margin: 32px 0; }
.card { display: block; background: var(--card); border: 1px solid var(--border); padding: 20px; color: var(--fg); transition: border-color 0.2s; }
.card:hover { border-color: var(--accent); text-decoration: none; }
.card h2 { font-size: 1.05rem; margin: 0 0 6px; color: var(--accent); }
.card p { margin: 0; color: var(--muted-fg); font-size: 0.92rem; line-height: 1.5; }

.pn { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; }
.pn a { display: block; border: 1px solid var(--border); background: var(--card); padding: 14px 18px; min-width: 0; color: var(--fg); }
.pn a:hover { border-color: var(--accent); text-decoration: none; }
.pn a span { display: block; font-size: 0.75rem; color: var(--muted-fg); text-transform: uppercase; letter-spacing: 0.06em; }
.pn .next { text-align: right; margin-left: auto; }

footer { border-top: 1px solid var(--border); padding: 32px 0; color: var(--muted-fg); font-size: 0.875rem; }
.frow { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; }
.frow .sep { flex: 1; }
footer a { color: var(--muted-fg); display: inline-flex; align-items: center; min-height: 44px; }
footer a:hover { color: var(--accent); }

/* Code: highlighted at build time (scripts/docs-kit.mjs), no script on the page. */
pre.code { position: relative; padding-top: 34px; }
pre.code::before { content: attr(data-lang); position: absolute; top: 8px; left: 20px; font: 0.7rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-fg); }
pre.code code { background: none; border: 0; padding: 0; font-size: inherit; color: var(--fg); }
pre .k { color: #d2a8ff; }
pre .s { color: #7ee787; }
pre .n { color: var(--amber); }
pre .f { color: var(--accent); }
pre .t { color: #ffa657; }
pre .v { color: #79c0ff; }
pre .o { color: #ff9bce; }

pre .copy { position: absolute; top: 6px; right: 8px; padding: 2px 12px; min-height: 28px; background: var(--card); color: var(--muted-fg); border: 1px solid var(--border); border-radius: 999px; font: 0.75rem/1.6 var(--mono); cursor: pointer; }
pre .copy:hover { color: var(--accent); border-color: var(--accent); }
pre .copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Language tabs: radio inputs pick the panel, so they work without JavaScript. */
.tabs { margin: 0 0 20px; }
.tabs > input { position: absolute; opacity: 0; pointer-events: none; }
.tab-bar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.tab-bar label { padding: 4px 14px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted-fg); cursor: pointer; font: 0.85rem/1.6 var(--mono); min-height: 32px; }
.tab-bar label:hover { color: var(--fg); }
.tabs > section { display: none; }
.tabs pre.code { margin: 0; padding-top: 20px; }
.tabs pre.code::before { content: none; }
.tabs > input:nth-of-type(1):checked ~ section:nth-of-type(1) { display: block; }
.tabs > input:nth-of-type(1):checked ~ .tab-bar label:nth-child(1) { border-color: var(--accent); color: var(--accent); }
.tabs > input:nth-of-type(1):focus-visible ~ .tab-bar label:nth-child(1) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabs > input:nth-of-type(2):checked ~ section:nth-of-type(2) { display: block; }
.tabs > input:nth-of-type(2):checked ~ .tab-bar label:nth-child(2) { border-color: var(--accent); color: var(--accent); }
.tabs > input:nth-of-type(2):focus-visible ~ .tab-bar label:nth-child(2) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabs > input:nth-of-type(3):checked ~ section:nth-of-type(3) { display: block; }
.tabs > input:nth-of-type(3):checked ~ .tab-bar label:nth-child(3) { border-color: var(--accent); color: var(--accent); }
.tabs > input:nth-of-type(3):focus-visible ~ .tab-bar label:nth-child(3) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabs > input:nth-of-type(4):checked ~ section:nth-of-type(4) { display: block; }
.tabs > input:nth-of-type(4):checked ~ .tab-bar label:nth-child(4) { border-color: var(--accent); color: var(--accent); }
.tabs > input:nth-of-type(4):focus-visible ~ .tab-bar label:nth-child(4) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabs > input:nth-of-type(5):checked ~ section:nth-of-type(5) { display: block; }
.tabs > input:nth-of-type(5):checked ~ .tab-bar label:nth-child(5) { border-color: var(--accent); color: var(--accent); }
.tabs > input:nth-of-type(5):focus-visible ~ .tab-bar label:nth-child(5) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabs > input:nth-of-type(6):checked ~ section:nth-of-type(6) { display: block; }
.tabs > input:nth-of-type(6):checked ~ .tab-bar label:nth-child(6) { border-color: var(--accent); color: var(--accent); }
.tabs > input:nth-of-type(6):focus-visible ~ .tab-bar label:nth-child(6) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Diagrams. */
.diagram { margin: 0 0 24px; }
.dg-scroll { overflow-x: auto; border: 1px solid var(--border); background: var(--bg-deep); padding: 12px; }
.dg-scroll svg { display: block; min-width: 520px; width: 100%; height: auto; font-family: var(--sans); }
.dg-box { fill: var(--card); stroke: var(--border); stroke-width: 1; }
.dg-hot { stroke: var(--accent); }
.dg-note { fill: var(--muted); stroke: var(--border); }
.dg-title { fill: var(--fg); font-size: 14px; font-weight: 700; }
.dg-sub { fill: var(--muted-fg); font-size: 11px; }
.dg-label { fill: var(--fg); font-size: 13px; font-family: var(--mono); paint-order: stroke; stroke: var(--bg); stroke-width: 5px; stroke-linejoin: round; }
.dg-life { stroke: var(--border); stroke-dasharray: 3 5; }
.dg-arrow { stroke: var(--accent); stroke-width: 1.6; fill: none; }
.dg-dash { stroke: var(--muted-fg); stroke-dasharray: 6 4; }
.dg-head { fill: var(--accent); }
.dg-head-dash { fill: var(--muted-fg); }
.flow { list-style: none; margin: 0; padding: 14px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 28px; border: 1px solid var(--border); background: var(--bg-deep); }
.flow li { position: relative; margin: 0; padding: 10px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; font-size: 0.85rem; line-height: 1.45; }
.flow li:not(:last-child)::after { content: "\2192"; position: absolute; right: -22px; top: 50%; transform: translateY(-50%); color: var(--accent); font-size: 1.1rem; }
.flow b { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font: 700 0.7rem/1 var(--mono); margin-bottom: 6px; }
.flow strong { display: block; color: var(--fg); }
.flow span { display: block; color: var(--muted-fg); margin-top: 2px; }
.flow code { font-size: 0.8em; }
.flow-note { margin: 12px 0 0; color: var(--muted-fg); font-size: 0.9rem; }
@media (max-width: 700px) {
  .flow { grid-auto-flow: row; gap: 26px; }
  .flow li:not(:last-child)::after { content: "\2193"; right: auto; left: 50%; top: auto; bottom: -24px; transform: translateX(-50%); }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 24px; padding-top: 24px; }
  .side { position: static; max-height: none; }
  .side-links { flex-direction: row; flex-wrap: wrap; gap: 4px; border-left: 0; }
  .side-links a { border: 1px solid var(--border); border-radius: 999px; margin: 0; padding: 4px 12px; }
  .side-links a[aria-current="page"] { border-color: var(--accent); }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  header nav { gap: 12px; font-size: 0.9rem; }
  header nav a[href="REFERENCE.md"], header nav a[href^="https://github.com"] { display: none; }
  h1 { font-size: 1.8rem; }
}

header nav a.lang { border: 1px solid var(--border); border-radius: 999px; padding: 0 12px; min-height: 32px; align-self: center; color: var(--fg); }
header nav a.lang:hover { border-color: var(--accent); }
