/* ioxide knowledge base. Inter for text and Geist Mono for code (both SIL OFL 1.1, served from fonts/). */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/geist-mono-latin-wght-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-mute: #eff1f4;
  --bg-elev: #ffffff;
  --text: #1f2328;
  --text-2: #59636e;
  --text-3: #8b949e;
  --border: #e3e6ea;
  --divider: #eceef1;
  --brand: #2563eb;
  --brand-2: #059669;
  --brand-soft: rgba(37, 99, 235, .08);
  --brand-line: rgba(37, 99, 235, .4);
  --on-brand: #ffffff;
  --grad: linear-gradient(100deg, #2563eb 10%, #0891b2 52%, #16a34a 92%);
  --ring-2: rgba(37, 99, 235, .45);
  --ring-3: rgba(5, 150, 105, .5);
  --code-bg: #f6f8fa;
  --code-fg: #24292f;
  --code-line: #e3e6ea;
  --tok-k: #cf222e;
  --tok-t: #8250df;
  --tok-s: #0a3069;
  --tok-c: #6e7781;
  --inline-code: rgba(175, 184, 193, .22);
  --info: rgba(37, 99, 235, .06);
  --info-line: rgba(37, 99, 235, .28);
  --info-ink: #1d4ed8;
  --warn: rgba(217, 119, 6, .08);
  --warn-line: rgba(217, 119, 6, .38);
  --warn-ink: #b45309;
  --ok: rgba(22, 163, 74, .07);
  --ok-line: rgba(22, 163, 74, .32);
  --ok-ink: #15803d;
  --shadow: 0 10px 30px -14px rgba(15, 23, 42, .25);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --header: 64px;
  --side: 272px;
  --outline: 224px;

  /* the names the 3D views and diagrams use */
  --line: var(--border);
  --panel: var(--bg-elev);
  --muted: var(--text-2);
  --accent: var(--brand);
  --accent-soft: var(--brand-soft);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e13;
  --bg-soft: #10141a;
  --bg-mute: #171c24;
  --bg-elev: #12171e;
  --text: #e6e9ee;
  --text-2: #a2acb8;
  --text-3: #6d7682;
  --border: #252c36;
  --divider: #1c222b;
  --brand: #6aa8ff;
  --brand-2: #9ece6a;
  --brand-soft: rgba(106, 168, 255, .12);
  --brand-line: rgba(106, 168, 255, .45);
  --on-brand: #0b0e13;
  --grad: linear-gradient(100deg, #5aa9ff 10%, #22d3ee 52%, #9ece6a 92%);
  --ring-2: rgba(106, 168, 255, .5);
  --ring-3: rgba(158, 206, 106, .45);
  --code-bg: #0d1117;
  --code-fg: #e6edf3;
  --code-line: #21262d;
  --tok-k: #ff9e64;
  --tok-t: #7dcfff;
  --tok-s: #9ece6a;
  --tok-c: #7d8b99;
  --inline-code: rgba(110, 118, 129, .28);
  --info: rgba(106, 168, 255, .08);
  --info-line: rgba(106, 168, 255, .3);
  --info-ink: #8ab9ff;
  --warn: rgba(251, 191, 36, .08);
  --warn-line: rgba(251, 191, 36, .32);
  --warn-ink: #fbbf24;
  --ok: rgba(74, 222, 128, .07);
  --ok-line: rgba(74, 222, 128, .28);
  --ok-ink: #4ade80;
  --shadow: 0 14px 36px -14px rgba(0, 0, 0, .7);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0e13;
    --bg-soft: #10141a;
    --bg-mute: #171c24;
    --bg-elev: #12171e;
    --text: #e6e9ee;
    --text-2: #a2acb8;
    --text-3: #6d7682;
    --border: #252c36;
    --divider: #1c222b;
    --brand: #6aa8ff;
    --brand-2: #9ece6a;
    --brand-soft: rgba(106, 168, 255, .12);
    --brand-line: rgba(106, 168, 255, .45);
    --on-brand: #0b0e13;
    --grad: linear-gradient(100deg, #5aa9ff 10%, #22d3ee 52%, #9ece6a 92%);
    --ring-2: rgba(106, 168, 255, .5);
    --ring-3: rgba(158, 206, 106, .45);
    --code-bg: #0d1117;
    --code-fg: #e6edf3;
    --code-line: #21262d;
    --tok-k: #ff9e64;
    --tok-t: #7dcfff;
    --tok-s: #9ece6a;
    --tok-c: #7d8b99;
    --inline-code: rgba(110, 118, 129, .28);
    --info: rgba(106, 168, 255, .08);
    --info-line: rgba(106, 168, 255, .3);
    --info-ink: #8ab9ff;
    --warn: rgba(251, 191, 36, .08);
    --warn-line: rgba(251, 191, 36, .32);
    --warn-ink: #fbbf24;
    --ok: rgba(74, 222, 128, .07);
    --ok-line: rgba(74, 222, 128, .28);
    --ok-ink: #4ade80;
    --shadow: 0 14px 36px -14px rgba(0, 0, 0, .7);
  }
}

/* ── base ─────────────────────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--header) + 16px); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.7 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

::selection { background: var(--brand-soft); }

kbd {
  font: 600 11px/1 var(--mono);
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--text-2);
}

.skip { position: absolute; left: -999px; top: 10px; }
.skip:focus { left: 12px; z-index: 100; background: var(--bg-elev); padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; }

/* ── header ───────────────────────────────────────────────────────────────────────────── */

header.top {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--header);
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--divider);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 18px;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -.02em;
}

.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }

.badge {
  font: 600 11px/1 var(--font);
  letter-spacing: .02em;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--brand);
  background: var(--brand-soft);
}

.top-links { display: flex; gap: 4px; }
.top-links a { padding: 6px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.top-links a:hover { color: var(--text); text-decoration: none; background: var(--bg-soft); }
.top-links a.active { color: var(--brand); }

.spacer { flex: 1; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}

.icon-btn:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }

button.menu { display: none; }

.theme .sun { display: none; }
:root[data-theme="dark"] .theme .sun { display: block; }
:root[data-theme="dark"] .theme .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .sun { display: block; }
  :root:not([data-theme="light"]) .theme .moon { display: none; }
}

.search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  min-width: 220px;
  margin-right: 4px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text-3);
  font: 500 14px var(--font);
  cursor: pointer;
}

.search-btn:hover { border-color: var(--brand-line); color: var(--text-2); }
.search-btn kbd { margin-left: auto; }

/* ── layout ───────────────────────────────────────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  min-height: calc(100vh - var(--header));
}

main {
  display: flex;
  justify-content: center;
  gap: 56px;
  min-width: 0;
  padding: 40px 48px 64px;
}

article.content { flex: 1 1 auto; min-width: 0; max-width: 780px; }
.wide article.content { max-width: 1140px; }

.home .layout { grid-template-columns: minmax(0, 1fr); }
.home nav.side { display: none; }
.home main { padding-top: 24px; }
.home article.content { max-width: 1160px; }
.home article.content > p, .home article.content > .callout { max-width: 48rem; }

/* ── sidebar ──────────────────────────────────────────────────────────────────────────── */

nav.side {
  position: sticky;
  top: var(--header);
  align-self: start;
  height: calc(100vh - var(--header));
  overflow-y: auto;
  padding: 28px 18px 48px 24px;
  border-right: 1px solid var(--divider);
  background: var(--bg-soft);
  font-size: 14px;
}

nav.side ul { list-style: none; margin: 0; padding: 0; }
nav.side li { margin: 1px 0; }

nav.side a {
  display: block;
  padding: 5px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-weight: 500;
  line-height: 1.45;
}

nav.side a:hover { color: var(--text); text-decoration: none; }
nav.side a.active { color: var(--brand); background: var(--brand-soft); font-weight: 600; }

.side-home { margin-bottom: 14px; }

.side-product {
  margin: 0 0 4px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
}

.side-group {
  margin: 18px 0 4px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-3);
}

.side-product + .side-group { margin-top: 8px; }

.side-category {
  margin: 22px 0 6px;
  padding: 0 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
}

details.side-topic { margin: 1px 0; }

details.side-topic > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-radius: 8px;
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

details.side-topic > summary::-webkit-details-marker { display: none; }
details.side-topic > summary:hover { background: var(--bg-mute); }

details.side-topic > summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 3px;
  border-right: 1.5px solid var(--text-3);
  border-bottom: 1.5px solid var(--text-3);
  transform: rotate(-45deg);
  transition: transform .15s;
}

details.side-topic[open] > summary::after { transform: rotate(45deg); }

details.side-topic > ul, details.side-topic > .side-group { margin-left: 14px; }
details.side-topic > ul { margin-bottom: 6px; padding-left: 6px; border-left: 1px solid var(--border); }
details.side-topic > .side-group { margin-top: 10px; padding-left: 10px; }
details.side-topic > .side-group + ul { margin-top: 2px; }

nav.side ul.side-toc { margin: 4px 0 8px 14px; padding-left: 8px; border-left: 1px solid var(--border); }
nav.side ul.side-toc a { padding: 3px 10px; font-size: 13px; font-weight: 450; }
nav.side ul.side-toc a.lvl3 { padding-left: 20px; }

.doc nav.side ul.side-toc { display: none; }

/* ── content ──────────────────────────────────────────────────────────────────────────── */

.eyebrow { margin: 0 0 10px; font-size: 13.5px; font-weight: 600; color: var(--brand); letter-spacing: .01em; }
.eyebrow span { color: var(--text-3); margin: 0 4px; }

h1, h2, h3, h4 { color: var(--text); scroll-margin-top: calc(var(--header) + 16px); }

h1 { font-size: 2.5rem; line-height: 1.15; font-weight: 750; letter-spacing: -.028em; margin: 0 0 12px; text-wrap: balance; }

h2 {
  font-size: 1.625rem;
  line-height: 1.3;
  font-weight: 680;
  letter-spacing: -.02em;
  margin: 3rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--divider);
}

h3 { font-size: 1.2rem; line-height: 1.4; font-weight: 650; letter-spacing: -.012em; margin: 2.2rem 0 .6rem; }
h4 { font-size: 1rem; font-weight: 650; margin: 1.6rem 0 .5rem; }

.anchor { margin-left: .35em; color: var(--text-3); font-weight: 500; opacity: 0; transition: opacity .15s; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; text-decoration: none; }

p { margin: 0 0 1rem; }
p.lead { font-size: 1.15rem; line-height: 1.65; color: var(--text-2); margin: 0 0 1.75rem; }

ul, ol { padding-left: 1.4rem; margin: 0 0 1rem; }
li { margin: .3rem 0; }
li::marker { color: var(--text-3); }

strong { font-weight: 650; }

code {
  font-family: var(--mono);
  font-variant-ligatures: none;   /* Geist Mono would draw => and != as arrows */
  font-size: .86em;
  font-weight: 450;
  background: var(--inline-code);
  padding: .15em .4em;
  border-radius: 6px;
}

a code { color: var(--brand); }

/* code blocks: a wrapper holds the copy button so it does not scroll with the code */
.code { position: relative; margin: 1rem 0 1.4rem; }

pre {
  margin: 1rem 0 1.4rem;
  padding: 18px 20px;
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--code-line);
  border-radius: 12px;
  font: 13.5px/1.65 var(--mono);
  font-variant-ligatures: none;
  tab-size: 4;
}

.code pre { margin: 0; padding-right: 56px; }
pre code { background: none; padding: 0; border-radius: 0; font-size: inherit; color: inherit; }
pre .k { color: var(--tok-k); }
pre .t { color: var(--tok-t); }
pre .s { color: var(--tok-s); }
pre .c { color: var(--tok-c); font-style: italic; }

.code .lang {
  position: absolute;
  top: 8px;
  right: 50px;
  font: 500 11.5px/26px var(--mono);
  color: var(--text-3);
  pointer-events: none;
  transition: opacity .15s;
}

.code .copy {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--code-line);
  border-radius: 7px;
  background: var(--code-bg);
  color: var(--text-3);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, color .15s;
}

.code:hover .copy, .code .copy:focus-visible, .code .copy.done { opacity: 1; }
.code:hover .lang { opacity: 0; }
.code .copy:hover { color: var(--text); }
.code .copy.done { color: var(--ok-ink); }

/* tables */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.55; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--divider); }
th { background: var(--bg-soft); color: var(--text-2); font-size: 13px; font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--bg-soft) 60%, transparent); }
td code { white-space: nowrap; }
td.wrap code { white-space: normal; }

/* callouts */
.callout {
  position: relative;
  margin: 1.2rem 0 1.5rem;
  padding: 12px 16px;
  border: 1px solid var(--info-line);
  border-radius: 12px;
  background: var(--info);
}

.callout::before { content: "Note"; display: block; margin-bottom: 2px; font-size: 13px; font-weight: 700; color: var(--info-ink); }
.callout.warn { border-color: var(--warn-line); background: var(--warn); }
.callout.warn::before { content: "Warning"; color: var(--warn-ink); }
.callout.ok { border-color: var(--ok-line); background: var(--ok); }
.callout.ok::before { content: "Tip"; color: var(--ok-ink); }
.callout p { margin: 4px 0; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 1.2rem 0 1.8rem; }

.card {
  display: block;
  position: relative;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elev);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

a.card:hover { border-color: var(--brand-line); box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
a.card::after { content: "→"; position: absolute; top: 18px; right: 20px; color: var(--text-3); transition: transform .2s, color .2s; }
a.card:hover::after { color: var(--brand); transform: translateX(3px); }
.card h3 { margin: 0 24px 6px 0; font-size: 1.02rem; font-weight: 650; }
.card p { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--text-2); }

.tag {
  display: inline-block;
  margin-top: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg-mute);
}

.tag.ok { color: var(--ok-ink); background: var(--ok); }
.card.soon { background: transparent; border-style: dashed; }
.card.soon h3 { color: var(--text-2); }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); }

figure { margin: 1.4rem 0 1.8rem; }
figcaption { color: var(--text-2); font-size: 14px; margin-top: 8px; }

.flow { width: 100%; height: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.flow text { font-family: var(--font); fill: var(--text); }
.flow .muted { fill: var(--muted); }
.flow .box { fill: var(--accent-soft); stroke: var(--accent); }
.flow .line { stroke: var(--muted); fill: none; }
.flow .hot { stroke: var(--accent); }

/* previous and next, and the footer */
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; }

.prevnext a {
  display: block;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--brand);
  font-weight: 600;
  transition: border-color .2s;
}

.prevnext a:hover { border-color: var(--brand-line); text-decoration: none; }
.prevnext a span { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.prevnext a.next { grid-column: 2; text-align: right; }

footer.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--divider);
  font-size: 13px;
  color: var(--text-3);
}

footer.foot a { color: var(--text-3); }

/* ── outline ──────────────────────────────────────────────────────────────────────────── */

aside.outline {
  position: sticky;
  top: calc(var(--header) + 40px);
  align-self: flex-start;
  flex: 0 0 var(--outline);
  max-height: calc(100vh - var(--header) - 72px);
  overflow-y: auto;
  font-size: 13.5px;
}

.outline-title { margin: 0 0 8px; font-size: 13px; font-weight: 650; color: var(--text); }
aside.outline ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--divider); }
aside.outline li { margin: 0; }

aside.outline a {
  display: block;
  margin-left: -1px;
  padding: 4px 0 4px 14px;
  border-left: 2px solid transparent;
  color: var(--text-2);
  line-height: 1.4;
}

aside.outline a.lvl3 { padding-left: 26px; font-size: 13px; }
aside.outline a:hover { color: var(--text); text-decoration: none; }
aside.outline a.active { color: var(--brand); border-left-color: var(--brand); }
aside.outline:has(ul:empty) { display: none; }

/* ── search ───────────────────────────────────────────────────────────────────────────── */

.search {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 16px 16px;
  background: rgba(8, 10, 14, .45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.search[hidden] { display: none; }

.search-box {
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  max-height: 72vh;
  overflow: hidden;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 28px 70px -18px rgba(0, 0, 0, .5);
}

.search-field { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--divider); color: var(--text-3); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: 500 17px var(--font); }
.search-field input::-webkit-search-cancel-button { display: none; }

.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.search-results li { margin: 0; }
.search-results a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text); }
.search-results a:hover { text-decoration: none; }
.search-results li[aria-selected="true"] a { background: var(--brand-soft); }
.search-results .sr-page { display: block; font-size: 12px; color: var(--text-3); }
.search-results .sr-head { display: block; font-weight: 600; }
.search-results li[aria-selected="true"] .sr-head { color: var(--brand); }
.search-results .sr-text { display: block; font-size: 13.5px; line-height: 1.5; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results mark { background: rgba(250, 204, 21, .35); color: inherit; border-radius: 3px; padding: 0 1px; }
.search-results .empty { padding: 28px 12px; text-align: center; color: var(--text-3); }

.search-hint { display: flex; gap: 18px; margin: 0; padding: 10px 16px; border-top: 1px solid var(--divider); font-size: 12px; color: var(--text-3); }
.search-hint kbd { margin-right: 4px; }

/* ── home ─────────────────────────────────────────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  align-items: center;
  gap: 32px;
  padding: 48px 0 32px;
}

.hero h1 { font-size: clamp(2.1rem, 5.2vw, 3.75rem); line-height: 1.04; font-weight: 800; letter-spacing: -.038em; margin: 6px 0 20px; }
.hero .lead { font-size: 1.2rem; max-width: 34em; }

.nowrap { white-space: nowrap; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.btn {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  transition: border-color .2s, filter .2s, transform .2s;
}

.btn:hover { border-color: var(--brand-line); text-decoration: none; transform: translateY(-1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { filter: brightness(1.08); }

.hero-art { display: flex; justify-content: center; }
svg.rings { width: min(100%, 380px); height: auto; overflow: visible; }
.rings .glow { fill: var(--brand-soft); }
.rings circle.r1, .rings circle.r2, .rings circle.r3 { fill: none; stroke-linecap: round; }
.rings .r1 { stroke: var(--brand); stroke-width: 14; stroke-dasharray: 78 32; }
.rings .r2 { stroke: var(--ring-2); stroke-width: 3; stroke-dasharray: 46 16; }
.rings .r3 { stroke: var(--ring-3); stroke-width: 2; stroke-dasharray: 3 10; }
.rings .core, .rings .dot { fill: var(--brand-2); }
.rings .dot2 { fill: var(--brand); }
.rings .spin { transform-box: view-box; transform-origin: 50% 50%; animation: spin 28s linear infinite; }
.rings .spin.rev { animation-duration: 44s; animation-direction: reverse; }
.rings .spin.slow { animation-duration: 80s; }
@keyframes spin { to { transform: rotate(360deg); } }

.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 8px 0 16px; }
.fact { padding: 18px 18px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-elev); }
.fact .n { font: 600 12px var(--mono); color: var(--brand); }
.fact h3 { margin: 6px 0; font-size: 1rem; font-weight: 650; letter-spacing: -.01em; }
.fact p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text-2); }

/* ── the 3D views ─────────────────────────────────────────────────────────────────────── */

.viz {
  position: relative;
  height: 560px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, #16202c 0%, #0a0e13 75%);
  margin: 16px 0 10px;
}

.viz canvas { display: block; }

.viz .hud {
  position: absolute;
  left: 12px;
  top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 24px);
}

.viz .hud button, .viz .hud select {
  font: 500 13px var(--font);
  color: #e6edf3;
  background: rgba(20, 28, 38, .82);
  border: 1px solid #2e3b4a;
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
}

.viz .hud button:hover { border-color: #5aa9ff; }
.viz .hud button.on { border-color: #5aa9ff; color: #5aa9ff; }

.viz .stats, .viz .legend {
  position: absolute;
  bottom: 12px;
  font: 12.5px/1.6 var(--mono);
  color: #c9d4df;
  background: rgba(10, 14, 19, .72);
  border: 1px solid #253141;
  border-radius: 8px;
  padding: 8px 12px;
}

.viz .stats { right: 12px; min-width: 190px; }
.viz .legend { left: 12px; }
.viz .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.viz .log { position: absolute; right: 12px; top: 58px; width: 300px; max-width: 46%; font: 12px/1.5 var(--mono); color: #c9d4df; text-align: right; pointer-events: none; }
.viz .log div { background: rgba(10, 14, 19, .6); border-radius: 4px; padding: 1px 6px; margin: 0 0 2px auto; display: table; }
.viz .label { font: 12px var(--font); color: #c9d4df; text-shadow: 0 1px 2px #000; pointer-events: none; white-space: nowrap; }
.viz .label.big { font-size: 14px; font-weight: 600; color: #e6edf3; }
.viz noscript, .viz .fallback { position: absolute; inset: 0; display: grid; place-items: center; color: #c9d4df; padding: 20px; text-align: center; }
.viz .stats, .viz .legend, .viz .log { z-index: 2; }
.viz .hud { z-index: 3; }
.viz .stats b { color: #e6edf3; }

.viz-split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; margin: 16px 0 10px; }
.viz-split .viz { margin: 0; height: 600px; }
.steps-panel { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); padding: 12px 14px; font-size: 14px; display: flex; flex-direction: column; max-height: 600px; }
.steps-panel h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.steps-panel ol { margin: 0 0 10px; padding-left: 20px; overflow: auto; flex: 0 1 auto; }
.steps-panel li { margin: 2px 0; color: var(--muted); }
.steps-panel li.done { color: var(--text); opacity: .7; }
.steps-panel li.now { color: var(--accent); font-weight: 600; opacity: 1; }
.steps-panel .say { border-top: 1px solid var(--line); padding-top: 10px; line-height: 1.55; overflow: auto; flex: 1 1 auto; }
.viz .label.packet { color: #fff; font-size: 11.5px; background: rgba(10, 14, 19, .72); padding: 1px 6px; border-radius: 4px; }
.viz .label.note { color: #8b97a3; font-size: 10.5px; }
.viz .label.badge { font-weight: 600; font-size: 12px; padding: 2px 7px; border-radius: 4px; background: rgba(10, 14, 19, .82); border: 1px solid #253141; }

/* ── narrower screens ─────────────────────────────────────────────────────────────────── */

@media (max-width: 1279px) {
  aside.outline { display: none; }
  .doc nav.side ul.side-toc { display: block; }
  main { padding: 36px 40px 64px; }
}

@media (max-width: 959px) {
  :root { --header: 58px; }
  header.top { padding: 0 10px 0 6px; gap: 4px; }
  button.menu { display: inline-grid; }
  .brand { margin-right: 0; font-size: 17px; }
  .top-links { display: none; }
  .search-btn { min-width: 0; width: 38px; padding: 0; justify-content: center; border-color: transparent; background: transparent; margin: 0; }
  .search-btn span, .search-btn kbd { display: none; }

  .layout, .home .layout { grid-template-columns: minmax(0, 1fr); }

  nav.side, .home nav.side {
    display: block;
    position: fixed;
    top: var(--header);
    left: 0;
    bottom: 0;
    align-self: auto;   /* the desktop column's "start" would pin the drawer to the top of the page */
    z-index: 35;
    width: min(320px, 86vw);
    height: auto;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform .22s ease, visibility .22s;
    background: var(--bg);
    box-shadow: var(--shadow);
  }

  nav.side.open, .home nav.side.open { transform: none; visibility: visible; }
  .scrim { position: fixed; inset: var(--header) 0 0 0; z-index: 34; background: rgba(8, 10, 14, .4); }
  .scrim[hidden] { display: none; }

  main, .home main { padding: 24px 20px 56px; }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.4rem; }
  .two { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; padding: 16px 0 8px; gap: 8px; }
  .hero-art { order: -1; }
  svg.rings { width: 180px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .viz { height: 460px; }
  .viz .log { display: none; }
  .viz-split { grid-template-columns: 1fr; }
  .viz-split .viz { height: 460px; }
  .steps-panel { max-height: none; }
  .prevnext { grid-template-columns: 1fr; }
  .prevnext a.next { grid-column: 1; }
  .code .lang { display: none; }
  .table-wrap table { min-width: 540px; }
}

@media (hover: none) {
  .code .copy { opacity: 1; }
}

@media (max-width: 560px) {
  .facts { grid-template-columns: 1fr; }
  .badge { display: none; }
  .search-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
