/*
 * Vitrine website. Every value comes from docs/DESIGN_SYSTEM.md (§2–§4, §9).
 * Fonts are self-hosted (SIL Open Font License 1.1): no third-party requests.
 */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-latin-400-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
}

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

/*
 * Site colors use --site-* names on purpose: --vt-* variables set on an ancestor override
 * every component theme (that is the theming contract), so the page must not set them.
 */

:root {
  --ink: #11151c;
  --paper: #f3f4f1;
  --teal: #14b8a6;
  --teal-deep: #0a6e6f;

  --site-bg: var(--paper);
  --site-surface: #ffffff;
  --site-surface-sunken: #eaece7;
  --site-border: #d6d9d2;
  --site-border-strong: #b9beb4;
  --site-fg: var(--ink);
  --site-fg-muted: #4a5260;
  --site-accent: var(--teal);
  --site-accent-fg: var(--teal-deep);
  --site-on-accent: var(--ink);
  --site-accent-soft: rgba(20, 184, 166, 0.12);
  --site-danger: #b2384f;

  --font-display: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --vt-font-mono: var(--font-display);

  --vt-text-display: clamp(2.5rem, 1.6rem + 3.6vw, 3.5rem);
  --vt-text-h1: clamp(2rem, 1.5rem + 2vw, 2.5rem);
  --vt-text-h2: clamp(1.5rem, 1.25rem + 1vw, 1.75rem);
  --vt-text-h3: 1.25rem;
  --vt-text-body: 1rem;
  --vt-text-small: 0.875rem;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 112px;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-full: 999px;

  --duration-fast: 120ms;
  --duration: 180ms;
  --easing: cubic-bezier(0.2, 0, 0, 1);

  --max-width: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

:root[data-theme='dark'] {
  --site-bg: var(--ink);
  --site-surface: #171c25;
  --site-surface-sunken: #0c0f14;
  --site-border: #262d3a;
  --site-border-strong: #3a4354;
  --site-fg: #e8eae6;
  --site-fg-muted: #9aa3b2;
  --site-accent-fg: var(--teal);
  --site-accent-soft: rgba(20, 184, 166, 0.16);
  --site-danger: #ff8f73;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --site-bg: var(--ink);
    --site-surface: #171c25;
    --site-surface-sunken: #0c0f14;
    --site-border: #262d3a;
    --site-border-strong: #3a4354;
    --site-fg: #e8eae6;
    --site-fg-muted: #9aa3b2;
    --site-accent-fg: var(--teal);
    --site-accent-soft: rgba(20, 184, 166, 0.16);
    --site-danger: #ff8f73;
    color-scheme: dark;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0ms;
    --duration: 0ms;
  }
}

/* ---------------------------------------------------------------- base */

[hidden] {
  display: none !important;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--site-bg);
  color: var(--site-fg);
  font: 400 var(--vt-text-body) / 1.65 var(--font-body);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--site-fg);
  text-wrap: balance;
}

h1 {
  font: 700 var(--vt-text-h1) / 1.1 var(--font-display);
  letter-spacing: -0.03em;
}

h2 {
  font: 700 var(--vt-text-h2) / 1.2 var(--font-display);
  letter-spacing: -0.02em;
}

h3 {
  font: 600 var(--vt-text-h3) / 1.3 var(--font-body);
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--site-accent-fg);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

code,
kbd {
  font-family: var(--font-display);
  font-size: 0.9em;
}

:not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
  background: var(--site-surface-sunken);
}

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

::selection {
  background: rgba(20, 184, 166, 0.28);
}

.wrap {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.prose {
  max-width: 72ch;
}

.muted {
  color: var(--site-fg-muted);
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: 100;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--site-accent);
  color: var(--site-on-accent);
  font-weight: 600;
}

.skip-link:focus {
  top: var(--space-3);
}

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

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--site-border);
  background: var(--site-bg);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  height: 64px;
}

.lockup {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 10px;
  color: var(--site-fg);
  text-decoration: none;
}

.lockup svg {
  width: 28px;
  height: 28px;
}

.lockup-word {
  font: 700 1.25rem/1 var(--font-display);
  letter-spacing: -0.04em;
}

.lockup-word span,
.cursor {
  color: var(--site-accent);
}

.site-nav {
  display: flex;
  flex: 1 1 auto;
  justify-content: flex-end;
  gap: var(--space-1);
}

.site-nav a {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--site-fg-muted);
  font-weight: 500;
  text-decoration: none;
  transition:
    color var(--duration-fast) var(--easing),
    background-color var(--duration-fast) var(--easing);
}

.site-nav a:hover {
  background: var(--site-accent-soft);
  color: var(--site-fg);
}

.site-nav a[aria-current='page'] {
  color: var(--site-fg);
  box-shadow: inset 0 -2px 0 var(--site-accent);
  border-radius: 0;
}

.icon-btn {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--site-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--site-fg-muted);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--easing);
}

.icon-btn:hover {
  background: var(--site-accent-soft);
  color: var(--site-fg);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.menu-btn {
  display: none;
}

@media (max-width: 860px) {
  .menu-btn {
    display: inline-grid;
    margin-left: auto;
  }

  .site-nav {
    position: absolute;
    top: 64px;
    right: 0;
    left: 0;
    display: none;
    flex-direction: column;
    padding: var(--space-3) var(--gutter) var(--space-5);
    border-bottom: 1px solid var(--site-border);
    background: var(--site-bg);
  }

  .site-nav.open {
    display: flex;
  }

  .site-nav a[aria-current='page'] {
    box-shadow: inset 2px 0 0 var(--site-accent);
  }
}

@media (pointer: coarse) {
  .icon-btn {
    width: 44px;
    height: 44px;
  }

  .site-nav a {
    padding-block: var(--space-3);
  }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0 var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: 600 1rem/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--easing);
}

.btn-primary {
  background: var(--site-accent);
  color: var(--site-on-accent);
}

.btn-primary:hover {
  background: #2dd4bf;
}

.btn-secondary {
  border-color: var(--site-border-strong);
  background: transparent;
  color: var(--site-fg);
}

.btn-secondary:hover {
  background: var(--site-accent-soft);
}

@media (pointer: coarse) {
  .btn {
    min-height: 44px;
  }
}

/* ---------------------------------------------------------------- segmented control */

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--site-border);
  border-radius: var(--radius-sm);
  background: var(--site-surface);
}

.segmented button {
  min-height: 32px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--site-fg-muted);
  font: 500 var(--vt-text-small) / 1 var(--font-body);
  cursor: pointer;
}

.segmented button:hover {
  color: var(--site-fg);
}

.segmented button[aria-pressed='true'],
.segmented button[aria-selected='true'] {
  background: var(--site-accent-soft);
  color: var(--site-fg);
}

/* ---------------------------------------------------------------- hero */

.hero {
  padding: var(--space-8) 0 var(--space-7);
}

.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: var(--space-7);
  align-items: center;
}

.hero .wrap > * {
  min-width: 0;
}

.display {
  font: 700 var(--vt-text-display) / 1.05 var(--font-display);
  letter-spacing: -0.04em;
}

.display .cursor {
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .display .cursor {
    animation: none;
  }
}

.lede {
  max-width: 46ch;
  margin-top: var(--space-5);
  color: var(--site-fg-muted);
  font-size: 1.125rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.install {
  margin-top: var(--space-5);
  max-width: 560px;
}

@media (max-width: 960px) {
  .hero .wrap {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------------------------------------------------------------- showcase (the one bold element) */

.showcase {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
  min-width: 0;
}

.showcase-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.swatches {
  display: flex;
  gap: var(--space-2);
}

.swatch {
  position: relative;
  width: 28px;
  height: 28px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--site-border-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
}

.swatch::before,
.swatch::after {
  content: '';
  position: absolute;
  inset: 0;
}

.swatch::before {
  background: var(--swatch-bg);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.swatch::after {
  background: var(--swatch-fg);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.swatch[aria-pressed='true'] {
  outline: 2px solid var(--site-accent);
  outline-offset: 2px;
}

.swatch[data-theme='light'] {
  --swatch-bg: #ffffff;
  --swatch-fg: #14b8a6;
}
.swatch[data-theme='paper'] {
  --swatch-bg: #fbf8f1;
  --swatch-fg: #a63148;
}
.swatch[data-theme='dim'] {
  --swatch-bg: #212a3a;
  --swatch-fg: #8faeff;
}
.swatch[data-theme='dark'] {
  --swatch-bg: #11151c;
  --swatch-fg: #14b8a6;
}
.swatch[data-theme='high-contrast'] {
  --swatch-bg: #000000;
  --swatch-fg: #ffd166;
}

/* Fixed stage height: switching content type never moves the page. */
.showcase-stage {
  min-height: 384px;
}

.showcase-stage > * {
  --vt-radius: var(--radius-lg);
}

.call span {
  flex: none;
}

.call {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  min-width: 0;
  color: var(--site-fg-muted);
  font-size: var(--vt-text-small);
}

.call code {
  min-width: 0;
  overflow: hidden;
  color: var(--site-fg);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------- sections */

.section {
  padding: var(--space-9) 0 0;
}

.section-head {
  display: grid;
  gap: var(--space-3);
  max-width: 64ch;
  margin-bottom: var(--space-6);
}

.section-head p {
  color: var(--site-fg-muted);
  font-size: 1.0625rem;
}

.components {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5);
}

.component {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: var(--space-3);
  padding: var(--space-5);
  border: 1px solid var(--site-border);
  border-radius: var(--radius-lg);
  background: var(--site-surface);
}

.component h3 {
  font: 700 1.125rem/1.3 var(--font-display);
  letter-spacing: -0.02em;
}

.component p {
  color: var(--site-fg-muted);
}

.component .preview {
  align-self: start;
}

@media (max-width: 960px) {
  .components {
    grid-template-columns: minmax(0, 1fr);
  }
}

.reasons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6) var(--space-7);
  margin: 0;
}

.reason {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: var(--space-1) var(--space-4);
}

.reason svg {
  grid-row: span 2;
  width: 28px;
  height: 28px;
  color: var(--site-accent-fg);
}

.reason dt {
  font: 600 1.0625rem/1.4 var(--font-body);
}

.reason dd {
  margin: 0;
  color: var(--site-fg-muted);
}

@media (max-width: 720px) {
  .reasons {
    grid-template-columns: minmax(0, 1fr);
  }
}

.install-tabs {
  display: grid;
  gap: var(--space-4);
  max-width: 820px;
}

.install-tabs [role='tabpanel'] {
  display: grid;
  gap: var(--space-3);
}

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

.site-footer {
  margin-top: var(--space-9);
  padding: var(--space-7) 0;
  background: var(--ink);
  color: var(--paper);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

.site-footer .lockup {
  color: var(--paper);
}

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

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
}

.site-footer p {
  color: #9aa3b2;
  font-size: var(--vt-text-small);
}

/* ---------------------------------------------------------------- inner pages */

.page-head {
  padding: var(--space-7) 0 var(--space-6);
}

.page-head p {
  max-width: 64ch;
  margin-top: var(--space-3);
  color: var(--site-fg-muted);
  font-size: 1.0625rem;
}

/* Docs: sidebar + content (DESIGN_SYSTEM §9 layout). */
.docs {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: var(--space-7);
  padding-top: var(--space-6);
}

.docs-nav {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 104px);
  overflow: auto;
}

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

.docs-nav li + li {
  margin-top: 2px;
}

.docs-nav a {
  display: block;
  padding: 6px var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--site-fg-muted);
  text-decoration: none;
}

.docs-nav a:hover {
  background: var(--site-accent-soft);
  color: var(--site-fg);
}

.docs-nav a[aria-current='page'] {
  background: var(--site-accent-soft);
  color: var(--site-fg);
  font-weight: 500;
}

.docs-nav .group {
  margin: var(--space-4) 0 var(--space-1);
  padding: 0 var(--space-3);
  color: var(--site-fg-muted);
  font-size: var(--vt-text-small);
  font-weight: 600;
}

.docs-content vt-markdown {
  --vt-font-size-body: 1rem;
  max-width: 80ch;
}

@media (max-width: 960px) {
  .docs {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
  }

  .docs-nav {
    position: static;
    max-height: none;
  }
}

/* Examples: live result next to the markup that produced it. */
.example-group {
  padding-top: var(--space-7);
}

.example-group > h2 {
  margin-bottom: var(--space-2);
}

.example {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-5);
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--site-border);
}

.example-text {
  grid-column: 1 / -1;
  max-width: 72ch;
}

.example-text h3 {
  margin-bottom: var(--space-1);
}

.example-text p {
  color: var(--site-fg-muted);
}

@media (max-width: 960px) {
  .example {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Playground. */
.playground {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.controls {
  position: sticky;
  top: 88px;
  display: grid;
  gap: var(--space-5);
  max-height: calc(100vh - 104px);
  overflow: auto;
  padding: var(--space-5);
  border: 1px solid var(--site-border);
  border-radius: var(--radius-lg);
  background: var(--site-surface);
}

.controls fieldset {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  border: 0;
}

.controls legend {
  margin-bottom: var(--space-2);
  font-weight: 600;
}

.field {
  display: grid;
  gap: var(--space-1);
  font-size: var(--vt-text-small);
}

.field > span {
  color: var(--site-fg-muted);
}

.field input[type='text'],
.field input[type='search'],
.field input[type='number'],
.field select,
.field textarea {
  width: 100%;
  min-height: 36px;
  padding: var(--space-2);
  border: 1px solid var(--site-border-strong);
  border-radius: var(--radius-sm);
  background: var(--site-surface-sunken);
  color: var(--site-fg);
  font: inherit;
}

.field textarea {
  min-height: 160px;
  font: 400 13px/1.5 var(--font-display);
  resize: vertical;
}

.check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--vt-text-small);
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--site-accent);
}

.check code {
  font-size: 0.85em;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2) var(--space-3);
}

.playground > *,
.builder > * {
  min-width: 0;
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
}

@media (max-width: 960px) {
  .playground {
    grid-template-columns: minmax(0, 1fr);
  }

  .controls {
    position: static;
    max-height: none;
  }
}

/* Themes. */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: var(--space-5);
}

.theme-card {
  display: grid;
  gap: var(--space-3);
}

.theme-card h3 {
  font: 700 1rem/1.3 var(--font-display);
}

.builder {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.color-field {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--vt-text-small);
}

.color-field input[type='color'] {
  width: 36px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--site-border-strong);
  border-radius: var(--radius-sm);
  background: var(--site-surface);
  cursor: pointer;
}

@media (max-width: 960px) {
  .builder {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Stress lab. */
.lab {
  display: grid;
  gap: var(--space-5);
}

.trials {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: var(--space-3);
}

.trial {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--site-border);
  border-radius: var(--radius);
  background: var(--site-surface);
  color: var(--site-fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--easing);
}

.trial:hover {
  border-color: var(--site-accent);
}

.trial[aria-pressed='true'] {
  border-color: var(--site-accent);
  background: var(--site-accent-soft);
}

.trial strong {
  font-weight: 600;
}

.trial span {
  color: var(--site-fg-muted);
  font-size: var(--vt-text-small);
}

.verdict {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--site-border);
  border-radius: var(--radius);
  background: var(--site-surface);
  font-size: var(--vt-text-small);
}

.verdict b {
  font-family: var(--font-display);
  font-weight: 500;
}

.verdict .ok {
  color: var(--site-accent-fg);
}

.verdict .bad {
  color: var(--site-danger);
}

/* Used by the "theme and custom properties" example. */
.brand-example {
  --vt-accent: #7c9cff;
  --vt-accent-fg: #7c9cff;
  --vt-radius: 4px;
}

.example-live {
  display: grid;
  align-content: start;
  gap: var(--space-3);
  min-width: 0;
}

.controls .hint {
  color: var(--site-fg-muted);
  font-size: 0.8125rem;
}

.flag-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

/* Used by the "custom look" tags example. */
.square-tags {
  --vt-tag-radius: 4px;
}

.square-tags::part(tag-kind-danger) {
  font-weight: 700;
}

/* Section shortcuts at the top of long pages. */
.jump {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.jump a {
  padding: 4px var(--space-3);
  border: 1px solid var(--site-border);
  border-radius: var(--radius-full);
  color: var(--site-fg);
  font-size: var(--vt-text-small);
  text-decoration: none;
}

.jump a:hover {
  border-color: var(--site-accent);
  background: var(--site-accent-soft);
}

/* Integrations: framework snippets and the live binding demo. */
.integration {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-7) 0 0;
}

.integration > p {
  max-width: 72ch;
  color: var(--site-fg-muted);
}

.binding {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

@media (max-width: 860px) {
  .binding {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Syntax theme explorer. */
.syntax-explorer {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.syntax-explorer > * {
  min-width: 0;
}

.syntax-controls {
  position: sticky;
  top: 88px;
  display: grid;
  gap: var(--space-3);
}

.syntax-list {
  max-height: min(60vh, 560px);
  margin: 0;
  padding: var(--space-1);
  overflow: auto;
  border: 1px solid var(--site-border);
  border-radius: var(--radius);
  background: var(--site-surface);
  list-style: none;
}

.syntax-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  padding: 6px var(--space-2);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--site-fg);
  font: 400 var(--vt-text-small) / 1.4 var(--font-display);
  text-align: left;
  cursor: pointer;
}

.syntax-list button:hover {
  background: var(--site-accent-soft);
}

.syntax-list button[aria-pressed='true'] {
  background: var(--site-accent-soft);
  font-weight: 700;
}

.syntax-list .ratio {
  flex: none;
  color: var(--site-fg-muted);
  font-size: 0.75rem;
}

.syntax-list .ratio.ok {
  color: var(--site-accent-fg);
}

@media (max-width: 960px) {
  .syntax-explorer {
    grid-template-columns: minmax(0, 1fr);
  }

  .syntax-controls {
    position: static;
  }
}

/* ---------------------------------------------------------------- brand effects */

/* The hero types itself once, in the brand's mono face, ending on the blinking cursor. */
.type-line {
  display: inline-block;
  clip-path: inset(0 100% 0 0);
  animation: type-in 900ms steps(16, end) 150ms forwards;
}

.type-line.second {
  animation-duration: 600ms;
  animation-timing-function: steps(9, end);
  animation-delay: 1100ms;
}

@keyframes type-in {
  to {
    clip-path: inset(0 0 0 0);
  }
}

/* The logo redraws its V when pointed at, like the component loader. */
.lockup .mark-v {
  stroke-dasharray: 100;
}

.lockup:hover .mark-v,
.lockup:focus-visible .mark-v {
  animation: mark-draw 700ms var(--easing);
}

.lockup:hover .mark-dot,
.lockup:focus-visible .mark-dot {
  animation: mark-pulse 700ms var(--easing);
  transform-origin: 29px 29px;
}

@keyframes mark-draw {
  from {
    stroke-dashoffset: 100;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes mark-pulse {
  50% {
    opacity: 0.35;
    transform: scale(0.75);
  }
}

/* Section titles end with the brand cursor. */
.section-head h2::after {
  content: '_';
  color: var(--teal);
}

/* Component cards are drawn as windows: title bar and status dot, like the mark. */
.component {
  position: relative;
  padding-top: calc(var(--space-5) + 18px);
  transition: border-color var(--duration) var(--easing);
}

.component::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 18px;
  border-bottom: 1px solid var(--site-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.component::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 14px;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--teal);
}

.component:hover {
  border-color: var(--teal);
}

.component:hover::before {
  border-bottom-color: var(--teal);
}

/* Switching the showcase content. */
.showcase-stage > .entering {
  animation: window-in var(--duration) var(--easing);
}

@keyframes window-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .type-line {
    clip-path: none;
    animation: none;
  }

  .lockup .mark-v,
  .lockup .mark-dot,
  .showcase-stage > .entering {
    animation: none !important;
  }
}

/* ================================================================ motion
 * One system for the whole site: content rises in as it is reached, controls answer
 * the pointer, the header settles when the page scrolls, the theme switch spreads from
 * its button, and pages crossfade. Everything here is off with reduced motion: the
 * `motion` class is only set when the system allows it (theme-init.js).
 */

@view-transition {
  navigation: auto;
}

.site-header {
  view-transition-name: site-header;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 260ms;
  animation-timing-function: var(--easing);
}

/* The theme switch draws its own circular reveal (site.js). */
.theme-switching::view-transition-old(root),
.theme-switching::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

.theme-switching::view-transition-old(site-header),
.theme-switching::view-transition-new(site-header) {
  animation: none;
}

/* ---------- Reveal on scroll ---------- */

.motion [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 520ms var(--easing),
    transform 620ms var(--easing);
  transition-delay: var(--reveal-delay, 0ms);
  /* Safety net: shown after 2 s even if the script never runs. */
  animation: reveal-failsafe 0ms 2s forwards;
}

.motion [data-reveal].is-visible {
  opacity: 1;
  transform: none;
  transition:
    opacity 520ms var(--easing) var(--reveal-delay, 0ms),
    transform 620ms var(--easing) var(--reveal-delay, 0ms);
  animation: none;
}

@keyframes reveal-failsafe {
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Header ---------- */

.site-header {
  transition:
    background-color var(--duration) var(--easing),
    box-shadow var(--duration) var(--easing),
    border-color var(--duration) var(--easing);
}

.site-header.scrolled {
  border-bottom-color: transparent;
  background: color-mix(in srgb, var(--site-bg) 82%, transparent);
  box-shadow:
    0 1px 0 var(--site-border),
    0 8px 24px rgba(17, 21, 28, 0.06);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}

.scroll-progress {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--teal-deep), var(--teal));
  transform: scaleX(var(--progress, 0));
  transform-origin: 0 50%;
  pointer-events: none;
}

.site-nav a {
  position: relative;
}

.motion .site-nav a::after {
  content: '';
  position: absolute;
  right: 10px;
  bottom: 6px;
  left: 10px;
  height: 2px;
  border-radius: 2px;
  background: var(--site-accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 260ms var(--easing);
}

.motion .site-nav a:hover::after,
.motion .site-nav a[aria-current='page']::after {
  transform: scaleX(1);
}

/* ---------- Controls ---------- */

.motion .btn {
  transition:
    background-color var(--duration-fast) var(--easing),
    border-color var(--duration-fast) var(--easing),
    box-shadow var(--duration) var(--easing),
    transform var(--duration) var(--easing);
}

.motion .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(10, 110, 111, 0.18);
}

.motion .btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: none;
}

.motion .btn-secondary:hover {
  border-color: var(--site-accent);
}

.motion .icon-btn,
.motion .segmented button,
.motion .swatch {
  transition:
    background-color var(--duration-fast) var(--easing),
    color var(--duration-fast) var(--easing),
    transform var(--duration) var(--easing);
}

.motion .icon-btn:active,
.motion .segmented button:active,
.motion .swatch:active {
  transform: scale(0.94);
}

.motion .theme-btn svg {
  transition: transform 500ms var(--easing);
}

.motion .theme-btn:hover svg {
  transform: rotate(-25deg);
}

/* ---------- Cards ---------- */

.motion .component,
.motion .reason,
.motion .integration {
  transition:
    border-color var(--duration) var(--easing),
    box-shadow 320ms var(--easing),
    transform 320ms var(--easing),
    opacity 520ms var(--easing);
}

.motion .component:hover {
  border-color: color-mix(in srgb, var(--site-accent) 55%, var(--site-border));
  box-shadow: 0 14px 36px rgba(17, 21, 28, 0.08);
  transform: translateY(-3px);
}

.motion .component::after {
  transition: box-shadow 320ms var(--easing);
}

.motion .component:hover::after {
  box-shadow: 0 0 0 4px var(--site-accent-soft);
}

.motion .reason svg {
  transition: transform 420ms var(--easing);
}

.motion .reason:hover svg {
  transform: translateY(-2px) scale(1.06);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  overflow-x: clip;
}

.motion .hero::before {
  content: '';
  position: absolute;
  inset: -20% -10% auto auto;
  z-index: -1;
  width: min(720px, 80vw);
  aspect-ratio: 1;
  border-radius: 50%;
  /* A soft gradient on its own: a blur filter here overloads WebKit with the backdrop. */
  background: radial-gradient(closest-side, rgba(20, 184, 166, 0.16), transparent 72%);
  animation: hero-drift 18s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes hero-drift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(-12%, 10%) scale(1.15);
  }
}

/* ---------- Section menus: the section being read ---------- */

.jump a {
  transition:
    color var(--duration-fast) var(--easing),
    background-color var(--duration) var(--easing),
    border-color var(--duration) var(--easing);
}

.jump a[aria-current='location'] {
  border-color: var(--site-accent);
  background: var(--site-accent-soft);
  color: var(--site-accent-fg);
}

/* ---------- Docs page changes ---------- */

.motion vt-markdown.switching {
  animation: docs-in 360ms var(--easing);
}

@keyframes docs-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }

  .motion [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Backdrop: a quiet living graph behind every page (backdrop.js) ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* A faint dot grid, like graph paper, under the drawing. */
  background-image: radial-gradient(
    color-mix(in srgb, var(--site-fg) 14%, transparent) 1px,
    transparent 1.2px
  );
  background-size: 28px 28px;
  /* Strongest at the top and edges, lighter where text sits. */
  -webkit-mask-image: radial-gradient(
    ellipse 120% 100% at 50% 0%,
    #000 35%,
    rgba(0, 0, 0, 0.45) 100%
  );
  mask-image: radial-gradient(ellipse 120% 100% at 50% 0%, #000 35%, rgba(0, 0, 0, 0.45) 100%);
}

@media print {
  .backdrop {
    display: none;
  }
}

/* ======================================================================
 * One design language for every page.
 * Controls share one height scale, one radius scale and one focus ring;
 * every code sample sits in a "demo window" with its result.
 * ====================================================================== */

:root {
  --control: 40px;
  --control-sm: 32px;
  --ring: 0 0 0 3px color-mix(in srgb, var(--site-accent) 32%, transparent);
  --shadow-sm: 0 1px 2px rgba(17, 21, 28, 0.05);
  --shadow-md: 0 1px 2px rgba(17, 21, 28, 0.04), 0 10px 30px rgba(17, 21, 28, 0.07);
  --header-h: 64px;
}

:root[data-theme='dark'] {
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
  }
}

/* ---------- Focus: the same ring everywhere ---------- */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--site-accent);
  outline-offset: 2px;
}

/* ---------- Buttons ---------- */

.btn {
  min-height: var(--control);
  padding: 0 18px;
  border-radius: var(--radius);
  font: 600 0.9375rem/1 var(--font-body);
  letter-spacing: -0.005em;
  white-space: nowrap;
}

.btn-primary {
  border-color: transparent;
  background: var(--site-accent);
  color: var(--site-on-accent);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--site-accent) 88%, #ffffff);
}

.btn-secondary {
  border-color: var(--site-border-strong);
  background: var(--site-surface);
  color: var(--site-fg);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  border-color: var(--site-accent);
  color: var(--site-accent-fg);
}

.icon-btn {
  width: var(--control);
  height: var(--control);
  border-radius: var(--radius);
}

/* ---------- Chips: section menus and filters ---------- */

.jump a {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-sm);
  padding: 0 14px;
  border: 1px solid var(--site-border);
  border-radius: var(--radius-full);
  background: var(--site-surface);
  color: var(--site-fg);
  font-size: var(--vt-text-small);
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.jump a:hover {
  border-color: var(--site-accent);
  color: var(--site-accent-fg);
}

/* The section menu sticks under the header and scrolls sideways on small screens. */
.subnav {
  position: sticky;
  top: var(--header-h);
  z-index: 15;
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-2);
  margin: 0 calc(-1 * var(--gutter)) var(--space-4);
  padding: 10px var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
  background: color-mix(in srgb, var(--site-bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 var(--gutter),
    #000 calc(100% - var(--gutter)),
    transparent
  );
}

.subnav::-webkit-scrollbar {
  display: none;
}

/* ---------- Segmented controls ---------- */

.segmented {
  display: inline-flex;
  flex-wrap: nowrap;
  max-width: 100%;
  gap: 2px;
  padding: 3px;
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid var(--site-border);
  border-radius: calc(var(--radius) + 2px);
  background: var(--site-surface);
  box-shadow: var(--shadow-sm);
}

.segmented button {
  min-height: var(--control-sm);
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--site-fg-muted);
  font: 500 var(--vt-text-small) / 1 var(--font-body);
  white-space: nowrap;
  cursor: pointer;
}

.segmented button:hover {
  color: var(--site-fg);
  background: var(--site-surface-sunken);
}

.segmented button[aria-pressed='true'],
.segmented button[aria-selected='true'] {
  background: var(--site-accent-soft);
  color: var(--site-accent-fg);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--site-accent) 35%, transparent);
}

/* ---------- Form fields ---------- */

.field {
  gap: 6px;
}

.field > span {
  font-weight: 500;
}

.field input[type='text'],
.field input[type='search'],
.field input[type='number'],
.field select,
.field textarea {
  min-height: var(--control);
  padding: 0 12px;
  border: 1px solid var(--site-border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--site-surface);
  color: var(--site-fg);
  font: 400 0.9375rem/1.4 var(--font-body);
  box-shadow: var(--shadow-sm);
  transition:
    border-color var(--duration-fast) var(--easing),
    box-shadow var(--duration-fast) var(--easing);
}

.field textarea {
  padding: 10px 12px;
  font: 400 13px/1.55 var(--font-display);
}

.field select {
  padding-right: 34px;
  appearance: none;
  -webkit-appearance: none;
  /* A chevron drawn in the text color, light or dark. */
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 52%,
    calc(100% - 13px) 52%;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.field :is(input, select, textarea):hover {
  border-color: color-mix(in srgb, var(--site-accent) 45%, var(--site-border-strong));
}

.field :is(input, select, textarea):focus-visible {
  outline: none;
  border-color: var(--site-accent);
  box-shadow: var(--ring);
}

.controls legend {
  font: 700 0.8125rem/1.3 var(--font-display);
  letter-spacing: 0;
}

/* The playground panel scrolls inside itself, with room at the bottom. */
.controls {
  max-height: calc(100vh - var(--header-h) - 40px);
  padding-bottom: var(--space-6);
  box-shadow: var(--shadow-md);
  scrollbar-width: thin;
}

/* ---------- Page heads ---------- */

.page-head {
  padding: clamp(40px, 7vw, 80px) 0 clamp(20px, 3vw, 32px);
}

.page-head h1 {
  font: 700 var(--vt-text-display) / 1.05 var(--font-display);
  letter-spacing: -0.04em;
}

.page-head h1::after {
  content: '_';
  color: var(--site-accent);
}

.page-head p {
  margin-top: var(--space-3);
  font-size: 1.125rem;
  line-height: 1.6;
}

/* ---------- Demo windows: a result and the code that renders it ---------- */

.demo {
  overflow: hidden;
  border: 1px solid var(--site-border);
  border-radius: var(--radius-lg);
  background: var(--site-surface);
  box-shadow: var(--shadow-md);
}

.demo-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 38px;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--site-border);
  background: var(--site-surface);
  color: var(--site-fg-muted);
  font: 500 0.75rem/1 var(--font-display);
  letter-spacing: 0.02em;
}

.demo-dots {
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: 28px;
  border-radius: 50%;
  background: var(--site-accent);
  box-shadow:
    14px 0 0 var(--site-border-strong),
    28px 0 0 var(--site-border-strong);
}

.demo-canvas {
  display: grid;
  align-content: center;
  gap: var(--space-4);
  min-height: 120px;
  padding: clamp(16px, 3vw, 32px);
  /* Graph paper: the same grid as the page backdrop. */
  background-color: var(--site-bg);
  background-image: radial-gradient(
    color-mix(in srgb, var(--site-fg) 13%, transparent) 1px,
    transparent 1.2px
  );
  background-size: 20px 20px;
}

.demo-code::part(container) {
  border: 0;
  border-top: 1px solid var(--site-border);
  border-radius: 0;
}

/* Examples: the explanation, then the window, full width. */
.example {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-6) 0;
  border-bottom: 0;
}

.example-group {
  padding-top: var(--space-6);
}

.example-group > h2 {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--site-border);
  font-size: var(--vt-text-h2);
}

.example-text h3 {
  font-size: 1.125rem;
}

/* ---------- Home ---------- */

.components .preview {
  max-height: 230px;
  overflow: hidden;
  border-radius: var(--radius);
  -webkit-mask-image: linear-gradient(#000 82%, transparent);
  mask-image: linear-gradient(#000 82%, transparent);
}

.install-tabs {
  display: grid;
  gap: var(--space-4);
  max-width: 920px;
}

/* On narrow screens the typed title is plain text, so the cursor stays with its word. */
@media (max-width: 640px) {
  .type-line {
    display: inline;
    width: auto !important;
    animation: none !important;
    overflow: visible;
    white-space: normal;
  }

  .section {
    padding: var(--space-7) 0;
  }

  .hero {
    padding-bottom: var(--space-6);
  }
}

/* ---------- Lab ---------- */

.trial {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-4) var(--space-3);
  border: 1px solid var(--site-border);
  border-radius: var(--radius-lg);
  background: var(--site-surface);
  color: var(--site-fg);
  text-align: left;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.trial strong {
  font: 700 0.9375rem/1.3 var(--font-display);
  letter-spacing: -0.01em;
}

.trial-run {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--site-accent-fg);
  font: 600 var(--vt-text-small) / 1 var(--font-body);
}

.trial-run::before {
  content: '';
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid currentColor;
}

.trial:hover {
  border-color: var(--site-accent);
}

.trial[aria-pressed='true'] {
  border-color: var(--site-accent);
  background: color-mix(in srgb, var(--site-accent-soft) 60%, var(--site-surface));
  box-shadow: var(--ring);
}

.verdict {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ---------- Footer ---------- */

.site-footer {
  position: relative;
  margin-top: var(--space-9);
  padding: var(--space-8) 0 var(--space-6);
  overflow: hidden;
}

.site-footer::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
  opacity: 0.6;
}

.site-footer .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr);
  gap: var(--space-6) var(--space-7);
  align-items: start;
}

.footer-tagline {
  grid-column: 1;
  max-width: 34ch;
  margin-top: calc(-1 * var(--space-4));
  color: #9aa3b2;
}

.footer-cols {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5);
}

.footer-cols div {
  display: grid;
  gap: 10px;
  align-content: start;
}

.footer-cols h2 {
  margin: 0 0 4px;
  color: var(--paper);
  font: 700 0.8125rem/1.2 var(--font-display);
  letter-spacing: 0;
}

.site-footer .footer-cols a {
  color: #b9c0cc;
  text-decoration: none;
  transition: color var(--duration-fast) var(--easing);
}

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

.footer-legal {
  grid-column: 1 / -1;
  padding-top: var(--space-5);
  border-top: 1px solid rgba(232, 234, 230, 0.1);
}

@media (max-width: 760px) {
  .site-footer .wrap {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer-tagline,
  .footer-cols {
    grid-column: 1;
    grid-row: auto;
    margin-top: 0;
  }
}

/* ======================================================================
 * Typography, home rhythm, site search and back to top.
 * ====================================================================== */

/* ---------- Navigation: one highlight, a pill (no underline) ---------- */

.site-nav a,
.site-nav a[aria-current='page'] {
  border-radius: var(--radius-full);
  box-shadow: none;
}

.motion .site-nav a::after {
  content: none;
}

.site-nav a {
  padding: 7px 14px;
  font-size: 0.9375rem;
}

.site-nav a:hover {
  background: color-mix(in srgb, var(--site-fg) 6%, transparent);
}

.site-nav a[aria-current='page'] {
  background: var(--site-accent-soft);
  color: var(--site-accent-fg);
  font-weight: 600;
}

@media (max-width: 860px) {
  .site-nav a[aria-current='page'] {
    box-shadow: none;
  }
}

/* ---------- Type scale ---------- */

body {
  font-size: 1.0625rem;
  line-height: 1.7;
}

.display {
  font: 700 clamp(3rem, 1.6rem + 5.6vw, 6.25rem) / 0.95 var(--font-display);
  letter-spacing: -0.055em;
}

.page-head h1 {
  font: 700 clamp(2.75rem, 1.7rem + 4.4vw, 5.25rem) / 0.98 var(--font-display);
  letter-spacing: -0.05em;
}

.section-head h2,
.cta h2 {
  max-width: 20ch;
  font: 700 clamp(2.1rem, 1.4rem + 2.8vw, 3.6rem) / 1.02 var(--font-display);
  letter-spacing: -0.045em;
}

.example-group > h2 {
  font: 700 clamp(1.6rem, 1.2rem + 1.4vw, 2.25rem) / 1.1 var(--font-display);
  letter-spacing: -0.035em;
}

/* Titles get depth: full ink at the top, a touch lighter at the bottom. */
:is(.display, .page-head h1, .section-head h2, .cta h2) {
  background: linear-gradient(
    180deg,
    var(--site-fg) 35%,
    color-mix(in srgb, var(--site-fg) 72%, var(--site-accent-fg))
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

:is(.display, .page-head h1, .section-head h2, .cta h2) :is(.cursor, code),
.page-head h1::after,
.section-head h2::after {
  -webkit-text-fill-color: var(--site-accent);
}

h3 {
  font: 600 1.25rem/1.3 var(--font-body);
  letter-spacing: -0.012em;
}

.lede,
.section-head p,
.page-head p,
.cta p {
  color: var(--site-fg-muted);
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  line-height: 1.65;
}

.section-head p,
.page-head p {
  max-width: 58ch;
}

/* ---------- Titles rising word by word ---------- */

.words .word {
  display: inline-block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
  vertical-align: bottom;
}

.words .word > * {
  display: inline-block;
  transform: translateY(105%);
  transition: transform 720ms cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--i, 0) * 55ms);
}

.words.words-in .word > * {
  transform: none;
}

/* Gradient text must be painted by each word box once split. */
.words .word > * {
  background: inherit;
  -webkit-background-clip: text;
  background-clip: text;
}

/* ---------- Cards and blocks: a clearer entrance ---------- */

.motion [data-reveal] {
  /* No blur filter: with the animated backdrop it overloads WebKit's compositor. */
  transform: translateY(28px) scale(0.985);
}

.motion [data-reveal].is-visible {
  transform: none;
  transition:
    opacity 700ms var(--easing) var(--reveal-delay, 0ms),
    transform 800ms cubic-bezier(0.16, 1, 0.3, 1) var(--reveal-delay, 0ms);
}

/* ---------- Home ---------- */

.hero {
  display: grid;
  align-items: center;
  min-height: calc(100svh - var(--header-h));
  padding: clamp(48px, 8vw, 112px) 0 clamp(72px, 9vw, 128px);
}

.hero .wrap {
  gap: clamp(40px, 6vw, 96px);
}

.display .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
}

.display .line > span {
  display: inline-block;
  background: inherit;
  -webkit-background-clip: text;
  background-clip: text;
}

.hero .lede {
  max-width: 46ch;
  margin-top: var(--space-5);
}

.hero-actions {
  margin-top: var(--space-6);
}

.hero .install {
  margin-top: var(--space-5);
}

/* Entrance: title lines, then text, buttons, install line and the window. */
.motion .display .line > span {
  transform: translateY(110%);
  animation: rise 900ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.motion .display .line:nth-child(2) > span {
  animation-delay: 110ms;
}

.motion .display .line:nth-child(3) > span {
  animation-delay: 220ms;
}

.motion .hero .intro {
  opacity: 0;
  animation: fade-up 800ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.motion .hero .lede.intro {
  animation-delay: 420ms;
}

.motion .hero .hero-actions.intro {
  animation-delay: 540ms;
}

.motion .hero .install.intro {
  animation-delay: 660ms;
}

.motion .hero .showcase.intro {
  animation: window-rise 1100ms cubic-bezier(0.16, 1, 0.3, 1) 380ms forwards;
}

@keyframes rise {
  to {
    transform: none;
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes window-rise {
  from {
    opacity: 0;
    transform: perspective(1400px) translateY(40px) rotateX(10deg) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 50%;
  display: grid;
  place-items: center;
  width: 28px;
  height: 44px;
  margin-left: -14px;
  border: 1.5px solid var(--site-border-strong);
  border-radius: 14px;
}

.scroll-cue span {
  width: 3px;
  height: 8px;
  border-radius: 2px;
  background: var(--site-accent);
}

.motion .scroll-cue span {
  animation: cue 1.8s ease-in-out infinite;
}

@keyframes cue {
  0% {
    opacity: 0;
    transform: translateY(-8px);
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(10px);
  }
}

.section {
  padding: clamp(88px, 11vw, 168px) 0 0;
}

.section-head {
  display: grid;
  gap: var(--space-4);
  margin-bottom: clamp(32px, 5vw, 56px);
}

.components {
  gap: clamp(16px, 2vw, 28px);
}

.component {
  padding: var(--space-6);
}

.reasons {
  gap: clamp(28px, 4vw, 56px) clamp(32px, 5vw, 72px);
}

.cta {
  padding: clamp(96px, 12vw, 176px) 0 0;
  text-align: center;
}

.cta .wrap {
  display: grid;
  justify-items: center;
  gap: var(--space-5);
}

.cta h2 {
  max-width: 16ch;
  margin: 0 auto;
}

.cta p {
  max-width: 52ch;
}

.cta .hero-actions {
  justify-content: center;
  margin-top: var(--space-2);
}

@media (max-width: 860px) {
  .hero {
    min-height: 0;
  }

  .scroll-cue {
    display: none;
  }
}

/* ---------- Search ---------- */

.search-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: var(--control);
  margin-left: auto;
  padding: 0 8px 0 12px;
  border: 1px solid var(--site-border);
  border-radius: var(--radius);
  background: var(--site-surface);
  color: var(--site-fg-muted);
  font: 500 0.875rem/1 var(--font-body);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--easing),
    color var(--duration-fast) var(--easing);
}

.search-btn:hover {
  border-color: var(--site-accent);
  color: var(--site-fg);
}

.search-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
}

.search-btn .search-label {
  min-width: 7ch;
  text-align: left;
}

.search-btn kbd,
.search-hint {
  font: 500 0.6875rem/1 var(--font-display);
}

.search-btn kbd {
  padding: 4px 6px;
  border: 1px solid var(--site-border);
  border-radius: 6px;
  background: var(--site-surface-sunken);
  color: var(--site-fg-muted);
}

.site-header .site-nav {
  margin-left: auto;
}

.site-header .search-btn + .theme-btn,
.site-nav + .search-btn {
  margin-left: 0;
}

@media (max-width: 1100px) {
  .search-btn .search-label,
  .search-btn kbd {
    display: none;
  }

  .search-btn {
    width: var(--control);
    padding: 0;
    justify-content: center;
  }
}

.search-dialog {
  width: min(640px, calc(100vw - 24px));
  max-height: min(560px, calc(100svh - 120px));
  margin: 12vh auto auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--site-border);
  border-radius: var(--radius-lg);
  background: var(--site-surface);
  color: var(--site-fg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.search-dialog::backdrop {
  background: color-mix(in srgb, var(--ink) 45%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.motion .search-dialog[open] {
  animation: dialog-in 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}

.search-box {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: inherit;
}

.search-box input {
  width: 100%;
  height: 58px;
  padding: 0 20px 0 52px;
  border: 0;
  border-bottom: 1px solid var(--site-border);
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2314b8a6' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M21 21l-4.3-4.3M11 18a7 7 0 1 1 0-14 7 7 0 0 1 0 14Z'/%3E%3C/svg%3E")
    20px 50% / 18px no-repeat;
  color: var(--site-fg);
  font: 400 1.0625rem/1 var(--font-body);
}

.search-box input:focus-visible {
  outline: none;
}

.search-results {
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  list-style: none;
}

.search-results a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--site-fg);
  text-decoration: none;
}

.search-results [aria-selected='true'] a {
  background: var(--site-accent-soft);
  box-shadow: inset 3px 0 0 var(--site-accent);
}

.search-title {
  overflow: hidden;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.search-where {
  flex: none;
  color: var(--site-fg-muted);
  font: 500 0.75rem/1 var(--font-display);
}

.search-empty {
  padding: 24px 12px;
  color: var(--site-fg-muted);
  text-align: center;
}

.search-hint {
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--site-border);
  color: var(--site-fg-muted);
}

/* ---------- Back to top ---------- */

.to-top {
  position: fixed;
  right: clamp(16px, 3vw, 32px);
  bottom: clamp(16px, 3vw, 32px);
  z-index: 30;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--site-surface);
  color: var(--site-fg);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  transform: translateY(16px) scale(0.9);
  pointer-events: none;
  transition:
    opacity 300ms var(--easing),
    transform 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

.to-top.shown {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.to-top:hover {
  color: var(--site-accent-fg);
}

.to-top svg {
  width: 48px;
  height: 48px;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.to-top path {
  stroke: currentColor;
  stroke-width: 2.4;
}

.to-top-track {
  stroke: var(--site-border);
  stroke-width: 2.5;
}

.to-top-ring {
  stroke: var(--site-accent);
  stroke-width: 2.5;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

@media (prefers-reduced-motion: reduce) {
  .motion .display .line > span,
  .motion .hero .intro {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* Gradient titles: every animated box repaints the gradient through its own glyphs. */
.display .line,
.words .word {
  background: inherit;
  -webkit-background-clip: text;
  background-clip: text;
}

.search-box input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* ---------- Legal page ---------- */

.legal {
  display: grid;
  gap: var(--space-5);
  max-width: 820px;
}

.legal-card {
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid var(--site-border);
  border-radius: var(--radius-lg);
  background: var(--site-surface);
  box-shadow: var(--shadow-sm);
  scroll-margin-top: calc(var(--header-h) + 72px);
}

.legal-card h2 {
  margin-bottom: var(--space-4);
  font: 700 clamp(1.5rem, 1.2rem + 1vw, 2rem) / 1.15 var(--font-display);
  letter-spacing: -0.035em;
}

.legal-card h3 {
  margin: var(--space-5) 0 var(--space-2);
  font-size: 1.0625rem;
}

.legal-card p {
  max-width: 68ch;
  color: var(--site-fg-muted);
}

.legal-card a {
  color: var(--site-accent-fg);
}

.legal-facts {
  display: grid;
  gap: var(--space-3);
  margin: 0;
}

.legal-facts div {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--site-border);
}

.legal-facts div:last-child {
  border-bottom: 0;
}

.legal-facts dt {
  font-weight: 600;
}

.legal-facts dd {
  margin: 0;
  color: var(--site-fg-muted);
}

@media (max-width: 560px) {
  .legal-facts div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}

.footer-cols {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 560px) {
  .footer-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Theme button: the moon switches to dark, the sun back to light ---------- */

.theme-btn .sun {
  display: none;
}

:root[data-theme='dark'] .theme-btn .sun {
  display: block;
}

:root[data-theme='dark'] .theme-btn .moon {
  display: none;
}

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

  :root:not([data-theme='light']) .theme-btn .moon {
    display: none;
  }
}

.motion .theme-btn:hover .sun {
  transform: rotate(45deg);
}

/* ---------- Section list (examples) ---------- */

.section-menu {
  align-items: center;
  gap: var(--space-3);
}

.section-menu label {
  color: var(--site-fg-muted);
  font-size: var(--vt-text-small);
}

.section-menu select {
  min-width: 14rem;
  min-height: var(--control-sm);
  padding: 0 var(--space-3);
  border: 1px solid var(--site-border);
  border-radius: var(--radius-full);
  background: var(--site-surface);
  color: var(--site-fg);
  font: inherit;
  font-size: var(--vt-text-small);
}

.section-menu select:hover {
  border-color: var(--site-accent);
}
