/* =========================================================
   Ontwerp 2: SATURDAY NIGHT
   De verlichte dansvloer ís de spectrum-analyzer. Volle kleuren op
   aubergine-zwart, vette funk-letters, led-ladders als VU-meters.
   ========================================================= */

:root {
  --bg: oklch(0.15 0.045 310);
  --bg-raise: oklch(0.21 0.06 310);
  --ink: oklch(0.97 0.012 90);
  --ink-dim: oklch(0.78 0.04 310);
  --line: oklch(1 0 0 / 0.14);
  --pink: oklch(0.68 0.25 355);
  --amber: oklch(0.83 0.17 78);
  --blue: oklch(0.65 0.19 255);
  --lime: oklch(0.87 0.21 132);
  --red: oklch(0.65 0.24 27);
  --led-off: oklch(0.27 0.04 310);

  --font-display: 'Shrikhand', 'Cooper Black', serif;
  --font-body: 'Rubik', -apple-system, 'Helvetica Neue', Arial, sans-serif;

  --sheet-bg: oklch(0.2 0.06 310);
  --sheet-text: var(--ink);
  --sheet-dim: var(--ink-dim);
  --sheet-accent: var(--amber);
  --sheet-line: oklch(1 0 0 / 0.14);
  --sheet-font-display: var(--font-body);
  --sheet-font-body: var(--font-body);
  --toast-bg: var(--ink);
  --toast-text: var(--bg);

  color-scheme: dark;
}

/* iPhone-schermen kunnen feller dan sRGB: daar de neonkleuren echt laten knallen */
@media (color-gamut: p3) {
  :root {
    --pink: color(display-p3 1 0.22 0.6);
    --amber: color(display-p3 1 0.74 0.16);
    --lime: color(display-p3 0.66 1 0.24);
    --red: color(display-p3 1 0.23 0.17);
  }
}

html,
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* ---------- De club (eerste scherm) ---------- */
.club {
  --energy: 0;
  --beat: 0;
  --downbeat: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 520px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 12px) 20px calc(var(--safe-bottom) + 16px);
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(90% 46% at 50% 18%, oklch(0.3 0.12 320 / 0.75), transparent 72%);
}

/* Gekleurde lichtbundels die vanaf de bol de zaal in waaieren */
.beams {
  --ball-y: calc(var(--safe-top) + 162px);
  position: absolute;
  top: var(--ball-y);
  left: 50%;
  z-index: -1;
  width: 1500px;
  height: 1500px;
  translate: -50% -50%;
  background: conic-gradient(
    from 90deg,
    transparent 0deg 22deg,
    var(--pink) 30deg, transparent 39deg 58deg,
    var(--amber) 66deg, transparent 75deg 100deg,
    var(--blue) 108deg, transparent 117deg 139deg,
    var(--lime) 146deg, transparent 154deg 360deg
  );
  -webkit-mask-image: radial-gradient(circle, #000 4%, oklch(0 0 0 / 0.5) 22%, transparent 46%);
  mask-image: radial-gradient(circle, #000 4%, oklch(0 0 0 / 0.5) 22%, transparent 46%);
  filter: blur(7px);
  opacity: calc(0.1 + var(--energy) * 0.2 + var(--beat) * 0.1 + var(--downbeat) * 0.08);
  animation: sway 11s ease-in-out infinite alternate paused;
}

[data-motion='full'] .beams {
  animation-play-state: running;
}

@keyframes sway {
  from { rotate: -9deg; }
  to { rotate: 9deg; }
}

/* ---------- Bovenbalk ---------- */
.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.topbar__brand {
  --wordmark-size: 21px;
  width: 92px;
}

/* Status rechtsboven: lampje + "LIVE", daaronder het aantal luisteraars */
.pill {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 3px 7px;
  max-width: 120px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
}

.pill__crowd {
  flex-basis: 100%;
  text-align: right;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink-dim);
}

[data-online='false'] .pill__dot {
  background: var(--led-off);
  box-shadow: none;
}

.pill__crowd b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- Discobol: groot en in het midden ---------- */
.ball-rig {
  --ball-canvas: 300px;
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 2;
  width: var(--ball-canvas);
  translate: -50% 0;
  pointer-events: none;
}

.ball-rig__chain {
  position: absolute;
  top: 0;
  left: 50%;
  width: 3px;
  height: calc(var(--safe-top) + 48px);
  translate: -50% 0;
  background: repeating-linear-gradient(180deg, oklch(0.85 0.01 300) 0 3px, oklch(0.45 0.02 300) 3px 6px);
}

.ball-rig__ball {
  display: block;
  width: var(--ball-canvas);
  height: var(--ball-canvas);
  margin-top: calc(var(--safe-top) + 44px - var(--ball-canvas) * 0.11);
}

/* ---------- Now playing met led-ladders ---------- */
.now {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 20px 1fr 20px;
  gap: 12px;
  align-items: end;
  margin-top: 232px;
}

.now__center {
  display: grid;
  justify-items: center;
  text-align: center;
  min-width: 0;
}

.now__art {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-raise);
  border: 3px solid var(--ink);
  box-shadow: 0 0 0 5px var(--pink), 0 12px 28px oklch(0 0 0 / 0.5);
  animation: spin 6s linear infinite paused;
}

:is([data-state='playing'], [data-demo='true'])[data-motion='full'] .now__art {
  animation-play-state: running;
}

@keyframes spin {
  to { rotate: 360deg; }
}

.now__title {
  margin-top: 18px;
  font-family: var(--font-display);
  font-size: clamp(30px, 9vw, 40px);
  font-weight: 400;
  line-height: 1.04;
  text-wrap: balance;
  overflow-wrap: anywhere;
  text-shadow: 3px 3px 0 var(--pink);
}

.now__artist {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}

.now__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  min-height: 26px;
  margin-top: 12px;
}

.chip {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.chip--year {
  background: var(--ink);
  color: var(--bg);
  font-variant-numeric: tabular-nums;
}

.chip--version {
  border: 1px solid var(--line);
  color: var(--ink-dim);
  text-transform: uppercase;
}

[data-has-year='false'] .chip--year,
[data-has-version='false'] .chip--version {
  display: none;
}

/* Tempo: verschijnt pas als de maat gevonden is */
.chip--bpm {
  border: 1px solid var(--lime);
  color: var(--lime);
  font-variant-numeric: tabular-nums;
}

[data-on-beat='false'] .chip--bpm {
  display: none;
}

/* Led-ladder: 16 segmenten, groen naar oranje naar rood */
.ladder {
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
  height: 196px;
}

.ladder i {
  flex: 1;
  border-radius: 2px;
  background: var(--led-off);
}

.ladder i.is-lit {
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
}

.ladder i.is-lit:nth-child(n + 11) {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}

.ladder i.is-lit:nth-child(n + 14) {
  background: var(--red);
  box-shadow: 0 0 9px var(--red);
}

/* ---------- De dansvloer ---------- */
.floor-stage {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 0;
  height: 350px;
  overflow: hidden;
  perspective: 560px;
  perspective-origin: 50% 0%;
  -webkit-mask-image: linear-gradient(transparent 0, #000 26%);
  mask-image: linear-gradient(transparent 0, #000 26%);
}

.floor {
  position: absolute;
  top: 8%;
  left: -32%;
  width: 164%;
  height: 250%;
  transform-origin: 50% 0;
  transform: rotateX(60deg);
}

/* Donker verloop onderaan, zodat de knoppen op de vloer leesbaar blijven */
.floor-stage::after {
  content: '';
  position: absolute;
  inset: 66% 0 0 0;
  background: linear-gradient(transparent, oklch(0.12 0.04 310 / 0.72));
}

/* ---------- Bediening ---------- */
.dock {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr 1fr auto 1fr 1fr;
  align-items: center;
  justify-items: center;
  margin-top: auto;
  padding-top: 24px;
}

.dock__button {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 62px;
  padding: 6px 6px 8px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: oklch(0.17 0.05 310 / 0.86);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  transition: scale 180ms var(--ease-out-quart), background 180ms ease;
}

.dock__button:active {
  scale: 0.94;
  background: var(--pink);
}

.dock__button svg {
  width: 40px;
  height: 40px;
  padding: 8px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-favorite='true'] .dock__heart {
  fill: var(--pink);
  stroke: var(--pink);
}

.dock__play {
  position: relative;
  display: grid;
  place-items: center;
  width: 90px;
  height: 90px;
  margin: 0 4px;
  border-radius: 50%;
  background: var(--pink);
  color: var(--ink);
  box-shadow:
    0 0 0 5px oklch(0.15 0.045 310),
    0 0 0 7px var(--amber),
    0 0 calc(18px + var(--beat) * 30px) var(--pink);
  /* Meeveren op de tel: de knop wordt iets groter op elke tel, extra op de eerste */
  scale: calc(1 + var(--beat) * 0.035 + var(--downbeat) * 0.02);
  transition: scale 180ms var(--ease-out-quart);
}

.dock__play:active {
  scale: 0.94;
  transition-duration: 80ms;
}

.dock__icon {
  width: 36px;
  height: 36px;
  fill: currentColor;
}

.dock__icon--stop,
:is([data-state='playing'], [data-state='connecting'], [data-state='error']) .dock__icon--play {
  display: none;
}

:is([data-state='playing'], [data-state='connecting'], [data-state='error']) .dock__icon--stop {
  display: block;
}

.dock__play-ring {
  position: absolute;
  inset: -13px;
  border: 3px solid transparent;
  border-top-color: var(--lime);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 200ms ease;
}

:is([data-state='connecting'], [data-state='error']) .dock__play-ring {
  opacity: 1;
  animation: spin 900ms linear infinite;
}

/* ---------- Secties onder de club ---------- */
.page-section {
  max-width: 520px;
  margin: 0 auto;
  padding: 44px 20px 0;
}

.page-section__title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.1;
  text-shadow: 2px 2px 0 var(--blue);
}

.played__list {
  list-style: none;
  margin-top: 14px;
  counter-reset: played;
}

.played__item {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
}

.played__art {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--bg-raise);
}

/* Elke rij krijgt een vloertegel-kleur mee */
.played__item:nth-child(4n + 1) { --tile: var(--pink); }
.played__item:nth-child(4n + 2) { --tile: var(--amber); }
.played__item:nth-child(4n + 3) { --tile: var(--blue); }
.played__item:nth-child(4n + 4) { --tile: var(--lime); }

.played__art {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--tile);
}

.played__title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
}

.played__artist {
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-dim);
}

.played__time {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--tile);
}

.shows__item {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}

.shows__day {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 16px;
  background: var(--amber);
  color: oklch(0.2 0.05 60);
  font-family: var(--font-display);
  font-size: 22px;
}

.shows__item:nth-child(even) .shows__day {
  background: var(--blue);
  color: var(--ink);
}

.shows__name {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
}

.shows__time {
  margin-top: 3px;
  font-size: 13px;
  font-weight: 600;
  color: var(--amber);
}

.shows__desc {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-dim);
}

.request__text {
  margin-top: 14px;
  max-width: 60ch;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-dim);
}

.request__actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.request__link {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid var(--line);
  font-weight: 700;
  text-decoration: none;
}

.request__link:first-child {
  background: var(--lime);
  border-color: transparent;
  color: oklch(0.22 0.06 140);
}

.colophon {
  max-width: 520px;
  margin: 0 auto;
  padding: 48px 20px calc(var(--safe-bottom) + 40px);
  text-align: center;
  font-size: 12px;
  color: var(--ink-dim);
}

.colophon__social {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 600;
}

.colophon__social a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  color: var(--ink);
}

/* ---------- Breakpoints ---------- */
@media (max-width: 980px) {
  .club,
  .page-section,
  .colophon {
    max-width: 560px;
  }
}

@media (max-width: 640px) {
  .club,
  .page-section,
  .colophon {
    max-width: none;
  }
}

@media (max-width: 420px) {
  .club {
    padding-inline: 16px;
  }

  .page-section {
    padding-inline: 16px;
  }

  .dock__play {
    width: 84px;
    height: 84px;
  }
}

/* Lage schermen: bol en vloer compacter zodat play in beeld blijft */
@media (max-height: 760px) {
  .ball-rig {
    --ball-canvas: 236px;
  }

  .beams {
    --ball-y: calc(var(--safe-top) + 136px);
  }

  .now {
    margin-top: 176px;
  }

  .now__art {
    width: 64px;
    height: 64px;
  }

  .ladder {
    height: 150px;
  }

  .floor-stage {
    height: 270px;
  }
}
