/* ==========================================================================
   FormScript documentation site
   One token set drives every surface. The theme is set on <html> before the
   stylesheet loads, so there is exactly one light or dark appearance and
   never a mix of the two.
   ========================================================================== */

:root {
  color-scheme: light;

  --bg: #f4f6fa;
  --bg-alt: #eaeef5;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;

  --text: #101828;
  --text-soft: #475467;
  --text-faint: #7a8798;
  --text-inverse: #f8fafc;

  --border: #dde3ec;
  --border-strong: #c3ccd9;

  --brand: #4f46e5;
  --brand-strong: #4338ca;
  --brand-soft: #eef0fe;
  --brand-contrast: #ffffff;
  --accent: #0ea5e9;
  --accent-soft: #e2f5fd;

  --good: #15803d;
  --good-soft: #e6f6ec;
  --bad: #c02626;
  --bad-soft: #fdeaea;
  --warn: #b45309;
  --warn-soft: #fdf2e2;

  --code-bg: #f5f7fb;
  --code-surface: #1b2434;
  --code-surface-2: #232e42;
  --code-border: #d9e0ea;
  --code-text: #d7e0ec;
  --code-muted: #8d9bb0;

  --hl-comment: #64748b;
  --hl-string: #0f766e;
  --hl-number: #b45309;
  --hl-keyword: #4338ca;
  --hl-builtin: #7c3aed;
  --hl-title: #101828;

  --json-key: #4338ca;
  --json-string: #0f766e;
  --json-number: #b45309;
  --json-null: #64748b;

  --shadow-sm: 0 1px 2px rgb(16 24 40 / 6%);
  --shadow-md: 0 8px 24px -12px rgb(16 24 40 / 22%);
  --shadow-lg: 0 24px 64px -28px rgb(16 24 40 / 30%);

  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 18px;

  --measure: 68ch;
  --gutter: 1.6rem;
  --tap: 44px;
  --shell: 78rem;
  --shell-wide: 92rem;

  --display: "Literata", "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --sans: "Source Sans 3", "Source Sans Pro", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

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

  --bg: #0a0e18;
  --bg-alt: #0e1420;
  --surface: #131a29;
  --surface-2: #182132;
  --surface-3: #1f2a3d;

  --text: #e9eef7;
  --text-soft: #a9b6c9;
  --text-faint: #7d8ca3;
  --text-inverse: #0a0e18;

  --border: #253147;
  --border-strong: #35435c;

  --brand: #818cf8;
  --brand-strong: #a5b4fc;
  --brand-soft: #1d2544;
  --brand-contrast: #0a0e18;
  --accent: #38bdf8;
  --accent-soft: #10293a;

  --good: #4ade80;
  --good-soft: #10281a;
  --bad: #f87171;
  --bad-soft: #2b1414;
  --warn: #fbbf24;
  --warn-soft: #2b2010;

  --code-bg: #111827;
  --code-surface: #0c111c;
  --code-surface-2: #141c2b;
  --code-border: #253147;
  --code-text: #d7e0ec;
  --code-muted: #8d9bb0;

  --hl-comment: #7d8ca3;
  --hl-string: #5eead4;
  --hl-number: #fbbf24;
  --hl-keyword: #a5b4fc;
  --hl-builtin: #c4b5fd;
  --hl-title: #e9eef7;

  --json-key: #a5b4fc;
  --json-string: #5eead4;
  --json-number: #fbbf24;
  --json-null: #8d9bb0;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-md: 0 8px 24px -12px rgb(0 0 0 / 60%);
  --shadow-lg: 0 24px 64px -28px rgb(0 0 0 / 70%);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

img, svg, video, iframe { max-width: 100%; height: auto; }

a { color: var(--brand); text-decoration-color: color-mix(in srgb, var(--brand) 35%, transparent); }
a:hover { text-decoration-color: currentColor; }

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

code, pre, kbd { font-family: var(--mono); font-size: 0.88em; }

code {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.36em;
  overflow-wrap: anywhere;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  line-height: 1.55;
  -webkit-overflow-scrolling: touch;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.85rem;
  overflow-wrap: normal;
  white-space: pre;
}

h1, h2, h3, h4 { font-family: var(--display); font-weight: 650; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 1.2rem + 2.6vw, 3.1rem); line-height: 1.1; margin: 0 0 1rem; }
h2 { font-size: clamp(1.4rem, 1.15rem + 0.8vw, 1.9rem); margin: 2.4rem 0 0.8rem; }
h3 { font-size: 1.16rem; margin: 1.7rem 0 0.5rem; }

p, ul, ol { max-width: var(--measure); }
li { margin: 0.25rem 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

.anchor { color: inherit; text-decoration: none; }
.anchor:hover { color: var(--brand); }
h1 > .anchor:hover, h2 > .anchor:hover, h3 > .anchor:hover { text-decoration: underline; text-underline-offset: 3px; }

.muted { color: var(--text-faint); font-size: 0.9rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip { position: absolute; left: -9999px; }
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 40;
  background: var(--surface);
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ---------- buttons ---------- */

.cta { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 1.8rem 0 2.2rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.68rem 1.3rem;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--brand-contrast);
  font-weight: 600;
  font-size: 0.97rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}
.button:hover { background: var(--brand-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.button.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: none;
}
.button.ghost:hover { background: var(--surface-3); color: var(--text); border-color: var(--brand); }
.button.small { padding: 0.42rem 0.8rem; font-size: 0.86rem; }

/* ---------- masthead ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.7rem var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.brand .mark {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--brand), var(--accent));
  color: #fff;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.brand .version { color: var(--text-faint); font-weight: 500; }

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: auto;
  align-items: center;
}
.top-nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
}
.top-nav a:hover { color: var(--text); background: var(--surface-3); }
.top-nav a.active { color: var(--brand); background: var(--brand-soft); }

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: var(--tap);
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.search-trigger:hover { border-color: var(--border-strong); color: var(--text); }
.search-trigger .icon-search {
  display: none;
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}
.search-trigger kbd {
  font-family: var(--mono);
  font-size: 0.72rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  color: var(--text-faint);
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  min-height: var(--tap);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  padding: 0;
}
.theme-toggle:hover { color: var(--brand); border-color: var(--border-strong); }
.theme-toggle svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.nav-toggle {
  display: none;
  margin-left: auto;
  align-items: center;
  gap: 0.45rem;
  min-height: var(--tap);
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}
.nav-toggle::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"]::after { transform: translateY(1px) rotate(225deg); }

/* The panel the Menu button opens on a narrow screen. */
.mobile-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 40;
  max-height: min(72vh, 34rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.4rem var(--gutter) 1.2rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 18px 32px rgb(15 23 42 / 0.14);
}
.mm-links { display: flex; flex-direction: column; }
.mm-links a {
  display: block;
  padding: 0.72rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
}
.mm-links a:hover { background: var(--surface-3); }
.mm-links a.active { color: var(--brand); background: var(--brand-soft); }
.mm-docs { margin-top: 0.5rem; padding-top: 0.3rem; border-top: 1px solid var(--border); }
.mm-docs .docs-sidebar {
  position: static;
  max-height: none;
  overflow: visible;
  padding: 0;
}

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

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 4rem;
}

.product-shell main { max-width: none; margin: 0; padding: 0; }
.pg-page main { padding: 0; }
.main > h1:first-child, main > article > h1:first-child { margin-top: 0; }

.wrap { width: min(var(--shell), calc(100% - 2 * var(--gutter))); margin-inline: auto; }
.wrap-wide { width: min(var(--shell-wide), calc(100% - 2 * var(--gutter))); }

.band { padding: 4.6rem 0; }
.band-lede { max-width: 56ch; color: var(--text-soft); font-size: 1.1rem; }
.band-foot { color: var(--text-faint); font-size: 0.92rem; margin-top: 1rem; }

/* ---------- docs shell ---------- */

.docs-shell main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 4rem;
}
.docs-shell h2 { border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; }

.docs-layout {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr) 12rem;
  gap: 1.5rem;
  align-items: start;
}
.docs-sidebar,
.docs-toc {
  position: sticky;
  top: 4.6rem;
  max-height: calc(100vh - 5.6rem);
  overflow: auto;
  padding: 0.2rem 0.2rem 2rem;
}
.docs-sidebar .side-title,
.toc-title {
  margin: 0.9rem 0 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
}
.docs-sidebar ul,
.docs-toc ul { list-style: none; margin: 0; padding: 0; }
.docs-sidebar a,
.docs-toc a {
  display: block;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.88rem;
}
.docs-sidebar a:hover,
.docs-toc a:hover,
.docs-sidebar a.active { background: var(--brand-soft); color: var(--brand); }
.docs-main { min-width: 0; }
.toc-h3 { padding-left: 0.7rem; }

/* ---------- rail (examples page) ---------- */

.rail-layout {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  width: min(var(--shell-wide), calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
  padding: 2.4rem 0 4rem;
}
.rail-main { min-width: 0; }

.rail {
  position: sticky;
  top: 4.6rem;
  max-height: calc(100vh - 5.6rem);
  overflow: auto;
  padding: 0 0.2rem 2rem;
}
.rail-title {
  margin: 0 0 0.7rem;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
}
.rail-filter input {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}
.rail-filter input:focus { border-color: var(--brand); outline: none; }
.rail-count { margin: 0.6rem 0 0; font-size: 0.8rem; color: var(--text-faint); }
.rail-list { list-style: none; margin: 1rem 0 0; padding: 0; border-top: 1px solid var(--border); }
.rail-list li { margin: 0; }
.rail-list a {
  display: grid;
  grid-template-columns: 1.9rem minmax(0, 1fr);
  gap: 0.2rem 0.4rem;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.88rem;
}
.rail-list a:hover { background: var(--surface-3); color: var(--text); }
.rail-list a.current { color: var(--brand); font-weight: 600; }
.rail-num { font-family: var(--mono); font-size: 0.72rem; color: var(--text-faint); }
.rail-label { min-width: 0; }
.rail-tags { grid-column: 2; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.rail-empty { margin: 1rem 0 0; font-size: 0.86rem; color: var(--text-faint); }

/* ---------- tags ---------- */

.tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

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

.footer {
  border-top: 1px solid var(--border);
  padding: 3rem var(--gutter) 2.4rem;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.95rem;
}
.footer a { color: var(--text); text-decoration: none; }
.footer a:hover { color: var(--brand); text-decoration: underline; }
.footer-grid {
  display: grid;
  grid-template-columns: minmax(12rem, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 1.6rem 2rem;
  max-width: var(--shell-wide);
  margin: 0 auto;
}
.footer-brand {
  font-family: var(--display);
  font-size: 1.4rem;
  color: var(--text);
  margin: 0 0 0.4rem;
  font-weight: 650;
}
.footer-label {
  margin: 0 0 0.55rem;
  color: var(--text-faint);
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 700;
}
.footer-grid > div { display: grid; align-content: start; gap: 0.28rem; }
.footer-pains { display: grid; gap: 0.28rem; }
.footer-meta {
  max-width: var(--shell-wide);
  margin: 1.8rem auto 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.85rem;
}

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

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.1rem 0 1.6rem;
  max-width: 100%;
}

table { width: 100%; border-collapse: collapse; margin: 0; font-size: 0.92rem; }
th, td { text-align: left; vertical-align: top; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); }
th { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); font-weight: 700; }
tbody tr:hover { background: var(--surface-2); }

table.facts th { width: 11rem; text-transform: none; letter-spacing: 0; font-size: 0.85rem; color: var(--text-soft); }
table.spec td:nth-child(1) { white-space: nowrap; width: 8rem; }
table.spec td:nth-child(2) { width: 16rem; }
table.api td:nth-child(1) { white-space: nowrap; }
table.render td:nth-child(3) { white-space: nowrap; }

blockquote {
  margin: 1.4rem 0;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 3px solid var(--brand);
  color: var(--text-soft);
}

.example {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin: 1.6rem 0;
  background: var(--surface);
}
.example h3 { margin-top: 0; }
.example p { max-width: var(--measure); }

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

.code-block {
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.1rem 0;
  background: var(--code-bg);
}
.code-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-bottom: 1px solid var(--code-border);
  background: var(--surface-3);
}
.code-lang {
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
}
.copy-code {
  font: inherit;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-soft);
  padding: 0.2rem 0.55rem;
  cursor: pointer;
}
.copy-code:hover { color: var(--brand); border-color: var(--brand); }
.code-block pre { margin: 0; border: 0; border-radius: 0; background: transparent; }

/* A code surface that always reads as code, in either theme. */
.code-dark {
  background: var(--code-surface);
  border-color: var(--code-surface-2);
  color: var(--code-text);
}
.code-dark .code-toolbar { background: var(--code-surface-2); border-bottom-color: #2b3a52; }
.code-dark .code-lang { color: var(--code-muted); }
.code-dark .copy-code { background: transparent; border-color: #2b3a52; color: var(--code-muted); }
.code-dark pre { color: var(--code-text); background: transparent; }

.hljs-comment, .hljs-quote { color: var(--hl-comment); font-style: italic; }
.hljs-string { color: var(--hl-string); }
.hljs-number { color: var(--hl-number); }
.hljs-keyword { color: var(--hl-keyword); font-weight: 600; }
.hljs-literal { color: var(--hl-number); }
.hljs-built_in { color: var(--hl-builtin); }
.hljs-meta { color: var(--hl-builtin); }
.hljs-title, .hljs-section { font-weight: 600; color: var(--hl-title); }
.hljs-attr, .hljs-attribute { color: var(--text-soft); }
.hljs-tag { color: var(--brand); }

/* ---------- the live form ---------- */

.fs-form { display: grid; gap: 1rem; width: 100%; }
.fs-body { display: grid; gap: 1rem; }
.fs-field { display: grid; gap: 0.35rem; }
.fs-label { font-weight: 600; font-size: 0.93rem; line-height: 1.4; }
.fs-required { color: var(--bad); margin-left: 0.15rem; }
.fs-control { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }

.fs-input, .fs-select {
  font: inherit;
  font-size: 0.96rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  min-width: 0;
  max-width: 100%;
}
.fs-input:focus, .fs-select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.fs-control > .fs-input:not([type="checkbox"]):not([type="radio"]),
.fs-control > .fs-select { flex: 1 1 16rem; width: 100%; }
.fs-input[readonly],
.fs-field[data-fs-locked] .fs-input,
.fs-field[data-fs-locked] .fs-select {
  background: var(--surface-3);
  color: var(--text-soft);
}
.fs-field[data-fs-locked] { opacity: 0.94; }
.fs-input[type="checkbox"], .fs-input[type="radio"] { min-width: auto; width: auto; padding: 0; }
.fs-toggle { width: 1.2rem; height: 1.2rem; accent-color: var(--brand); }
.fs-hint, .fs-help, .fs-pending, .fs-note { margin: 0; font-size: 0.83rem; color: var(--text-soft); }
.fs-pending { color: var(--warn); }
.fs-error { margin: 0; font-size: 0.86rem; color: var(--bad); font-weight: 600; }
.fs-note { color: var(--warn); }
.fs-group, .fs-choice, .fs-repeat-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 0;
  min-width: 0;
  background: var(--surface-2);
}
.fs-group > legend, .fs-choice > legend {
  font-weight: 650;
  font-size: 0.9rem;
  padding: 0 0.4rem;
  color: var(--text);
}
.fs-group-body { display: grid; gap: 0.9rem; }
.fs-option { display: flex; align-items: center; gap: 0.45rem; font-size: 0.93rem; }
.fs-repeat { display: grid; gap: 0.6rem; }
.fs-repeat-items { display: grid; gap: 0.7rem; }
.fs-count { margin: 0; font-size: 0.8rem; color: var(--text-faint); }
.fs-page { display: grid; gap: 0.8rem; }
.fs-progress { width: 100%; height: 0.5rem; accent-color: var(--brand); }
.fs-signature { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); max-width: 100%; }
.fs-location { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.fs-button {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.9rem;
  min-height: var(--tap);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.fs-button:hover { border-color: var(--brand); color: var(--brand); }
.fs-submit { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); font-weight: 600; }
.fs-submit:hover { color: var(--brand-contrast); background: var(--brand-strong); }
.fs-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.fs-summary {
  border: 1px solid var(--bad);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--bad-soft);
  padding: 0.85rem 1rem;
}
.fs-summary-title { margin: 0 0 0.4rem; font-size: 0.95rem; color: var(--bad); }
.fs-summary ul { margin: 0; padding-left: 1.1rem; font-size: 0.9rem; }
.fs-summary li { margin: 0.15rem 0; }

.diagnostic { display: flex; gap: 0.6rem; padding: 0.45rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.diagnostic:last-child { border-bottom: 0; }
.diagnostic .code { font-family: var(--mono); font-weight: 700; white-space: nowrap; }
.diagnostic.error .code { color: var(--bad); }
.diagnostic.warning .code { color: var(--warn); }
.diagnostic.note .code { color: var(--text-faint); }

.output-json { font-size: 0.82rem; margin: 0; }
.output-key { color: var(--json-key); }
.output-string { color: var(--json-string); }
.output-number { color: var(--json-number); }
.output-null { color: var(--json-null); }

/* ---------- playground ---------- */

.pg-page .footer { display: none; }

.pg-app {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 3.5rem);
  min-height: 32rem;
  background: var(--bg);
}
.pg-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.1rem;
  padding: 0.55rem var(--gutter);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.pg-pick { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; color: var(--text-soft); }
.pg-pick select {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  min-height: 2.5rem;
  min-width: 15rem;
}
.pg-bar-actions { display: flex; align-items: center; gap: 0.5rem; }
.pg-live-toggle { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; color: var(--text-soft); }
.pg-bar-note { margin: 0 0 0 auto; color: var(--text-faint); font-size: 0.85rem; }

.pg-work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr) minmax(20rem, 0.85fr);
  flex: 1;
  min-height: 0;
}
.pg-col { display: flex; flex-direction: column; align-items: stretch; min-width: 0; min-height: 0; border-right: 1px solid var(--border); }
.pg-col:last-child { border-right: 0; }
.pg-col-head,
.pg-col .pane h4 {
  margin: 0;
  padding: 0.5rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--sans);
}
.pg-col .pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: var(--surface);
}
.pg-results { background: var(--bg); }
.pg-results .pane { border-bottom: 1px solid var(--border); flex: 0 1 auto; max-height: 32%; }
.pg-results .pane-grow { flex: 1 1 auto; max-height: none; }
.pg-col .pane .body { flex: 1; overflow: auto; padding: 1rem 1.1rem; }

/* The live form gets the room it needs: no artificial cap on the pane, and
   the controls inside it fill the column. */
.pg-live { background: var(--surface); }
.pg-live .pane { height: 100%; }
.pg-live .pane .body { max-width: none; }

.pg-source { background: var(--code-surface); }
.pg-source .pg-col-head { background: var(--code-surface-2); color: var(--code-muted); border-bottom-color: #2b3a52; }
.cm-host { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 0; border-radius: 0; background: var(--code-surface); }
.cm-editor { flex: 1; height: auto !important; min-height: 0; font-size: 0.84rem; }
.cm-scroller { font-family: var(--mono) !important; }
.pg-source .cm-editor,
.pg-source .cm-gutters { background: var(--code-surface); color: var(--code-text); }
.pg-source .cm-gutters { border: 0; color: var(--code-muted); }
.pg-source .cm-activeLine, .pg-source .cm-activeLineGutter { background: var(--code-surface-2); }
.pg-source .cm-cursor { border-left-color: var(--code-text); }
.pg-col .pane pre { margin: 0; max-height: none; border: 0; background: transparent; }
.pg-results .pane .body pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.8rem; }

.assignments-panel {
  margin: 0;
  padding: 0.5rem 0.8rem 0.75rem;
  background: var(--code-surface-2);
  color: var(--code-text);
  border-top: 1px solid #2b3a52;
}
.assignments-panel summary { cursor: pointer; font-size: 0.82rem; color: var(--code-muted); }
.assignments-panel textarea {
  width: 100%;
  min-height: 4.2rem;
  margin-top: 0.45rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.55rem;
  border: 1px solid #2b3a52;
  border-radius: var(--radius-sm);
  background: var(--code-surface);
  color: var(--code-text);
}

.playground textarea {
  width: 100%;
  min-height: 26rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--text);
  resize: vertical;
  tab-size: 2;
}

/* ---------- home page ---------- */

.band-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1100px 520px at 78% -12%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 62%),
    radial-gradient(900px 480px at 8% 8%, color-mix(in srgb, var(--brand) 34%, transparent), transparent 60%),
    var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 5.4rem 0 5rem;
}
.band-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(color-mix(in srgb, var(--text) 5%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--text) 5%, transparent) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(70% 60% at 50% 0%, #000, transparent 78%);
  opacity: 0.6;
  pointer-events: none;
}
.band-hero .wrap { position: relative; z-index: 1; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 3.4rem;
  align-items: center;
}
.hero-copy { max-width: 34rem; }
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.1rem;
  padding: 0.28rem 0.8rem 0.28rem 0.6rem;
  border-radius: 999px;
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 28%, transparent);
  color: var(--brand-strong);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.hero-kicker::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
}
.band-hero h1 {
  max-width: 16ch;
  margin: 0 0 1.2rem;
  font-size: clamp(2.5rem, 1.1rem + 4.4vw, 4.5rem);
  line-height: 1.04;
}
.lede { font-size: 1.18rem; line-height: 1.55; color: var(--text-soft); max-width: 46ch; }
.band-hero .lede { color: var(--text-soft); }

.hero-panel {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.hero-panel-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.hero-dots { display: inline-flex; gap: 0.32rem; }
.hero-dots span { width: 0.62rem; height: 0.62rem; border-radius: 50%; background: var(--border-strong); }
.hero-panel-title { margin: 0 0 0 0.6rem; font-family: var(--mono); font-size: 0.78rem; color: var(--text-faint); }
.hero-panel .code-block { margin: 0; border: 0; border-radius: 0; background: var(--code-surface); }
.hero-panel .code-toolbar { background: var(--code-surface-2); border-bottom-color: #2b3a52; }
.hero-panel .code-lang { color: var(--code-muted); }
.hero-panel pre { background: transparent; color: var(--code-text); }
.hero-panel-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.86rem;
  color: var(--text-soft);
}
.hero-panel-foot b { color: var(--text); font-weight: 650; }

.claim-list {
  list-style: none;
  margin: 0;
  padding: 1.1rem 1.2rem;
  display: grid;
  gap: 0.65rem;
}
.claim-statement {
  margin: 0;
  padding: 1.1rem 1.2rem 0.2rem;
  font-family: var(--display);
  font-size: 1.15rem;
  line-height: 1.4;
  font-weight: 650;
}
.claim-list li {
  display: grid;
  grid-template-columns: 1.4rem minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
  margin: 0;
  font-size: 0.98rem;
  color: var(--text);
}
.claim-tick {
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--page-accent, var(--brand)) 16%, transparent);
  color: var(--page-accent, var(--brand));
  font-size: 0.72rem;
  font-weight: 700;
}

.band-proof { background: var(--bg); }
.proof-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 1.8rem 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  min-height: 30rem;
}
.proof-grid .pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.proof-grid .pane:last-child { border-right: 0; }
.proof-grid .pane h4 {
  margin: 0;
  padding: 0.55rem 0.9rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--sans);
}
.proof-grid .pane .body { flex: 1; overflow: auto; padding: 1rem; }
.proof-grid .pane.pane-dark { background: var(--code-surface); color: var(--code-text); }
.proof-grid .pane.pane-dark h4 { color: var(--code-muted); border-bottom-color: #2b3a52; background: var(--code-surface-2); }
.proof-grid .pane.pane-paper { background: var(--surface-2); }
.proof-grid .pane.pane-out { background: var(--code-bg); }
.proof-source { margin: 0; background: transparent; border: 0; color: var(--code-text); font-size: 0.78rem; }
.proof-grid .pane.pane-out pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.8rem; }

.band-split { background: var(--surface); border-block: 1px solid var(--border); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; }
.split h2 { margin-top: 0; }
.split p { max-width: 42ch; color: var(--text-soft); }

.band-facts { background: var(--surface); border-top: 1px solid var(--border); padding: 2.8rem 0; }
.facts-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; }
.facts-row div { display: grid; gap: 0.15rem; }
.facts-row strong {
  font-family: var(--display);
  font-size: clamp(1.6rem, 1rem + 1.6vw, 2.2rem);
  font-weight: 650;
  color: var(--brand);
}
.facts-row span { color: var(--text-faint); font-size: 0.9rem; }
.facts-sentence { color: var(--text-faint); font-size: 0.88rem; margin: 1.1rem 0 0; max-width: none; }

.band-pains { background: var(--bg); }

/* ---------- feature and step grids ---------- */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.1rem;
  margin: 1.6rem 0 0;
}
.feature-card {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.feature-icon {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 1.1rem;
}
.feature-card h3 { margin: 0.2rem 0 0; font-size: 1.1rem; }
.feature-card p { margin: 0; color: var(--text-soft); font-size: 0.95rem; max-width: 34ch; }
.feature-card .feature-meta { font-size: 0.8rem; color: var(--text-faint); font-family: var(--mono); }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.1rem; margin: 1.6rem 0 0; counter-reset: step; }
.step { position: relative; padding: 1.3rem 1.4rem 1.4rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.step::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--brand);
  color: var(--brand-contrast);
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.7rem;
}
.step h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.step p { margin: 0; color: var(--text-soft); font-size: 0.94rem; max-width: 32ch; }

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

.pain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 1.1rem;
  margin: 1.8rem 0 0;
}
.pain-card {
  position: relative;
  display: grid;
  gap: 0.55rem;
  align-content: start;
  padding: 1.5rem 1.5rem 1.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}
.pain-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--pain, var(--brand));
}
.pain-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--pain, var(--brand)) 45%, var(--border)); }
.pain-card .pain-kicker {
  font-size: 0.74rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--pain, var(--brand));
}
.pain-card .pain-title { font-family: var(--display); font-size: 1.28rem; font-weight: 650; line-height: 1.25; }
.pain-card .pain-text { color: var(--text-soft); font-size: 0.94rem; margin: 0; }
.pain-card .pain-cta { font-size: 0.88rem; font-weight: 650; color: var(--pain, var(--brand)); display: inline-flex; align-items: center; gap: 0.35rem; }
.pain-card .pain-cta::after { content: "→"; transition: transform 140ms ease; }
.pain-card:hover .pain-cta::after { transform: translateX(3px); }

/* ---------- CTA band ---------- */

.cta-band {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 3rem 3.2rem;
  margin: 2.5rem 0 0;
  color: #fff;
  background:
    radial-gradient(700px 340px at 88% 0%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 62%),
    linear-gradient(120deg, var(--brand-strong), var(--brand));
  box-shadow: var(--shadow-lg);
}
.cta-band h2 { margin: 0 0 0.6rem; color: #fff; font-size: clamp(1.6rem, 1.1rem + 1.6vw, 2.3rem); }
.cta-band p { margin: 0 0 1.4rem; color: rgb(255 255 255 / 86%); max-width: 46ch; font-size: 1.05rem; }
.cta-band .button { background: #fff; color: var(--brand-strong); }
.cta-band .button.ghost { background: transparent; color: #fff; border-color: rgb(255 255 255 / 45%); }
.cta-band .button.ghost:hover { background: rgb(255 255 255 / 12%); color: #fff; }
.cta-band .cta { margin: 0; }

/* ---------- marketing page ---------- */

.mk-hero {
  position: relative;
  overflow: hidden;
  padding: 4.6rem 0 3.6rem;
  background:
    radial-gradient(900px 420px at 82% -20%, color-mix(in srgb, var(--page-accent, var(--brand)) 34%, transparent), transparent 62%),
    var(--surface);
  border-bottom: 1px solid var(--border);
}
.mk-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(color-mix(in srgb, var(--text) 5%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--text) 5%, transparent) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(60% 90% at 30% 0%, #000, transparent 76%);
  opacity: 0.55;
  pointer-events: none;
}
.mk-hero .wrap { position: relative; z-index: 1; }
.mk-kicker {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--page-accent, var(--brand)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--page-accent, var(--brand)) 34%, transparent);
  color: var(--page-accent, var(--brand));
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mk-hero h1 {
  max-width: 17ch;
  margin: 0 0 1.1rem;
  font-size: clamp(2.3rem, 1.15rem + 3.6vw, 3.8rem);
  line-height: 1.05;
}
.mk-lede { font-size: 1.2rem; line-height: 1.55; color: var(--text-soft); max-width: 44ch; }
.mk-hero .cta { margin-bottom: 0; }

.mk-body { width: min(58rem, calc(100% - 2 * var(--gutter))); margin: 0 auto; padding: 3.4rem 0 0; }
.mk-body h1 { display: none; }
.mk-body > p:first-of-type { font-size: 1.12rem; color: var(--text-soft); }
.mk-body h2 { margin-top: 2.8rem; }
.mk-body strong { font-weight: 700; }

.mk-promise {
  display: grid;
  gap: 0.4rem;
  padding: 1.3rem 1.5rem;
  margin: 1.6rem 0;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--page-accent, var(--brand)) 30%, var(--border));
  border-left: 4px solid var(--page-accent, var(--brand));
  background: color-mix(in srgb, var(--page-accent, var(--brand)) 7%, var(--surface));
}
.mk-promise p { margin: 0; }
.mk-boundary {
  margin: 1.8rem 0;
  padding: 1.1rem 1.3rem;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-soft);
}
.mk-boundary p { margin: 0; }
.mk-body .boundary {
  margin: 1.8rem 0;
  padding: 1.1rem 1.3rem;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.mk-body ul { padding-left: 1.2rem; }
.mk-body li { margin: 0.4rem 0; }
.mk-body li::marker { color: var(--page-accent, var(--brand)); }

.mk-points {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.6rem 0 0;
}
.mk-point {
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.mk-point h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.mk-point p { margin: 0; color: var(--text-soft); font-size: 0.92rem; }

.mk-next {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin: 2.4rem 0 0;
}
.mk-next a {
  display: grid;
  gap: 0.3rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
}
.mk-next a:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.mk-next .next-label { font-size: 0.72rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-faint); font-weight: 700; }
.mk-next .next-title { font-weight: 650; font-family: var(--display); font-size: 1.08rem; }

/* ---------- examples page ---------- */

.examples-page main { padding: 0; }
.ex-head { margin-bottom: 1.6rem; }
.ex-head h1 { margin: 0 0 0.5rem; }
.ex-head .lede { max-width: 52ch; }

.studio-list { display: grid; gap: 0; }
.studio {
  padding: 2.6rem 0 3rem;
  border-top: 1px solid var(--border);
  scroll-margin-top: 5rem;
}
.studio:first-child { border-top: 0; padding-top: 0.5rem; }
.studio[hidden] { display: none; }
.studio-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 0.9rem; }
.studio-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
}
.studio-copy { min-width: 0; flex: 1; }
.studio-copy h2 { margin: 0 0 0.35rem; font-size: 1.5rem; }
.studio-copy p { color: var(--text-soft); margin: 0 0 0.7rem; }
.studio-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 0.9rem; }

.studio-stage {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  min-height: 26rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.studio-source { background: var(--code-surface); min-width: 0; overflow: auto; }
.studio-source .code-block { margin: 0; border: 0; border-radius: 0; background: transparent; }
.studio-source .code-toolbar { background: var(--code-surface-2); border-bottom-color: #2b3a52; }
.studio-source .code-lang { color: var(--code-muted); }
.studio-source pre { background: transparent; color: var(--code-text); }
.studio-form { min-width: 0; background: var(--surface-2); display: flex; }
.studio-form .pane { border: 0; border-radius: 0; width: 100%; display: flex; flex-direction: column; background: var(--surface); }
.studio-form .pane h4 {
  margin: 0;
  padding: 0.55rem 0.9rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.studio-form .body { flex: 1; overflow: auto; padding: 1.15rem 1.25rem; }

/* ---------- reference pages ---------- */

.card-grid,
.package-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  margin: 1.2rem 0 2rem;
}
.card, .package-card {
  display: grid;
  gap: 0.45rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
}
.card:hover, .package-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.package-name { font-weight: 700; }
.package-desc { color: var(--text-soft); font-size: 0.92rem; }
.package-spec { font-size: 0.82rem; }

.spec-layout { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 1.2rem; }
.spec-nav ul { list-style: none; margin: 0; padding: 0; position: sticky; top: 4.6rem; }
.spec-nav a {
  display: block;
  padding: 0.3rem 0;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.86rem;
}
.spec-nav a:hover { color: var(--brand); }
.spec-toolbar { margin: 1rem 0; }
.spec-toolbar input {
  width: min(100%, 28rem);
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}
.spec-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 0.7rem 0;
  background: var(--surface);
}
.spec-card header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: baseline;
  margin-bottom: 0.35rem;
}
.spec-subject { color: var(--text-soft); font-size: 0.92rem; }

.api-list { display: grid; gap: 0.65rem; margin: 1rem 0 2rem; }
.api-symbol {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.15rem 0.8rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  align-items: baseline;
}
.api-symbol > code { font-size: 0.92rem; }
.api-kind { font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); }
.api-doc { grid-column: 1 / -1; margin: 0.15rem 0 0; font-size: 0.88rem; color: var(--text-soft); }
.api-nav { display: flex; flex-wrap: wrap; gap: 0.45rem 0.8rem; margin: 0.8rem 0 1.2rem; }
.api-nav a { font-size: 0.85rem; }

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

.search-dialog {
  width: min(40rem, calc(100vw - 2rem));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--surface);
  color: var(--text);
}
.search-dialog::backdrop { background: color-mix(in srgb, #000 52%, transparent); }
.search-form { display: flex; gap: 0.5rem; padding: 0.8rem; border-bottom: 1px solid var(--border); }
.search-form input {
  flex: 1;
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  color: var(--text);
}
.search-results { max-height: min(60vh, 28rem); overflow: auto; padding: 0.6rem 0.8rem 1rem; }
.search-group h3 {
  margin: 0.7rem 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-family: var(--sans);
}
.search-hit {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.5rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
}
.search-hit:hover { background: var(--brand-soft); }
.search-hit span { color: var(--text-soft); font-size: 0.85rem; }

/* ---------- responsive ---------- */

@media (max-width: 1240px) {
  .pg-work { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(18rem, 1fr) minmax(16rem, 1fr); }
  .pg-results { grid-column: 1 / -1; flex-direction: row; }
  .pg-results .pane { max-height: none; flex: 1; border-bottom: 0; border-right: 1px solid var(--border); }
}

@media (max-width: 1100px) {
  .docs-layout { grid-template-columns: 13rem minmax(0, 1fr); }
  .docs-toc { display: none; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 2.4rem; }
  .proof-grid,
  .studio-stage,
  .split,
  .facts-row { grid-template-columns: minmax(0, 1fr); }
  .facts-row { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .spec-layout { grid-template-columns: minmax(0, 1fr); }
  .spec-nav { display: none; }
  .rail-layout { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; max-height: none; }
  .rail-list { display: flex; flex-wrap: wrap; gap: 0.4rem; border-top: 0; }
  .rail-list li { margin: 0; }
  .rail-list a { grid-template-columns: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.4rem 0.6rem; background: var(--surface); }
  .rail-tags { display: none; }
}

@media (max-width: 900px) {
  .pg-app { height: auto; min-height: 0; }
  .pg-work { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .pg-source .cm-host, .pg-source .cm-editor { min-height: 22rem; }
  .pg-results { flex-direction: column; }
  .pg-bar-note { margin-left: 0; width: 100%; }
  .mk-body { padding-top: 2.4rem; }

  /* The header keeps one row, and the navigation moves into the panel. */
  .masthead { flex-wrap: nowrap; gap: 0.45rem; }
  .brand { margin-right: auto; font-size: 1rem; }
  .nav-toggle { display: inline-flex; margin-left: 0; }
  .top-nav { width: auto; margin-left: 0; flex-wrap: nowrap; gap: 0.35rem; }
  .top-nav > a { display: none; }
  .search-trigger { padding: 0.4rem 0.55rem; }
  .search-trigger span,
  .search-trigger kbd { display: none; }
  .search-trigger .icon-search { display: block; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }

  /* The documentation index moves into the panel as well. */
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .docs-layout > .docs-sidebar { display: none; }
}

@media (min-width: 901px) {
  .mobile-panel { display: none !important; }
}

@media (max-width: 560px) {
  :root { --gutter: 1rem; }
  body { font-size: 16px; }
  .masthead { padding: 0.55rem var(--gutter); }
  main { padding: 1.6rem var(--gutter) 3rem; }
  .footer { padding: 1.8rem var(--gutter) 2.4rem; }
  .example { padding: 0.9rem 1rem; }
  .pg-pick select { min-width: 0; width: 100%; }
  .button { min-height: var(--tap); }
  .cta { gap: 0.6rem; }
  table { font-size: 0.88rem; }
  th, td { padding: 0.5rem 0.55rem; }
  .band-hero { padding: 3.4rem 0 3.2rem; }
  .cta-band { padding: 2.2rem 1.5rem; }
  .studio-head { flex-direction: column; gap: 0.5rem; }
  /* A table squeezed into a phone is unreadable; let it scroll instead. */
  .table-scroll table { min-width: 30rem; }
}

/*
 * A text table has no business being three columns on a phone, so each row
 * becomes a card and every cell carries the column it came from.
 */
@media (max-width: 700px) {
  .table-scroll:has(.compare-table) { overflow-x: visible; }
  .table-scroll table.compare-table { min-width: 0; }
  .compare-table,
  .compare-table tbody,
  .compare-table tr,
  .compare-table td { display: block; width: 100%; }
  .compare-table thead { display: none; }
  .compare-table tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 0.3rem 0.2rem;
    margin: 0 0 0.7rem;
  }
  .compare-table td { border: 0; padding: 0.4rem 0.85rem; }
  .compare-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
    font-weight: 700;
    margin-bottom: 0.1rem;
  }
  .compare-table td:first-child::before { color: var(--brand); }
}
