/*
 * SoftCloud 3.0 — homepage.
 * Quiet, editorial layout around one playful object: the cloud you can press.
 * Colours and type come from tokens.css.
 */

/* ---------- Base ---------- */

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

html {
    background: var(--paper);       /* Also what a phone shows behind the status bar and on overscroll. */
    scroll-behavior: smooth;
    scroll-padding-top: 88px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 400 1rem/1.75 var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
}

h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a, button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
kbd { font: 500 .75rem/1 var(--font-mono); }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-s); }

.shell { width: min(1200px, 100% - clamp(40px, 8vw, 96px)); margin-inline: auto; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.nowrap { white-space: nowrap; }
.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.skip-link { position: fixed; top: 12px; left: 12px; z-index: 100; padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--paper); transform: translateY(-200%); }
.skip-link:focus { transform: none; }

/* Full-width punctuation carries blank space; hang it so centred lines look centred. */
.hang { margin-right: -.5em; }

/* ---------- Buttons and labels ---------- */

.button {
    display: inline-flex;
    align-items: center;
    gap: .6em;
    min-height: 52px;
    padding: 0 1.5em;
    border-radius: 999px;
    background: var(--ink);
    color: var(--paper);
    font-weight: 600;
    font-size: .9375rem;
    line-height: 1;
    white-space: nowrap;
    transition: transform .3s var(--ease-out), background-color .3s, color .3s, border-color .3s;
}
.button .icon { width: 1.15em; height: 1.15em; transition: transform .3s var(--ease-out); }
@media (hover: hover) { .button:hover { transform: translateY(-2px); } }
.button:active { transform: scale(.97); transition-duration: .08s; }
@media (hover: hover) { .button:hover .icon { transform: translate(2px, -2px); } }
@media (hover: hover) { .button[href^="#"]:hover .icon { transform: translateY(2px); } }
.button--quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
@media (hover: hover) { .button--quiet:hover { box-shadow: inset 0 0 0 1px var(--ink); } }
.button--quiet:focus-visible { box-shadow: var(--focus); }
.button--tone { background: var(--tone); color: var(--surface); }
[data-theme="dark"] .button--tone { color: var(--paper-sunk); }

.icon-button { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--ink-soft); transition: background-color .2s, color .2s, transform .3s var(--ease-spring); }
@media (hover: hover) { .icon-button:hover { background: var(--line); color: var(--ink); } }
.icon-button:active { transform: scale(.9); }

.text-button { color: var(--ink-soft); font-size: .8125rem; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: .3em; transition: color .2s; }
@media (hover: hover) { .text-button:hover { color: var(--ink); } }

.label { display: flex; align-items: center; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid var(--line-strong); color: var(--ink); font-size: .875rem; font-weight: 600; letter-spacing: .08em; }
.label__count { margin-left: auto; color: var(--ink-faint); font: 500 .8125rem var(--font-mono); letter-spacing: .04em; }

.version-tag { display: inline-block; margin-right: .75em; padding: .28em .7em; border-radius: 999px; background: var(--ink); color: var(--paper); font: 600 .75rem/1.2 var(--font-mono); letter-spacing: .02em; vertical-align: .08em; }

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

.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--paper) 82%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid transparent; transition: border-color .3s; }
.site-header.is-stuck { border-bottom-color: var(--line); }
.site-header__inner { display: flex; align-items: center; gap: 24px; height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; }
.brand img { width: 36px; height: auto; }
.brand__latin { color: var(--ink-faint); font: 500 .75rem var(--font-mono); letter-spacing: .06em; }

.site-nav { display: flex; gap: 4px; margin-left: auto; font-size: .9375rem; }
.site-nav a { position: relative; padding: 8px 14px; border-radius: 999px; color: var(--ink-soft); transition: color .2s, background-color .2s; }
@media (hover: hover) { .site-nav a:hover { color: var(--ink); background: var(--line); } }
.site-nav a[aria-current="true"] { color: var(--ink); }
.site-nav a[aria-current="true"]::after { content: ''; position: absolute; left: 50%; bottom: 2px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--brand-teal); }

.site-actions { display: flex; align-items: center; gap: 6px; }
.jump-button { display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px 0 12px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink-soft); font-size: .875rem; transition: color .2s, box-shadow .2s; }
@media (hover: hover) { .jump-button:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink-faint); } }
.jump-button:focus-visible { box-shadow: var(--focus); border-radius: 999px; }
.jump-button .icon { width: 1.1em; height: 1.1em; }
.jump-button .icon--menu { display: none; }
.jump-button__key { padding: 5px 7px; border-radius: 999px; background: var(--line); color: var(--ink-faint); }

.icon--moon { display: none; }
[data-theme="dark"] .icon--moon { display: block; }
[data-theme="dark"] .icon--sun { display: none; }

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

/* The glow behind the cloud is wider than a phone screen; unclipped, it would widen the whole page. */
.hero { position: relative; overflow: hidden; overflow: clip; display: flex; flex-direction: column; align-items: center; min-height: calc(100vh - 64px); min-height: calc(100svh - 64px); padding-bottom: 28px; text-align: center; }

/*
 * The cloud's stage. --unit is one outline unit in pixels and must match EXTENT in cloud.js:
 * the view is 5.5 units wide and 4 tall, so the poster lands exactly where WebGL will draw.
 */
/* manipulation: scrolling and pinching still work over the stage, but two quick taps on the cloud
   are not read as "zoom the page". */
.cloud { position: relative; touch-action: manipulation; width: 100%; height: clamp(240px, min(44vh, 73vw), 500px); height: clamp(240px, min(44svh, 73vw), 500px); container-type: size; --unit: min(100cqw / 5.5, 100cqh / 4); }
/* Without container units, size the stage from the viewport instead: close enough for a still. */
@supports not (width: 1cqw) { .cloud { --unit: min(18vw, 11vh); } }
.cloud__glow { position: absolute; left: 50%; top: 46%; width: min(calc(var(--unit) * 8), 100%); height: calc(var(--unit) * 5.2); translate: -50% -50%; border-radius: 50%; background: radial-gradient(closest-side, #fff, transparent); opacity: .9; pointer-events: none; }
[data-theme="dark"] .cloud__glow { background: radial-gradient(closest-side, rgba(52, 150, 196, .26), transparent); }
.cloud__poster, .cloud__surface { position: absolute; left: 50%; top: 50%; width: calc(var(--unit) * 4.4); height: calc(var(--unit) * 2.8); translate: -50% calc(-50% - var(--unit) * .1); }
.cloud__poster { transition: opacity .2s linear, visibility .2s; }
.cloud::after { content: ''; position: absolute; left: 50%; top: calc(50% + var(--unit) * 1.74); width: calc(var(--unit) * 4.6); height: calc(var(--unit) * .4); translate: -50% -50%; border-radius: 50%; background: radial-gradient(closest-side, rgba(26, 92, 128, .22), transparent); transition: opacity .2s linear; pointer-events: none; }
[data-theme="dark"] .cloud::after { background: radial-gradient(closest-side, rgba(41, 153, 199, .16), transparent); }
.cloud__canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.cloud[data-state="ready"] .cloud__canvas { opacity: 1; }
.cloud[data-state="ready"] .cloud__poster { opacity: 0; visibility: hidden; }
.cloud[data-state="ready"]::after { opacity: 0; }
.cloud__canvas:focus-visible { box-shadow: none; outline: 2px dashed var(--accent); outline-offset: -8px; border-radius: var(--radius-l); }
/* pan-y: on a touch screen a vertical swipe over the cloud still scrolls the page; pressing and
   dragging sideways go to the cloud. */
.cloud__surface { pointer-events: none; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.cloud[data-state="ready"] .cloud__surface { pointer-events: auto; cursor: grab; }
.cloud[data-state="ready"] .cloud__surface.is-dragging { cursor: grabbing; }

.hint-touch { display: none; }
@media (hover: none), (pointer: coarse) { .hint-pointer { display: none; } .hint-touch { display: inline; } }

.hero__copy { display: flex; flex-direction: column; align-items: center; margin-top: clamp(8px, 2vh, 24px); }
.hero__kicker { color: var(--ink-soft); font-size: .875rem; letter-spacing: .06em; }
.hero__kicker-sep { display: inline-block; width: 3px; height: 3px; margin: 0 .9em; border-radius: 50%; background: currentColor; vertical-align: middle; opacity: .6; }
.hero__title { margin-top: 18px; font-size: clamp(3rem, 8.6vw, 7.25rem); font-weight: 700; line-height: 1.08; letter-spacing: -.02em; }
.hero__line { display: inline-block; white-space: nowrap; }
.hang--break { margin-right: 0; }
.hero__lead { max-width: 40em; margin-top: 22px; color: var(--ink-soft); font-size: clamp(1rem, 1.3vw, 1.125rem); line-height: 1.85; }
.hero__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 30px; }

.hero__index { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: auto; padding-top: clamp(36px, 6vh, 64px); text-align: left; }
.hero__index a { --tone: var(--ink); position: relative; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; padding: 18px 16px 6px 0; border-top: 1px solid var(--line-strong); transition: border-color .3s; }
.hero__index a + a { padding-left: 20px; }
.hero__index a::before { content: ''; position: absolute; left: 0; top: -1px; width: 100%; height: 2px; background: var(--tone); transform: scaleX(0); transform-origin: left; transition: transform .5s var(--ease-out); }
@media (hover: hover) { .hero__index a:hover::before { transform: scaleX(1); } }
.hero__index-num { grid-row: span 2; color: var(--ink-faint); font: 500 .75rem/2 var(--font-mono); }
.hero__index strong { font-size: .9375rem; font-weight: 650; line-height: 1.6; }
.hero__index a > span:last-child { color: var(--ink-faint); font-size: .8125rem; line-height: 1.6; }

[data-tone="rhyme"] { --tone: var(--tone-rhyme); }
[data-tone="words"] { --tone: var(--tone-words); }
[data-tone="focus"] { --tone: var(--tone-focus); }
[data-tone="sbti"] { --tone: var(--tone-sbti); }

/* ---------- Sections ---------- */

.section { padding-top: clamp(96px, 13vw, 176px); }
.section-head { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; }
.section-head .label { grid-column: 1 / -1; }
.section-head h2 { grid-column: 1 / span 8; margin-top: clamp(28px, 4vw, 48px); font-size: clamp(2.125rem, 5.2vw, 4.25rem); font-weight: 700; line-height: 1.14; letter-spacing: -.015em; }
.section-head__note { grid-column: 9 / -1; align-self: end; padding-bottom: .6em; color: var(--ink-soft); font-size: .9375rem; line-height: 1.85; }

/* ---------- Products ---------- */

.product { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; align-items: center; margin-top: clamp(72px, 10vw, 136px); scroll-margin-top: 96px; }
.product__copy { grid-column: 1 / span 5; padding-right: clamp(0px, 2vw, 32px); }
.product .demo { grid-column: 6 / -1; }
.product:nth-of-type(even) .product__copy { grid-column: 8 / -1; grid-row: 1; padding: 0 0 0 clamp(0px, 2vw, 32px); }
.product:nth-of-type(even) .demo { grid-column: 1 / span 7; grid-row: 1; }

.product__meta { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); font-size: .8125rem; letter-spacing: .1em; }
.product__num { display: inline-grid; place-items: center; min-width: 34px; height: 24px; padding: 0 8px; border-radius: 999px; background: color-mix(in srgb, var(--tone) 14%, transparent); color: var(--tone); font: 600 .75rem var(--font-mono); letter-spacing: 0; }
.product__name { margin-top: 20px; font-size: clamp(2rem, 3.6vw, 3rem); font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.product__lead { margin-top: 14px; font-size: clamp(1.0625rem, 1.5vw, 1.25rem); font-weight: 550; line-height: 1.6; }
.product__text { margin-top: 14px; color: var(--ink-soft); line-height: 1.9; }
.points { display: grid; gap: 10px; margin-top: 24px; font-size: .9375rem; }
.points li { display: flex; align-items: center; gap: 10px; }
.points .icon { width: 20px; height: 20px; padding: 4px; border-radius: 50%; background: color-mix(in srgb, var(--tone) 14%, transparent); color: var(--tone); stroke-width: 2.6; }
.product__go { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 32px; }
.product__host { color: var(--ink-faint); font: 500 .8125rem var(--font-mono); }

/* The stage each demo sits on. */
.demo { position: relative; display: grid; min-width: 0; padding: clamp(14px, 2.4vw, 32px); border-radius: var(--radius-xl); background: color-mix(in srgb, var(--tone) 9%, var(--paper)); }
[data-theme="dark"] .demo { background: color-mix(in srgb, var(--tone) 11%, var(--paper)); }
.demo__window { display: flex; flex-direction: column; min-width: 0; min-height: clamp(420px, 38vw, 500px); border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); box-shadow: var(--shadow-m); overflow: hidden; }
.demo__bar { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 14px; border-bottom: 1px solid var(--line); color: var(--ink-faint); font-size: .75rem; }
.demo__dots { display: inline-flex; gap: 6px; }
.demo__dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.demo__title { color: var(--ink-soft); font-weight: 600; letter-spacing: .04em; }
.demo__badge { margin-left: auto; padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--tone) 12%, transparent); color: var(--tone); font-weight: 600; }
.demo__body { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: clamp(16px, 2vw, 24px); }
.demo__placeholder, .demo__noscript { margin: auto; color: var(--ink-faint); font-size: .875rem; }
.demo__noscript { padding: 16px 4px 0; }
.demo__foot { margin-top: auto; padding-top: 16px; color: var(--ink-faint); font-size: .75rem; line-height: 1.7; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 34px; padding: 0 14px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink-soft); font-size: .875rem; transition: background-color .2s, color .2s, box-shadow .2s, transform .2s var(--ease-spring); }
@media (hover: hover) { .chip:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink-faint); } }
.chip:active { transform: scale(.94); }
.chip:focus-visible { box-shadow: var(--focus); border-radius: 999px; }
.chip[aria-pressed="true"] { background: var(--tone); color: var(--surface); box-shadow: none; font-weight: 600; }
[data-theme="dark"] .chip[aria-pressed="true"] { color: var(--paper-sunk); }

/* Demo 01 — rhyme finder */
.rhyme { display: flex; flex-direction: column; flex: 1; gap: 14px; }
.rhyme__search { display: flex; align-items: center; gap: 12px; height: 50px; padding: 0 16px; border-radius: var(--radius-m); background: var(--paper); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--tone) 55%, transparent); color: var(--tone); }
.rhyme__query { color: var(--ink); font-size: 1.125rem; font-weight: 650; }
.rhyme__query::after { content: ''; display: inline-block; width: 1.5px; height: 1.1em; margin-left: 8px; background: var(--tone); vertical-align: -.18em; animation: blink 1.1s steps(1) infinite; }
.rhyme__pinyin { margin-left: auto; color: var(--ink-faint); font: 500 .8125rem var(--font-mono); }
@keyframes blink { 50% { opacity: 0; } }
.rhyme__columns { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; flex: 1; }
.rhyme__group { display: flex; align-items: center; gap: 8px; margin: 4px 0 6px; color: var(--ink-faint); font-size: .75rem; font-weight: 600; letter-spacing: .1em; }
.rhyme__group span:last-child { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0; }
.rhyme__group:not(:first-child) { margin-top: 12px; }
.rhyme__row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; border-radius: 12px; text-align: left; transition: background-color .2s; }
@media (hover: hover) { .rhyme__row:hover { background: var(--paper); } }
.rhyme__row[aria-pressed="true"] { background: color-mix(in srgb, var(--tone) 12%, transparent); }
.rhyme__word { font-size: 1.0625rem; font-weight: 650; }
.rhyme__py { color: var(--ink-faint); font: 500 .75rem var(--font-mono); white-space: nowrap; }
.rhyme__py b { color: var(--tone); font-weight: 600; }
.rhyme__tag { margin-left: auto; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--tone) 14%, transparent); color: var(--tone); font-size: .6875rem; font-weight: 600; white-space: nowrap; }
.rhyme__check { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--radius-m); background: var(--paper); }
.rhyme__check-title { color: var(--ink-faint); font-size: .75rem; font-weight: 600; letter-spacing: .1em; }
.rhyme__pair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 10px 8px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); animation: settle .5s var(--ease-out) both; animation-delay: calc(var(--i) * 140ms); }
.rhyme__cell { display: grid; justify-items: center; gap: 2px; }
.rhyme__cell .han { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.rhyme__cell .py { color: var(--ink-faint); font: 500 .75rem var(--font-mono); }
.rhyme__cell .py b { color: var(--tone); font-weight: 600; }
.rhyme__marks { display: grid; gap: 4px; }
.mark { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: 999px; font-size: .6875rem; font-weight: 600; white-space: nowrap; }
.mark .icon { width: 12px; height: 12px; stroke-width: 3; }
.mark.is-match { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.mark.is-miss { background: var(--line); color: var(--ink-faint); }
.rhyme__verdict { margin-top: auto; padding-top: 4px; font-size: .9375rem; font-weight: 650; }
.rhyme__verdict small { display: block; color: var(--ink-faint); font-size: .75rem; font-weight: 400; }
@keyframes settle { from { opacity: 0; transform: translateY(8px); } }

/* Demo 02 — typing practice */
.words { position: relative; display: flex; flex-direction: column; flex: 1; gap: 12px; border-radius: var(--radius-m); cursor: text; }
.words__top, .words__foot { display: flex; align-items: center; gap: 16px; color: var(--ink-faint); font-size: .75rem; }
.words__top span:last-child, .words__foot .text-button { margin-left: auto; }
.words__top span:last-child { font-family: var(--font-mono); }
.words__stage { display: grid; justify-items: center; align-content: center; gap: 6px; flex: 1; min-height: 132px; padding: 12px; border-radius: var(--radius-m); background: var(--paper); transition: box-shadow .2s; }
.words:focus-visible { box-shadow: none; }
.words:focus-within .words__stage { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--tone) 55%, transparent); }
.words:focus-visible .words__stage { box-shadow: inset 0 0 0 2px var(--tone); }
.words__word { display: flex; font: 600 clamp(1.75rem, 4.4vw, 2.75rem)/1.2 var(--font-mono); letter-spacing: .04em; }
.words__word span { position: relative; color: var(--ink-faint); opacity: .55; transition: color .12s, opacity .12s; }
.words__word .is-done { color: var(--tone); opacity: 1; }
.words__word .is-next { color: var(--ink); opacity: 1; }
.words__word .is-next::after { content: ''; position: absolute; left: 8%; right: 8%; bottom: -4px; height: 2.5px; border-radius: 2px; background: var(--tone); animation: blink 1.1s steps(1) infinite; }
.words__word.is-wrong { animation: shake .3s; }
.words__word.is-wrong .is-next { color: var(--bad); }
.words__word.is-complete span { color: var(--good); }
.words__phonetic { color: var(--ink-faint); font: 500 .8125rem var(--font-mono); }
.words__meaning { font-size: .9375rem; }
.words__prompt { color: var(--ink-faint); font-size: .75rem; }
.words:focus-within .words__prompt { visibility: hidden; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.keys { display: grid; gap: 5px; }
.keys__row { display: flex; justify-content: center; gap: 5px; }
.key { flex: 0 1 38px; min-width: 0; height: 36px; border-radius: 8px; background: var(--paper); box-shadow: inset 0 -2px 0 var(--line), inset 0 0 0 1px var(--line); color: var(--ink-soft); font: 500 .8125rem/1 var(--font-mono); text-transform: uppercase; transition: background-color .12s, color .12s, transform .08s; }
.key:active, .key.is-down { transform: translateY(1px); box-shadow: inset 0 0 0 1px var(--line); }
.key.is-next { background: var(--tone); box-shadow: none; color: var(--surface); }
[data-theme="dark"] .key.is-next { color: var(--paper-sunk); }
.key.is-wrong { background: color-mix(in srgb, var(--bad) 22%, transparent); color: var(--bad); }

/* Demo 03 — ambient mixer */
.mixer { display: flex; flex-direction: column; flex: 1; gap: 16px; }
.mixer__head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 12px; border-radius: var(--radius-m); background: var(--paper); }
.mixer__play { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--tone); color: var(--surface); transition: transform .3s var(--ease-spring); }
[data-theme="dark"] .mixer__play { color: var(--paper-sunk); }
@media (hover: hover) { .mixer__play:hover { transform: scale(1.06); } }
.mixer__play:active { transform: scale(.94); }
.mixer__play:focus-visible { border-radius: 50%; }
.mixer__play .icon { width: 24px; height: 24px; }
.mixer__play .icon--pause, .mixer__play[aria-pressed="true"] .icon--play { display: none; }
.mixer__play[aria-pressed="true"] .icon--pause { display: block; }
.mixer__scope { width: 100%; height: 48px; }
.mixer__timer { display: grid; justify-items: end; padding-right: 6px; }
.mixer__time { font: 600 1.375rem/1.2 var(--font-mono); font-variant-numeric: tabular-nums; }
.mixer__timer span:last-child { color: var(--ink-faint); font-size: .6875rem; letter-spacing: .08em; }
.mixer__channels { display: grid; gap: 6px; }
.channel { display: grid; grid-template-columns: 36px 4.2em minmax(0, 1fr) 2.2em; align-items: center; gap: 12px; min-height: 48px; }
.channel__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--paper); color: var(--ink-faint); transition: background-color .3s, color .3s; }
.channel.is-on .channel__icon { background: color-mix(in srgb, var(--tone) 14%, transparent); color: var(--tone); }
.channel__icon .icon { width: 18px; height: 18px; }
.channel__name { font-size: .9375rem; font-weight: 600; }
.channel output { color: var(--ink-faint); font: 500 .75rem var(--font-mono); text-align: right; }
.channel input[type="range"] { --fill: 50%; -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: none; cursor: pointer; }
.channel input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--tone) var(--fill), var(--line-strong) var(--fill)); }
.channel input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--tone) var(--fill), var(--line-strong) var(--fill)); }
.channel input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border: 0; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 1px var(--line-strong), 0 2px 6px rgba(13, 31, 42, .25); transition: transform .2s var(--ease-spring); }
.channel input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 1px var(--line-strong), 0 2px 6px rgba(13, 31, 42, .25); }
.channel input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }
.channel input[type="range"]:focus-visible { box-shadow: none; }
.channel input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: var(--focus); }
.channel input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: var(--focus); }

/* Demo 04 — three questions */
.quiz { display: flex; flex-direction: column; flex: 1; gap: 14px; animation: settle .45s var(--ease-out) both; }
.quiz__progress { display: flex; gap: 6px; }
.quiz__progress span { flex: 1; height: 4px; border-radius: 2px; background: var(--line-strong); transition: background-color .3s; }
.quiz__progress .is-done, .quiz__progress .is-current { background: var(--tone); }
.quiz__progress .is-current { opacity: .45; }
.quiz__dimension { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--tone); font-size: .8125rem; font-weight: 600; letter-spacing: .06em; }
.quiz__dimension code { padding: 2px 7px; border-radius: 6px; background: color-mix(in srgb, var(--tone) 14%, transparent); font: 600 .75rem var(--font-mono); letter-spacing: 0; }
.quiz__question { font-size: clamp(1.25rem, 2.2vw, 1.625rem); font-weight: 650; line-height: 1.5; }
.quiz__options { display: grid; gap: 8px; margin-top: auto; }
.quiz__option { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 16px; border-radius: 14px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); text-align: left; font-size: .9375rem; line-height: 1.5; transition: box-shadow .2s, background-color .2s, transform .2s var(--ease-spring); }
@media (hover: hover) { .quiz__option:hover { box-shadow: inset 0 0 0 1.5px var(--tone); } }
.quiz__option:active { transform: scale(.98); }
.quiz__option:focus-visible { box-shadow: var(--focus); border-radius: 14px; }
.quiz__option kbd { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 7px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink-faint); }
.quiz__option.is-picked { background: var(--tone); box-shadow: none; color: var(--surface); }
[data-theme="dark"] .quiz__option.is-picked { color: var(--paper-sunk); }
.quiz__bars { display: grid; gap: 10px; }
.quiz__bars li { display: grid; grid-template-columns: 7.5em minmax(0, 1fr) 2.5em; align-items: center; gap: 12px; font-size: .875rem; }
.quiz__bars li > span:last-child { color: var(--ink-faint); font-size: .75rem; text-align: right; }
.quiz__meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.quiz__meter i { display: block; width: calc(var(--level) / 3 * 100%); height: 100%; border-radius: 4px; background: var(--tone); transform-origin: left; animation: grow .9s var(--ease-out) both; animation-delay: calc(var(--i) * 120ms + 150ms); }
@keyframes grow { from { transform: scaleX(0); } }
.quiz__summary { color: var(--ink-soft); font-size: .875rem; line-height: 1.8; }
.quiz__types { display: grid; gap: 8px; }
.quiz__type { display: grid; grid-template-columns: 5.2em 1fr; align-items: baseline; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--paper); animation: settle .5s var(--ease-out) both; animation-delay: calc(var(--i) * 110ms + 400ms); }
.quiz__type b { color: var(--tone); font: 700 .875rem var(--font-mono); }
.quiz__type span { font-size: .875rem; font-weight: 600; }
.quiz__type small { grid-column: 2; color: var(--ink-faint); font-size: .75rem; }
.quiz__again { align-self: flex-start; margin-top: auto; }

/* ---------- Tools ---------- */

.tool-list { margin-top: clamp(40px, 6vw, 72px); border-top: 1px solid var(--line-strong); }
.tool { position: relative; display: grid; grid-template-columns: 4.5rem 52px minmax(9em, 1fr) minmax(0, 2.2fr) 48px; align-items: center; column-gap: 20px; min-height: 96px; padding: 16px 12px; border-bottom: 1px solid var(--line); transition: background-color .3s, padding .4s var(--ease-out); }
@media (hover: hover) { .tool:hover { background: var(--surface); padding-inline: 24px 20px; } }
.tool:focus-visible { border-radius: var(--radius-m); }
.tool:active { background: var(--surface); }
.tool__num { color: var(--ink-faint); font: 500 .75rem var(--font-mono); }
.tool__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--accent); transition: background-color .3s, color .3s, transform .5s var(--ease-spring); }
@media (hover: hover) { .tool:hover .tool__icon { background: var(--ink); color: var(--paper); box-shadow: none; transform: rotate(-6deg); } }
.tool__icon .icon { width: 22px; height: 22px; }
.tool__name { font-size: clamp(1.125rem, 1.8vw, 1.375rem); font-weight: 650; letter-spacing: -.005em; }
.tool__text { color: var(--ink-soft); font-size: .9375rem; }
.tool__go { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink-soft); transition: background-color .3s, color .3s, transform .4s var(--ease-out); }
@media (hover: hover) { .tool:hover .tool__go { background: var(--accent); box-shadow: none; color: var(--accent-ink); transform: translateX(4px); } }
.tool__go .icon { width: 18px; height: 18px; }
.tool-note { margin-top: 20px; color: var(--ink-faint); font-size: .8125rem; }

/* ---------- About ---------- */

.about { margin-top: clamp(96px, 13vw, 176px); padding-block: clamp(80px, 11vw, 144px); background: var(--paper-sunk); }
.manifesto { max-width: 22em; margin-top: clamp(32px, 5vw, 64px); font-size: clamp(1.75rem, 4.3vw, 3.5rem); font-weight: 700; line-height: 1.36; letter-spacing: -.01em; text-wrap: pretty; }
.manifesto .char { color: color-mix(in srgb, var(--ink) calc(clamp(0, (var(--progress, 1) * var(--count) - var(--i)) / 5, 1) * 82% + 18%), transparent); }
.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: clamp(64px, 9vw, 112px); }
.principles li { padding-top: 22px; border-top: 1px solid var(--line-strong); }
.principles__num { color: var(--brand-teal); font: italic 500 1rem Georgia, "Times New Roman", serif; }
.principles h3 { margin-top: 12px; font-size: 1.25rem; font-weight: 650; }
.principles p { max-width: 20em; margin-top: 8px; color: var(--ink-soft); font-size: .9375rem; line-height: 1.85; }

/* ---------- Closing and footer ---------- */

.closing { padding-block: clamp(96px, 14vw, 184px); text-align: center; }
.closing h2 { font-size: clamp(2.25rem, 7vw, 5.5rem); font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
.closing__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: clamp(28px, 4vw, 44px); }

.site-footer { border-top: 1px solid var(--line-strong); }
.site-footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; padding-block: 56px 40px; }
.site-footer__brand p { margin-top: 14px; color: var(--ink-soft); font-size: .875rem; }
.site-footer nav { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; font-size: .9375rem; }
.site-footer nav a { color: var(--ink-soft); transition: color .2s; }
@media (hover: hover) { .site-footer nav a:hover { color: var(--ink); } }
.site-footer__title { margin-bottom: 6px; color: var(--ink-faint); font-size: .75rem; font-weight: 600; letter-spacing: .14em; }
.site-footer__base { display: flex; justify-content: space-between; gap: 16px; padding-block: 20px 28px; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: .8125rem; }
.site-footer__version { font-family: var(--font-mono); }

/* ---------- Quick jump palette ---------- */

.palette { width: min(560px, 100vw - 24px); max-height: min(520px, 100dvh - 96px); margin: 12vh auto auto; padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-l); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-m), 0 40px 120px -20px rgba(8, 24, 34, .45); overflow: hidden; }
.palette[open] { display: flex; flex-direction: column; animation: palette-in .28s var(--ease-out); }
.palette::backdrop { background: rgba(8, 20, 28, .38); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade-in .2s; }
@keyframes palette-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
.palette__form { display: flex; align-items: center; gap: 12px; padding: 0 12px 0 18px; border-bottom: 1px solid var(--line); color: var(--ink-faint); }
.palette__input { flex: 1; min-width: 0; height: 58px; border: 0; background: none; color: var(--ink); font-size: 1.0625rem; outline: none; }
.palette__input:focus-visible { box-shadow: none; }
.palette__input::placeholder { color: var(--ink-faint); }
.palette__close-text { display: none; padding: 8px 6px; color: var(--ink-soft); font-size: .9375rem; }
.palette__list:focus-visible { box-shadow: none; }
.palette__close kbd, .palette__foot kbd { display: inline-block; padding: 5px 7px; border-radius: 6px; background: var(--line); color: var(--ink-faint); }
.palette__list { flex: 1; padding: 8px; overflow-y: auto; overscroll-behavior: contain; }
.palette__item { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: 12px; cursor: pointer; }
.palette__item[aria-selected="true"] { background: var(--paper); }
.palette__item strong { font-weight: 600; }
.palette__item small { margin-left: auto; color: var(--ink-faint); font-size: .75rem; }
.palette__item .icon { width: 16px; height: 16px; color: var(--ink-faint); opacity: 0; }
.palette__item[aria-selected="true"] .icon { opacity: 1; }
.palette__empty { padding: 28px 12px; color: var(--ink-faint); text-align: center; font-size: .9375rem; }
.palette__foot { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: .75rem; }
.palette__foot kbd { margin-right: 4px; }

/* ---------- Motion ---------- */

.js .rise { animation: rise .9s var(--ease-out) both; }
.js .hero__title.rise { animation-delay: .06s; }
.js .hero__lead.rise { animation-delay: .14s; }
.js .hero__actions.rise { animation-delay: .22s; }
.js .hero__index.rise { animation-delay: .34s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.js .reveal { transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); }
.js .reveal.is-waiting { opacity: 0; transform: translateY(28px); }

/* The theme switch sweeps out from the button that triggered it. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: theme-sweep .6s var(--ease-out); }
@keyframes theme-sweep { from { clip-path: circle(0 at var(--sweep-x, 50%) var(--sweep-y, 0)); } to { clip-path: circle(var(--sweep-r, 150vmax) at var(--sweep-x, 50%) var(--sweep-y, 0)); } }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
    .js .reveal.is-waiting { opacity: 1; transform: none; }
    ::view-transition-new(root) { animation: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
    .product { column-gap: 20px; }
    .product__copy { grid-column: 1 / span 6; }
    .product .demo { grid-column: 7 / -1; }
    .product:nth-of-type(even) .product__copy { grid-column: 7 / -1; }
    .product:nth-of-type(even) .demo { grid-column: 1 / span 6; }
    .rhyme__columns { grid-template-columns: 1fr; }
    .tool { grid-template-columns: 3.5rem 52px minmax(8em, 1fr) minmax(0, 1.6fr) 48px; }
}

@media (max-width: 860px) {
    .brand__latin { display: none; }
    .section-head h2 { grid-column: 1 / -1; }
    .section-head__note { grid-column: 1 / -1; max-width: 32em; margin-top: 18px; padding-bottom: 0; }
    .product { display: block; }
    .product__copy, .product:nth-of-type(even) .product__copy { padding: 0; }
    .product .demo { margin-top: 36px; }
    .rhyme__columns { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
    .tool { grid-template-columns: 52px minmax(0, 1fr) 44px; row-gap: 2px; min-height: 0; padding: 18px 4px; }
    @media (hover: hover) { .tool:hover { padding-inline: 12px 8px; } }
    .tool__num { display: none; }
    .tool__icon { grid-row: span 2; }
    .tool__text { grid-column: 2; font-size: .875rem; }
    .tool__go { grid-column: 3; grid-row: 1 / span 2; }
    .principles { grid-template-columns: 1fr; gap: 0; }
    .principles li { padding-block: 22px; }
    .site-footer__grid { grid-template-columns: repeat(3, 1fr); }
    .site-footer__brand { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
    html { scroll-padding-top: 72px; }

    /* Header: the three section links move into the menu. */
    .site-header__inner { height: 56px; gap: 12px; }
    .site-nav { display: none; }
    .site-actions { margin-left: auto; }
    .jump-button { width: 40px; padding: 0; justify-content: center; box-shadow: none; }
    .jump-button__text, .jump-button__key, .jump-button .icon--search { display: none; }
    .jump-button .icon--menu { display: block; width: 1.4em; height: 1.4em; }

    /* Hero */
    .hero { min-height: calc(100svh - 56px); }
    .hero__title { font-size: clamp(2.75rem, 15.5vw, 4.5rem); }
    .hero__line { display: block; }
    .hang--break { margin-right: -.5em; }
    .hero__lead .nowrap { white-space: normal; }
    .hero__actions { width: 100%; }
    .hero__actions .button { flex: 1 1 auto; justify-content: center; }
    .hero__index { grid-template-columns: 1fr 1fr; padding-top: 32px; }
    .hero__index a, .hero__index a + a { padding: 14px 8px 12px 0; }
    .hero__index a:nth-child(even) { padding-left: 14px; }

    /* Tighter rhythm: the page is a single column here, so the same gaps read as much longer. */
    .section { padding-top: 76px; }
    .product { margin-top: 60px; }
    .product .demo { margin-top: 28px; }
    .product__text { line-height: 1.8; }
    .tool-list { margin-top: 32px; }
    .about { margin-top: 76px; padding-block: 64px 72px; }
    .principles { margin-top: 48px; }
    .closing { padding-block: 80px; }

    /* Demos run nearly edge to edge. */
    .demo { margin-inline: calc(clamp(40px, 8vw, 96px) / -2 + 8px); padding: 10px; border-radius: var(--radius-l); }
    .demo__window { min-height: 0; border-radius: 18px; }
    .demo__body { padding: 16px 12px; }
    .chips { gap: 6px; }
    .chip { min-height: 36px; padding: 0 12px; font-size: .8125rem; }
    /* The check goes above the list, so a tap on any row changes something still on screen. */
    .rhyme__columns { grid-template-columns: 1fr; }
    .rhyme__check { order: -1; }
    .rhyme__results li:nth-of-type(n + 4) { display: none; }
    .keys, .keys__row { gap: 4px; }
    .key { height: 42px; border-radius: 7px; }
    .channel { grid-template-columns: 36px 3.6em minmax(0, 1fr) 2em; gap: 10px; }
    .mixer__head { grid-template-columns: auto minmax(0, 1fr); }
    .mixer__timer { display: none; }

    /* Tools: smaller icon, a plain arrow, and the description gets the width. */
    .tool { grid-template-columns: 44px minmax(0, 1fr) 20px; column-gap: 14px; padding: 16px 0; }
    .tool__icon { width: 44px; height: 44px; border-radius: 13px; }
    .tool__icon .icon { width: 20px; height: 20px; }
    .tool__text { text-wrap: pretty; }
    .tool__go { width: 20px; height: 20px; box-shadow: none; }

    /* Quick jump opens as a menu under the top edge. */
    .palette { width: calc(100vw - 16px); max-width: none; max-height: calc(100dvh - 16px); margin-top: 8px; }

    .site-footer__grid { grid-template-columns: 1fr 1fr; padding-block: 40px 32px; }
    .site-footer__base { flex-direction: column; gap: 4px; }
}

/* The narrowest phones: keep the line under the cloud to one line. */
@media (max-width: 360px) {
    .hero__kicker-extra { display: none; }
}

/* Fingers need bigger targets than cursors, whatever the screen width. */
@media (pointer: coarse) {
    .chip { min-height: 36px; }
    .text-button { padding-block: 10px; }
    .channel { min-height: 52px; }
    .channel input[type="range"] { height: 40px; }
    .channel input[type="range"]::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -10px; }
    .channel input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; }
    .palette__item { min-height: 54px; }
    .palette__foot, .palette__close kbd { display: none; }
    .palette__close-text { display: inline; }
}
