/* Vice website. Colour comes only from accents.css, the app's own Material 3
   schemes, so the five swatches recolour everything at once. Surfaces separate
   by tone, never by shadow, the same rule the app follows. */

@font-face {
  font-family: 'Figtree';
  src: url('assets/fonts/figtree.woff2') format('woff2');
  font-weight: 300 900;
  font-display: swap;
}
@font-face {
  font-family: 'Syne Vice';
  src: url('assets/fonts/syne-vice.woff2') format('woff2');
  font-weight: 800;
  font-display: block;
}

:root {
  --spring: cubic-bezier(0.34, 1.45, 0.64, 1);
  --emph: cubic-bezier(0.2, 0, 0, 1);
  --rail: 0px;
  --pad: clamp(18px, 4vw, 56px);
  --max: 1320px;
  color-scheme: dark;
}
@media (min-width: 1200px) {
  :root { --rail: 132px; }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--on-surface);
  font: 400 17px/1.6 'Figtree', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color 0.5s var(--emph);
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p, ul, ol, dl, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--base); outline-offset: 3px; border-radius: 8px; }
.skip {
  position: absolute; left: 16px; top: -60px; z-index: 50;
  padding: 10px 18px; border-radius: 999px;
  background: var(--base); color: var(--on-base); text-decoration: none; font-weight: 700;
}
.skip:focus { top: 16px; }

.wordmark {
  font-family: 'Syne Vice', 'Figtree', sans-serif;
  font-weight: 800;
  letter-spacing: 0.02em;
}

/* ── Buttons, chips, segmented control ──────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 22px; border-radius: 22px; border: 0;
  font-weight: 650; font-size: 15px; text-decoration: none;
  transition: border-radius 0.35s var(--spring), background-color 0.2s, transform 0.35s var(--spring);
}
.btn:hover { border-radius: 14px; }
.btn:active { border-radius: 10px; transform: scale(0.97); }
.btn-filled { background: var(--base); color: var(--on-base); }
.btn-tonal { background: var(--secondary-container); color: var(--on-secondary-container); }

.chip {
  display: inline-flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 16px 0 12px; border-radius: 18px;
  background: var(--secondary-container); color: var(--on-secondary-container);
  font-size: 14px; font-weight: 600; text-decoration: none;
  transition: border-radius 0.35s var(--spring);
}
.chip:hover { border-radius: 10px; }
.chip-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--base); }

.clip-label {
  display: inline-flex; align-items: center; gap: 12px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--base);
}
.clip-label span {
  padding: 4px 12px; border-radius: 999px;
  background: color-mix(in srgb, currentColor 14%, transparent);
  letter-spacing: 0.06em; text-transform: none; font-size: 13px;
}

h2 {
  font-size: clamp(2.4rem, 5.6vw, 5rem);
  line-height: 0.96;
  font-weight: 780;
  letter-spacing: -0.045em;
  text-wrap: balance;
}
h2 em { font-style: normal; font-weight: 340; color: var(--on-surface-variant); }
p { text-wrap: pretty; }
.small { font-size: 14px; color: var(--on-surface-variant); }

.ticks { display: grid; gap: 14px; }
.ticks li { position: relative; padding-left: 30px; }
.ticks li::before {
  content: ''; position: absolute; left: 0; top: 0.35em;
  width: 16px; height: 16px; border-radius: 5px;
  background: var(--base);
  transform: rotate(45deg) scale(0.72);
}

/* ── Top bar ────────────────────────────────────────────────────────── */
.bar {
  position: fixed; inset: 14px var(--pad) auto calc(var(--pad) + var(--rail)); z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 64px; padding: 0 10px 0 18px; border-radius: 32px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--on-surface); }
.brand-mark { width: 24px; height: 24px; color: var(--base); }
.brand .wordmark { font-size: 22px; transition: opacity 0.3s var(--emph), transform 0.45s var(--spring); }
/* The hero carries the full-size mark; the bar's copy arrives once it leaves. */
.bar[data-hero-visible] .brand .wordmark { opacity: 0; transform: translateY(6px); }
.bar-end { display: flex; align-items: center; gap: 10px; }
/* With the voxel surface the bar draws itself on a canvas and steps out of
   the way of whatever is underneath; the controls keep a solid pill each. */
.bar.voxel { background: none; backdrop-filter: none; isolation: isolate; }
.bar-voxels { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; pointer-events: none; z-index: -1; }
.bar.voxel .brand { background: var(--surface); border-radius: 999px; padding: 10px 16px 10px 12px; margin-left: -10px; }
.bar.voxel .bar-end { background: var(--surface); border-radius: 999px; padding: 5px; margin-right: -5px; }

.swatches { display: flex; gap: 6px; }
.swatches button {
  width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%;
  transition: border-radius 0.35s var(--spring), transform 0.35s var(--spring), box-shadow 0.2s;
}
.swatches button:hover { transform: scale(1.15); }
.swatches button[aria-checked='true'] {
  border-radius: 7px;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--on-surface);
}
[data-swatch='blue'] { background: #8ab9f3; }
[data-swatch='purple'] { background: #d0b3ff; }
[data-swatch='green'] { background: #85d7ae; }
[data-swatch='red'] { background: #ffb3ad; }
[data-swatch='orange'] { background: #ffb68a; }
.swatches-lg button { width: 34px; height: 34px; }
.swatches-lg button[aria-checked='true'] { border-radius: 11px; }

/* ── The buffer rail ────────────────────────────────────────────────── */
.rail { display: none; }
@media (min-width: 1200px) {
  .rail {
    display: block; position: fixed; z-index: 25;
    left: 40px; top: 110px; bottom: 40px; width: 60px;
  }
  .rail-tape {
    position: absolute; left: 21px; top: 6px; bottom: 44px; width: 6px; border-radius: 3px;
    background: var(--surface-high); overflow: hidden;
  }
  .rail-fill {
    position: absolute; inset: 0; transform-origin: top; transform: scaleY(0);
    background: var(--base); border-radius: 3px;
  }
  .rail-marks {
    position: absolute; left: 0; top: 6px; bottom: 44px; margin: 0; padding: 0; list-style: none;
  }
  .rail-marks li { position: absolute; left: 0; top: var(--at, 0%); transform: translateY(-50%); }
  .rail-marks a {
    position: relative; display: block; width: 48px; height: 48px; text-decoration: none;
  }
  .rail-marks i {
    position: absolute; left: 17px; top: 17px; width: 14px; height: 14px; border-radius: 50%;
    background: var(--surface-highest); box-shadow: 0 0 0 4px var(--bg);
    transition: background-color 0.3s, transform 0.45s var(--spring), border-radius 0.45s var(--spring);
  }
  .rail-marks a:hover i, .rail-marks a[data-active] i { background: var(--base); transform: scale(1.4); border-radius: 4px; }
  .rail-marks span {
    position: absolute; left: 54px; top: 50%; transform: translate(-6px, -50%);
    white-space: nowrap; padding: 6px 12px; border-radius: 999px;
    background: var(--surface-high); color: var(--on-surface); font-size: 13px; font-weight: 650;
    opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.35s var(--spring);
  }
  .rail-marks a:hover span, .rail-marks a:focus-visible span { opacity: 1; transform: translate(0, -50%); }
  .rail-time {
    position: absolute; left: 0; bottom: 0; width: 120px;
    font: 600 12px/1 'Figtree', sans-serif; font-variant-numeric: tabular-nums;
    color: var(--on-surface-variant); letter-spacing: 0.04em;
  }
  .rail-time span { color: var(--base); }
}

/* ── Layout shell ───────────────────────────────────────────────────── */
main { padding-left: var(--rail); }
main > section {
  width: min(var(--max), 100% - 2 * var(--pad));
  margin-inline: auto;
}

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero { padding-top: clamp(104px, 12vh, 140px); }
.statement {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px clamp(20px, 3vw, 44px);
  margin: 0; container-type: inline-size; width: 100%;
}
.hero-mark {
  font-size: clamp(4.5rem, 15.5vw, 15rem); line-height: 0.74; color: var(--base);
  letter-spacing: 0; margin-left: -0.03em;
}
.hero-line {
  padding-bottom: 0.08em;
  font-size: clamp(1.4rem, 2.7vw, 2.6rem); line-height: 1.04; font-weight: 700; letter-spacing: -0.03em;
}
.hero-what { margin: 0 0 24px; max-width: 46ch; font-size: 1.15rem; line-height: 1.5; color: var(--on-surface-variant); }

/* The stage: a real clip with Vice's own status, overlay and share toast. */
.demo {
  position: relative; margin-top: clamp(28px, 3.4vw, 44px);
  aspect-ratio: 1440 / 602; overflow: hidden; container-type: inline-size;
  border-radius: clamp(24px, 3.2vw, 48px);
  background: var(--surface-lowest);
}
.demo-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.demo-island {
  position: absolute; top: 2.4cqi; right: 2.4cqi;
  display: flex; align-items: center; gap: 0.7em;
  padding: 0.65em 1.2em 0.65em 0.95em; border-radius: 999px;
  font-size: clamp(11px, 1.15cqi, 17px); font-weight: 650; white-space: nowrap;
  background: color-mix(in srgb, var(--surface-low) 90%, transparent); color: var(--on-surface);
  transition: background-color 0.35s var(--emph), color 0.35s, padding 0.45s var(--spring);
}
.demo-island-dot { width: 0.7em; height: 0.7em; border-radius: 50%; background: #ff6b6b; }
.demo-island-meta { color: var(--on-surface-variant); font-weight: 550; font-variant-numeric: tabular-nums; }
.demo-island[data-state='saved'] { background: var(--base); color: var(--on-base); padding-inline: 1.5em; }
.demo-island[data-state='saved'] .demo-island-dot { background: var(--on-base); }
.demo-island[data-state='saved'] .demo-island-meta { color: color-mix(in srgb, var(--on-base) 72%, transparent); }
.keys.demo-keys { left: 2.4cqi; bottom: 18cqi; --u: 2.1cqi; }
.demo-toast {
  position: absolute; right: 2.6cqi; bottom: 6.5cqi; width: min(34cqi, 380px);
  padding: 1.1em 1.3em; border-radius: 1.4em;
  font-size: clamp(10px, 1.05cqi, 15px);
  background: color-mix(in srgb, var(--surface-low) 94%, transparent); color: var(--on-surface);
  opacity: 0; transform: translateY(14px) scale(0.96);
  transition: opacity 0.3s var(--emph), transform 0.5s var(--spring);
}
.demo-toast.show { opacity: 1; transform: none; }
.demo-toast-title { font-weight: 750; font-size: 1.15em; }
.demo-toast-link { margin-top: 0.2em; color: var(--base); overflow-wrap: anywhere; }
.demo-toast-note { margin-top: 0.35em; color: var(--on-surface-variant); }
.demo-scrub {
  position: absolute; left: 2.6cqi; right: 2.6cqi; bottom: 2.6cqi; height: 4px; border-radius: 2px;
  background: color-mix(in srgb, white 22%, transparent);
}
.demo-scrub-fill { position: absolute; inset: 0; border-radius: 2px; background: var(--base); transform-origin: left; transform: scaleX(0); }
.demo-scrub i {
  position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 4px;
  background: #ffb347; transform: rotate(45deg);
}

.hero-foot {
  display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px);
  align-items: end; margin-top: clamp(40px, 5vw, 64px);
}
.install { max-width: 560px; }
.facts { display: grid; gap: 8px; justify-self: end; text-align: right; color: var(--on-surface-variant); font-size: 15px; }
.facts b { color: var(--on-surface); font-weight: 700; }
.facts a { color: var(--base); }
.seg {
  display: inline-flex; padding: 4px; gap: 4px; border-radius: 26px;
  background: var(--surface-low);
}
.seg button {
  height: 40px; padding: 0 18px; border: 0; border-radius: 20px;
  background: transparent; color: var(--on-surface-variant); font-weight: 650; font-size: 14px;
  transition: background-color 0.2s, color 0.2s, border-radius 0.35s var(--spring);
}
.seg button[aria-selected='true'] { background: var(--secondary-container); color: var(--on-secondary-container); border-radius: 12px; }
.cmd {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 8px 8px 8px 20px; border-radius: 22px;
  background: var(--surface-lowest);
}
.cmd[hidden] { display: none; }
.cmd code {
  flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: none;
  font: 500 14px/1.4 ui-monospace, 'JetBrains Mono', monospace; color: var(--on-surface);
}
.copy {
  flex: none; height: 38px; padding: 0 16px; border: 0; border-radius: 19px;
  background: var(--base); color: var(--on-base); font-weight: 700; font-size: 14px;
  transition: border-radius 0.35s var(--spring);
}
.copy:hover { border-radius: 10px; }
.hero-shot { margin-top: clamp(80px, 10vw, 140px); }

/* ── The buffer ─────────────────────────────────────────────────────── */
.how { padding-top: clamp(110px, 14vw, 190px); }
.how h2 { margin-top: 18px; max-width: 16ch; }
.how-lede { margin-top: 26px; max-width: 58ch; font-size: clamp(17px, 1.4vw, 20px); color: var(--on-surface-variant); }
.buffer { margin-top: clamp(40px, 6vw, 72px); }
.buffer-track {
  position: relative; height: clamp(76px, 9vw, 120px); border-radius: 999px; overflow: hidden;
  background: var(--surface-low);
}
.buffer-tape {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, var(--surface-high) 0 3px, transparent 3px 22px);
  animation: tape 2.4s linear infinite;
}
@keyframes tape { to { background-position: -22px 0; } }
.buffer-keep {
  position: absolute; top: 8px; bottom: 8px; right: 8px; width: calc(16.667% - 8px);
  display: grid; place-items: center; border-radius: 999px;
  background: var(--base); color: var(--on-base); font-weight: 750; font-size: clamp(12px, 1.2vw, 17px);
  white-space: nowrap; overflow: hidden;
}
.buffer-scale {
  display: flex; justify-content: space-between; margin-top: 14px;
  font-size: 13px; font-weight: 650; color: var(--on-surface-variant); font-variant-numeric: tabular-nums;
}
.buffer-scale span:last-child { color: var(--base); }
.steps {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(16px, 3vw, 48px);
  margin-top: clamp(40px, 5vw, 64px); counter-reset: s;
}
.steps li { color: var(--on-surface-variant); font-size: 17px; }
.steps b { display: block; margin-bottom: 6px; color: var(--on-surface); font-size: 22px; letter-spacing: -0.02em; }

/* ── Colour blocks ──────────────────────────────────────────────────── */
.block {
  position: relative; overflow: hidden; isolation: isolate;
  margin-top: clamp(110px, 14vw, 190px);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 64px); align-items: center;
  padding: clamp(32px, 5.5vw, 88px);
  border-radius: clamp(32px, 5vw, 72px);
}
.block-primary { background: var(--primary-container); color: var(--on-primary-container); }
.block-tertiary { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.block .clip-label { color: inherit; }
.block p, .block li { color: color-mix(in srgb, currentColor 86%, transparent); }
.block h2 { margin: 18px 0 22px; color: inherit; }
.block .ticks { margin-top: 26px; }
.block .ticks li::before { background: currentColor; }
.block .small { margin-top: 22px; color: color-mix(in srgb, currentColor 70%, transparent); }

.chat {
  display: flex; gap: 14px; padding: clamp(18px, 2.4vw, 28px);
  border-radius: 32px; background: var(--surface-lowest); color: var(--on-surface);
}
.chat-avatar {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--base); color: var(--on-base); font-weight: 800;
}
.chat-body { min-width: 0; flex: 1; }
.chat-name { font-weight: 700; color: var(--on-surface) !important; }
.chat-name span { margin-left: 8px; font-size: 12px; font-weight: 500; color: var(--on-surface-variant); }
.chat-text { color: var(--on-surface) !important; }
.chat-link { color: var(--base) !important; font-size: 15px; overflow-wrap: anywhere; }
.embed {
  margin-top: 10px; padding: 14px 16px 16px; border-radius: 14px;
  background: var(--surface); border-left: 4px solid var(--base);
}
.embed-site { font-size: 12px; color: var(--on-surface-variant) !important; }
.embed-title { font-weight: 700; color: var(--base) !important; margin-bottom: 10px; }
.embed-video { position: relative; border-radius: 10px; overflow: hidden; }
.embed-play {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px; border-radius: 50%;
  background: color-mix(in srgb, black 55%, transparent);
}
.embed-play::after {
  content: ''; position: absolute; left: 25px; top: 20px;
  border-left: 20px solid white; border-top: 12px solid transparent; border-bottom: 12px solid transparent;
}
.embed-time {
  position: absolute; right: 10px; bottom: 10px; padding: 2px 8px; border-radius: 8px;
  background: color-mix(in srgb, black 60%, transparent); color: white; font-size: 12px; font-weight: 700;
}

/* ── Recording ──────────────────────────────────────────────────────── */
.split {
  margin-top: clamp(110px, 14vw, 190px);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 64px);
  grid-template-areas: 'copy figs' 'ticks figs';
}
.split-copy { grid-area: copy; }
.split-copy h2 { margin: 18px 0 22px; }
.split-copy p { color: var(--on-surface-variant); max-width: 46ch; }
.split-ticks { grid-area: ticks; align-self: start; color: var(--on-surface-variant); }
.split-ticks b { color: var(--on-surface); }
.ticks-head { margin: 0 0 16px; font-size: 1.05rem; font-weight: 700; color: var(--base); letter-spacing: 0; }
.figures { grid-area: figs; position: relative; min-height: 460px; }
.fig {
  position: absolute; display: grid; place-content: center; justify-items: center; text-align: center;
  aspect-ratio: 1; isolation: isolate; transition: transform 0.6s var(--spring);
}
.fig i { position: absolute; inset: 0; z-index: -1; }
.fig i svg { width: 100%; height: 100%; display: block; fill: currentColor; }
.fig b { font-size: clamp(2.6rem, 5vw, 4.6rem); line-height: 1; font-weight: 820; letter-spacing: -0.05em; }
.fig span { max-width: 13ch; margin-top: 6px; font-size: 14px; font-weight: 650; line-height: 1.25; }
.fig:hover { transform: rotate(-8deg) scale(1.04); }
.fig-a { width: 58%; left: 4%; top: 0; color: var(--base); }
.fig-a b, .fig-a span { color: var(--on-base); }
.fig-b { width: 46%; right: 0; top: 18%; color: var(--secondary-container); }
.fig-b b, .fig-b span { color: var(--on-secondary-container); }
.fig-c { width: 48%; left: 26%; bottom: 0; color: var(--tertiary-container); }
.fig-c b, .fig-c span { color: var(--on-tertiary-container); }
.frame { border-radius: clamp(24px, 3vw, 40px); overflow: hidden; background: var(--surface-low); }
.frame-slant {
  grid-area: shot; margin-top: clamp(16px, 3vw, 40px);
  border-radius: clamp(24px, 3vw, 40px) clamp(64px, 9vw, 140px) clamp(24px, 3vw, 40px) clamp(64px, 9vw, 140px);
}

/* ── Editor ─────────────────────────────────────────────────────────── */
.editor { grid-template-columns: 1fr; }
.editor .block-copy { max-width: 760px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.pills li {
  padding: 8px 16px; border-radius: 999px; font-weight: 650; font-size: 15px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  color: inherit !important;
  transition: border-radius 0.35s var(--spring);
}
.pills li:hover { border-radius: 8px; }
.frame-editor { background: var(--bg); border-radius: clamp(20px, 2.6vw, 36px); }

/* ── Keyboard overlay ───────────────────────────────────────────────── */
.overlay {
  margin-top: clamp(110px, 14vw, 190px);
  display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr); gap: clamp(28px, 4vw, 64px); align-items: center;
}
.overlay-copy h2 { margin: 18px 0 22px; font-size: clamp(3rem, 7vw, 6.4rem); }
.overlay-copy > p { color: var(--on-surface-variant); }
.hint { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 26px; }
.hint span { margin-left: 6px; font-size: 14px; font-weight: 650; color: var(--on-surface); }
kbd {
  display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 9px;
  border-radius: 10px; background: var(--surface-high);
  box-shadow: inset 0 -3px 0 color-mix(in srgb, black 30%, var(--surface-high));
  font: 700 13px/1 'Figtree', sans-serif; color: var(--on-surface);
}
.try { display: flex; align-items: center; gap: 16px; margin: 26px 0 22px; font-size: 14px; font-weight: 650; }
.stage {
  position: relative; container-type: inline-size;
  border-radius: clamp(28px, 4vw, 56px) clamp(28px, 4vw, 56px) clamp(28px, 4vw, 56px) 12px;
  overflow: hidden;
}
/* The same panel vice/key_overlay.py draws: 44 px keys, 6 px gaps, 12 px
   padding and a 28 px corner, scaled to the frame. */
.keys {
  position: absolute; left: 3.2cqi; bottom: 3.2cqi;
  --u: 4.2cqi;
  display: grid; gap: calc(var(--u) * 0.136); padding: calc(var(--u) * 0.27);
  border-radius: calc(var(--u) * 0.64);
  background: color-mix(in srgb, var(--surface-low) 88%, transparent);
}
.keys-row { display: grid; grid-template-columns: repeat(11, calc(var(--u) / 2)); column-gap: calc(var(--u) * 0.068); }
.keys-row > * {
  grid-column: span 2; display: grid; place-items: center; height: var(--u);
  border-radius: calc(var(--u) * 0.32);
  background: var(--secondary-container); color: var(--on-secondary-container);
  font-weight: 750; font-size: calc(var(--u) * 0.36);
  transition: background-color 0.09s, color 0.09s, border-radius 0.16s var(--spring), transform 0.16s var(--spring);
}
.keys-row > .gap { grid-column: span 1; background: none; }
.keys-row > .w15 { grid-column: span 3; font-size: calc(var(--u) * 0.29); }
.keys-row > .w4 { grid-column: span 8; }
.keys-row > .on {
  background: var(--base); color: var(--on-base);
  border-radius: calc(var(--u) * 0.16); transform: scale(0.94);
}

/* ── Library ────────────────────────────────────────────────────────── */
.library {
  margin-top: clamp(110px, 14vw, 190px);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: clamp(28px, 4vw, 64px);
  grid-template-areas: 'copy art' 'notes art';
}
.library-copy { grid-area: copy; }
.library-copy h2 { margin: 18px 0 22px; }
.library-copy p { color: var(--on-surface-variant); }
.library-art { grid-area: art; align-self: start; position: relative; padding-bottom: 22%; }
.frame-clips { border-radius: clamp(24px, 3vw, 40px); }
.frame-float {
  position: absolute; width: 52%; left: -7%; bottom: 0;
  border-radius: 28px; outline: 10px solid var(--bg);
}
.library-notes { grid-area: notes; align-self: end; display: grid; gap: 18px; color: var(--on-surface-variant); }
.library-notes b { color: var(--on-surface); }

/* ── The rest ───────────────────────────────────────────────────────── */
.rest { margin-top: clamp(110px, 14vw, 190px); }
.rest h2 { max-width: 12ch; }
.groups {
  margin-top: clamp(36px, 5vw, 64px);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
}
.group {
  padding: clamp(26px, 3vw, 40px); border-radius: 32px;
  transition: border-radius 0.45s var(--spring);
}
.group:hover { border-radius: 48px; }
.group h3 { margin: 0 0 22px; font-size: clamp(1.5rem, 2.2vw, 2rem); font-weight: 760; letter-spacing: -0.03em; line-height: 1.05; }
.group ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.group li { padding-top: 14px; border-top: 1px solid color-mix(in srgb, currentColor 16%, transparent); }
.group li b { font-weight: 700; }
.group code { font-size: 0.92em; }
.group-a { background: var(--secondary-container); color: var(--on-secondary-container); }
.group-b { background: var(--primary-container); color: var(--on-primary-container); }
.group-c { background: var(--surface-high); color: var(--on-surface); }
.group-c li { color: var(--on-surface-variant); }
.group-c li b { color: var(--on-surface); }

/* ── Beyond games ───────────────────────────────────────────────────── */
.beyond {
  margin-top: clamp(110px, 14vw, 190px);
  display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 80px); align-items: center;
}
.frame-viewer { border-radius: clamp(28px, 3.4vw, 48px); background: var(--surface-low); }
.beyond-copy h2 { margin: 18px 0 22px; }
.beyond-copy > p { color: var(--on-surface-variant); max-width: 52ch; }
.who { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 32px; }
.who > div { padding: 24px; border-radius: 28px; background: var(--surface-low); }
.who h3 { font-size: 19px; letter-spacing: -0.01em; margin-bottom: 8px; }
.who p { font-size: 15px; color: var(--on-surface-variant); }

/* ── Compatibility ──────────────────────────────────────────────────── */
.compat {
  margin-top: clamp(110px, 14vw, 190px);
  display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr); gap: clamp(28px, 4vw, 64px); align-items: start;
}
.compat-head p { margin-top: 22px; color: var(--on-surface-variant); }
.table-wrap { min-width: 0; overflow-x: auto; border-radius: 32px; background: var(--surface-low); padding: 8px 12px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 16px 14px; text-align: left; white-space: nowrap; }
thead th { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-surface-variant); }
tbody tr + tr { border-top: 1px solid var(--outline-variant); }
tbody th { font-weight: 700; }
td::before {
  content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 10px; border-radius: 50%;
  vertical-align: 1px;
}
td.yes::before { background: var(--base); }
td.part::before { background: transparent; box-shadow: inset 0 0 0 2px var(--base); }
td.no::before { background: var(--outline-variant); }
td.no { color: var(--on-surface-variant); }

/* ── Install ────────────────────────────────────────────────────────── */
.get {
  position: relative; overflow: hidden; isolation: isolate;
  margin-top: clamp(110px, 14vw, 190px);
  padding: clamp(36px, 6vw, 96px);
  border-radius: clamp(36px, 6vw, 88px);
  background: var(--base); color: var(--on-base);
}
.get .clip-label { color: inherit; }
.get h2 { margin: 18px 0 clamp(32px, 5vw, 60px); font-size: clamp(3rem, 8.4vw, 8rem); line-height: 0.88; letter-spacing: -0.06em; }
.get-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.get-card {
  min-width: 0;
  display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr); gap: 10px;
  padding: 26px; border-radius: 32px; background: var(--bg); color: var(--on-surface);
}
.get-card h3 { font-size: 20px; letter-spacing: -0.01em; }
.get-card p { color: var(--on-surface-variant); font-size: 15px; }
.get-card p code { font: 500 13px ui-monospace, monospace; color: var(--on-surface); overflow-wrap: anywhere; }
.get-card .cmd { margin-top: 6px; }
.get-after { margin-top: 28px; font-weight: 600; }

/* ── Credits and footer ─────────────────────────────────────────────── */
.credits { margin-top: clamp(110px, 14vw, 170px); }
.credits h2 { font-size: clamp(1.8rem, 3.4vw, 3rem); max-width: 26ch; text-wrap: balance; }
.credits-note { margin-top: 22px; max-width: 60ch; color: var(--on-surface-variant); }
.people { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.people a {
  display: inline-block; padding: 9px 16px; border-radius: 999px; text-decoration: none;
  background: var(--surface-high); font-weight: 650; font-size: 15px;
  transition: border-radius 0.35s var(--spring), background-color 0.2s;
}
.people a:hover { border-radius: 10px; background: var(--secondary-container); }
.foot {
  padding: clamp(80px, 10vw, 140px) var(--pad) 40px calc(var(--pad) + var(--rail));
  display: grid; justify-items: start; gap: 22px; overflow: hidden; container-type: inline-size;
}
.wordmark-foot {
  font-size: min(22rem, 24.8cqi); line-height: 0.8; color: var(--surface-high);
  margin-left: -0.04em;
}
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; font-weight: 650; }
.foot nav a { text-decoration: none; color: var(--on-surface); }
.foot nav a:hover { color: var(--base); }
.foot p { color: var(--on-surface-variant); font-size: 14px; }

/* ── Reveal ─────────────────────────────────────────────────────────── */
.pre { opacity: 0; transform: translateY(48px) scale(0.985); }
.pre.in { opacity: 1; transform: none; transition: opacity 0.7s var(--emph), transform 0.9s var(--spring); }

/* ── Smaller screens ────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .split { grid-template-areas: 'copy copy' 'figs figs' 'ticks ticks'; }
  .figures { min-height: 0; aspect-ratio: 1.6; }
  .fig-a { width: 38%; left: 4%; } .fig-b { width: 32%; right: 6%; top: 6%; } .fig-c { width: 32%; left: 36%; }
}
@media (max-width: 900px) {
  .hero-foot { grid-template-columns: minmax(0, 1fr); }
  .facts { justify-self: start; text-align: left; }
  .block, .overlay, .library, .compat, .beyond, .groups { grid-template-columns: minmax(0, 1fr); }
  .who { grid-template-columns: 1fr; }
  .library { grid-template-areas: 'copy' 'art' 'notes'; }
  .split { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'copy' 'figs' 'ticks'; }
  .steps { grid-template-columns: 1fr; }
  .get-grid { grid-template-columns: 1fr; }
  .bar .swatches { display: none; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .bar { height: 56px; }
  .bar .btn-tonal { display: none; }
  .figures { aspect-ratio: 1; }
  .fig-a { width: 56%; left: 0; } .fig-b { width: 46%; right: 0; top: 24%; } .fig-c { width: 48%; left: 18%; }
  .buffer-scale span:nth-child(2), .buffer-scale span:nth-child(4) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* On a phone the stage is too short for the toast and the island together. */
@container (max-width: 640px) {
  .demo-toast, .demo-island-meta { display: none; }
}

.demo-note { margin: 10px 2px 0; font-size: 12px; color: var(--on-surface-variant); opacity: 0.8; }
@media (max-width: 600px) {
  .hero-mark { font-size: 22.5vw; }
}
