/* =========================================================
   Basis voor alle ontwerpen: reset, safe areas, lichtvlekjes-canvas,
   uitschuifpanelen (sheets), toast en toegankelijkheid.
   Elk ontwerp kleurt dit in via de --sheet-* en --toast-* variabelen.
   ========================================================= */

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

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);

  /* Standaardwaarden; ontwerpen overschrijven deze */
  --sheet-bg: oklch(0.2 0.01 60);
  --sheet-text: oklch(0.95 0.01 80);
  --sheet-dim: oklch(0.72 0.02 80);
  --sheet-accent: oklch(0.8 0.13 85);
  --sheet-line: oklch(1 0 0 / 0.12);
  --sheet-radius: 28px;
  --sheet-font-display: inherit;
  --sheet-font-body: inherit;
  --toast-bg: oklch(0.95 0.01 80);
  --toast-text: oklch(0.2 0.01 60);

  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html {
  -webkit-tap-highlight-color: transparent;
}

/* Pagina niet laten meescrollen achter een open paneel. Op <html> zetten breekt op
   iOS het scrollen binnen het paneel zelf, dus het gebeurt op body. */
body:has(dialog[open]) {
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--sheet-accent);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Sfeerwissel ---------- */
/* Boven in het midden: daar is in alle drie de ontwerpen ruimte, het woordmerk staat
   links en de live-regel rechts. Klein en halfdoorzichtig, het is een hulpmiddel en
   geen onderdeel van de sfeer. */
.skin-switch {
  position: fixed;
  /* JS zet top net onder de kopregel; dit is de waarde als dat niet lukt */
  top: calc(var(--safe-top) + 64px);
  right: calc(var(--safe-right) + 10px);
  z-index: 40;
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-height: 30px;
  padding: 5px 10px 5px 12px;
  border: 1px solid var(--sheet-line);
  border-radius: 999px;
  background: oklch(0 0 0 / 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--sheet-text);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s var(--ease-out-quart), opacity 0.2s var(--ease-out-quart);
}

.skin-switch:active {
  background: oklch(0 0 0 / 0.62);
}

.skin-switch__name {
  font-family: var(--sheet-font-display);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--sheet-accent);
}

.skin-switch__chevron {
  font-size: 13px;
  line-height: 1;
  color: var(--sheet-dim);
}

/* Achter een open paneel hoort hij niet doorheen te schemeren */
body:has(dialog[open]) .skin-switch {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 420px) {
  .skin-switch {
    padding: 4px 8px 4px 10px;
  }

  .skin-switch__name {
    font-size: 10px;
  }
}

/* ---------- Nerd-overlay (?nerd=1) ---------- */
.nerd {
  position: fixed;
  right: calc(var(--safe-right) + 8px);
  bottom: calc(var(--safe-bottom) + 8px);
  z-index: 55;
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--sheet-line);
  border-radius: 12px;
  background: oklch(0.12 0.008 60 / 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--sheet-text);
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 10px;
  line-height: 1.5;
  /* Nooit het halve scherm vullen; op een klein scherm scrollt hij maar */
  max-height: min(56dvh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.nerd dl {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0 10px;
}

.nerd dt {
  color: var(--sheet-dim);
}

.nerd dd {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.nerd__verdict {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--sheet-line);
  color: var(--sheet-accent);
  font-weight: 700;
  max-width: 30ch;
}

/* Meldingen in beeld: nodig op een toestel zonder ontwikkelaarsconsole, en als het
   versturen van een rapport niet lukt is dit de enige manier om ze te zien. */
.nerd__messages {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--sheet-line);
  max-height: 120px;
  overflow: auto;
  color: oklch(0.82 0.16 35);
  font: inherit;
  font-size: 9px;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}

.nerd__actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.nerd__actions button {
  flex: 1;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--sheet-line);
  border-radius: 8px;
  color: var(--sheet-text);
  font: inherit;
  font-size: 11px;
}

.nerd__actions button[data-nerd='close'] {
  flex: none;
}

/* ---------- Melding bij "minder beweging" ---------- */
.motion-notice {
  position: fixed;
  top: calc(var(--safe-top) + 8px);
  left: 50%;
  z-index: 45;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 4px;
  width: calc(100% - 24px);
  max-width: 480px;
  padding: 8px 6px 8px 14px;
  border: 1px solid var(--sheet-line);
  border-radius: 14px;
  background: oklch(0.16 0.01 60 / 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--sheet-dim);
  font-size: 12px;
  line-height: 1.4;
}

.motion-notice p {
  flex: 1;
}

.motion-notice a {
  color: var(--sheet-accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.motion-notice button {
  position: relative;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--sheet-text);
}

.motion-notice button::before,
.motion-notice button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 13px;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  translate: -50% -50%;
  rotate: 45deg;
}

.motion-notice button::after {
  rotate: -45deg;
}

/* ---------- Zichtbare melding als een onderdeel niet start ---------- */
.failure {
  position: fixed;
  top: calc(var(--safe-top) + 8px);
  left: 50%;
  z-index: 60;
  translate: -50% 0;
  max-width: calc(100% - 24px);
  padding: 10px 16px;
  border-radius: 12px;
  background: oklch(0.55 0.2 27);
  color: oklch(0.99 0.01 27);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

/* ---------- Zenderlogo: officieel bestand of woordmerk in Monoton ---------- */
.brand__logo {
  width: 100%;
  height: auto;
}

.wordmark {
  display: grid;
  font-family: 'Monoton', 'Arial Black', sans-serif;
  font-size: var(--wordmark-size, 30px);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---------- Zenderlogo als terugweg naar het keuzescherm ---------- */
.brand {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: opacity 180ms ease;
}

.brand:active {
  opacity: 0.6;
}

/* ---------- Lichtvlekjes over de hele interface ---------- */
.specks {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: screen;
  z-index: 5;
}

/* ---------- Discobol: terugval zonder WebGL ---------- */
.disco-ball--fallback {
  border-radius: 50%;
  scale: 0.78;
  background:
    repeating-linear-gradient(0deg, oklch(0 0 0 / 0.55) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(90deg, oklch(0 0 0 / 0.55) 0 1px, transparent 1px 9px),
    radial-gradient(circle at 35% 30%, oklch(0.98 0.01 90), oklch(0.62 0.02 90) 45%, oklch(0.18 0.01 90) 100%);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 24px);
  z-index: 40;
  translate: -50% 16px;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms var(--ease-out-quart), translate 240ms var(--ease-out-quart);
}

.toast.is-visible {
  opacity: 1;
  translate: -50% 0;
}

/* ---------- Uitschuifpaneel (bottom sheet) ---------- */
.sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 560px;
  /* Vaste hoogte, niet alleen een maximum: iOS scrollt het binnenste deel anders niet */
  height: min(86dvh, 780px);
  margin: 0 auto;
  border: 0;
  border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
  background: var(--sheet-bg);
  color: var(--sheet-text);
  font-family: var(--sheet-font-body);
  overflow: hidden;
  box-shadow: 0 -24px 60px oklch(0 0 0 / 0.5);
  transition: transform 420ms var(--ease-out-expo);
}

.sheet[open] {
  display: flex;
  flex-direction: column;
}

@starting-style {
  .sheet[open] {
    transform: translateY(100%);
  }
}

.sheet.is-closing {
  transform: translateY(100%);
  transition-duration: 300ms;
}

.sheet.is-dragging {
  transition: none;
}

.sheet::backdrop {
  background: oklch(0 0 0 / 0.6);
  transition: opacity 300ms ease;
}

@starting-style {
  .sheet[open]::backdrop {
    opacity: 0;
  }
}

.sheet.is-closing::backdrop {
  opacity: 0;
}

.sheet__grip {
  display: grid;
  place-items: center;
  height: 26px;
  flex: none;
  cursor: grab;
  touch-action: none;
}


.sheet__grip span {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: var(--sheet-line);
}

.sheet__header {
  position: relative;
  flex: none;
  padding: 4px 72px 16px 24px;
  border-bottom: 1px solid var(--sheet-line);
}

.sheet__kicker {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sheet-accent);
}

.sheet__title {
  margin-top: 4px;
  font-family: var(--sheet-font-display);
  font-size: 26px;
  line-height: 1.15;
  font-weight: 600;
  text-wrap: balance;
}

.sheet__close {
  position: absolute;
  top: 0;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--sheet-line);
}

.sheet__close::before,
.sheet__close::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  translate: -50% -50%;
  rotate: 45deg;
}

.sheet__close::after {
  rotate: -45deg;
}

.sheet__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  /* Verticaal vegen is scrollen; het wegslepen zit alleen op de greep en de kop */
  touch-action: pan-y;
  padding: 20px 24px calc(28px + var(--safe-bottom));
}

.sheet__status {
  padding: 28px 0;
  color: var(--sheet-dim);
  font-size: 16px;
  line-height: 1.5;
}

/* Artiest */
.artist__figure {
  margin: 0 -24px 18px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--sheet-line);
}

.artist__figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
}

.sheet__body > .artist__figure:first-child {
  margin-top: -20px;
}

.artist__facts {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sheet-accent);
}

.artist__summary {
  margin-top: 12px;
  max-width: 62ch;
  font-size: 16px;
  line-height: 1.65;
}

.artist__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.artist__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--sheet-line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.artist__links a:active {
  background: var(--sheet-line);
}

/* Songtekst */
.lyrics {
  list-style: none;
  font-family: var(--sheet-font-display);
  font-size: 22px;
  line-height: 1.45;
  font-weight: 500;
}

.lyrics__line {
  padding: 5px 0;
  text-wrap: balance;
}

.lyrics__line--gap {
  height: 18px;
}

.lyrics--synced .lyrics__line {
  color: var(--sheet-dim);
  opacity: 0.55;
  transition: color 300ms ease, opacity 300ms ease;
}

.lyrics--synced .lyrics__line.is-active {
  color: var(--sheet-accent);
  opacity: 1;
}

.lyrics__sync {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--sheet-dim);
}

.lyrics__sync span {
  margin-right: auto;
}

.lyrics__sync button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--sheet-line);
  border-radius: 999px;
  font-size: 13px;
}

.lyrics__credit {
  margin-top: 24px;
  font-size: 12px;
  color: var(--sheet-dim);
}

@media (max-width: 420px) {
  .sheet__title {
    font-size: 22px;
  }

  .lyrics {
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet,
  .sheet::backdrop,
  .toast {
    transition-duration: 1ms;
  }
}
