/* The brand site itself. Every value comes from tokens.css. */
@font-face { font-family: "Sora"; src: url(fonts/sora-latin-wght-normal.woff2) format("woff2"); font-weight: 100 800; font-display: swap; }
@font-face { font-family: "Google Sans"; src: url(fonts/google-sans-latin-wght-normal.woff2) format("woff2"); font-weight: 400 700; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Google Sans"; src: url(fonts/google-sans-latin-ext-wght-normal.woff2) format("woff2"); font-weight: 400 700; font-display: swap; unicode-range: U+0100-02AF, U+1E00-1EFF; }

*, ::before, ::after { box-sizing: border-box; }
* { margin: 0; }
html { color-scheme: light; -webkit-text-size-adjust: 100%; }
html[data-theme="dark"] { color-scheme: dark; }
body { background: var(--shell); color: var(--fg); font: 400 var(--text-base)/1.5 var(--font-body); padding: var(--space-2); min-height: 100vh; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button, .btn, label.switch, .seg label { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; top: 12px; left: 12px; z-index: 9; background: var(--fg); color: var(--bg); padding: 8px 16px; border-radius: var(--radius-pill); }

/* the squircle, where the browser can draw it */
.pill, .canvas, .code, .row, .sw, .input, .list, .list li, .nest-out, .nest-in, .stage > div, .chip, .donts div, .empty, .pair, pre, .seg, .seg span { corner-shape: var(--corner); }

/* shell */
.bar { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-bottom: var(--space-2); }
.pill { min-height: 40px; display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.home { gap: var(--space-2); padding: 0 16px 0 4px; font: var(--weight-head) 16px var(--font-head); letter-spacing: -0.02em; text-decoration: none; }
.home img { border-radius: 9px; display: block; }
.home span { color: var(--muted); }
.tabs { padding: 2px; gap: 2px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.tabs a { padding: 8px 14px; border-radius: 14px; text-decoration: none; font-size: 14px; font-weight: var(--weight-strong); color: var(--muted); white-space: nowrap; transition: background var(--dur-fast), color var(--dur-fast); }
.tabs a:hover { color: var(--fg); }
.tabs a[aria-current] { background: var(--shell); color: var(--fg); }
.btn.get { gap: 0.3em; margin-left: auto; height: 40px; font-size: 14px; }

.work { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "canvas controls" "canvas code"; grid-template-rows: auto 1fr; gap: var(--space-2) var(--space-4); align-items: start; }
.canvas { grid-area: canvas; background: var(--bg); border-radius: var(--radius-xl); padding: clamp(20px, 4.5vw, 56px); min-height: calc(100vh - 72px); outline: 0; }
.controls { grid-area: controls; display: grid; gap: var(--space-4); padding: var(--space-2) var(--space-1) 0; }
.code { grid-area: code; position: sticky; top: var(--space-2); padding: 0 var(--space-1); display: grid; gap: var(--space-3); }
.js .canvas > section:not(.on) { display: none; }
.canvas > section + section { margin-top: var(--space-16); }

/* type */
h1 { font: var(--weight-head) clamp(40px, 7vw, var(--text-3xl))/1 var(--font-head); letter-spacing: -0.05em; }
h2 { font: var(--weight-head) var(--text-lg)/1.2 var(--font-head); letter-spacing: -0.02em; margin-top: var(--space-12); }
.lead { font-size: var(--text-lg); line-height: 1.4; max-width: 34em; margin-top: var(--space-4); color: var(--muted); text-wrap: pretty; }
h1 + .lead + * { margin-top: var(--space-8); }
.note { font-size: var(--text-sm); color: var(--muted); max-width: 60ch; margin-top: var(--space-1); }
h2 + .note + *, h2 + :not(.note) { margin-top: var(--space-4); }
.rules { padding: 0; list-style: none; max-width: 62ch; border-top: 1px solid var(--line); }
.rules li { padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.code h2 { margin: 0; font-size: var(--text-base); }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3); font: 12px/1.7 var(--font-code); overflow: auto; max-height: min(52vh, 480px); white-space: pre; }

/* buttons */
.btn { height: var(--control-h); padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); border: 1.5px solid var(--fg); border-radius: var(--radius-pill); background: var(--fg); color: var(--bg); font-weight: var(--weight-strong); text-decoration: none; white-space: nowrap; transition: background var(--dur-fast), border-color var(--dur-fast), scale var(--dur-fast) var(--ease); }
.btn:hover { background: color-mix(in oklab, var(--fg) 84%, var(--bg)); border-color: color-mix(in oklab, var(--fg) 84%, var(--bg)); }
.btn:active { scale: 0.97; }
.btn.accent { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.btn.accent:hover { background: var(--lime-hover); border-color: var(--lime-hover); }
.btn.quiet { background: none; color: var(--fg); border-color: var(--line); }
.btn.quiet:hover { background: var(--shell); border-color: var(--line); }
.btn.danger { background: var(--danger-tint); border-color: var(--danger-tint); color: var(--danger); }
.btn.danger:hover { background: color-mix(in oklab, var(--danger-tint) 88%, var(--danger)); border-color: transparent; }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.4; cursor: not-allowed; scale: 1; }
.btn[aria-busy="true"] { opacity: 0.7; cursor: progress; }

/* segmented control */
.seg { border: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; align-items: center; min-width: 0; }
.seg legend { font-size: var(--text-sm); font-weight: var(--weight-strong); margin-bottom: var(--space-2); padding: 0; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: 8px 10px; font-size: 14px; font-weight: var(--weight-strong); color: var(--muted); border: 1px solid transparent; border-radius: var(--radius-md); transition: background var(--dur-fast), color var(--dur-fast); }
.seg label:hover span { color: var(--fg); }
.seg input:checked + span { background: var(--bg); border-color: var(--line); color: var(--fg); }
.seg input:focus-visible + span { outline: 2px solid var(--fg); outline-offset: 2px; }
.seg.small span { padding: 3px 10px; font-size: 12px; }

/* token rows */
.rows { display: grid; gap: 2px; margin-inline: calc(var(--space-3) * -1); }
.row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; width: 100%; min-height: 52px; padding: var(--space-2) var(--space-3); background: none; border: 0; border-radius: var(--radius-md); text-align: left; transition: background var(--dur-fast); }
.row:hover { background: var(--shell); }
.row .pv { display: grid; place-items: center; min-width: 0; }
.row .nm { font: 13px var(--font-code); display: block; }
.row .ds { font-size: var(--text-sm); color: var(--muted); display: block; }
.row .vl { font: 13px var(--font-code); color: var(--muted); text-align: right; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv i { display: block; background: var(--fg); }
.pv .dot { width: 28px; height: 28px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.pv .sq { width: 40px; height: 40px; }
.pv .aa { background: none; font-style: normal; font-size: 20px; }
[data-group="Space"] .row { grid-template-columns: 64px minmax(0, 1fr) auto; }
[data-group="Space"] .pv { justify-items: start; }
[data-group="Motion"] .row { grid-template-columns: 96px minmax(0, 1fr) auto; }
.track { width: 96px; height: 20px; border-radius: 10px; background: var(--shell) !important; border: 1px solid var(--line); position: relative; }
.track b { position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 5px; background: var(--fg); }
.row.go .track b { translate: 76px 0; }

/* colour */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3); }
.sw { display: grid; align-content: start; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); text-align: left; overflow: hidden; transition: translate var(--dur-fast) var(--ease); }
.sw:active { translate: 0 1px; }
.sw i { display: block; height: 84px; border-bottom: 1px solid var(--line); }
.sw span { display: block; padding: 0 var(--space-3); }
.sw .nm { font: var(--weight-head) 16px var(--font-head); letter-spacing: -0.02em; padding-top: var(--space-3); text-transform: capitalize; }
.sw .vl { font: 12px var(--font-code); color: var(--muted); }
.sw .ds { font-size: 13px; line-height: 1.35; color: var(--muted); padding-block: var(--space-1) var(--space-3); }
.pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-3); }
.pair { border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); border: 1px solid var(--line); }
.pair b { display: block; font: var(--weight-head) 20px var(--font-head); letter-spacing: -0.02em; }
.pair span { font-size: 13px; }
.pair.fail b { text-decoration: line-through; }

/* type specimen */
.specimen { display: grid; gap: var(--space-6); }
.specimen p { text-wrap: balance; }
.s-3xl, .s-2xl, .s-xl, .s-lg { font-family: var(--font-head); font-weight: var(--weight-head); line-height: 1.05; letter-spacing: var(--track-tight); }
.s-3xl { font-size: clamp(40px, 9vw, var(--text-3xl)); letter-spacing: -0.05em; }
.s-2xl { font-size: clamp(30px, 6vw, var(--text-2xl)); }
.s-xl { font-size: var(--text-xl); }
.s-lg { font-size: var(--text-lg); letter-spacing: -0.02em; line-height: 1.3; max-width: 32em; }
.s-base { max-width: 66ch; }
.s-sm { font-size: var(--text-sm); color: var(--muted); }

/* shape */
.nest-demo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-8); align-items: center; }
.nest-out { background: var(--shell); border-radius: var(--radius-lg); padding: 8px; }
.nest-in { background: var(--surface); border: 1px solid var(--line); height: 96px; display: grid; place-items: center; border-radius: 12px; font-size: var(--text-sm); color: var(--muted); }
.nest-ctl label, .size-ctl label { display: flex; justify-content: space-between; font-weight: var(--weight-strong); font-size: var(--text-sm); }
output { font: 13px var(--font-code); color: var(--muted); }
input[type="range"] { width: 100%; height: var(--control-h); accent-color: var(--fg); margin: 0; }

/* components */
.demo { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.demo + .note { margin-top: var(--space-3); }
.demo.col { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); max-width: 440px; }
.field label { display: block; font-size: var(--text-sm); font-weight: var(--weight-strong); margin-bottom: var(--space-1); }
.input { display: flex; align-items: center; height: var(--control-h); padding: 0 var(--space-3); background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-md); transition: border-color var(--dur-fast); }
.input span { color: var(--muted); }
.input input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: 0; padding: 0; }
.input:hover { border-color: color-mix(in oklab, var(--fg) 30%, var(--line)); }
.input:focus-within { border-color: var(--fg); }
.input:has(:disabled) { background: var(--shell); border-color: var(--line); color: var(--muted); }
.input:has([aria-invalid="true"]) { border-color: var(--danger); }
.msg { font-size: var(--text-sm); color: var(--muted); margin-top: var(--space-1); min-height: 1.5em; }
.msg.err { color: var(--danger); }
.list { list-style: none; padding: var(--space-2); background: var(--shell); border-radius: var(--radius-lg); display: grid; gap: var(--space-2); }
.list li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-height: calc(var(--control-h) + 8px); padding: 0 var(--space-3) 0 var(--space-4); background: var(--surface); border-radius: var(--radius-md); }
.list .price { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.list li.out .dish { color: var(--muted); text-decoration: line-through; }
.badge { font-size: var(--text-xs); font-weight: var(--weight-strong); padding: 2px 10px; border-radius: var(--radius-pill); white-space: nowrap; }
.badge.new { background: var(--accent-tint); }
.badge.sold { background: var(--danger-tint); color: var(--danger); }
.switch { display: grid; place-items: center; height: var(--control-h); padding-left: var(--space-2); position: relative; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.switch i { width: 44px; height: 26px; border-radius: 13px; background: var(--line); position: relative; transition: background var(--dur-base); }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(22 40 20 / 0.25); transition: translate var(--dur-base) var(--ease); }
.switch input:checked + i { background: var(--lime); }
.switch input:checked + i::after { translate: 18px 0; background: var(--ink); }
.switch input:focus-visible + i { outline: 2px solid var(--fg); outline-offset: 2px; }
.empty { width: 100%; max-width: 440px; padding: var(--space-8) var(--space-6); border: 1.5px dashed var(--line); border-radius: var(--radius-lg); display: grid; justify-items: start; gap: var(--space-1); }
.empty .btn { margin-top: var(--space-4); }

/* logo: these are brand colours on purpose, they do not follow the theme */
.stage { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.stage > div { height: 220px; display: grid; place-items: center; border-radius: var(--radius-lg); border: 1px solid var(--line); overflow: hidden; }
.on-canvas { background: var(--canvas); } .on-ink { background: var(--ink); } .on-tint { background: var(--lime-tint); }
.chip { display: flex; align-items: center; gap: var(--space-2); height: 44px; padding: 4px 14px 4px 8px; background: var(--lime); color: var(--ink); border-radius: var(--radius-md); font: 600 18px var(--font-head); letter-spacing: -0.03em; }
.size-ctl { max-width: 440px; margin-top: var(--space-4); }
.files { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.donts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-3); }
.donts div { height: 130px; display: grid; place-items: center; background: var(--shell); border-radius: var(--radius-lg); overflow: hidden; }
.donts img { width: 56px; height: 56px; }
.donts figcaption { font-size: var(--text-sm); margin-top: var(--space-2); }

/* voice */
.voice { display: grid; border-top: 1px solid var(--line); max-width: 860px; }
.voice > div { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--space-6); align-items: center; padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.voice s { color: var(--muted); font-size: var(--text-sm); text-decoration-color: var(--danger); }
.voice button { background: none; border: 0; padding: var(--space-1) 0; min-height: var(--control-h); text-align: left; font: var(--weight-head) var(--text-lg)/1.25 var(--font-head); letter-spacing: -0.02em; cursor: copy; border-radius: var(--radius-sm); }
.voice button:hover { background: var(--accent-tint); box-shadow: 0 0 0 6px var(--accent-tint); }

/* the copied note is the one tilted brick on the page */
#toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 80px; rotate: var(--tilt); background: var(--lime); color: var(--ink); padding: 10px 20px; border-radius: var(--radius-md); corner-shape: var(--corner); font-weight: var(--weight-strong); font-size: 14px; max-width: calc(100vw - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: translate var(--dur-base) var(--ease), opacity var(--dur-base); pointer-events: none; z-index: 5; }
#toast.on { translate: -50% 0; opacity: 1; }

@media (max-width: 900px) {
  .work { grid-template-columns: minmax(0, 1fr); grid-template-areas: "controls" "canvas" "code"; }
  .controls { display: flex; justify-content: space-between; gap: var(--space-2); padding: 0; }
  .controls legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .controls .seg { flex-wrap: nowrap; } .controls .seg span { padding: 8px; }
  .code { position: static; padding: var(--space-4) var(--space-1); }
  .canvas { min-height: 0; }
  .tabs { order: 3; width: 100%; }
  .get .wide { display: none; }
  .nest-demo, .voice > div { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
  .stage { grid-template-columns: minmax(0, 1fr); } .stage > div { height: 160px; }
  .row .vl { max-width: 12ch; }
}
@media (prefers-reduced-motion: reduce) { *, ::before, ::after { transition-duration: 0.01ms !important; } }

/* a theme switch is not an animation */
.no-anim, .no-anim * { transition: none !important; }
