/* ============================================================================
   Urlaubsagenten Radio — Fullscreen Test Player v2
   Aesthetic: festival mainstage. Hard black canvas, Impact-tabloid headlines,
   massive yellow primary, REC-red live signal, caution-tape brand stripes,
   sharp-edged VU bars. No softness, no apologies.
   ========================================================================== */

:root {
  /* --- Core palette ----------------------------------------------------- */
  --c-bg:        #0a0a0a;
  --c-bg-deep:   #060606;
  --c-paper:    #ffffff;
  --c-paper-dim: rgba(255, 255, 255, 0.62);
  --c-paper-faint: rgba(255, 255, 255, 0.28);

  --c-yellow:    #fabe0c;
  --c-yellow-hot:#ffd11f;
  --c-yellow-deep:#c89306;
  --c-rec:       #ff2222;
  --c-rec-deep:  #c00808;

  /* --- Typography ------------------------------------------------------- */
  --f-display:   "Impact", "Haettenschweiler", "Franklin Gothic Heavy",
                 "Anton", "Arial Narrow Bold", "Arial Black", sans-serif;
  --f-body:      "Helvetica Neue", Helvetica, Arial, sans-serif;
  --f-mono:      ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--c-bg);
  color: var(--c-paper);
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  overscroll-behavior: none;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
}

img { user-select: none; }

button { font-family: inherit; }

/* Make sure [hidden] always wins over later `display:` rules */
[hidden] { display: none !important; }

/* iOS: volume slider has no effect (Apple restriction), so we hide it.
   Mute still works via audio.muted, so the mute button stays. */
.is-ios .vol__slider { display: none; }
.is-ios .vol { justify-content: flex-start; }

/* ============================================================================
   Visualizer canvas + atmosphere
   ========================================================================== */

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  /* Force GPU compositing — required so iOS Safari keeps the canvas
     pinned to the viewport while the body scrolls. */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image:
    url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.85 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: overlay;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0,
    rgba(0,0,0,0) 2px,
    rgba(255,255,255,0.04) 2px,
    rgba(255,255,255,0.04) 3px
  );
}

/* ============================================================================
   Operational bars (top and bottom)
   ========================================================================== */

.opbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-paper-dim);
}

.opbar--btm {
  font-size: 10px;
  color: var(--c-paper-faint);
  padding: 12px 22px 16px;
}

.opbar__sep {
  color: var(--c-paper-faint);
}

.opbar__brand {
  color: var(--c-paper);
  font-weight: 700;
  letter-spacing: 0.32em;
}

.opbar__brand-thin {
  color: var(--c-yellow);
  font-weight: 400;
}

.opbar__test {
  color: var(--c-yellow);
  border: 1px solid var(--c-yellow);
  padding: 2px 7px 1px;
  font-weight: 700;
  letter-spacing: 0.28em;
}

.opbar__premiere {
  color: var(--c-paper);
  font-weight: 700;
  letter-spacing: 0.28em;
  font-variant-numeric: tabular-nums;
}
.opbar__premiere-dot {
  color: var(--c-yellow);
}

.opbar__flex { flex: 1; min-width: 8px; }

.opbar__clock {
  color: var(--c-paper);
  font-variant-numeric: tabular-nums;
}

/* --- REC / LIVE indicator ----------------------------------------------- */

.rec {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--c-paper-faint);
  font-weight: 700;
  letter-spacing: 0.28em;
}

.rec__dot {
  width: 9px;
  height: 9px;
  background: var(--c-paper-faint);
  flex-shrink: 0;
}

[data-mode="enabled"] .player.is-live ~ * .rec,
.is-live .rec {
  color: var(--c-rec);
}

.is-live .rec__dot {
  background: var(--c-rec);
  box-shadow: 0 0 12px rgba(255, 34, 34, 0.7);
  animation: rec-pulse 1.1s ease-in-out infinite;
}

.is-offline .rec { color: rgba(255,255,255,0.35); }
.is-offline .rec__dot { background: rgba(255,255,255,0.35); animation: none; box-shadow: none; }

@keyframes rec-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* ============================================================================
   Player block — main content
   ========================================================================== */

.player {
  position: relative;
  z-index: 8;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: clamp(28px, 4vw, 56px);
  padding: clamp(20px, 4vw, 56px) clamp(22px, 5vw, 80px);
  align-content: center;
  justify-items: stretch;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s ease, transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.player.is-hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  visibility: hidden;
}

/* --- Track row ---------------------------------------------------------- */

.player__track {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(20px, 3vw, 36px);
  align-items: center;
}

.player__cover {
  position: relative;
  width: clamp(120px, 16vw, 200px);
  height: clamp(120px, 16vw, 200px);
  background: rgba(255,255,255,0.04);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--c-paper);
  box-shadow:
    8px 8px 0 rgba(250, 190, 12, 0.85),
    -2px -2px 0 var(--c-bg);
  transition: box-shadow 0.4s ease;
}

.is-live .player__cover {
  box-shadow:
    8px 8px 0 rgba(255, 34, 34, 0.85),
    -2px -2px 0 var(--c-bg);
}

.player__cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: none;
}

.player__cover img[src]:not([src=""]) { display: block; }
.player__cover img[src]:not([src=""]) ~ .player__cover-fallback { display: none; }

.player__cover-fallback {
  width: 30%;
  height: 30%;
  color: var(--c-paper-faint);
}

.player__cover-corner {
  position: absolute;
  top: -2px; right: -2px;
  width: 14px; height: 14px;
  background: var(--c-yellow);
  pointer-events: none;
}

.is-live .player__cover-corner { background: var(--c-rec); }

/* --- Track info --------------------------------------------------------- */

.player__info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player__title {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(48px, 9vw, 144px);
  line-height: 0.88;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--c-paper);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 0 rgba(0,0,0,0.5);
}

.player__title::selection { background: var(--c-yellow); color: var(--c-bg); }

.player__artist {
  margin: 0;
  font-family: var(--f-body);
  font-weight: 500;
  font-size: clamp(13px, 1.4vw, 18px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-yellow);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.is-offline .player__artist { color: rgba(255, 34, 34, 0.8); }

/* ============================================================================
   Controls row
   ========================================================================== */

.controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: clamp(18px, 3vw, 36px);
  align-items: center;
}

/* --- Big play button ---------------------------------------------------- */

.play {
  width: clamp(64px, 7vw, 88px);
  height: clamp(64px, 7vw, 88px);
  border: none;
  border-radius: 50%;
  background: var(--c-yellow);
  color: var(--c-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  position: relative;
  flex-shrink: 0;
  transition: transform 0.16s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s ease, box-shadow 0.3s ease;
  outline: none;
  box-shadow:
    0 0 0 0 rgba(250, 190, 12, 0),
    6px 6px 0 0 var(--c-bg-deep);
}

.play::before {
  content: "";
  position: absolute;
  inset: -10px;
  border: 2px solid transparent;
  border-radius: 50%;
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.play:hover {
  background: var(--c-yellow-hot);
  transform: scale(1.05);
}

.play:active { transform: scale(0.94); }

.play:focus-visible::before { border-color: var(--c-yellow); }

.is-playing .play {
  box-shadow:
    0 0 0 8px rgba(250, 190, 12, 0.18),
    6px 6px 0 0 var(--c-bg-deep);
}

.is-playing .play::before {
  border-color: var(--c-yellow);
  animation: ring 2s ease-in-out infinite;
}

@keyframes ring {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.08); }
}

.play__icon {
  width: clamp(24px, 2.4vw, 32px);
  height: clamp(24px, 2.4vw, 32px);
  display: none;
}

.play__icon--play { display: block; margin-left: clamp(2px, 0.3vw, 4px); }

.is-playing .play__icon--play  { display: none; }
.is-playing .play__icon--pause { display: block; margin: 0; }

.is-loading .play__icon--play,
.is-loading .play__icon--pause { display: none; }
.is-loading .play__icon--loading {
  display: block;
  margin: 0;
  animation: spin 1.1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Volume ------------------------------------------------------------- */

.vol {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.vol__mute {
  background: none;
  border: 2px solid rgba(255,255,255,0.18);
  color: var(--c-paper-dim);
  cursor: pointer;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.vol__mute:hover {
  border-color: var(--c-paper);
  color: var(--c-paper);
}

.vol__mute:focus-visible {
  border-color: var(--c-yellow);
  color: var(--c-yellow);
}

.is-muted .vol__mute {
  background: var(--c-yellow);
  color: var(--c-bg);
  border-color: var(--c-yellow);
}

.vol__icon {
  width: 18px;
  height: 18px;
  display: none;
}
.vol__icon--on { display: block; }
.is-muted .vol__icon--on  { display: none; }
.is-muted .vol__icon--off { display: block; }

.vol__slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 8px;
  background: linear-gradient(
    to right,
    var(--c-yellow) 0 var(--vol, 80%),
    rgba(255, 255, 255, 0.12) var(--vol, 80%) 100%
  );
  border: 2px solid rgba(255,255,255,0.18);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.vol__slider:hover, .vol__slider:focus { border-color: var(--c-paper); }

.vol__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 0;
  background: var(--c-paper);
  border: 2px solid var(--c-bg);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.vol__slider::-webkit-slider-thumb:hover { transform: scale(1.18); }

.vol__slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 0;
  background: var(--c-paper);
  border: 2px solid var(--c-bg);
  cursor: pointer;
}

/* --- Hint line ---------------------------------------------------------- */

.controls__hint {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--c-paper-faint);
  font-weight: 700;
  transition: opacity 0.35s ease;
  white-space: nowrap;
  justify-self: end;
}

.is-playing .controls__hint { opacity: 0; }
.is-offline .controls__hint { color: var(--c-rec); }

/* ============================================================================
   Marketing slot — content via banners.json, gepflegt manuell
   (spaeter U-OPS-Marketing-Modul)
   ========================================================================== */

.promo {
  position: relative;
  z-index: 8;
  padding: clamp(12px, 1.6vw, 22px) clamp(14px, 1.5vw, 22px);
  display: flex;
  justify-content: center;
}

.promo[hidden] { display: none !important; }

.promo__link {
  display: block;
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 3 / 1;
  overflow: hidden;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid var(--c-paper);
  box-shadow:
    6px 6px 0 rgba(250, 190, 12, 0.85),
    -2px -2px 0 var(--c-bg);
  transition:
    transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.25s ease,
    opacity 0.35s ease;
  opacity: 1;
}

.promo__link:hover {
  transform: translateY(-2px);
  box-shadow:
    8px 8px 0 var(--c-yellow-hot),
    -2px -2px 0 var(--c-bg);
}

.promo__link:active { transform: translateY(0); }

.promo.is-fading .promo__link { opacity: 0; }

.promo__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

/* ============================================================================
   Standby state — "06.06." premiere card
   ========================================================================== */

.standby {
  position: relative;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(40px, 6vw, 96px);
  gap: clamp(16px, 2vw, 28px);
  min-height: 60vh;
}

.standby__eyebrow {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--c-yellow);
  font-weight: 700;
  animation: fadein 0.5s ease 0.05s both;
}

.standby__date {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(96px, 22vw, 320px);
  line-height: 0.78;
  letter-spacing: -0.025em;
  color: var(--c-paper);
  -webkit-text-stroke: 0;
  position: relative;
  animation: fadein 0.7s ease 0.15s both;
}

.standby__dot {
  color: var(--c-yellow);
}

.standby__msg {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(22px, 3.4vw, 44px);
  line-height: 1.04;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  color: var(--c-paper);
  max-width: 24ch;
  text-wrap: balance;
  animation: fadein 0.85s ease 0.3s both;
}

.standby__pulse {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  animation: fadein 0.85s ease 0.5s both;
}

.standby__pulse span {
  width: 12px; height: 12px;
  background: var(--c-yellow);
  animation: standby-blink 1.4s ease-in-out infinite;
}

.standby__pulse span:nth-child(2) { animation-delay: 0.22s; }
.standby__pulse span:nth-child(3) { animation-delay: 0.44s; }

@keyframes standby-blink {
  0%, 100% { opacity: 0.18; transform: translateY(2px); }
  50%      { opacity: 1;    transform: translateY(0); }
}

@keyframes fadein {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   Caution-tape stripes
   ========================================================================== */

.stripes {
  height: 14px;
  position: relative;
  z-index: 10;
  background-image: repeating-linear-gradient(
    -45deg,
    var(--c-yellow) 0 12px,
    var(--c-bg) 12px 24px
  );
  background-size: 200% 100%;
  /* Animation skaliert mit Viewport-Breite: auf Desktop laeuft das Band
     gefuehlt schneller, weil mehr Pixel pro Periode zurueckzulegen sind.
     Default langsam fuer Desktop, Mobile-Override unten holt das Tempo zurueck. */
  animation: stripes-march 20s linear infinite;
}

@keyframes stripes-march {
  to { background-position: 200% 0; }
}

/* ============================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .rec__dot,
  .standby__pulse span,
  .play::before,
  .play__icon--loading,
  .stripes {
    animation: none !important;
  }
}

/* ============================================================================
   Mobile + small tablets
   ========================================================================== */

@media (max-width: 720px) {

  /* Mobile: body scrolls normally, canvas stays pinned via translateZ.
     Reserve safe-area space so the top bar doesn't disappear under
     the iPhone notch / Dynamic Island / address bar. */
  html, body {
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    -webkit-overflow-scrolling: touch;
  }
  body {
    min-height: 100vh;
    min-height: 100svh;
    display: block;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
  }
  .player, .standby {
    min-height: 0;
    align-content: start;
    padding-top: clamp(12px, 3vw, 24px);
  }

  .opbar {
    padding: 14px 16px;
    font-size: 10px;
    letter-spacing: 0.18em;
    gap: 8px;
  }

  .opbar__brand,
  .opbar__brand-thin { letter-spacing: 0.22em; }

  .opbar__sep { display: none; }
  .opbar__brand .opbar__brand-thin { display: none; }
  /* On phones the topbar is tight — show only TEST + premiere date,
     drop the host name + clock so the premiere date can breathe. */
  .opbar__brand { display: none; }
  .opbar__clock { display: none; }

  .player {
    padding: 14px 16px;
    gap: 16px;
  }

  .player__track {
    grid-template-columns: 1fr;
    gap: 12px;
    justify-items: center;
    text-align: center;
  }

  .player__cover {
    width: 42vw;
    height: 42vw;
    max-width: 180px;
    max-height: 180px;
  }

  .player__title {
    font-size: clamp(28px, 8.5vw, 48px);
    white-space: normal;
    text-overflow: clip;
    line-height: 0.92;
    max-height: 2.5em;
    overflow: hidden;
  }

  .player__artist {
    white-space: normal;
    text-overflow: clip;
    font-size: 11px;
    letter-spacing: 0.14em;
  }

  .controls {
    grid-template-columns: 1fr;
    gap: 12px;
    justify-items: center;
  }

  .play {
    width: 56px;
    height: 56px;
  }

  .vol {
    width: 100%;
    max-width: 320px;
  }

  .controls__hint {
    justify-self: center;
    font-size: 10px;
  }

  .promo {
    padding: 10px 16px;
  }

  .promo__link {
    max-width: 360px;
    box-shadow:
      4px 4px 0 rgba(250, 190, 12, 0.85),
      -2px -2px 0 var(--c-bg);
  }

  .standby {
    padding: 28px 18px;
    align-items: center;
    text-align: center;
  }

  .standby__date { font-size: clamp(96px, 28vw, 200px); }
  .standby__msg  { max-width: 18ch; text-align: center; }

  .stripes {
    height: 10px;
    animation-duration: 6s;
  }

  .opbar--btm {
    padding: 10px 16px 16px;
    font-size: 9px;
    letter-spacing: 0.18em;
  }
}

/* Very narrow phones */
@media (max-width: 380px) {
  .opbar__test { display: none; }
  .player__title { font-size: clamp(32px, 13vw, 56px); }
}
