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

:root {
  /* Colors */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f7f7f5;
  --surface-sub: #f3f3f0;
  --border: #e5e4df;
  --border-strong: #cfcec7;
  --letterpress: 0 1px 0 rgba(255, 255, 255, 0.9);
  --tile-edge: 0 1px 1px rgba(20, 20, 18, 0.04), 0 1px 0 rgba(20, 20, 18, 0.03);
  --tile-edge-strong:
    0 1px 2px rgba(20, 20, 18, 0.06), 0 1px 0 rgba(20, 20, 18, 0.04);
  --button-inset: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  --button-edge:
    0 1px 0 rgba(20, 20, 18, 0.06), 0 1px 2px rgba(20, 20, 18, 0.04);
  --text: #1a1a18;
  --muted: #2b2b29; /* darker than typical "muted" — readable as body text */
  --on-accent: #fff; /* text/icon on accent backgrounds */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --accent-ring: #bfdbfe;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-ring: #fecaca;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --success-ring: #bbf7d0;
  --success-soft: #dcfce7; /* green chip background (status pill, .badge-green) */
  --success-strong: #15803d; /* green chip foreground */
  --warning: #d97706;
  --code-bg: #f0f0ed; /* inline code chip */
  --code-block-bg: #fafaf7; /* pre block — slightly lighter, paper feel */
  --tooltip-bg: #18181b;
  --scrim: rgba(0, 0, 0, 0.45);
  --scrim-strong: rgba(20, 20, 20, 0.5);

  /* Fonts */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Typography scale */
  --text-xs: 0.75rem; /* 12px — labels, badges */
  --text-sm: 0.8125rem; /* 13px — hints, captions */
  --text-ui: 0.875rem; /* 14px — UI, nav, buttons */
  --text-base: 1.0625rem; /* 17px */
  --text-h2: 1.375rem; /* 22px — section headings */
  --text-h3: 1.125rem; /* 18px — sub headings */
  --text-hero: 2.125rem; /* 34px — hero heading */

  /* Line-height scale */
  --leading-hero: 1.15;
  --leading-tight: 1.35;
  --leading-ui: 1.5;
  --leading-body: 1.75;
  --leading-relaxed: 1.85;

  /* Spacing scale */
  --sp-1: 0.375rem; /*   6px */
  --sp-2: 0.5rem; /*   8px */
  --sp-3: 0.75rem; /*  12px */
  --sp-4: 0.875rem; /*  14px */
  --sp-5: 1rem; /*  16px */
  --sp-6: 1.25rem; /*  20px */
  --sp-7: 1.5rem; /*  24px */
  --sp-8: 1.75rem; /*  28px */
  --sp-9: 2rem; /*  32px */
  --sp-10: 2.5rem; /*  40px */
  --sp-11: 3.5rem; /*  56px */
  --sp-12: 5rem; /*  80px */

  /* Shape */
  --radius: 0.375rem; /*  6px */
  --radius-lg: 0.5rem; /*  8px */
  --radius-xl: 0.625rem; /* 10px */
  --radius-pill: 62.5rem; /* 999px */
  --shadow:
    0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.08),
    0 0.0625rem 0.125rem rgba(0, 0, 0, 0.04);
  --shadow-md: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.08);
  --shadow-lg:
    0 1.25rem 3rem rgba(0, 0, 0, 0.18), 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
  --shadow-tooltip: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.2);
  --shadow-thumb: 0 1px 3px rgba(0, 0, 0, 0.2);

  /* Layout */
  --sidebar-w: 13.75rem; /* 220px */
  --content-max: 56.25rem; /* 900px */
  --content-pad: 2rem; /*  32px */
}

/* ── Base ────────────────────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── Prose typography ───────────────────────────────────────────── */
/* Default leading and vertical rhythm for paragraphs and lists.
   Per-context overrides only when justified (e.g. hero, captions). */
p {
  line-height: var(--leading-body);
}

ul,
ol {
  line-height: var(--leading-body);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  text-shadow: var(--letterpress);
}

/* ── Code blocks (unified) ──────────────────────────────────────── */
/* One source of truth for every <pre> and <code> on the site.
   Per-context wrappers (.example-code, .mini-code, .install-pre, etc.)
   should only handle layout — not the visual chrome. */
pre {
  background: var(--code-block-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  margin: var(--sp-3) 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text);
}

pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Standalone <code> (not inside <pre>) — chip-style inline code. */
:not(pre) > code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.125rem 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.92em;
}

/* ── Syntax highlighter (assets/highlight.js) ───────────────────── */
/* Restrained palette. Micra's own directives (data-*, @event, :bind)
   use --accent so the library's signature pops in every code sample. */
.hl-tag {
  color: #6b7560;
}
.hl-directive {
  color: var(--accent);
  font-weight: 600;
}
.hl-attr {
  color: #7d6a4d;
}
.hl-string {
  color: #1f7a4d;
}
.hl-comment {
  color: #8c8c85;
  font-style: italic;
}
.hl-kw {
  color: #5e35b1;
  font-weight: 500;
}
.hl-number {
  color: #c25e00;
}
.hl-fn {
  color: var(--text);
  font-weight: 500;
}
.hl-prop {
  color: var(--text);
}

/* ── App shell ───────────────────────────────────────────────────── */
.app {
  display: flex;
  min-height: 100vh;
  align-items: flex-start;
}

/* ── Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  padding: var(--sp-6) 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  line-height: var(--leading-ui);
  border-right: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-5) var(--sp-6);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: var(--sp-2);
}

.sidebar-logo > span {
  color: var(--accent);
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.4375rem var(--sp-5);
  color: var(--muted);
  text-decoration: none;
  font-size: var(--text-ui);
  transition:
    color 0.15s,
    background 0.15s;
}

.sidebar-nav a:hover {
  color: var(--text);
  background: var(--bg);
}

.sidebar-nav a.active {
  color: var(--accent);
  font-weight: 500;
}

.sidebar-section-link {
  color: var(--text) !important;
  font-weight: 600;
  background: var(--surface-alt);
  border-radius: var(--radius);
  margin: 0 var(--sp-3) var(--sp-3);
  padding: 0.5rem var(--sp-3) !important;
}

.sidebar-section-link:hover {
  background: var(--accent-light) !important;
  color: var(--accent) !important;
}

.dot {
  width: var(--sp-1);
  height: var(--sp-1);
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Mobile hamburger button — hidden on desktop */
.menu-toggle {
  display: none;
  align-items: center;
  gap: var(--sp-1);
  padding: 0.25rem var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--text-ui);
  font-family: inherit;
  cursor: pointer;
  line-height: 1.4;
}

/* ── Main content area ───────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.content {
  padding: var(--sp-9) var(--content-pad) var(--sp-12);
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

/* ── Hero ────────────────────────────────────────────────────────── */
.hero {
  margin-bottom: var(--sp-10);
}

.hero h2 {
  font-size: var(--text-hero);
  line-height: var(--leading-hero);
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-5);
}

.hero p {
  color: var(--muted);
  max-width: 43.75rem;
  line-height: var(--leading-body);
  margin-bottom: var(--sp-6);
}

.hero-install-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}

.hero-code {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: var(--sp-2) var(--sp-4);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  box-shadow: var(--tile-edge);
}

.size-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--sp-1) var(--sp-3);
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent-ring);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

/* Hero CTA row — primary action, GitHub link, size badge */
.hero-subtitle {
  font-size: var(--text-base);
  color: var(--muted);
  max-width: 43.75rem;
  line-height: var(--leading-body);
  margin-top: var(--sp-3);
}

/* Hero trust strip — version, size, deps, license. Sits between p and demo. */
.hero-trust {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: var(--sp-5) 0 0;
  padding: 0;
  font-size: var(--text-sm);
  color: var(--muted);
  font-family: var(--font-mono);
}

.hero-trust li {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--sp-3);
  border-right: 1px solid var(--border);
}

.hero-trust li:first-child {
  padding-left: 0;
}

.hero-trust li:last-child {
  border-right: none;
  padding-right: 0;
}

.hero-trust strong {
  color: var(--text);
  font-weight: 600;
  margin-right: 0.25rem;
}

.hero-trust a {
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
}

.hero-trust a:hover {
  color: var(--accent);
}

.hero-trust a:hover strong {
  color: var(--accent);
}

/* Hero demo — live counter side-by-side with its source */
.hero-demo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: var(--sp-4);
  margin-top: var(--sp-6);
  align-items: stretch;
}

.hero-demo-pane {
  display: flex;
  flex-direction: column;
  position: relative;
}

.hero-demo-caption {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: var(--sp-2);
}

.hero-demo-live {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--tile-edge);
}

.hero-demo-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  padding: var(--sp-6) 0;
  flex: 1;
}

.hero-demo-counter strong {
  font-size: 2.5rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  min-width: 2.5rem;
  text-align: center;
  text-shadow: var(--letterpress);
}

.hero-demo-counter .btn {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  font-size: 1.125rem;
  line-height: 1;
}

.hero-demo-foot {
  font-size: var(--text-sm);
  color: var(--muted);
  font-family: var(--font-mono);
  text-align: center;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

.hero-demo-code pre {
  margin: 0;
  height: 100%;
}

/* ── Performance bench grid ──────────────────────────────────────── */
.bench-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}

.bench-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  box-shadow: var(--tile-edge);
}

.bench-label {
  font-size: var(--text-xs, 11px);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.bench-value {
  font-size: calc(var(--text-h2) + 0.25rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  text-shadow: var(--letterpress);
}

.bench-unit {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}

.bench-foot {
  font-size: var(--text-sm);
  color: var(--muted);
}

.bench-foot code {
  font-size: var(--text-xs);
  padding: 1px 5px;
}

@media (max-width: 720px) {
  .bench-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Speed strip (×N vs Alpine.js / petite-vue) ──────────────────── */
.speed-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}

.speed-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  box-shadow: var(--tile-edge);
}

.speed-card-hero {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2, var(--surface)) 100%);
  border-color: var(--border-strong);
  box-shadow: var(--tile-edge-strong);
}

.speed-label {
  font-size: var(--text-xs, 11px);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.speed-value {
  font-size: calc(var(--text-h2) + 0.25rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  text-shadow: var(--letterpress);
}

.speed-unit {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}

.speed-mult {
  font-size: var(--text-sm);
  color: var(--text);
  margin-top: 4px;
}

.speed-mult strong {
  font-size: calc(var(--text-base) + 0.1rem);
  font-variant-numeric: tabular-nums;
  color: var(--accent, var(--text));
}

.speed-foot {
  font-size: var(--text-xs);
  color: var(--muted);
}

.speed-foot-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  align-items: center;
  margin-top: var(--sp-5);
}

.speed-method-note {
  flex: 1 1 320px;
  min-width: 0;
}

@media (max-width: 720px) {
  .speed-grid {
    grid-template-columns: 1fr;
  }
}

/* ── AI sandbox strip (Copy LLM prompt) ──────────────────────────── */
.ai-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: var(--sp-5);
  margin-top: var(--sp-5);
  align-items: start;
}

.ai-checklist {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.ai-checklist li {
  position: relative;
  padding-left: 28px;
  font-size: var(--text-base);
  color: var(--text);
  line-height: 1.55;
}

.ai-checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 16px;
  height: 16px;
  background: var(--accent, var(--text));
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'><path d='m4.5 12.75 6 6 9-13.5'/></svg>");
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'><path d='m4.5 12.75 6 6 9-13.5'/></svg>");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

.ai-action {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  box-shadow: var(--tile-edge);
}

.ai-copy-btn {
  width: 100%;
  justify-content: center;
}

.ai-action-hint {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.ai-sandboxes {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

.ai-sandboxes li {
  font-size: var(--text-xs);
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
}

@media (max-width: 820px) {
  .ai-grid {
    grid-template-columns: 1fr;
  }
}

/* ── TypeScript callout (Getting Started) ────────────────────────── */
.ts-callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--sp-5);
  margin-top: var(--sp-5);
  box-shadow: var(--tile-edge);
}

.ts-callout-title {
  font-size: calc(var(--text-base) + 0.15rem);
  margin: 0 0 var(--sp-2);
  letter-spacing: -0.01em;
}

.ts-callout > p {
  margin: 0 0 var(--sp-3);
}

.ts-callout pre {
  margin: var(--sp-3) 0;
}

.ts-callout-honest {
  font-size: var(--text-sm);
  color: var(--muted);
  border-top: 1px dashed var(--border);
  padding-top: var(--sp-3);
  margin-top: var(--sp-4) !important;
}

/* ── Install tabs ────────────────────────────────────────────────── */
.install-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
  margin: var(--sp-4) 0 var(--sp-5);
}

.install-tab .caption {
  margin-bottom: var(--sp-1);
}

.install-pre {
  display: block;
  padding: var(--sp-3) var(--sp-4);
  white-space: pre;
  margin: var(--sp-1) 0 0;
}

/* ── "When to use" block ─────────────────────────────────────────── */
.use-when {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
  margin: var(--sp-5) 0;
}

.use-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--tile-edge);
}

.use-card strong {
  text-shadow: var(--letterpress);
}

.use-card strong {
  display: block;
  font-size: var(--text-ui);
  margin-bottom: var(--sp-2);
}

.use-card ul {
  list-style: none;
  display: grid;
  gap: 0.3125rem;
}

.use-card li {
  font-size: var(--text-sm);
  color: var(--muted);
  padding-left: var(--sp-4);
  position: relative;
  line-height: 1.5;
}

.use-card li::before {
  position: absolute;
  left: 0;
}

.use-card-yes {
  background: var(--success-bg);
  border-color: var(--success-ring);
}

.use-card-yes strong {
  color: var(--success);
}

.use-card-yes li::before {
  content: "✓";
  color: var(--success);
}

.use-card-no {
  background: var(--surface-alt);
  border-color: var(--border);
}

.use-card-no strong {
  color: var(--text);
}

.use-card-no li::before {
  content: "→";
  color: var(--muted);
}

/* ── Comparison table (Micra.js vs others) ──────────────────────── */
.vs-table-wrap {
  margin: var(--sp-5) 0 var(--sp-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--tile-edge);
  background: var(--surface);
  max-width: 94.5vw;
}

.vs-table {
  width: 100%;
  min-width: 56rem;
  border-collapse: collapse;
  font-size: var(--text-sm);
  background: var(--surface);
}

.vs-table thead th {
  background: var(--surface-alt);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  padding: var(--sp-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.vs-table tbody th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.vs-table td {
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
  white-space: nowrap;
}

.vs-table tbody tr:last-child th,
.vs-table tbody tr:last-child td {
  border-bottom: none;
}

.vs-table .vs-col-mine {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.vs-table thead .vs-col-mine {
  color: var(--accent);
  text-shadow: var(--letterpress);
}

.vs-table .vs-yes::before {
  content: "✓ ";
  font-weight: 700;
  color: var(--success);
}

.vs-table .vs-col-mine.vs-yes::before {
  color: var(--accent);
}

.vs-table .vs-no {
  color: var(--muted);
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0.4375rem 0.875rem;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--button-inset), var(--button-edge);
  transition:
    background 0.12s,
    border-color 0.12s,
    color 0.12s,
    transform 0.05s;
  font-family: inherit;
  text-decoration: none;
}

.btn:hover {
  background: var(--surface-alt);
  border-color: #b9b6a8;
}

.btn:active {
  transform: translateY(1px);
  box-shadow: var(--button-inset);
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 1px 0 rgba(0, 0, 0, 0.18);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-lg {
  padding: 0.625rem 1.125rem;
  font-size: var(--text-ui);
  border-radius: var(--radius-lg);
}

/* ── Doc sections ────────────────────────────────────────────────── */
.doc-section {
  scroll-margin-top: 5.25rem;
  margin-bottom: var(--sp-11);
}

.doc-section h2 {
  font-size: var(--text-h2);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.doc-section > p {
  line-height: var(--leading-relaxed);
  margin-bottom: var(--sp-5);
  color: var(--muted);
  max-width: 52rem;
}

.doc-section > ol,
.doc-section > ul {
  margin: var(--sp-4) 0 var(--sp-6);
  padding-left: var(--sp-7);
  display: grid;
  gap: var(--sp-3);
}

.doc-section > ol li,
.doc-section > ul li {
  line-height: var(--leading-body);
}

/* ── Example layout ──────────────────────────────────────────────── */
.example {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
}

.example-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--tile-edge);
}

.example-code {
  display: flex;
  flex-direction: column;
}

.example-code h3,
.code-stack h4,
.preview-stack h4 {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.625rem;
  color: var(--muted);
}

.example-code pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.code-stack,
.preview-stack,
.stack {
  display: grid;
  gap: var(--sp-5);
}

.mini-demo {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  background: linear-gradient(180deg, var(--surface), var(--surface-alt));
}

.mini-code {
  display: flex;
  flex-direction: column;
}

.mini-code pre {
  margin: 0;
}

.mini-demo p,
.mini-demo li,
.mini-demo label,
.mini-demo span,
.mini-demo strong,
.example-preview p,
.example-preview li {
  line-height: 1.6;
}

/* ── Common UI atoms ─────────────────────────────────────────────── */
.demo-row {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
}

.demo-row + .demo-row {
  margin-top: 0.625rem;
}

input,
textarea,
select {
  font: inherit;
  color: inherit;
}

.field,
.todo-input,
.form-input {
  width: 100%;
  padding: 0.5625rem 0.6875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  outline: none;
}

.field:focus,
.todo-input:focus,
.form-input:focus {
  border-color: var(--accent);
}

.hint {
  color: var(--muted);
  font-size: var(--text-ui);
  line-height: var(--leading-body);
}

.inline-code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.125rem 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.directive-output,
.panel,
.callout,
.mount-placeholder,
.mounted-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-3);
  background: var(--surface);
}

.caption {
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--sp-1);
}

.panel {
  background: linear-gradient(180deg, var(--surface), var(--surface-sub));
}

/* ── Tabs ────────────────────────────────────────────────────────── */
.tab-row {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.tab-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 0.4375rem 0.75rem;
  cursor: pointer;
  font-size: var(--text-ui);
}

.tab-btn.active {
  color: var(--accent);
  border-color: var(--accent-ring);
  background: var(--accent-light);
}

.tab-panel {
  margin-top: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-3);
  background: var(--surface-alt);
}

/* ── Status pill ─────────────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem var(--sp-2);
  border-radius: var(--radius-pill);
  background: var(--success-soft);
  color: var(--success-strong);
  font-size: var(--text-xs);
  font-weight: 600;
}

/* ── Bus / grid layouts ──────────────────────────────────────────── */
.bus-grid,
.triple-grid {
  display: grid;
  gap: var(--sp-3);
}

.bus-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.triple-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ── Lists ───────────────────────────────────────────────────────── */
.user-list,
.menu-list,
.log-list {
  display: grid;
  gap: var(--sp-2);
}

.user-card,
.log-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.625rem 0.75rem;
  background: var(--surface-alt);
}

.user-card strong {
  display: block;
}
.user-card span {
  color: var(--muted);
  font-size: var(--text-sm);
}

.todo-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border);
}

.todo-row:last-child {
  border-bottom: none;
}
.todo-row button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: var(--text-base);
}

.done {
  text-decoration: line-through;
  color: var(--muted);
}

/* ── Recipe: todo app ────────────────────────────────────────────── */
.todo-app {
  width: 100%;
  max-width: 28rem;
}

.todo-header h4 {
  font-size: var(--text-h2);
  font-weight: 600;
  margin-bottom: var(--sp-3);
}

.todo-header small {
  color: var(--muted);
  font-weight: 400;
  margin-left: 0.25rem;
}

.todo-filters {
  display: flex;
  gap: var(--sp-1);
  margin-bottom: var(--sp-3);
}

.todo-filters button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0.625rem;
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--muted);
  cursor: pointer;
}

.todo-filters button:hover {
  color: var(--text);
}

.todo-filters button.active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.todo-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border);
}

.todo-item .todo-text {
  flex: 1;
  font-size: var(--text-ui);
}

.todo-item.done .todo-text {
  text-decoration: line-through;
  color: var(--muted);
}

.todo-empty {
  padding: var(--sp-5) 0;
  text-align: center;
  color: var(--muted);
  font-size: var(--text-sm);
}

.todo-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--sp-3);
  font-size: var(--text-sm);
  color: var(--muted);
}

/* ── Canvas / refs ───────────────────────────────────────────────── */
.canvas-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.625rem;
  background: var(--surface-alt);
}

canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
}

/* ── Events grid ─────────────────────────────────────────────────── */
.event-grid {
  display: grid;
  gap: var(--sp-4);
}

/* ── Dropdown ────────────────────────────────────────────────────── */
.dropdown-root {
  position: relative;
}
.dropdown-toggle {
  width: 100%;
  justify-content: space-between;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + var(--sp-1));
  left: 0;
  right: 0;
  z-index: 15;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--sp-1);
}

.menu-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: var(--sp-2) 0.625rem;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  font: inherit;
}

.menu-item:hover {
  background: var(--bg);
}

/* ── Lifecycle / mount demo ──────────────────────────────────────── */
.mount-host {
  min-height: 5.5rem;
}

.mount-placeholder {
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5.5rem;
  background: repeating-linear-gradient(
    -45deg,
    var(--surface-sub),
    var(--surface-sub) 0.625rem,
    #f6f5f1 0.625rem 1.25rem
  );
}

.mounted-card h4 {
  margin-bottom: var(--sp-1);
}

/* ── Footer ──────────────────────────────────────────────────────── */
.doc-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-5);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--muted);
  padding: var(--sp-7) var(--content-pad);
  max-width: var(--content-max);
  width: 100%;
  margin: var(--sp-10) auto 0;
}

.footer-meta {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.footer-brand {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  font-size: var(--text-ui);
  color: var(--text);
}

.footer-brand strong {
  font-weight: 600;
  letter-spacing: -0.01em;
  text-shadow: var(--letterpress);
}

.footer-brand strong > span {
  color: var(--accent);
}

.footer-version {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius);
}

.footer-lines {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.footer-row-links {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.footer-link {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

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

.footer-link-btn {
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.footer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius, 6px);
  color: var(--muted);
  text-decoration: none;
  transition:
    color 0.15s,
    background 0.15s;
}

.footer-icon:hover {
  color: var(--text);
  background: var(--bg);
}

.footer-icon svg {
  display: block;
}

/* ── Table ───────────────────────────────────────────────────────── */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  margin-top: var(--sp-5);
}

table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  background: var(--bg);
  padding: var(--sp-2) 0.625rem;
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr {
  border-bottom: 1px solid var(--border);
}
tbody tr:last-child {
  border-bottom: none;
}

td {
  padding: var(--sp-2) 0.625rem;
  font-size: var(--text-ui);
  vertical-align: middle;
}

.badge {
  display: inline-block;
  padding: 0.125rem var(--sp-2);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
}

.badge-green {
  background: var(--success-soft);
  color: var(--success-strong);
}
.badge-yellow {
  background: #fef9c3;
  color: #a16207;
}
.badge-red {
  background: #fee2e2;
  color: var(--danger);
}
.badge-blue {
  background: #dbeafe;
  color: var(--accent);
}
.badge-purple {
  background: #f3e8ff;
  color: #7c3aed;
}
.badge-gray {
  background: #f3f4f6;
  color: #6b7280;
}

.filter-summary {
  color: var(--muted);
  font-size: var(--text-sm);
  padding: 0.5rem 0.625rem;
}

.empty-state {
  text-align: center;
  padding: var(--sp-9) 0;
}
.empty-state p {
  color: var(--muted);
  font-size: var(--text-ui);
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 70rem) {
  .example,
  .bus-grid,
  .triple-grid,
  .hero-demo,
  .use-when,
  .install-tabs {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 60rem) {
  .app {
    flex-direction: column;
  }

  .hero-install-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-code {
    display: flex;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .hero-code > * {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    border-right: none;
    padding: var(--sp-3) 0;
    z-index: 100;
  }

  .sidebar-logo {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: none;
  }

  .sidebar-logo.open {
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--sp-3);
    margin-bottom: var(--sp-2);
  }

  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: var(--sp-1);
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
  }

  .sidebar-nav.open {
    max-height: 30rem;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .doc-section {
    scroll-margin-top: 1rem;
  }
}

@media (max-width: 45rem) {
  .content {
    padding-left: var(--sp-5);
    padding-right: var(--sp-5);
  }

  .sidebar-nav {
    grid-template-columns: 1fr;
  }
}

/* ── Sidebar groups (used on components pages) ───────────────────── */
.sidebar-group {
  display: block;
  padding: var(--sp-4) var(--sp-5) var(--sp-1);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

/* ── Component gallery ───────────────────────────────────────────── */
.component-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-4);
}

.component-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--tile-edge);
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    transform 0.15s;
}

.component-card:hover {
  border-color: var(--accent-ring);
  box-shadow: 0 0.5rem 1rem rgba(20, 20, 18, 0.06);
  transform: translateY(-1px);
}

.component-card strong {
  text-shadow: var(--letterpress);
}

.component-card .icon-lg {
  color: var(--accent);
}

.component-card strong {
  font-size: var(--text-base);
  font-weight: 600;
}

.component-card span {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.55;
}

/* ── Component page layout (preview / code / API) ────────────────── */
.component-section {
  margin-bottom: var(--sp-10);
}

.component-section h3 {
  font-size: var(--text-h2);
  font-weight: 600;
  margin-bottom: var(--sp-4);
  letter-spacing: -0.01em;
}

.component-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--sp-7);
  margin-bottom: var(--sp-4);
  min-height: 8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--tile-edge);
}

.component-preview.preview-left {
  justify-content: flex-start;
}

.code-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-3);
}

.code-tab {
  background: transparent;
  border: none;
  padding: var(--sp-2) var(--sp-4);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-ui);
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition:
    color 0.15s,
    border-color 0.15s;
}

.code-tab:hover {
  color: var(--text);
}

.code-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Sub headings within doc sections ────────────────────────────── */
.sub-h {
  font-size: var(--text-base);
  font-weight: 600;
  margin: var(--sp-5) 0 var(--sp-2);
  letter-spacing: -0.01em;
}

/* .doc-section pre / .recipe-section pre / .component-section pre all
   inherit from the global `pre` rule defined in Base — no overrides. */

/* ── Component library: shared primitives ───────────────────────── */

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--sp-5);
}

.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-5) var(--sp-3);
}

.modal-header h3 {
  font-size: var(--text-base);
  font-weight: 600;
}

.modal-body {
  padding: 0 var(--sp-5) var(--sp-5);
  color: var(--muted);
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
}

/* Dropdown */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 12rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--sp-1);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: var(--text-ui);
  color: var(--text);
  width: 100%;
}

.menu-item:hover,
.menu-item.highlight {
  background: var(--accent-light);
  color: var(--accent);
}

.menu-item.selected::after {
  content: "";
  margin-left: auto;
  width: 0.875rem;
  height: 0.875rem;
  background: currentColor;
  mask: url("icons.svg#icon-check") no-repeat center / contain;
}

/* Tooltip */
.tooltip-wrap {
  position: relative;
  display: inline-block;
}

.tooltip-bubble {
  position: absolute;
  background: var(--tooltip-bg);
  color: var(--on-accent);
  font-size: var(--text-sm);
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius);
  white-space: nowrap;
  pointer-events: none;
  z-index: 60;
  box-shadow: var(--shadow-tooltip);
}

.tooltip-bubble[data-placement="top"] {
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
}

.tooltip-bubble[data-placement="bottom"] {
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
}

.tooltip-bubble[data-placement="left"] {
  right: calc(100% + 0.5rem);
  top: 50%;
  transform: translateY(-50%);
}

.tooltip-bubble[data-placement="right"] {
  left: calc(100% + 0.5rem);
  top: 50%;
  transform: translateY(-50%);
}

/* Toast */
.toast-stack {
  position: fixed;
  top: var(--sp-5);
  right: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  z-index: 2000;
  max-width: 22rem;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  animation: toast-in 0.18s ease-out;
}

.toast.toast-success {
  border-left-color: var(--success);
}

.toast.toast-error {
  border-left-color: var(--danger);
}

.toast.toast-warning {
  border-left-color: var(--warning);
}

.toast-body {
  flex: 1;
  font-size: var(--text-ui);
  line-height: 1.5;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.toast-message {
  color: var(--muted);
}

.toast .icon-btn {
  margin-left: auto;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Tabs */
.tabs-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  margin-bottom: var(--sp-4);
}

.tab-trigger {
  background: transparent;
  border: none;
  padding: var(--sp-3) var(--sp-4);
  font-family: inherit;
  font-size: var(--text-ui);
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition:
    color 0.15s,
    border-color 0.15s;
}

.tab-trigger:hover {
  color: var(--text);
}

.tab-trigger.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

.tab-panel {
  padding: var(--sp-3) 0;
  color: var(--muted);
  line-height: 1.6;
}

/* Accordion */
.accordion {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: 100%;
  max-width: 32rem;
}

.accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}

.accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  padding: var(--sp-3) var(--sp-4);
  font-family: inherit;
  font-size: var(--text-ui);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

.accordion-trigger:hover {
  background: var(--surface-alt);
}

.accordion-body {
  padding: 0 var(--sp-4) var(--sp-4);
  color: var(--muted);
  font-size: var(--text-ui);
  line-height: 1.6;
}

/* Combobox */
.combobox {
  position: relative;
  width: 100%;
  max-width: 22rem;
}

.combobox-input {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  padding-right: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit;
  font-size: var(--text-ui);
  color: var(--text);
}

.combobox-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.combobox-chev {
  position: absolute;
  right: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.combobox-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-height: 14rem;
  overflow-y: auto;
  z-index: 50;
  padding: var(--sp-1);
}

.combobox-empty {
  padding: var(--sp-3);
  color: var(--muted);
  font-size: var(--text-sm);
  text-align: center;
}

/* Toggle */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
  user-select: none;
}

.toggle-track {
  position: relative;
  width: 2.5rem;
  height: 1.375rem;
  border-radius: var(--radius-pill);
  background: var(--border);
  transition: background 0.18s;
  flex-shrink: 0;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-thumb);
  transition: transform 0.18s;
}

.toggle.on .toggle-track {
  background: var(--accent);
}

.toggle.on .toggle-thumb {
  transform: translateX(1.125rem);
}

.toggle.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.toggle-label {
  font-size: var(--text-ui);
}

/* Tag input */
.tag-field {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  padding: var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 2.5rem;
  width: 100%;
  max-width: 28rem;
  cursor: text;
}

.tag-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius);
  padding: 2px 0.375rem 2px 0.5rem;
  font-size: var(--text-sm);
  font-weight: 500;
}

.tag .tag-remove {
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: 2px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
}

.tag .tag-remove:hover {
  background: var(--accent-ring);
}

.tag-input-inner {
  border: none;
  outline: none;
  flex: 1;
  min-width: 6rem;
  font-family: inherit;
  font-size: var(--text-ui);
  background: transparent;
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-ui);
}

.data-table th,
.data-table td {
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
}

.data-table thead th {
  background: var(--surface-alt);
  font-weight: 600;
  color: var(--muted);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table .sortable {
  cursor: pointer;
  user-select: none;
}

.data-table .sortable:hover {
  color: var(--text);
}

.data-table .sort-indicator {
  display: inline-block;
  margin-left: 4px;
  color: var(--accent);
}

.table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-3) 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.table-pagination .page-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0.625rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
}

.table-pagination .page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Date picker */
.datepicker {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-3);
  width: 18rem;
}

.datepicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.datepicker-title {
  font-weight: 600;
  font-size: var(--text-ui);
}

.datepicker-weekdays,
.datepicker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.datepicker-weekdays {
  margin-bottom: var(--sp-1);
}

.datepicker-weekday {
  text-align: center;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 2px 0;
}

.datepicker-day {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: var(--text-ui);
  padding: 0.4rem 0;
  cursor: pointer;
  border-radius: var(--radius);
  color: var(--text);
  text-align: center;
}

.datepicker-day:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.datepicker-day.empty {
  visibility: hidden;
  cursor: default;
}

.datepicker-day.today {
  font-weight: 600;
  color: var(--accent);
}

.datepicker-day.selected {
  background: var(--accent);
  color: var(--on-accent);
}

.datepicker-day.selected:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

/* Slider */
.slider {
  width: 100%;
  max-width: 22rem;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.slider-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.slider-input {
  flex: 1;
  appearance: none;
  background: transparent;
  height: 1.25rem;
  cursor: pointer;
}

.slider-input::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--fill, 50%),
    var(--border) var(--fill, 50%),
    var(--border) 100%
  );
}

.slider-input::-moz-range-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--border);
}

.slider-input::-moz-range-progress {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--accent);
}

.slider-input::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  margin-top: -6px;
  cursor: grab;
  box-shadow: var(--shadow-thumb);
}

.slider-input::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  cursor: grab;
}

.slider-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: var(--text-ui);
  min-width: 3rem;
  text-align: right;
}

.slider-bounds {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--muted);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--text-ui);
  flex-wrap: wrap;
}

.breadcrumb a,
.breadcrumb .crumb-current {
  color: var(--muted);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
}

.breadcrumb a:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.breadcrumb .crumb-current {
  color: var(--text);
  font-weight: 500;
}

.breadcrumb .crumb-sep {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  opacity: 0.6;
}

.breadcrumb .crumb-sep .icon {
  width: 0.875rem;
  height: 0.875rem;
}

.breadcrumb .crumb-ellipsis {
  position: relative;
  padding: 0.25rem 0.5rem;
  color: var(--muted);
  cursor: pointer;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
}

.breadcrumb .crumb-ellipsis:hover {
  background: var(--surface-alt);
  color: var(--text);
}

/* Command palette */
.cmdk-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim-strong);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8vh;
  z-index: 1100;
}

.cmdk-panel {
  width: 100%;
  max-width: 32rem;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cmdk-search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}

.cmdk-search .icon {
  color: var(--muted);
}

.cmdk-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--text);
}

.cmdk-kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: var(--text-xs);
  color: var(--muted);
  background: var(--surface-alt);
  font-family: inherit;
}

.cmdk-list {
  max-height: 22rem;
  overflow-y: auto;
  padding: var(--sp-1);
}

.cmdk-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  background: transparent;
  border: none;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: var(--text-ui);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.cmdk-row.highlight {
  background: var(--accent-light);
  color: var(--accent);
}

.cmdk-row .icon {
  color: var(--muted);
}

.cmdk-row.highlight .icon {
  color: var(--accent);
}

.cmdk-row-label {
  flex: 1;
}

.cmdk-row-group {
  font-size: var(--text-xs);
  color: var(--muted);
}

.cmdk-empty {
  padding: var(--sp-5);
  text-align: center;
  color: var(--muted);
  font-size: var(--text-sm);
}

/* ── Recipe pages ─────────────────────────────────────────────────── */
.recipe-meta {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin: var(--sp-3) 0 var(--sp-5);
  font-size: var(--text-sm);
  color: var(--muted);
}

.recipe-meta .tag {
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 0.5rem;
  border-radius: var(--radius);
  font-weight: 500;
}

.recipe-section {
  margin-bottom: var(--sp-10);
}

.recipe-section h3 {
  font-size: var(--text-h2);
  font-weight: 600;
  margin-bottom: var(--sp-4);
}

.recipe-section p {
  line-height: var(--leading-body);
  margin-bottom: var(--sp-4);
  max-width: 52rem;
}

.component-section ul,
.component-section ol,
.recipe-section ul,
.recipe-section ol {
  margin-left: var(--sp-5);
  display: grid;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.recipe-section li,
.component-section li {
  line-height: var(--leading-body);
}

.recipe-callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-light);
  padding: var(--sp-3) var(--sp-4);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  margin: var(--sp-4) 0;
  color: var(--text);
  font-size: var(--text-ui);
  line-height: 1.6;
}

.recipe-callout strong {
  color: var(--accent);
  display: block;
  margin-bottom: 2px;
}

.recipe-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  margin: var(--sp-3) 0;
}

.recipe-table th,
.recipe-table td {
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.recipe-table thead th {
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-alt);
}

/* ── Recipe: signup form ─────────────────────────────────────────── */
.signup-form {
  width: 100%;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}

.field-input {
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit;
  font-size: var(--text-ui);
  color: var(--text);
}

.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.field-input.invalid {
  border-color: var(--danger);
}

.field-input.invalid:focus {
  box-shadow: 0 0 0 3px var(--danger-ring);
}

.field-error {
  color: var(--danger);
  font-size: var(--text-sm);
}

.field-hint {
  color: var(--muted);
  font-size: var(--text-ui);
  line-height: var(--leading-body);
}

.form-status {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  font-size: var(--text-ui);
}

.form-status.success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-ring);
}

.form-status.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-ring);
}

/* ── Recipe: search results / cards ──────────────────────────────── */
.search-wrap {
  width: 100%;
  max-width: 32rem;
}

.search-status {
  font-size: var(--text-sm);
  color: var(--muted);
  margin: var(--sp-2) 0;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.search-result {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: var(--text-ui);
}

/* ── Recipe: optimistic post list ────────────────────────────────── */
.post-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: 100%;
  max-width: 32rem;
}

.post-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.post-card .post-body {
  flex: 1;
  min-width: 0;
}

.post-card .post-title {
  font-weight: 500;
  font-size: var(--text-ui);
}

.post-card .post-snippet {
  font-size: var(--text-sm);
  color: var(--muted);
}

.post-card .like-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}

.post-card .like-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.post-card .like-btn.liked {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent-ring);
}

/* ── Recipe: routing demo ───────────────────────────────────────── */
.route-shell {
  width: 100%;
  max-width: 36rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface);
}

.route-tabs {
  display: flex;
  gap: 0;
  background: var(--surface-alt);
  padding: var(--sp-2);
}

.route-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: var(--sp-2);
  font-family: inherit;
  font-size: var(--text-ui);
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius);
}

.route-tab.active {
  background: var(--surface);
  color: var(--accent);
  font-weight: 500;
  box-shadow: var(--shadow);
}

.route-body {
  padding: var(--sp-5);
  font-size: var(--text-ui);
  line-height: 1.6;
  color: var(--text);
}

.route-url {
  display: block;
  font-size: var(--text-sm);
  padding: var(--sp-2) var(--sp-3);
  margin-top: var(--sp-3);
  color: var(--muted);
  word-break: break-all;
}

.filter-bar {
  display: flex;
  gap: var(--sp-1);
  margin: var(--sp-3) 0;
}

.filter-bar button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0.625rem;
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--muted);
  cursor: pointer;
}

.filter-bar button.active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

/* ── Icons (Heroicons sprite) ────────────────────────────────────── */
.icon {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  vertical-align: middle;
  pointer-events: none;
}

.icon-sm {
  width: 0.875rem;
  height: 0.875rem;
}

.icon-lg {
  width: 1.375rem;
  height: 1.375rem;
}

.icon-chev {
  transition: transform 0.15s ease;
}

.icon-chev.open {
  transform: rotate(180deg);
}

.btn .icon,
.menu-item .icon,
.dropdown-toggle .icon,
.footer-icon .icon {
  width: 1rem;
  height: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Compact icon-only button (e.g. the ✕ delete in lists) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s,
    background 0.15s;
}

.icon-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-bg);
}

.icon-btn .icon {
  width: 1rem;
  height: 1rem;
}
