/* Riffler home. Colour roles come from assets/tokens.css (brand-L03). This file holds type, space,
   grid and components. No raw colours below this block except the frame-picture fallbacks. */

@font-face { font-family: "Riffler Text"; font-weight: 300; font-style: normal; font-display: swap; src: url("assets/fonts/RifflerText-Light.woff2") format("woff2"); }
@font-face { font-family: "Riffler Text"; font-weight: 400; font-style: normal; font-display: swap; src: url("assets/fonts/RifflerText-Regular.woff2") format("woff2"); }
@font-face { font-family: "Riffler Text"; font-weight: 400; font-style: italic; font-display: swap; src: url("assets/fonts/RifflerText-Italic.woff2") format("woff2"); }
@font-face { font-family: "Riffler Edge"; font-weight: 400; font-display: swap; src: url("assets/fonts/RifflerEdge-Regular.woff2") format("woff2"); }
@font-face { font-family: "Riffler Edge"; font-weight: 500; font-display: swap; src: url("assets/fonts/RifflerEdge-Medium.woff2") format("woff2"); }

:root {
  --serif: "Riffler Text", Georgia, serif;
  --mono: "Riffler Edge", ui-monospace, monospace;

  /* space: 4-based scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;

  /* grid: 12 columns, 8 px gutters (a contact sheet's gutter), frames sit on the same pitch */
  --cols: 12;
  --gap: 8px;
  --margin: 40px;
  --container: min(100vw - 2 * var(--margin), 1600px);
  --col: calc((var(--container) - (var(--cols) - 1) * var(--gap)) / var(--cols));
  --pitch: calc(var(--col) + var(--gap));
  --frame: var(--col);

  /* type (type.md) */
  --t-display: clamp(80px, 6.4vw, 104px); --lh-display: 0.98;
  --t-h2: 44px;
  --t-h3: 22px;
  --t-lead: 24px;
  --t-body: 18px;
  --t-small: 16px;
  --t-total: 15px;
  --t-code: 14px;
  --t-codes: 12px;

  --radius: 2px;
  --bar-h: 56px;
}

@media (max-width: 1023px) {
  :root { --cols: 8; --margin: 32px; --t-display: 64px; --t-h2: 36px; --t-lead: 21px; }
}
@media (max-width: 639px) {
  :root { --cols: 4; --margin: 16px; --t-display: 44px; --lh-display: 1.02; --t-h2: 30px; --t-lead: 20px; --t-body: 17px; --t-code: 13px; --t-total: 13px; }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--bar-h) + var(--s5)); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font: 400 var(--t-body)/1.55 var(--serif);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
h1, h2, h3, p, ol, ul, dl, dd, figure, pre { margin: 0; padding: 0; }
ol, ul { list-style: none; }
code, pre { font-family: var(--mono); font-variant-numeric: tabular-nums; font-feature-settings: "calt" 0, "liga" 0; }
a { color: inherit; text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; text-decoration-color: var(--frame-edge); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: var(--radius); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html:not(.js) .js-only { display: none !important; }
.skip { position: absolute; left: var(--margin); top: -100px; background: var(--text); color: var(--surface); padding: var(--s2) var(--s3); z-index: 10; }
.skip:focus { top: var(--s2); }

.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--gap);
  width: var(--container);
  margin-inline: auto;
}

/* type roles */
.display { font: 300 var(--t-display)/var(--lh-display) var(--serif); letter-spacing: -0.02em; text-wrap: balance; }
.h2 { font: 300 var(--t-h2)/1.05 var(--serif); letter-spacing: -0.015em; text-wrap: balance; }
.h3 { font: 400 var(--t-h3)/1.25 var(--serif); letter-spacing: -0.005em; }
.lead { font: 300 var(--t-lead)/1.35 var(--serif); text-wrap: pretty; }
.body { font-size: var(--t-body); line-height: 1.55; color: var(--text-muted); text-wrap: pretty; max-width: 34em; }
.body-s { font-size: var(--t-small); line-height: 1.5; color: var(--text-muted); text-wrap: pretty; }
.label { font: 400 var(--t-small)/1.4 var(--serif); color: var(--text-muted); }
.total-tag { font: italic 400 var(--t-small)/1 var(--serif); color: var(--text-edge); margin-inline-end: var(--s2); }
p code, li code, dd code, .label code { font-size: 0.86em; color: var(--text); }

/* top bar: solid, text links, no pill */
.bar { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid transparent; transition: border-color 200ms; }
.bar.is-stuck { border-bottom-color: var(--rule); }
.bar-in { width: var(--container); margin-inline: auto; height: var(--bar-h); display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; color: var(--text); text-decoration: none; }
.brand svg { height: 24px; width: auto; display: block; }
.bar nav { display: flex; gap: var(--s5); font-size: var(--t-small); }
.bar nav a { text-decoration: none; color: var(--text-muted); padding: var(--s2) 0; }
.bar nav a:hover { color: var(--text); }

/* buttons and code */
.copy {
  font: 400 var(--t-small)/1 var(--serif);
  color: var(--text); background: transparent;
  border: 1px solid var(--frame-edge); border-radius: var(--radius);
  padding: 0 var(--s3); height: 32px; cursor: pointer;
}
.copy:hover { border-color: var(--text-edge); }
.copy[data-done] { color: var(--text-muted); }
.copy--primary { background: var(--text); color: var(--surface); border-color: var(--text); height: 44px; padding: 0 var(--s4); }
.copy--primary:hover { background: var(--graphite-200); border-color: var(--graphite-200); }
:root[data-theme="light"] .copy--primary:hover { background: var(--graphite-800); border-color: var(--graphite-800); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .copy--primary:hover { background: var(--graphite-800); border-color: var(--graphite-800); } }
.copy--primary[data-done] { color: var(--surface); }

.code-block { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface-frame); }
.code-block pre { padding: var(--s4); overflow-x: auto; font-size: var(--t-code); line-height: 1.6; color: var(--text); tab-size: 2; }
.code-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s2) var(--s2) var(--s2) var(--s4); border-bottom: 1px solid var(--rule); min-height: 48px; }
.code-path { font: 400 13px/1.3 var(--mono); color: var(--text-edge); overflow-wrap: anywhere; }
a.code-path:hover { color: var(--text); }
.code-block--alt { margin-top: var(--s3); }
.code-block--hero pre { font-size: var(--t-total); line-height: 1.7; white-space: pre; }

/* ---------- beat 1: hero ---------- */
.hero { padding-top: var(--s8); }
.hero-grid { align-items: end; row-gap: var(--s6); }
.hero-main { grid-column: 1 / span 7; display: grid; gap: var(--s5); }
.hero-main .lead { max-width: 30em; }
.display > span { display: block; }
.hero-side { grid-column: 8 / span 5; display: grid; gap: var(--s4); justify-items: start; }
.hero-side .code-block { width: 100%; }
.install-block { display: grid; gap: var(--s3); }
.install-actions { display: flex; align-items: center; gap: var(--s5); flex-wrap: wrap; }
.more { font-size: var(--t-small); color: var(--text-muted); }
.risk { font-size: var(--t-small); line-height: 1.5; color: var(--text-muted); max-width: 36em; }
.risk a { color: var(--text); }

.sheet-hero { margin-top: var(--s8); overflow: hidden; padding-top: 16px; }
.edge-line {
  width: var(--container); margin-inline: auto;
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s5);
  padding-bottom: var(--s3);
}
.total { font: 400 var(--t-total)/1.4 var(--mono); color: var(--text-muted); }
.keep-note { font: italic 400 26px/1 var(--serif); color: var(--kept-text); white-space: nowrap; }

.strips { position: relative; width: var(--container); margin-inline: auto; overflow: hidden; padding-top: 18px; margin-top: -18px; }
.strip { --g: var(--gap); position: relative; display: flex; gap: var(--gap); padding-bottom: 28px; }

/* a frame: picture as background so a missing file leaves an empty frame */
.frame { position: relative; flex: none; width: var(--frame); aspect-ratio: 1; background: var(--surface-frame); }
.pic {
  position: absolute; inset: 0; overflow: hidden;
  display: block; width: 100%; height: 100%; object-fit: cover;
  background-color: var(--surface-raised);
}
.code { position: absolute; left: 0; top: calc(100% + 6px); font: 500 var(--t-codes)/1 var(--mono); color: var(--text-edge); letter-spacing: 0.01em; }
.dur { position: absolute; right: 6px; bottom: 6px; font: 400 11px/1 var(--mono); color: var(--graphite-100); background: rgb(9 11 14 / 0.78); padding: 3px 5px 3px 14px; border-radius: 1px; }
.dur::before { content: ""; position: absolute; left: 5px; top: 50%; translate: 0 -50%; border-left: 6px solid currentColor; border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent; }
.dur.gif { padding-left: 5px; }
.dur.gif::before { content: none; }

/* the keep ring: filled art for the still state, centerline for the draw-on */
.ring { position: absolute; pointer-events: none; color: var(--kept); z-index: 2; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ring svg + svg { display: none; }
.ring--one { inset: -18%; }
.ring--span { top: 50%; translate: 0 -50%; left: calc(-0.06 * (400% + 3 * var(--g))); width: calc((400% + 3 * var(--g)) * 1.12); aspect-ratio: 400 / 110; margin-top: -3px; }
.is-kept .code { color: var(--kept-text); }

/* hero sequence states (only when html.motion; page.js drives them) */
.hero-lanes { display: none; }
.sheet-hero.run .pic, .sheet-hero.run .dur { visibility: hidden; }
.sheet-hero.run .ring, .sheet-hero.run .keep-note, .sheet-hero.run .total { visibility: hidden; }
.sheet-hero.run .hero-lanes {
  display: grid; position: absolute; inset: 0 0 auto 0; width: var(--container); height: calc(3 * (var(--frame) + 28px));
  grid-template-columns: repeat(10, minmax(0, 1fr)); column-gap: var(--gap); overflow: hidden; z-index: 3;
  font: 400 12px/1.6 var(--mono); color: var(--text-muted);
}
.hero-lanes ol { display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; border-top: 1px solid var(--rule); padding-top: var(--s1); white-space: nowrap; }
.sheet-hero.fill .pic, .sheet-hero.fill .dur { visibility: hidden; }
.sheet-hero.fill .frame.on .pic, .sheet-hero.fill .frame.on .dur { visibility: visible; }
.ring.draw svg:first-child { opacity: 0; }
.ring.draw svg + svg { display: block; }
.ring.draw svg + svg path { stroke-width: 5; stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 560ms cubic-bezier(.5, 0, .3, 1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- shared beat spacing ---------- */
.beat { padding-top: var(--s10); }
.beat .h2 { margin-bottom: var(--s5); }

/* ---------- beat 2: lanes ---------- */
.lanes-beat .h2 { grid-column: 1 / span 6; }
.lanes-beat .beat-side { grid-column: 8 / span 5; align-self: end; margin-bottom: var(--s5); }
.lanes {
  width: var(--container); margin: var(--s5) auto 0;
  display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); column-gap: var(--gap);
}
.lane { min-width: 0; border-top: 1px solid var(--rule); padding-top: var(--s3); }
.lane-head { display: block; font: 500 var(--t-codes)/1.3 var(--mono); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: var(--s3); }
.lane-rows { font: 400 12px/1.65 var(--mono); color: var(--text-edge); height: calc(15 * 1.65em); overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; white-space: nowrap; }
.lane-rows li { overflow: hidden; text-overflow: clip; }
.lane-rows li:last-child { color: var(--text); }
.lane-end { display: block; margin-top: var(--s3); padding-top: var(--s2); border-top: 1px solid var(--rule); font: 400 11px/1.4 var(--mono); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lanes.running .lane:not(.ended) .lane-end { visibility: hidden; }
.lanes-foot { width: var(--container); margin: var(--s5) auto 0; font-size: var(--t-total); color: var(--text-muted); }
.lanes-foot code { font-size: var(--t-total); color: var(--text); overflow-wrap: anywhere; }
.lanes.running ~ .lanes-foot code { visibility: hidden; }

/* ---------- beat 3: the reply ---------- */
.reply-h { grid-column: 1 / span 8; }
.reply-sub { grid-column: 1 / span 6; margin-bottom: var(--s7); }
.reply { grid-column: 1 / span 8; }
.reply .label { margin-bottom: var(--s3); }
.reply-text { font-size: var(--t-total); line-height: 1.75; color: var(--text-muted); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: var(--s4) 0; overflow-x: auto; }
.reply-text .r { display: block; white-space: pre; }
.reply-text .r-head { color: var(--text); }
.figure { grid-column: 10 / span 3; align-self: end; }
.figure-n { font: 300 128px/0.9 var(--serif); letter-spacing: -0.03em; font-variant-numeric: lining-nums; }
.figure-about { font-size: var(--t-lead); letter-spacing: 0; vertical-align: top; margin-inline-end: var(--s1); color: var(--text-muted); }
.figure-unit { font: 300 var(--t-lead)/1.3 var(--serif); margin-top: var(--s3); }
.figure-note { font: 400 13px/1.4 var(--mono); color: var(--text-edge); margin-top: var(--s4); }

/* ---------- beat 4: the contact sheet ---------- */
.sheet-wrap { grid-column: 1 / span 8; grid-row: 1 / span 2; }
.pic.flip { transform: scaleX(-1); }
.frame-btn { position: absolute; inset: 0; z-index: 3; margin: 0; padding: 0; border: 0; background: transparent; cursor: pointer; border-radius: 0; }
.frame-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.sheet-cap { margin-bottom: var(--s3); }
.sheet {
  --sc: 10; --sg: 4px; --g: var(--sg);
  --sf: calc((100% - (var(--sc) - 1) * var(--sg)) / var(--sc));
  display: grid; grid-template-columns: repeat(var(--sc), minmax(0, 1fr)); gap: 22px var(--sg);
  padding: var(--s4) var(--s4) var(--s6); background: var(--surface-frame); border: 1px solid var(--rule);
}
.sheet .frame { width: auto; }
.sheet .code { top: calc(100% + 5px); font-size: 11px; }
.sheet .ring--one { inset: -16%; }
.sheet-more { display: none; }
.js .sheet .frame { cursor: pointer; }
.js .sheet .frame:hover .pic { outline: 1px solid var(--text-edge); outline-offset: 2px; }
.sheet .frame:focus-visible { outline-offset: 4px; }
.sheet-side { grid-column: 9 / span 4; grid-row: 1; padding-left: var(--s5); }
.sheet-side .h2 { margin-top: calc(var(--s3) + 1.4em); }
.hint { font: italic 400 var(--t-small)/1.4 var(--serif); color: var(--text-muted); margin-top: var(--s4); }
.call { grid-column: 9 / span 4; grid-row: 2; align-self: end; padding-left: var(--s5); }
.call .label { margin-bottom: var(--s2); }
.call-code { font-size: var(--t-code); line-height: 1.6; padding: var(--s3) var(--s4); background: var(--surface-frame); border: 1px solid var(--rule); border-radius: var(--radius); white-space: pre-wrap; overflow-wrap: anywhere; }
.keep-str { color: var(--kept-text); }
.call-out { font-size: 13px; line-height: 1.7; color: var(--text-muted); padding: var(--s3) var(--s4) 0; white-space: pre-wrap; }
.tree { display: block; margin-top: var(--s2); }
.t-line { display: block; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-dir { color: var(--text-edge); }

/* ---------- beat 5: install ---------- */
.install-h { grid-column: 1 / span 6; }
.install-sub { grid-column: 8 / span 5; align-self: end; margin-bottom: var(--s5); }
.install-grid { margin-top: var(--s5); border-top: 1px solid var(--rule); padding-top: var(--s6); row-gap: var(--s7); align-items: start; }
.clients { grid-column: 1 / span 9; }
.client { border-bottom: 1px solid var(--rule); }
.client summary { list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 52px; cursor: pointer; gap: var(--s4); }
.client summary::-webkit-details-marker { display: none; }
.client-name { font: 400 var(--t-body)/1.2 var(--serif); }
.client-mark { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; color: var(--text); flex: none; }
.mark-svg { width: 100%; height: 100%; display: block; }
.client[data-mark="text"] .client-mark, html[data-marks="text"] .client-mark { visibility: hidden; }
.client-body { padding: var(--s2) 0 var(--s6); display: grid; gap: var(--s3); }
.client-how { font-size: var(--t-small); color: var(--text-muted); }
.client-note { font-size: 15px; line-height: 1.5; color: var(--text-muted); max-width: 44em; }
.source { display: flex; justify-content: space-between; align-items: center; min-height: 52px; margin-top: var(--s5); color: var(--text-muted); font-size: var(--t-small); }

/* enhanced: tabs on wide screens (page.js adds .tabs) */
@media (min-width: 1024px) {
  .clients.tabs { display: grid; grid-template-columns: calc(3 * var(--pitch) - var(--gap)) minmax(0, 1fr); column-gap: var(--s6); }
  .clients.tabs .tab-list { grid-column: 1; grid-row: 1; }
  .clients.tabs .tab-panels { grid-column: 2; grid-row: 1 / span 2; }
  .clients.tabs .source { grid-column: 1; grid-row: 2; align-self: start; }
}
.tab-list { display: flex; flex-direction: column; }
.tab {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  min-height: 52px; padding: 0 0 0 var(--s4); border: 0; border-bottom: 1px solid var(--rule); border-left: 2px solid transparent;
  background: none; color: var(--text-muted); font: 400 var(--t-body)/1.2 var(--serif); text-align: left; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-left-color: var(--text); background: var(--surface-raised); }
.tab .client-mark { color: inherit; opacity: 0.9; }
.tab[aria-selected="true"] .client-mark { opacity: 1; }
.tab-panel .client-body { padding-top: 0; }
.tab-panel[hidden] { display: none; }
@media (max-width: 1023px) {
  .clients.tabs .tab-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s4); margin-bottom: var(--s5); }
  .clients.tabs .source { margin: 0 0 var(--s5); }
}

.signin { grid-column: 4 / span 6; display: grid; gap: var(--s3); }
.signin .h3 { margin-bottom: var(--s1); }
.limits { grid-column: 10 / span 3; grid-row: 1 / span 2; }
.limits .h3 { margin-bottom: var(--s4); }
.limit-list { display: grid; gap: var(--s4); counter-reset: lim; }
.limit-list li { font-size: var(--t-small); line-height: 1.5; color: var(--text-muted); padding-top: var(--s3); border-top: 1px solid var(--rule); }
.limit-list strong { font-weight: 400; color: var(--text); }

/* ---------- beat 6: tools ---------- */
.tools-h { grid-column: 1 / span 6; }
.tools-sub { grid-column: 8 / span 5; align-self: end; margin-bottom: var(--s5); }
.tool-list { margin-top: var(--s5); }
.tool { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: baseline; padding: var(--s4) 0; border-top: 1px solid var(--rule); }
.tool-name { grid-column: 1 / span 2; font-size: var(--t-total); color: var(--text); }
.tool-what { grid-column: 3 / span 4; font-size: var(--t-small); line-height: 1.5; color: var(--text-muted); }
.tool-call { grid-column: 8 / span 5; font-size: 13px; color: var(--text-edge); overflow-wrap: anywhere; }
.spec { margin-top: var(--s7); row-gap: 0; }
.spec-row { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; padding: var(--s4) 0; border-top: 1px solid var(--rule); }
.spec-row dt { grid-column: 1 / span 2; font-size: var(--t-small); color: var(--text); }
.spec-row dd { grid-column: 3 / span 8; display: grid; gap: var(--s2); font-size: var(--t-small); line-height: 1.5; color: var(--text-muted); }
.spec-row dd > code { font-size: 13px; color: var(--text-edge); overflow-wrap: anywhere; }
.spec-row dd code + code { margin-left: 0; }
.spec-row:first-child dd { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); }
.spec-row:first-child dd code { font-size: 14px; color: var(--text); }
.ask { font-style: italic; color: var(--text); }
.readme { margin-top: var(--s5); font-size: var(--t-small); }
.readme a { grid-column: 3 / span 4; }

/* ---------- beat 7: free ---------- */
.free-beat { padding-bottom: var(--s10); }
.free-beat .grid { border-top: 1px solid var(--rule); padding-top: var(--s7); row-gap: var(--s6); align-items: end; }
.free-h { grid-column: 1 / span 7; margin-bottom: 0; }
.free-side { grid-column: 8 / span 5; display: grid; gap: var(--s3); }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--rule); padding: var(--s6) 0 var(--s7); font-size: 14px; color: var(--text-edge); }
.foot .grid { row-gap: var(--s4); align-items: start; }
.foot-brand { grid-column: 1 / span 2; color: var(--text-muted); }
.foot-brand svg { height: 18px; }
.foot-credit { grid-column: 3 / span 4; line-height: 1.5; }
.foot-legal { grid-column: 7 / span 5; line-height: 1.5; }
.foot-ver { grid-column: 12 / span 1; text-align: right; }
.foot code { font-size: 12px; color: var(--text-edge); }

/* ---------- tablet ---------- */
@media (max-width: 1023px) {
  .hero-main { grid-column: 1 / -1; }
  .hero-side { grid-column: 1 / span 7; }
  .lanes-beat .h2, .reply-h, .install-h, .tools-h { grid-column: 1 / -1; }
  .lanes-beat .beat-side, .install-sub, .tools-sub { grid-column: 1 / span 6; }
  .lanes { grid-template-columns: repeat(5, minmax(0, 1fr)); row-gap: var(--s6); }
  .reply-sub { grid-column: 1 / span 7; }
  .reply { grid-column: 1 / -1; order: 2; }
  .figure { grid-column: 1 / -1; order: 1; margin-bottom: var(--s6); }
  .sheet-wrap { grid-column: 1 / -1; grid-row: auto; }
  .sheet-side { grid-column: 1 / span 6; grid-row: auto; padding-left: 0; margin-bottom: var(--s6); }
  .sheet-side .h2 { margin-top: 0; }
  .call { grid-column: 1 / -1; grid-row: auto; padding-left: 0; margin-top: var(--s6); }
  .clients, .signin { grid-column: 1 / -1; }
  .limits { grid-column: 1 / -1; grid-row: auto; order: -1; }
  .install-grid .clients { order: -2; }
  .tool-name { grid-column: 1 / span 2; }
  .tool-what { grid-column: 3 / span 6; }
  .tool-call { grid-column: 3 / span 6; margin-top: var(--s2); }
  .spec-row dd { grid-column: 3 / span 6; }
  .free-h, .free-side { grid-column: 1 / -1; }
  .foot-brand { grid-column: 1 / span 2; }
  .foot-credit { grid-column: 3 / span 6; }
  .foot-legal { grid-column: 3 / span 6; }
  .foot-ver { grid-column: 3 / span 6; text-align: left; }
}

/* ---------- phone ---------- */
@media (max-width: 639px) {
  .hero { padding-top: var(--s7); }
  .hero-side { grid-column: 1 / -1; }
  .install-actions { gap: var(--s3) var(--s5); }
  .copy--primary { width: 100%; }
  .code-block--hero pre { white-space: pre-wrap; overflow-wrap: anywhere; }
  .bar nav { gap: var(--s4); }
  .bar nav a[href="#limits"] { display: none; }
  .brand svg { height: 20px; }

  .sheet-hero { margin-top: var(--s7); }
  .edge-line { flex-direction: column; align-items: flex-start; gap: var(--s2); }
  .keep-note { font-size: 22px; }
  .t-time { display: none; }
  .total-tag { display: block; margin-bottom: var(--s1); }
  .strips { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .strips::-webkit-scrollbar { display: none; }
  .sheet-hero.run .hero-lanes { grid-template-columns: repeat(5, minmax(0, 1fr)); width: calc(100vw - 2 * var(--margin)); }
  .sheet-hero.run .hero-lanes ol:nth-child(n+6) { display: none; }

  .lanes-beat .beat-side, .install-sub, .tools-sub, .reply-sub, .sheet-side { grid-column: 1 / -1; }
  .lanes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lane-rows { height: calc(6 * 1.65em); }
  .lane:nth-child(n+5) .lane-rows { height: calc(3 * 1.65em); }
  .figure-n { font-size: 96px; }

  .sheet { --sc: 6; gap: 20px var(--sg); padding: var(--s3) var(--s3) var(--s5); }
  .sheet .frame:nth-child(n+25) { display: none; }
  .sheet-more { display: block; grid-column: 1 / -1; font: 400 13px/1 var(--mono); color: var(--text-edge); padding-top: var(--s1); }
  .sheet .ring--one { inset: -14%; }

  .tool { grid-template-columns: 1fr; row-gap: var(--s2); }
  .tool > * { grid-column: 1 !important; }
  .spec-row { grid-template-columns: 1fr; row-gap: var(--s2); }
  .spec-row > * { grid-column: 1 !important; }
  .readme a { grid-column: 1 / -1; }
  .clients.tabs .tab-list { grid-template-columns: 1fr 1fr; }
  .tab { padding-left: var(--s3); font-size: 16px; }
  .foot-brand, .foot-credit, .foot-legal, .foot-ver { grid-column: 1 / -1; }
}

/* grid items holding code must be allowed to shrink so <pre> scrolls instead of widening the page */
.clients, .signin, .limits, .tab-panels, .tab-panel, .client-body, .hero-side, .reply, .sheet-side, .free-side, .code-block { min-width: 0; }
.nb { display: inline-block; white-space: nowrap; }
.lane-rows li, .hero-lanes li { flex: none; }
@media (max-width: 639px) { .tab { font-size: 16px; } }
.sheet-hero.run .hero-lanes { background: var(--surface); }
@media (min-width: 1024px) { .limits { padding-left: var(--s5); } }

/* sample image credit (design-003) */
.sample-credit { width: var(--container); margin: var(--s1) auto 0; font-size: 14px; line-height: 1.4; color: var(--text-edge); }
.sample-credit a { color: var(--text-muted); }
.foot-credits { grid-column: 3 / -1; font-size: 13px; }
.foot-credits summary { cursor: pointer; color: var(--text-muted); width: max-content; }
.foot-credits ol { margin-top: var(--s3); columns: 2; column-gap: var(--s6); }
.foot-credits li { break-inside: avoid; line-height: 1.45; margin-bottom: var(--s2); }
.cr-id { font: 400 12px/1 var(--mono); color: var(--text-edge); margin-inline-end: var(--s1); }
@media (max-width: 639px) { .foot-credits { grid-column: 1 / -1; } .foot-credits ol { columns: 1; } }
.ring--alt { display: none; }
@media (max-width: 639px) { .strips .ring--span { display: none; } .strips .ring--alt { display: block; } }

/* ===================== v2 (design-L02): energy from the product itself ===================== */

/* sharper rhythm: bigger section heads, tighter beats */
:root { --t-h2: 56px; }
@media (max-width: 1023px) { :root { --t-h2: 40px; } }
@media (max-width: 639px) { :root { --t-h2: 32px; } }
.beat { padding-top: var(--s9); }
.h2 { letter-spacing: -0.022em; line-height: 1.0; }

/* slim nav with the install one click away */
:root { --bar-h: 48px; }
.brand svg { height: 21px; }
.bar nav { align-items: center; }
.bar-copy { height: 30px; font-size: 15px; padding: 0 var(--s3); }
@media (max-width: 639px) { .bar nav a[href*="github"] { display: none; } }

/* the big-lilac field: one section on the brand colour, ink type, the sheet sits on it like a print */
.field {
  --on-field: var(--graphite-975);
  --on-field-muted: var(--graphite-850);
  background: var(--lilac-200);
  color: var(--on-field);
  margin-top: var(--s9);
  padding: var(--s9) 0 var(--s9);
}
.field .h2 { color: var(--on-field); }
.field .body, .field .label, .field .hint { color: var(--on-field-muted); }
.field .label code, .field p code { color: var(--on-field); }
.field .total-tag { color: var(--graphite-800); }
.field .sheet { background: var(--graphite-975); border-color: var(--graphite-975); }
.field .sheet .code { color: var(--graphite-330); }
.field .sheet .is-kept .code { color: var(--lilac-200); }
.field .call-code { background: var(--graphite-975); border-color: var(--graphite-975); color: var(--graphite-100); }
.field .keep-str { color: var(--lilac-200); }
.field .call-out { color: var(--on-field-muted); }
.field .t-line { color: var(--on-field); }
.field .t-dir { color: var(--graphite-700); }
.field :focus-visible { outline-color: var(--graphite-975); }
.field .sheet .frame-btn:focus-visible { outline-color: var(--lilac-200); }
.field .sheet .ring { color: var(--lilac-200); }
.link-btn { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }
.field .link-btn { color: var(--on-field); }

/* draw your keep: an SVG layer over the sheet; pencil cursor while JS can draw */
.sheet-box { position: relative; }
.draw-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 4; color: var(--lilac-200); }
.draw-layer path { fill: none; stroke: currentColor; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.draw-layer path.live { stroke-width: 3.5; opacity: 0.9; }
.js .sheet.can-draw { touch-action: none; cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M3 25l2.2-6.6L19.6 4a2.6 2.6 0 0 1 3.7 0l.7.7a2.6 2.6 0 0 1 0 3.7L9.6 22.8z' fill='%23cac2fb' stroke='%23090b0e' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M3 25l2.2-6.6 4.4 4.4z' fill='%23090b0e'/%3E%3C/svg%3E") 3 25, crosshair; }
.js .sheet.can-draw .frame-btn { cursor: inherit; }

/* frames land with a short, crisp settle (no springs) */
@keyframes land { from { transform: scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
.motion .sheet-hero .frame.on .pic { animation: land 140ms cubic-bezier(.2, .7, .2, 1) both; }
.count { font-variant-numeric: tabular-nums; }

/* tab-runners above each lane: small, never mascot size */
.runner { position: relative; display: block; width: 32px; height: 32px; margin-bottom: var(--s2); color: var(--text); }
.runner .pose { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.runner .rl { stroke: var(--text-muted); fill: none; }
.runner .rb { fill: var(--graphite-100); }
.runner .rp { fill: var(--graphite-400); }
.runner .pose--done { display: block; }
.lanes.running .lane:not(.ended) .runner .pose--done { display: none; }
.lanes.running .lane:not(.ended) .runner[data-f="a"] .pose--run-a,
.lanes.running .lane:not(.ended) .runner[data-f="b"] .pose--run-b { display: block; }


/* full-colour client marks: owners' own colours, a little larger */
.client-mark { width: 24px; height: 24px; }
.client-mark img, .client-mark svg { width: 100%; height: 100%; object-fit: contain; }
/* full-colour marks sit on a small ink tile in both themes: several owner marks are white-on-dark only */
.client-mark { width: 28px; height: 28px; padding: 4px; background: var(--graphite-975); border-radius: 3px; }
.source .client-mark { background: var(--graphite-975); }
@media (pointer: coarse) { .js .sheet.can-draw { touch-action: pan-y; } }
.client-mark .mark-img { border-radius: 4px; } .client-mark:has(.mark-img) { padding: 0; }

/* ---------- launch film (motion-L01), right after the hero ---------- */
.film-h { grid-column: 1 / span 6; }
.film-sub { grid-column: 8 / span 5; align-self: end; margin-bottom: var(--s5); }
.film { margin-top: var(--s5); }
.film-frame { grid-column: 1 / -1; position: relative; aspect-ratio: 16 / 9; background: var(--surface-frame); border: 1px solid var(--rule); overflow: hidden; }
.film-frame img, .film-frame video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.film-play {
  position: absolute; left: var(--s5); bottom: var(--s5); display: inline-flex; align-items: center; gap: var(--s3);
  height: 48px; padding: 0 var(--s4) 0 var(--s3); background: var(--graphite-975); color: var(--graphite-100);
  border: 1px solid var(--graphite-700); border-radius: var(--radius); font: 400 var(--t-small)/1 var(--serif); text-decoration: none;
}
.film-play:hover { border-color: var(--graphite-300); }
.film-play:focus-visible { outline: 2px solid var(--graphite-100); outline-offset: 3px; }
.film-play-ico { width: 0; height: 0; border-left: 12px solid currentColor; border-top: 7px solid transparent; border-bottom: 7px solid transparent; margin-left: 4px; }
.film-cap { grid-column: 1 / -1; margin-top: var(--s3); font-size: 14px; color: var(--text-edge); }
@media (max-width: 1023px) { .film-h, .film-sub { grid-column: 1 / -1; } }
@media (max-width: 639px) { .film-play { left: var(--s3); bottom: var(--s3); height: 44px; } }
.film-play[hidden] { display: none; }
