/* The showcase page. Dark, one type family (Figtree), three word colours that mean something and nothing else coloured.
   Neutrals are tinted toward the green of a right word. No build step: plain CSS. */

:root {
  --ink: oklch(0.145 0.012 178);
  --ink-2: oklch(0.185 0.014 178);
  --ink-3: oklch(0.235 0.016 178);
  --line: oklch(0.42 0.02 178 / 0.38);
  --text: oklch(0.965 0.008 165);
  --mute: oklch(0.76 0.018 172);
  --dim: oklch(0.58 0.018 172);
  --g: oklch(0.875 0.145 163);
  --d: oklch(0.865 0.15 86);
  --rail-w: 344px;
  --deck-h: 88px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ink);
  color: var(--text);
  font: 500 16px/1.5 var(--font);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
p, h1, h2, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }

.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) var(--deck-h);
  height: 100dvh;
}

/* ───────── the rail: what this is, and the ten tracks ───────── */
.rail {
  grid-column: 1; grid-row: 1;
  display: flex; flex-direction: column;
  min-height: 0;
  background: var(--ink-2);
  border-right: 1px solid var(--line);
}
.rail-head { padding: 30px 28px 18px; }
.pick { font-size: 0.82rem; line-height: 1.4; color: var(--dim); font-weight: 600; }

.tracks { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 12px 12px; scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent; }
.track {
  width: 100%;
  display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; column-gap: 10px;
  padding: 9px 16px 9px 12px; border-radius: 10px; text-align: left;
  transition: background-color 0.18s;
}
.track:hover { background: oklch(1 0 0 / 0.045); }
.track[aria-current="true"] { background: oklch(1 0 0 / 0.085); }
.t-n { color: var(--dim); font-size: 0.95rem; font-weight: 600; text-align: center; position: relative; height: 20px; line-height: 20px; }
.t-main b { display: block; font-size: 1rem; font-weight: 650; letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-main small { display: block; font-size: 0.8rem; color: var(--dim); font-weight: 500; }
.track[aria-current="true"] .t-main b { color: var(--g); }

/* three bars that move while the track plays (in the list and in the deck) */
.eq { display: none; position: absolute; inset: 3px 0 3px; justify-content: center; align-items: flex-end; gap: 2.5px; }
.eq i, .deck-eq i { width: 3px; border-radius: 1.5px; background: var(--g); height: 100%; transform-origin: bottom; transform: scaleY(0.3); }
.track[aria-current="true"] .eq { display: flex; }
.track[aria-current="true"] .t-num { visibility: hidden; }
body.playing .eq i, body.playing .deck-eq i { animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2), .deck-eq i:nth-child(2) { animation-delay: -0.35s !important; }
.eq i:nth-child(3), .deck-eq i:nth-child(3) { animation-delay: -0.6s !important; }
@keyframes eq { 0%, 100% { transform: scaleY(0.25); } 50% { transform: scaleY(1); } }


/* ───────── the stage: the sound, then the words ───────── */
.stage { grid-column: 2; grid-row: 1; position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }

.hero { position: relative; flex: none; height: clamp(250px, 41vh, 460px); overflow: hidden; background: var(--ink); }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, transparent 70%, var(--ink) 100%),
    linear-gradient(100deg, oklch(0.145 0.012 178 / 0.9) 0%, oklch(0.145 0.012 178 / 0.6) 30%, transparent 58%);
}
.now { position: absolute; z-index: 3; left: clamp(22px, 3.4vw, 52px); top: clamp(20px, 3.2vh, 38px); max-width: min(560px, 62%); }
.now-kicker { color: var(--mute); font-size: 0.86rem; font-weight: 600; }
.now-title { font-size: clamp(2.1rem, 1.25rem + 2.5vw, 3.7rem); line-height: 1.02; font-weight: 800; letter-spacing: -0.035em; margin-top: 4px; }
.now-link {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; margin-top: 14px;
  font-size: 0.88rem; font-weight: 600; color: var(--text); text-decoration: none;
  padding: 7px 13px 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: oklch(0.145 0.012 178 / 0.55);
  transition: border-color 0.2s, background-color 0.2s;
}
.now-link:hover { border-color: oklch(0.8 0.02 172 / 0.7); background: oklch(0.2 0.014 178 / 0.8); }
.now-link small { color: var(--dim); font-size: 0.8rem; font-weight: 600; }

/* the words, pinned to the sound that made them; they ride left with it */
.strip { position: absolute; z-index: 2; left: 0; right: 0; height: 74px; overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 100%); mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 100%); }
.strip-run { position: absolute; left: 0; top: 0; will-change: transform; }
.sw { position: absolute; white-space: nowrap; font-size: 0.98rem; font-weight: 650; line-height: 22px; color: var(--text);
  opacity: 0; transform: translateY(7px); transition: opacity 0.22s var(--ease), transform 0.3s var(--ease); }
.sw.on { opacity: 1; transform: none; }
body.colors .sw.g { color: var(--g); }
body.colors .sw.d { color: var(--d); }

/* ───────── colours on / off, and what they mean ───────── */
.tools { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 22px; padding: 6px clamp(22px, 3.4vw, 52px) 10px; }
.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 0.86rem; font-weight: 650; color: var(--mute); }
.switch-knob { width: 34px; height: 20px; border-radius: 999px; background: var(--ink-3); position: relative; transition: background-color 0.2s; flex: none; }
.switch-knob::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--mute); transition: transform 0.25s var(--ease), background-color 0.2s; }
.switch[aria-checked="true"] { color: var(--text); }
.switch[aria-checked="true"] .switch-knob { background: oklch(0.45 0.08 163); }
.switch[aria-checked="true"] .switch-knob::after { transform: translateX(14px); background: var(--text); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.84rem; font-weight: 650; transition: opacity 0.25s; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.k-g { color: var(--g); } .k-d { color: var(--d); }
.k-m { color: var(--d); } .k-m::before { display: none; } .k-m del { text-decoration-thickness: 1.5px; }
.k-n { color: var(--mute); }
body:not(.colors) .legend { opacity: 0; pointer-events: none; }

/* ───────── the transcript, a lyrics view ───────── */
.lyrics {
  position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 8px clamp(22px, 3.4vw, 52px) 42vh;
  scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26px, #000 calc(100% - 70px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 26px, #000 calc(100% - 70px), transparent 100%);
}
.lyrics:focus { outline: none; }
.turn { max-width: 31em; font-size: clamp(1.32rem, 0.92rem + 1.08vw, 1.95rem); padding-top: 0.75em; }
.turn-head {
  display: flex; width: fit-content; align-items: baseline; gap: 10px; margin-bottom: 0.3rem; line-height: 1.3;
  font-size: 0.82rem; font-weight: 650; color: var(--dim); border-radius: 6px; transition: color 0.2s;
}
.turn-head:hover, .turn.live .turn-head { color: var(--mute); }
.turn-head time { font-weight: 600; opacity: 0.8; }
.line { font-weight: 700; line-height: 1.5; letter-spacing: -0.012em; text-wrap: pretty; }
.w {
  position: relative; opacity: 0.36; cursor: pointer; border-radius: 0.24em; color: var(--text);
  text-decoration: none; transition: opacity 0.28s, background-color 0.18s, box-shadow 0.18s;
}
.w.on { opacity: 1; }
.w:hover { opacity: 1; background: oklch(1 0 0 / 0.09); box-shadow: 0 0 0 0.1em oklch(1 0 0 / 0.09); }
.w.cur, .w.cur:hover { background: oklch(1 0 0 / 0.2); box-shadow: 0 0 0 0.12em oklch(1 0 0 / 0.2); opacity: 1; }
body.colors .w.g { color: var(--g); }
body.colors .w.d { color: var(--d); }
.w.m { color: var(--d); text-decoration: line-through; text-decoration-thickness: 0.07em; font-weight: 600; cursor: default; }
.w.m:hover { background: none; box-shadow: none; }
body:not(.colors) .w.m { display: none; }
.w[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 7px); transform: translateX(-50%);
  white-space: nowrap; font-size: 0.8rem; line-height: 1; letter-spacing: 0; font-weight: 650; color: var(--text);
  background: var(--ink-3); border: 1px solid var(--line); padding: 7px 10px; border-radius: 8px; z-index: 3; pointer-events: none;
  text-decoration: none;
}
body:not(.colors) .w[data-tip]:hover::after { display: none; }

.follow {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--text); color: var(--ink); font-weight: 750; font-size: 0.88rem; padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 8px 30px oklch(0 0 0 / 0.45); z-index: 4;
}

/* ───────── the deck: transport ───────── */
.deck {
  grid-column: 1 / -1; grid-row: 2; z-index: 5;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 1.7fr) minmax(0, 1fr); align-items: center; gap: 20px;
  padding: 0 24px; background: oklch(0.118 0.012 178); border-top: 1px solid var(--line);
}
.deck-now { display: flex; align-items: center; gap: 14px; min-width: 0; }
.deck-eq { flex: none; display: flex; align-items: flex-end; gap: 3px; width: 18px; height: 18px; }
.deck-meta { min-width: 0; line-height: 1.25; }
.deck-meta b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-meta span { display: block; font-size: 0.82rem; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-main { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.deck-keys { display: flex; align-items: center; gap: 18px; }
.key { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: var(--mute); transition: color 0.15s, transform 0.15s var(--ease), background-color 0.15s; }
.key:hover { color: var(--text); }
.key:active { transform: scale(0.94); }
.key.play { width: 44px; height: 44px; background: var(--text); color: var(--ink); }
.key.play:hover { color: var(--ink); transform: scale(1.05); }
.key.play:active { transform: scale(0.97); }
.i-pause { display: none; }
body.playing .i-pause { display: block; }
body.playing .i-play { display: none; }
.deck-seek { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 640px; font-size: 0.78rem; color: var(--dim); font-weight: 600; }
.deck-seek time { width: 34px; text-align: center; flex: none; }
.seek { position: relative; flex: 1; height: 18px; cursor: pointer; touch-action: none; }
.seek-rail { position: absolute; left: 0; right: 0; top: 7px; height: 4px; border-radius: 2px; background: oklch(1 0 0 / 0.16); overflow: hidden; }
.seek-fill { height: 100%; width: 100%; background: var(--text); transform-origin: left; transform: scaleX(0); }
.seek:hover .seek-fill, .seek.drag .seek-fill, .seek:focus-visible .seek-fill { background: var(--g); }
.seek-thumb { position: absolute; top: 3px; left: 0; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--text); opacity: 0; transition: opacity 0.15s; box-shadow: 0 1px 6px oklch(0 0 0 / 0.5); }
.seek:hover .seek-thumb, .seek.drag .seek-thumb, .seek:focus-visible .seek-thumb { opacity: 1; }
.deck-side { display: flex; justify-content: flex-end; }
.speed { min-width: 52px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 0.86rem; font-weight: 700; color: var(--mute); transition: color 0.15s, border-color 0.15s; }
.speed:hover { color: var(--text); border-color: oklch(0.8 0.02 172 / 0.7); }

/* first paint: the page arrives once, quietly */
@media (prefers-reduced-motion: no-preference) {
  .rail-head > *, .now > *, .tracks > li { animation: rise 0.7s var(--ease) both; }
  .tracks > li:nth-child(n) { animation-delay: calc(0.12s + var(--i, 0) * 0.035s); }
  .now > :nth-child(2) { animation-delay: 0.08s; } .now > :nth-child(3) { animation-delay: 0.14s; }
  .lyrics.swap { animation: swap 0.5s var(--ease) both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes swap { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* a short laptop screen: give the words more room */
@media (min-width: 861px) and (max-height: 760px) {
  .hero { height: clamp(220px, 36vh, 300px); }
  .rail-head { padding-top: 22px; }
  .track { padding-top: 6px; padding-bottom: 6px; }
}

/* ───────── phone width: one column, the page scrolls, the sound stays on top ───────── */
@media (max-width: 860px) {
  body { overflow: auto; }
  .app { display: block; height: auto; padding-bottom: calc(118px + env(safe-area-inset-bottom)); }
  .rail { border-right: 0; background: var(--ink); display: block; }
  .rail-head { padding: 22px 16px 10px; }
  .tracks { display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; padding: 6px 16px 14px; scroll-snap-type: x proximity; scrollbar-width: none; }
  .tracks::-webkit-scrollbar { display: none; }
  .tracks li { flex: none; scroll-snap-align: start; }
  .track { width: auto; grid-template-columns: 22px auto; column-gap: 8px; padding: 9px 14px 9px 10px; border: 1px solid var(--line); border-radius: 14px; }
  .track[aria-current="true"] { border-color: transparent; }
  .stage { display: block; }
  .hero { position: sticky; top: 0; z-index: 3; height: clamp(230px, 36vh, 320px); }
  .now { left: 16px; top: 14px; max-width: calc(100% - 32px); }
  .now-title { font-size: 2rem; }
  .now-link { margin-top: 8px; font-size: 0.8rem; padding: 6px 11px; }
  .now-link small { display: none; }
  .hero-shade { background: linear-gradient(to bottom, oklch(0.145 0.012 178 / 0.78) 0%, oklch(0.145 0.012 178 / 0.2) 48%, transparent 66%, var(--ink) 100%); }
  .strip { height: 50px; }
  .sw { font-size: 0.86rem; }
  .tools { padding: 8px 16px 6px; position: relative; z-index: 2; }
  .legend { font-size: 0.8rem; gap: 3px 12px; }
  .lyrics { overflow: visible; padding: 4px 16px 30px; -webkit-mask-image: none; mask-image: none; }
  .turn { font-size: 1.32rem; max-width: none; }
  .follow { position: fixed; bottom: calc(128px + env(safe-area-inset-bottom)); }
  .deck { position: fixed; left: 0; right: 0; bottom: 0; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 2px 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .deck-now { grid-column: 1; grid-row: 1; }
  .deck-side { grid-column: 2; grid-row: 1; }
  .deck-main { grid-column: 1 / -1; grid-row: 2; flex-direction: column-reverse; gap: 2px; }
  .deck-keys { gap: 26px; }
  .deck-meta span { display: none; }
  .speed { padding: 5px 10px; min-width: 46px; }
}
