/* Pick by ear, the "Liquid" look: a big serif on moving colour. The colour itself is drawn by liquid.js on #gl;
   this file is the type, the buttons and how they move. */
:root {
  --serif: "Instrument Serif", "Times New Roman", serif;
  --ink: #0e0e10;
  color: #fff; font-family: "Inter", system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: #0b0b0e; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid #fff; outline-offset: 4px; border-radius: 6px; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- top line: name, the 7 rounds, where we are ---------- */
.top { position: fixed; z-index: 5; top: 0; left: 0; right: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: max(18px, env(safe-area-inset-top)) 24px 0; font-size: 13px; font-weight: 600; pointer-events: none; }
.brand i { font-style: normal; opacity: .7; margin-left: 8px; font-weight: 500; }
.where { justify-self: end; opacity: .85; }
.dots { display: flex; gap: 5px; opacity: 0; transition: opacity .5s; }
.dots i { width: 22px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .3); transition: background .4s; }
.dots i.done { background: #fff; }
.dots i.now { background: #fff; animation: pulse 1.2s ease-in-out infinite alternate; }
body:not([data-stage="hero"]) .dots { opacity: 1; }
@keyframes pulse { from { opacity: .45; } }

/* ---------- the three screens ---------- */
.stage { position: fixed; inset: 0; z-index: 2; opacity: 0; visibility: hidden; transition: opacity .5s, visibility 0s .5s; }
[data-stage="hero"] .hero, [data-stage="round"] .round, [data-stage="reveal"] .reveal { opacity: 1; visibility: visible; transition: opacity .6s .1s, visibility 0s; }

.pill { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border-radius: 999px; padding: 16px 30px; font-weight: 600; font-size: 16px; text-decoration: none; white-space: nowrap; background: #fff; color: var(--ink); transition: transform .25s cubic-bezier(.2, 1.5, .4, 1), opacity .3s, background .2s; }
.pill:hover { transform: scale(1.05); }
.pill:active { transform: scale(.96); }
.pill span { display: inline-block; transition: transform .25s; }
.pill:hover span { transform: translateX(4px); }
.pill.ghost { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.eyebrow { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; opacity: .85; }

/* ---------- start ---------- */
.hero { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 70px 24px 60px; gap: 22px; }
h1 { margin: 0; font: 400 clamp(64px, 14vw, 230px)/.86 var(--serif); letter-spacing: -.035em; }
h1 em { font-style: italic; }
h1 .w { display: inline-block; overflow: hidden; vertical-align: bottom; padding: .08em .04em .14em; margin: -.08em -.04em -.14em; }
h1 .w > span { display: inline-block; transform: translateY(115%) rotate(6deg); animation: rise .9s cubic-bezier(.16, 1, .3, 1) forwards; animation-delay: calc(.15s + var(--i) * .11s); }
.sub { margin: 0; max-width: 34ch; font-size: clamp(15px, 1.5vw, 19px); line-height: 1.4; animation: fade .8s .7s both; }
.hero .go { animation: fade .8s .9s both; }
@keyframes rise { to { transform: none; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- a round ---------- */
.round { display: grid; grid-template-columns: 1fr 1fr; }
.side { position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; cursor: pointer; }
/* no ring round a side: it drew a straight white frame over the moving border. A keyboard user sees the state word underlined instead. */
.side:focus-visible { outline: none; }
.side:focus-visible .state { text-decoration: underline; text-underline-offset: 5px; }
/* the record's cover, behind its side: blurred when its record starts, sharp after REVEAL_AFTER seconds of listening.
   --p (0 to 1) only moves while that side plays, so going back to the other record stops it where it is. The edges
   fade out before the side's straight edges, so only the wobbling border between the sides shows. */
.cover { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; pointer-events: none;
  opacity: var(--show, 0); filter: blur(calc((1 - var(--p, 0)) * 44px)) brightness(var(--dim, 1)) saturate(calc(.6 + var(--p, 0) * .4));
  transform: scale(calc(1.16 - var(--p, 0) * .1)); transition: opacity .7s, filter .3s linear, transform .3s linear;
  -webkit-mask-image: radial-gradient(closest-side, #000 45%, transparent 100%); mask-image: radial-gradient(closest-side, #000 45%, transparent 100%); }
.side:not(.on) .cover { --dim: .55; }
[data-busy] .cover { opacity: 0; }
.side.a { --lv: var(--la, 0); }
.side.b { --lv: var(--lb, 0); }
/* the letter breathes with the bass (scale), and comes and goes between rounds (transform, blur) */
.letter { font: italic 400 clamp(150px, 36vh, 420px)/.8 var(--serif); text-shadow: 0 10px 60px rgba(0, 0, 0, .25); scale: calc(1 + var(--lv) * .22); transition: opacity .55s, transform .8s .15s cubic-bezier(.16, 1, .3, 1), filter .6s .15s; will-change: scale, transform; }
/* the letter grows with the bass and overlaps the button under it: taps go through it to the side, and the button sits on top */
.letter, .side .cover { pointer-events: none; }
.keep { position: relative; z-index: 2; }
.side:not(.on) .letter { opacity: .45; }
.side:hover:not(.on) .letter { opacity: .7; }
.state { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; opacity: .85; min-height: 1.2em; transition: opacity .4s .35s; }
/* "More like this": one button, under the letter of each side, once both records have been heard */
/* The button comes out of the blur with its cover (--show and --p, set on the side). It can be pressed once both
   records have played 2.5 s; until then it stays half see-through. */
.keep { padding: 13px 26px; font-size: 15px; margin-top: 4px; --ok: .5; pointer-events: none;
  opacity: calc(var(--show, 0) * (.3 + .7 * var(--p, 0)) * var(--ok));
  filter: blur(calc((1 - var(--p, 0)) * 9px)); transform: scale(calc(.9 + .1 * var(--p, 0)));
  transition: opacity .3s linear, filter .3s linear, transform .3s linear; }
[data-ready] .keep { --ok: 1; pointer-events: auto; }
[data-ready] .keep:hover { transform: scale(1.06); }
.round-credit { position: absolute; left: 0; right: 0; bottom: calc(6px + env(safe-area-inset-bottom)); margin: 0; text-align: center; font-size: 10px; line-height: 1.2; opacity: .55; pointer-events: none; }
.hint { position: absolute; left: 0; right: 0; bottom: calc(24px + env(safe-area-inset-bottom)); margin: 0; text-align: center; font-size: 13px; font-weight: 500; opacity: .8; transition: opacity .4s; pointer-events: none; }
/* between rounds the letters leave: the kept one grows as it goes, the other shrinks */
[data-busy] .side > *, [data-busy] .hint { opacity: 0 !important; pointer-events: none; transition: opacity .3s; }
[data-busy] .letter { transform: scale(.8); filter: blur(10px); transition: opacity .4s, transform .6s cubic-bezier(.3, 0, .2, 1), filter .4s; }
[data-busy][data-kept="a"] .side.a .letter, [data-busy][data-kept="b"] .side.b .letter { transform: scale(1.5); }

/* the name of the round, while its clips load */
.announce { position: fixed; inset: 0; z-index: 3; margin: 0; display: grid; place-items: center; text-align: center; pointer-events: none; font: italic 400 clamp(64px, 13vw, 210px)/.9 var(--serif); letter-spacing: -.03em; opacity: 0; transform: scale(1.06); filter: blur(14px); transition: opacity .28s, transform .5s, filter .3s; }
[data-announce] .announce { opacity: 1; transform: none; filter: none; transition: opacity .5s, transform .8s cubic-bezier(.16, 1, .3, 1), filter .5s; }

/* ---------- the reveal ---------- */
.reveal { display: grid; grid-template-columns: 1fr 1fr; align-items: start; overflow-y: auto; gap: clamp(28px, 5vw, 88px); padding: 76px clamp(24px, 6vw, 96px) 36px; }
.slot { justify-self: end; width: min(100%, 64vh, 560px); aspect-ratio: 1; }
.slot img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; opacity: 0; }
.info { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; max-width: 520px; text-shadow: 0 1px 18px rgba(0, 0, 0, .35); }
.info h2 { margin: 2px 0 0; font: italic 400 clamp(40px, 5.6vw, 88px)/.95 var(--serif); letter-spacing: -.02em; }
.by { margin: 0; font-size: 18px; font-weight: 500; }
.by > span:first-child { opacity: .9; }
.why { margin: 0; font-size: 15px; line-height: 1.4; opacity: .85; max-width: 34ch; }
.stores a { margin-left: 12px; font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.caption .stores a { margin-left: 8px; font-size: 13px; }
.pill:disabled { opacity: .6; pointer-events: none; }
/* centred when there is room, scrolled when the list of things under the title is taller than the screen */
.reveal > * { margin-block: auto; }
.match { margin: 4px 0 6px; }
.match[hidden] { display: none; }
.match .eyebrow { font-size: 12px; }
.match-score { margin: 2px 0 0; font: italic 400 clamp(26px, 3vw, 40px)/1.05 var(--serif); }
.match-split { margin: 4px 0 0; font-size: 14px; opacity: .9; }
.heard[hidden] { display: none; }
.heard > p:first-child { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.tiles { display: flex; gap: 6px; }
.tiles a { display: block; width: clamp(34px, 3.6vw, 48px); aspect-ratio: 1; border-radius: 6px; overflow: hidden; transition: transform .2s cubic-bezier(.2, 1.5, .4, 1); box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.tiles a:hover { transform: scale(1.14) rotate(-2deg); }
/* the 8 in four groups by how far they got; a tap marks a cover "new to me" (the yellow dot) */
.tile { position: relative; display: block; width: clamp(32px, 3.4vw, 46px); aspect-ratio: 1; border-radius: 6px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); transition: transform .2s cubic-bezier(.2, 1.5, .4, 1); }
.tile img { border-radius: 6px; }
.tile:hover { transform: scale(1.12) rotate(-2deg); }
.caption { margin: 10px 0 0; min-height: 1.4em; font-size: 13px; line-height: 1.4; }
.text { font-size: 13px; text-decoration: underline; text-underline-offset: 3px; opacity: .85; }
.text[hidden] { display: none; }
.caption .text { margin-left: 14px; }
.tiles img { width: 100%; height: 100%; object-fit: cover; display: block; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.actions .ghost { padding: 16px 22px; }
.fine { margin: 6px 0 0; font-size: 13px; opacity: .85; text-shadow: none; }
.fine a + a { margin-left: 16px; }
.credit { margin: 6px 0 0; font-size: 12px; line-height: 1.4; opacity: .7; text-shadow: none; }
.hero .credit { margin-top: 4px; animation: fade .8s 1.1s both; }
.toast { margin: 0; min-height: 1.4em; font-size: 13px; font-weight: 600; opacity: 0; transition: opacity .2s; text-shadow: none; }
.toast.on { opacity: 1; }
[data-stage="reveal"] .info > * { animation: up .8s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(1.3s + var(--i) * .1s); }
@keyframes up { from { opacity: 0; transform: translateY(26px); } }

/* ---------- tall screens: A on top, B below ---------- */
@media (max-aspect-ratio: 1/1) {
  .top { padding-inline: 16px; }
  .dots i { width: 14px; }
  .round { grid-template-columns: none; grid-template-rows: 1fr 1fr; }
  .letter { font-size: clamp(120px, 24vh, 240px); }
  .side { gap: 8px; }
  .state { position: absolute; left: 18px; bottom: 32px; }
  .side.b .state { bottom: 66px; }
  .reveal { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 18px; padding: 62px 20px 28px; overflow-y: auto; }
  .reveal > * { margin-block: 0; }
  .slot { width: min(78vw, 38vh); flex: none; }
  .info { align-items: center; text-align: center; }
  .info h2 { font-size: clamp(36px, 10vw, 56px); }
  .tiles { justify-content: center; }
  .tiles a { width: clamp(30px, 9.4vw, 40px); }
  .tile { width: clamp(30px, 8.4vw, 38px); }
  .actions { justify-content: center; }
  .actions .pill { padding: 14px 20px; font-size: 15px; }
}

/* ---------- no WebGL 2: plain gradients, and the cover as a picture ---------- */
.nogl { background: linear-gradient(140deg, var(--c0, #ff2f56), var(--c1, #ff7a1a) 45%, var(--c4, #7b4dff) 70%, var(--c3, #2a2cff)); }
.nogl #gl { display: none; }
.nogl .side.a { background: linear-gradient(160deg, var(--c0), var(--c1), var(--c2)); }
.nogl .side.b { background: linear-gradient(160deg, var(--c3), var(--c4), var(--c5)); }
.nogl .side { transition: filter .4s; }
.nogl .side:not(.on) { filter: brightness(.3) saturate(.5); }
.nogl .slot img { opacity: 1; box-shadow: 0 30px 80px rgba(0, 0, 0, .4); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01s !important; animation-delay: 0s !important; transition-duration: .01s !important; } }
