/* candid-core documentation — design system.
   Zero dependencies: no webfonts, no CSS framework, no build step beyond
   build.mjs. Every colour is a token defined once on :root and re-bound for
   dark mode, so a page never hard-codes a colour. */

/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: light;

  /* Neutrals — a warm-cool ink ramp rather than pure grey. */
  --bg: #fbfbfd;
  --bg-raised: #ffffff;
  --bg-sunken: #f3f3f7;
  --bg-code: #f7f7fb;
  --bg-inline: #ecebf3;

  --fg: #16151d;
  --fg-muted: #56546a;
  --fg-subtle: #7d7b91;
  --fg-inverse: #ffffff;

  --border: #e3e2ec;
  --border-strong: #cfcddc;

  /* Accent — a deep violet that nods at the Internet Computer palette
     without copying it. One accent, used sparingly. */
  --accent: #5b32c4;
  --accent-hover: #4a27a6;
  --accent-soft: #efeafd;
  --accent-border: #d5c8f7;
  --accent-fg: #ffffff;

  /* Semantics for callouts and status. */
  --ok: #146c43;
  --ok-soft: #e6f4ec;
  --ok-border: #b7e0c8;
  --warn: #8a5300;
  --warn-soft: #fdf2e0;
  --warn-border: #f0d6a8;
  --danger: #a51c30;
  --danger-soft: #fdeaed;
  --danger-border: #f4c2ca;
  --info: #10557f;
  --info-soft: #e6f1f8;
  --info-border: #b7d6ea;

  /* Syntax. */
  --syn-comment: #7d7b91;
  --syn-keyword: #7c2bbd;
  --syn-string: #146c43;
  --syn-number: #b0500f;
  --syn-type: #10557f;
  --syn-fn: #1f4ed8;
  --syn-attr: #8a5300;
  --syn-punct: #56546a;

  --shadow-sm: 0 1px 2px rgb(20 18 40 / 6%), 0 1px 3px rgb(20 18 40 / 4%);
  --shadow-md: 0 4px 12px rgb(20 18 40 / 8%), 0 2px 4px rgb(20 18 40 / 4%);
  --shadow-lg: 0 16px 40px rgb(20 18 40 / 12%), 0 4px 10px rgb(20 18 40 / 6%);

  --font-sans:
    ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  --font-mono:
    ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono",
    monospace;

  --radius-sm: 5px;
  --radius: 9px;
  --radius-lg: 14px;

  --sidebar-w: 17.5rem;
  --toc-w: 15rem;
  --header-h: 3.75rem;
  --content-max: 48rem;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0e0d14;
  --bg-raised: #16151e;
  --bg-sunken: #0a0910;
  --bg-code: #141320;
  --bg-inline: #232135;

  --fg: #eceaf4;
  --fg-muted: #a5a1ba;
  --fg-subtle: #7f7b96;
  --fg-inverse: #0e0d14;

  --border: #262435;
  --border-strong: #38344d;

  --accent: #a78bfa;
  --accent-hover: #bda6ff;
  --accent-soft: #1e1935;
  --accent-border: #3a2f66;
  --accent-fg: #14101f;

  --ok: #5cd39a;
  --ok-soft: #11241b;
  --ok-border: #1f4735;
  --warn: #e8b661;
  --warn-soft: #251c0e;
  --warn-border: #4a3819;
  --danger: #f4899b;
  --danger-soft: #2a1219;
  --danger-border: #52222d;
  --info: #6cc2f0;
  --info-soft: #0d1e2b;
  --info-border: #1c3d54;

  --syn-comment: #6f6b87;
  --syn-keyword: #c4a2ff;
  --syn-string: #7fd6a4;
  --syn-number: #f0a86a;
  --syn-type: #6cc2f0;
  --syn-fn: #86a9ff;
  --syn-attr: #e8b661;
  --syn-punct: #a5a1ba;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-md: 0 4px 14px rgb(0 0 0 / 45%);
  --shadow-lg: 0 18px 44px rgb(0 0 0 / 55%);
}

/* --------------------------------------------------------------- reset  */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* `clip`, not `hidden`: it contains a decorative bleed such as the hero
     glow without creating a scroll container, so the sticky header, sidebar
     and table of contents keep working. Where it is unsupported the value
     falls back to `visible`, which is the behaviour before this line. */
  overflow-x: clip;
}

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

a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius) 0;
  font-weight: 600;
}

.skip-link:focus {
  left: 0;
}

/* --------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 640;
  font-size: 1rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand:hover {
  color: var(--fg);
}

.brand-mark {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 7px;
}

.brand-name {
  font-family: var(--font-mono);
  font-size: 0.95rem;
}

.brand-tag {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

.header-spacer {
  flex: 1;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}

.header-link:hover {
  background: var(--bg-sunken);
  color: var(--fg);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--bg-sunken);
  color: var(--fg);
  border-color: var(--border);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

#menu-toggle {
  display: none;
}

/* --------------------------------------------------------------- search */

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 13rem;
  padding: 0.35rem 0.5rem 0.35rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--fg-subtle);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
}

.search-trigger:hover {
  border-color: var(--accent-border);
  color: var(--fg-muted);
}

.search-trigger svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.search-trigger kbd {
  margin-left: auto;
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-sunken);
  color: var(--fg-subtle);
  white-space: nowrap;
}

.search-dialog {
  width: min(38rem, 92vw);
  max-height: 70vh;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  color: var(--fg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search-dialog::backdrop {
  background: rgb(10 9 16 / 45%);
  backdrop-filter: blur(3px);
}

.search-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.search-head svg {
  width: 17px;
  height: 17px;
  color: var(--fg-subtle);
  flex: none;
}

#search-input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 1rem;
  outline: none;
}

#search-results {
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  overflow-y: auto;
  max-height: calc(70vh - 3.5rem);
}

#search-results li a {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--fg);
  text-decoration: none;
}

#search-results li a:hover,
#search-results li[aria-selected="true"] a {
  background: var(--accent-soft);
}

.search-title {
  font-weight: 600;
  font-size: 0.92rem;
}

.search-crumb {
  font-size: 0.75rem;
  color: var(--fg-subtle);
  font-family: var(--font-mono);
}

.search-snippet {
  font-size: 0.82rem;
  color: var(--fg-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--fg-subtle);
  font-size: 0.9rem;
}

/* --------------------------------------------------------------- layout */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  gap: 0;
  max-width: 96rem;
  margin: 0 auto;
}

.layout.no-toc {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

.sidebar {
  grid-column: 1;
  position: sticky;
  top: var(--header-h);
  align-self: start;
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.5rem 0.75rem 4rem 1.25rem;
  border-right: 1px solid var(--border);
}

.nav-section {
  margin-bottom: 1.35rem;
}

.nav-section > h2 {
  margin: 0 0 0.4rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 680;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}

.nav-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-section a {
  display: block;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  color: var(--fg-muted);
  font-size: 0.875rem;
  text-decoration: none;
  line-height: 1.45;
}

.nav-section a:hover {
  background: var(--bg-sunken);
  color: var(--fg);
}

.nav-section a[aria-current="page"] {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.content {
  grid-column: 2;
  min-width: 0;
  padding: 2.5rem 2.5rem 5rem;
}

.content-inner {
  max-width: var(--content-max);
}

/* Reference pages carry wide tables whose value is in reading a row across.
   They opt in through "wide": true in _site.json; the cap is still a cap, so a
   narrower column simply wins. */
.content.wide .content-inner {
  max-width: 62rem;
}

.toc {
  grid-column: 3;
  position: sticky;
  top: var(--header-h);
  align-self: start;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 2.5rem 1.25rem 3rem 0.5rem;
  font-size: 0.83rem;
}

.toc h2 {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 680;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
}

.toc a {
  display: block;
  padding: 0.22rem 0 0.22rem 0.75rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--fg-muted);
  text-decoration: none;
  line-height: 1.4;
}

.toc a:hover {
  color: var(--fg);
}

.toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.toc .toc-h3 a {
  padding-left: 1.5rem;
  font-size: 0.79rem;
}

/* ------------------------------------------------------------- typography */

.content h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.024em;
  font-weight: 700;
}

.page-lead {
  margin: 0 0 2rem;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--fg-muted);
}

.content h2 {
  margin: 3rem 0 0.85rem;
  padding-top: 0.4rem;
  font-size: 1.45rem;
  line-height: 1.25;
  letter-spacing: -0.016em;
  font-weight: 660;
  border-top: 1px solid var(--border);
}

.content h3 {
  margin: 2.1rem 0 0.6rem;
  font-size: 1.12rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
  font-weight: 640;
}

.content h4 {
  margin: 1.6rem 0 0.5rem;
  font-size: 0.98rem;
  font-weight: 650;
  color: var(--fg);
}

.content p {
  margin: 0 0 1.05rem;
}

.content ul,
.content ol {
  margin: 0 0 1.05rem;
  padding-left: 1.4rem;
}

.content li {
  margin-bottom: 0.4rem;
}

.content li > ul,
.content li > ol {
  margin-top: 0.4rem;
  margin-bottom: 0.4rem;
}

.content strong {
  font-weight: 640;
  color: var(--fg);
}

.content hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

blockquote {
  margin: 1.25rem 0;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 3px solid var(--border-strong);
  color: var(--fg-muted);
}

.heading-anchor {
  margin-left: 0.4rem;
  color: var(--fg-subtle);
  opacity: 0;
  text-decoration: none;
  font-weight: 400;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor,
h4:hover .heading-anchor,
.heading-anchor:focus {
  opacity: 1;
}

/* ------------------------------------------------------------------ code */

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  font-variant-ligatures: none;
}

:not(pre) > code {
  padding: 0.13em 0.36em;
  border-radius: 4px;
  background: var(--bg-inline);
  color: var(--fg);
  /* Deliberately NOT `white-space: nowrap`. Inline code here carries long
     repository paths and full signatures, and nowrap makes those push the
     page sideways on a narrow screen — which the layout rules forbid. Breaking
     inside a long token is the lesser evil, and short identifiers fit anyway
     so they never break. */
  overflow-wrap: break-word;
  word-break: break-word;
}

.code-block {
  position: relative;
  margin: 1.25rem 0 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-code);
  overflow: hidden;
}

.code-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem 0.4rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-sunken) 60%, var(--bg-code));
  font-size: 0.74rem;
  font-family: var(--font-mono);
  color: var(--fg-subtle);
}

.code-lang {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

.code-file {
  color: var(--fg-muted);
  margin-left: auto;
}

.copy-button {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--fg-muted);
  font: inherit;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  cursor: pointer;
}

.code-file + .copy-button {
  margin-left: 0.6rem;
}

.copy-button:hover {
  color: var(--fg);
  border-color: var(--border-strong);
}

.copy-button[data-copied="true"] {
  color: var(--ok);
  border-color: var(--ok-border);
}

pre {
  margin: 0;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.65;
  tab-size: 2;
}

pre code {
  font-size: inherit;
  white-space: pre;
}

.tok-comment {
  color: var(--syn-comment);
  font-style: italic;
}
.tok-keyword {
  color: var(--syn-keyword);
  font-weight: 600;
}
.tok-string {
  color: var(--syn-string);
}
.tok-number {
  color: var(--syn-number);
}
.tok-type {
  color: var(--syn-type);
}
.tok-fn {
  color: var(--syn-fn);
}
.tok-attr {
  color: var(--syn-attr);
}
.tok-punct {
  color: var(--syn-punct);
}

/* ------------------------------------------------------------- callouts */

.callout {
  display: flex;
  gap: 0.75rem;
  margin: 1.4rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--info-border);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--info-soft);
  font-size: 0.93rem;
}

.callout > svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 0.18rem;
  color: var(--info);
}

.callout-body > :last-child {
  margin-bottom: 0;
}

.callout-title {
  display: block;
  font-weight: 660;
  margin-bottom: 0.15rem;
  color: var(--info);
}

.callout.note {
  border-color: var(--info-border);
  background: var(--info-soft);
}
.callout.tip {
  border-color: var(--ok-border);
  background: var(--ok-soft);
}
.callout.tip > svg,
.callout.tip .callout-title {
  color: var(--ok);
}
.callout.warn {
  border-color: var(--warn-border);
  background: var(--warn-soft);
}
.callout.warn > svg,
.callout.warn .callout-title {
  color: var(--warn);
}
.callout.danger {
  border-color: var(--danger-border);
  background: var(--danger-soft);
}
.callout.danger > svg,
.callout.danger .callout-title {
  color: var(--danger);
}

/* --------------------------------------------------------------- tables */

.table-wrap {
  margin: 1.35rem 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  padding: 0.55rem 0.85rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

thead th {
  background: var(--bg-sunken);
  font-weight: 640;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--fg-muted);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

/* Inside a table the wrapper scrolls, so nowrap cannot reach the page. */
td code,
th code {
  white-space: nowrap;
  word-break: normal;
}

/* ---------------------------------------------------------------- cards */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.85rem;
  margin: 1.5rem 0;
}

.card {
  display: block;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--fg);
  text-decoration: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    transform 0.15s;
}

a.card:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  color: var(--fg);
}

.card h3,
.card .card-title {
  display: block;
  margin: 0 0 0.3rem;
  font-size: 0.98rem;
  font-weight: 640;
  line-height: 1.35;
}

/* Inline code inside a card title must wrap with the sentence, not be pushed
   onto a line of its own by the nowrap the body copy wants. */
.card-title code,
.card p code {
  white-space: normal;
}

a.card:hover .card-title {
  color: var(--accent);
}

.card p {
  margin: 0;
  font-size: 0.87rem;
  color: var(--fg-muted);
  line-height: 1.55;
}

.card-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  margin-bottom: 0.3rem;
}

/* ------------------------------------------------------------- pill/tag */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.08rem 0.45rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-sunken);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--fg-muted);
  white-space: nowrap;
  vertical-align: middle;
}

.pill.accent {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}
.pill.ok {
  border-color: var(--ok-border);
  background: var(--ok-soft);
  color: var(--ok);
}
.pill.warn {
  border-color: var(--warn-border);
  background: var(--warn-soft);
  color: var(--warn);
}
.pill.danger {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger);
}

/* --------------------------------------------------------------- steps */

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}

.steps > li {
  position: relative;
  counter-increment: step;
  padding: 0 0 1.5rem 2.4rem;
  border-left: 1px solid var(--border);
  margin: 0;
}

.steps > li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: -0.85rem;
  top: 0;
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
}

.steps > li > h3,
.steps > li > .step-title {
  margin: 0.1rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 640;
}

/* ---------------------------------------------------------- page footer */

.page-nav {
  display: flex;
  gap: 0.75rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.page-nav a {
  flex: 1;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--fg);
  background: var(--bg-raised);
}

.page-nav a:hover {
  border-color: var(--accent-border);
  color: var(--fg);
}

.page-nav .dir {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  margin-bottom: 0.1rem;
}

.page-nav .label {
  font-weight: 600;
  font-size: 0.92rem;
}

.page-nav .next {
  text-align: right;
}

.edit-link {
  margin-top: 2rem;
  font-size: 0.82rem;
  color: var(--fg-subtle);
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-sunken);
  padding: 2rem 1.5rem;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.site-footer-inner {
  max-width: 96rem;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
}

.site-footer a {
  color: var(--fg-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

.site-footer .sep {
  flex: 1;
}

/* -------------------------------------------------------------- landing */

.landing {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}

.hero {
  padding: 4.5rem 0 3rem;
  text-align: center;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  /* Bounded horizontally on purpose: a negative left/right inset here made
     the page scroll sideways on a narrow screen. */
  inset: -20% 0 40%;
  z-index: -1;
  background: radial-gradient(
    45rem 22rem at 50% 0%,
    color-mix(in srgb, var(--accent) 13%, transparent),
    transparent 70%
  );
  pointer-events: none;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.8rem;
  margin-bottom: 1.4rem;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-mono);
  text-decoration: none;
}

.hero h1 {
  margin: 0 0 1.1rem;
  font-size: clamp(2.2rem, 1.2rem + 3.6vw, 3.75rem);
  line-height: 1.06;
  letter-spacing: -0.032em;
  font-weight: 720;
  max-width: 20ch;
  margin-inline: auto;
}

.hero p.hero-sub {
  margin: 0 auto 2rem;
  max-width: 46rem;
  font-size: clamp(1.02rem, 0.95rem + 0.4vw, 1.22rem);
  line-height: 1.6;
  color: var(--fg-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: center;
  align-items: center;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.15rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 0.93rem;
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-fg);
}

.button.secondary {
  background: var(--bg-raised);
  border-color: var(--border-strong);
  color: var(--fg);
}

.button.secondary:hover {
  border-color: var(--accent-border);
  background: var(--bg-raised);
  color: var(--fg);
}

.section {
  padding: 3.5rem 0 0;
}

.section > h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.4rem, 1.15rem + 0.9vw, 1.9rem);
  letter-spacing: -0.02em;
  font-weight: 680;
  text-align: center;
}

.section > p.section-sub {
  margin: 0 auto 2rem;
  max-width: 44rem;
  text-align: center;
  color: var(--fg-muted);
}

.pipeline {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  margin: 2rem 0;
}

.pipeline-step {
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.pipeline-step .n {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 700;
}

.pipeline-step h3 {
  margin: 0.2rem 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 640;
}

.pipeline-step p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* --------------------------------------------------------------- tabs  */

.tabs {
  margin: 1.35rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-code);
}

.tab-list {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-sunken) 60%, var(--bg-code));
  overflow-x: auto;
}

.tab-list button {
  padding: 0.5rem 0.95rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--fg-muted);
  font: inherit;
  font-size: 0.83rem;
  font-weight: 560;
  cursor: pointer;
  white-space: nowrap;
}

.tab-list button:hover {
  color: var(--fg);
}

.tab-list button[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel[hidden] {
  display: none;
}

.tabs .code-block {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.tabs .code-block .code-head {
  background: transparent;
  border-bottom: 0;
  padding-bottom: 0;
}

/* --------------------------------------------------------- api entries */

.api-entry {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  overflow: hidden;
}

.api-entry > .api-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.95rem;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border);
}

.api-entry > .api-head .api-name {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 640;
}

.api-entry > .api-body {
  padding: 0.9rem 0.95rem 0.3rem;
}

.api-entry .code-block {
  margin-top: 0;
}

/* --------------------------------------------------------------- media */

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
  .content {
    padding: 2.5rem 2rem 5rem;
  }
}

@media (max-width: 860px) {
  #menu-toggle {
    display: inline-flex;
  }
  .search-trigger {
    min-width: 0;
  }
  .search-trigger .search-label,
  .search-trigger kbd {
    display: none;
  }
  .brand-tag {
    display: none;
  }
  .header-links .header-link span {
    display: none;
  }
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: min(20rem, 84vw);
    background: var(--bg-raised);
    box-shadow: var(--shadow-lg);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    z-index: 40;
  }
  .sidebar[data-open="true"] {
    transform: translateX(0);
  }
  .content {
    grid-column: 1;
    padding: 2rem 1.25rem 4rem;
  }
  .nav-backdrop {
    position: fixed;
    inset: var(--header-h) 0 0;
    background: rgb(10 9 16 / 40%);
    z-index: 39;
  }
  .nav-backdrop[hidden] {
    display: none;
  }
  .page-nav {
    flex-direction: column;
  }
}

@media print {
  .site-header,
  .sidebar,
  .toc,
  .page-nav,
  .site-footer,
  .copy-button {
    display: none !important;
  }
  .content {
    padding: 0;
  }
}
