:root {
  --bg: #000000;          /* the page */
  --cherry: #d81f3c;      /* cherry red: the cabinet, the first record */
  --cherry-dark: #7e0f22; /* the shade of the cabinet and the felt of the turntable */
  --cream: #fff1d6;       /* cream: the title strips, the middle band of the arch */
  --mint: #6fe0c0;        /* mint: the inner band of the arch, a record */
  --gold: #f2b43a;        /* gold: the light in the window, the chosen strip */
  --sky: #5aa9ff;         /* sky blue: a record */
  --tangerine: #ff8a3d;   /* tangerine: a record */
  --chrome: #d9dee4;      /* chrome: rims, rails, the grille */
  --lacquer: #120a0c;     /* glossy black: the inside of the jukebox */
  --ink: #3a0710;         /* the words on the title strips */
}

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--cream);
  font-family: 'Bricolage Grotesque Variable', 'Bricolage Grotesque', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 14px;
  overflow: hidden;
}

/* the whole menu: the button on top, the jukebox under it (its place is kept when it is closed, so nothing jumps) */
.juke {
  --w: min(560px, calc(100vw - 28px));
  --h: max(226px, min(390px, calc(100vh - 140px)));
  width: var(--w);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* ---- the button: the top of a jukebox in a chrome pill ---- */
.juke-btn {
  position: relative;
  height: 60px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px 0 10px;
  border: 0;
  border-radius: 999px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--cherry) 92%, #ffffff) 0%, var(--cherry) 45%, var(--cherry-dark) 100%) padding-box,
    linear-gradient(180deg, #ffffff, #8c949d 45%, #f3f5f8 55%, #5e6670) border-box;
  border: 2px solid transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -6px 12px rgba(60, 0, 10, 0.45), 0 10px 24px -12px var(--cherry);
  color: var(--cream);
  font: inherit;
  font-size: 19px;
  font-weight: 640;
  font-stretch: 96%;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 rgba(80, 0, 15, 0.6);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.28s cubic-bezier(.3, 1.6, .5, 1), font-stretch 0.3s ease;
}

.juke-btn:active { transform: scale(0.96); }

.juke-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.juke-btn__icon {
  width: 44px;
  height: 44px;
  flex: none;
  overflow: visible;
}

.juke-btn__body { fill: var(--lacquer); }
.juke-btn__band--red { fill: color-mix(in srgb, var(--cherry) 70%, #ffffff); }
.juke-btn__band--cream { fill: var(--cream); }
.juke-btn__glass { fill: #241015; }
.juke-btn__vinyl { fill: #0d0b0d; stroke: rgba(255, 255, 255, 0.18); stroke-width: 0.6; }
.juke-btn__label { fill: var(--gold); }
.juke-btn__strips { fill: var(--cream); }
.juke-btn__grille rect { fill: var(--cherry-dark); }
.juke-btn__grille path { stroke: #e6eaee; stroke-width: 1; }
.juke-btn__sweep { fill: #ffffff; opacity: 0.55; }
.juke-btn__rim { fill: none; stroke: url(#btn-chrome); stroke-width: 2.2; stroke-linejoin: round; }

.juke-btn__disc { transform-box: view-box; transform-origin: 22px 24px; }

.juke-btn__word { min-width: 3.1em; text-align: left; }

@media (hover: hover) {
  .juke-btn:hover { font-stretch: 112%; }
}

/* ---- the jukebox under the button ---- */
.cabinet {
  position: relative;
  width: 100%;
  height: var(--h);
  visibility: hidden;
}

.cabinet__body {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 10px;
  border-radius: calc(var(--w) * 0.5) calc(var(--w) * 0.5) 22px 22px / 34% 34% 22px 22px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.0) 0%, rgba(255, 255, 255, 0.16) 7%, rgba(255, 255, 255, 0) 16%, rgba(0, 0, 0, 0) 84%, rgba(0, 0, 0, 0.28) 100%),
    linear-gradient(180deg, color-mix(in srgb, var(--cherry) 88%, #ffffff), var(--cherry) 30%, var(--cherry-dark));
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, var(--chrome) 80%, transparent),
    inset 0 2px 0 3px rgba(255, 255, 255, 0.25),
    0 24px 50px -24px var(--cherry);
  transform-origin: 50% 0;
  will-change: transform, opacity;
}

/* the arch: three bands of plastic, each with a stripe of light running through it */
.arch {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
}

.arch__band {
  grid-area: 1 / 1;
  position: relative;
  overflow: hidden;
  border-radius: 50% 50% 8px 8px / 42% 42% 8px 8px;
}

.arch__band--red {
  background: linear-gradient(180deg, color-mix(in srgb, var(--cherry) 55%, #ffffff), var(--cherry) 60%, color-mix(in srgb, var(--cherry) 70%, #000000));
}

.arch__band--cream {
  margin: 7px;
  background: linear-gradient(180deg, #ffffff, var(--cream) 60%, color-mix(in srgb, var(--cream) 80%, var(--gold)));
}

.arch__band--mint {
  margin: 13px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--mint) 60%, #ffffff), var(--mint) 60%, color-mix(in srgb, var(--mint) 70%, #003b2e));
}

/* the light running through the plastic: a soft diagonal stripe that moves across, never a dot */
.arch__light {
  position: absolute;
  inset: -20% -60%;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0) 0 34px, rgba(255, 255, 255, 0.55) 46px, rgba(255, 255, 255, 0) 58px 120px);
  mix-blend-mode: soft-light;
  will-change: transform;
}

.window {
  grid-area: 1 / 1;
  position: relative;
  margin: 18px;
  overflow: hidden;
  border-radius: 50% 50% 6px 6px / 40% 40% 6px 6px;
  /* the back of the jukebox: glossy black lacquer, a warm golden light from the top, thin chrome pinstripes */
  background:
    radial-gradient(90% 75% at 50% 0%, color-mix(in srgb, var(--gold) 42%, transparent), color-mix(in srgb, var(--gold) 8%, transparent) 55%, transparent 80%),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(255, 255, 255, 0.045) 39px 40px),
    linear-gradient(180deg, color-mix(in srgb, var(--lacquer) 80%, var(--cherry-dark)), var(--lacquer) 60%, #050304);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--chrome) 70%, transparent), inset 0 8px 18px rgba(0, 0, 0, 0.8);
}

.mech {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.stop-gold { stop-color: var(--gold); }
.stop-cherry-dark { stop-color: var(--cherry-dark); }

.stop-cherry { stop-color: var(--cherry); }

.table__shadow { fill: rgba(0, 0, 0, 0.55); }
.table__band { fill: none; stroke: #cfd6dd; stroke-width: 1.6; }
.table__edge { fill: none; stroke: rgba(255, 255, 255, 0.35); stroke-width: 0.8; }
.table__rim { fill: none; stroke: #e3e8ed; stroke-width: 1.4; }
.table__mat-rings { fill: none; stroke: rgba(255, 255, 255, 0.07); stroke-width: 0.8; }
.table__spindle { fill: #e9edf1; }

.rack__comb rect { fill: url(#chrome-v); }
.tray__line { stroke: rgba(0, 0, 0, 0.3); stroke-width: 1; }
.tray__shine { stroke: rgba(255, 255, 255, 0.3); stroke-width: 1.2; stroke-linecap: round; }
.tray__shadow { stroke: rgba(0, 0, 0, 0.55); stroke-width: 3; }

.arm__tube { fill: none; stroke: #c9d0d7; stroke-width: 3; stroke-linecap: round; }
.arm__tube-shine { fill: none; stroke: #ffffff; stroke-width: 0.9; stroke-linecap: round; opacity: 0.8; }
.arm__shell { fill: #1b1a1e; stroke: #d5dbe1; stroke-width: 0.8; stroke-linejoin: round; }
.arm__needle { stroke: #f2f4f6; stroke-width: 0.9; stroke-linecap: round; }
.arm__cap { fill: #ffffff; opacity: 0.85; }

.gantry__finger { fill: none; stroke: #d6dce2; stroke-width: 2.6; stroke-linecap: round; }
.gantry__lip { fill: rgba(0, 0, 0, 0.25); }

/* the record pieces, drawn by the script */
.rec__grooves { fill: none; stroke: rgba(255, 255, 255, 0.07); stroke-width: 0.6; }
.rec__lead { fill: none; stroke: rgba(255, 255, 255, 0.16); stroke-width: 0.7; }
.rec__edge { fill: none; stroke: rgba(255, 255, 255, 0.22); stroke-width: 0.8; }
.rec__label-ring { fill: none; stroke: rgba(0, 0, 0, 0.28); stroke-width: 1; }
.rec__print { fill: none; stroke: rgba(255, 255, 255, 0.6); stroke-width: 0.8; stroke-linecap: round; }
.rec__hole { fill: #0b0a0c; }
.rec__shadow { fill: rgba(0, 0, 0, 0.55); }

/* the glass: a sheet of reflections that slides up into the arch */
.window__glass {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(118deg, rgba(255, 255, 255, 0) 18%, rgba(255, 255, 255, 0.24) 26%, rgba(255, 255, 255, 0) 33%, rgba(255, 255, 255, 0) 56%, rgba(255, 255, 255, 0.12) 61%, rgba(255, 255, 255, 0) 66%),
    linear-gradient(180deg, rgba(255, 240, 220, 0.22), rgba(255, 240, 220, 0.06));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  pointer-events: none;
  will-change: transform;
}

/* ---- the title strips: cream cards in a chrome frame, the real links ---- */
.strips {
  flex: none;
  list-style: none;
  padding: 5px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  border-radius: 8px;
  background: linear-gradient(180deg, #f7f9fb, #8e969f 50%, #e8ecf0);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.25);
}

.strip {
  position: relative;
  display: grid;
  grid-template-rows: 5px 1fr;
  height: 100%;
  min-height: 38px;
  border-radius: 4px;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff, var(--cream));
  box-shadow: inset 0 -1px 0 rgba(120, 60, 20, 0.18), 0 1px 2px rgba(0, 0, 0, 0.35);
  color: var(--ink);
  text-decoration: none;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.25s ease, transform 0.25s cubic-bezier(.3, 1.6, .5, 1);
}

.strip__band { background: var(--tone); }

.strip__word {
  align-self: center;
  padding: 2px 4px 3px;
  font-size: clamp(11px, 2.4vw, 14px);
  line-height: 1.05;
  font-weight: 620;
  font-stretch: 86%;
  letter-spacing: 0.01em;
  transition: font-weight 0.3s ease, font-stretch 0.3s ease;
}

.strip.is-hot,
.strip:focus-visible {
  transform: translateY(-2px);
  background: linear-gradient(180deg, #ffffff, color-mix(in srgb, var(--tone) 22%, var(--cream)));
}

.strip.is-hot .strip__word,
.strip:focus-visible .strip__word { font-weight: 720; font-stretch: 100%; }

@media (hover: hover) {
  .strip:hover { transform: translateY(-2px); background: linear-gradient(180deg, #ffffff, color-mix(in srgb, var(--tone) 22%, var(--cream))); }
  .strip:hover .strip__word { font-weight: 720; font-stretch: 100%; }
}

.strip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.strip[aria-current="page"] {
  background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 35%, #ffffff), var(--gold));
}

.strip[aria-current="page"] .strip__word { font-weight: 780; font-stretch: 104%; }

/* ---- the grille: chrome bars over the dark red cloth, and the plate in the middle ---- */
.grille {
  flex: none;
  position: relative;
  height: clamp(26px, 9%, 38px);
  border-radius: 6px 6px 16px 16px;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0) 0 9px, #f2f5f8 9px, #8d959e 11.5px, rgba(0, 0, 0, 0) 12px 13px),
    linear-gradient(180deg, #3a050d, #1a0206);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--chrome) 70%, transparent), inset 0 4px 8px rgba(0, 0, 0, 0.7);
  display: grid;
  place-items: center;
}

.grille__plate {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 12px 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #a9b1ba 48%, #f1f4f7 52%, #7b838c);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  color: var(--cherry-dark);
  white-space: nowrap;
}

.grille__brand {
  font-size: 13px;
  font-weight: 800;
  font-stretch: 120%;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.grille__now {
  font-size: 11px;
  font-weight: 560;
  color: #3a2a2e;
}

.grille__now:empty { display: none; }

/* the notes that come out of the grille */
.notes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.note { fill: var(--cream); }

@media (max-width: 420px), (max-height: 520px) {
  .juke-btn { height: 56px; font-size: 18px; }
  .juke-btn__icon { width: 40px; height: 40px; }
  .cabinet__body { padding: 8px 8px 8px; gap: 6px; }
  .arch__band--cream { margin: 5px; }
  .arch__band--mint { margin: 10px; }
  .window { margin: 14px; }
  .strips { padding: 4px; gap: 4px; }
  .strip { min-height: 32px; }
  .strip__word { font-size: 10.5px; padding: 1px 2px 2px; }
  .grille__brand { font-size: 11px; }
  .grille__now { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .juke-btn, .strip, .strip__word { transition: none; }
  .arch__light { display: none; }
}
