/* Cool FM mängija – stiilid. Brändi tokenid ja fondid: assets/tokens.css */

:root {
  --logo-h: 52px;
  --logo-w: calc(var(--logo-h) * 3.2935); /* logo SVG küljesuhe 606 : 184 */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cfm-cobalt);
  color: var(--cfm-frost);
  font-family: var(--cfm-font-body);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
p, h1 { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--cfm-lime); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.wrap { width: 100%; max-width: 1440px; margin-inline: auto; padding-inline: clamp(16px, 4.5vw, 64px); }
.page { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; overflow-x: hidden; }

.top { padding-top: max(28px, env(safe-area-inset-top)); }
.logo { height: var(--logo-h); width: var(--logo-w); }

.main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 48px;
  align-items: center;
  padding-block: clamp(28px, 5vh, 64px) 16px;
}
.copy { max-width: 700px; }

/* Tüpograafia */
.kicker { font-size: 14px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--cfm-lime); }
.display { font-family: var(--cfm-font-display); font-weight: 900; text-transform: uppercase; line-height: .86; letter-spacing: -.01em; }
.display em { font-style: normal; color: var(--cfm-lime); }
.title { font-size: clamp(56px, 8.4vw, 124px); margin-top: 16px; }
.lead { margin-top: 20px; max-width: 30em; font-size: clamp(18px, 1.5vw, 21px); color: #DCE3FF; }

/* Mängija kaart */
.player {
  margin-top: 32px;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px 20px 20px;
  border-radius: var(--cfm-radius-panel);
  background: var(--cfm-ink);
}
.play {
  flex: none;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--cfm-lime);
  color: var(--cfm-ink);
  display: grid;
  place-items: center;
  transition: background-color .15s, transform .1s;
}
.play:hover { background: #E2FF6E; }
.play:active { transform: scale(.96); }
.play:focus-visible { outline-offset: 4px; border-radius: 50%; }
.play svg { grid-area: 1 / 1; }
.play .ic-pause, .play .ic-spin { display: none; }
[data-state="playing"] .play .ic-play, [data-state="loading"] .play .ic-play { display: none; }
[data-state="playing"] .play .ic-pause { display: block; }
[data-state="loading"] .play .ic-spin { display: block; animation: cfm-spin 1s linear infinite; }
@keyframes cfm-spin { to { transform: rotate(360deg); } }

.meta { flex: 1; min-width: 0; }
.label { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #9FAAD6; }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--cfm-lime); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
[data-state="playing"] .live i { animation: cfm-pulse 1s ease-in-out infinite; }
@keyframes cfm-pulse { 50% { opacity: .35; } }
.track { margin-top: 6px; font-size: 20px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.status { margin-top: 4px; font-size: 14px; color: var(--cfm-soft); }
[data-state="error"] .status { color: var(--cfm-lime); }
.volume { display: flex; align-items: center; gap: 10px; max-width: 240px; margin-top: 12px; color: var(--cfm-soft); }
.volume input { flex: 1; min-width: 0; accent-color: var(--cfm-lime); }
@media (pointer: coarse) { .volume { display: none; } } /* telefonis juhitakse helitugevust nuppudega */

/* Peasponsor: kuni 60% Cool FM-i logo laiusest, logo kaitsealast väljas */
.sponsor { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.sponsor-label { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--cfm-soft); }
.sponsor-slot {
  width: calc(var(--logo-w) * .6);
  min-height: 52px;
  padding: 6px;
  border: 2px dashed var(--cfm-tick);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--cfm-soft);
}
.sponsor-mark img { width: auto; height: auto; max-width: calc(var(--logo-w) * .6); max-height: 52px; }
.sponsor-note { flex-basis: 100%; max-width: 520px; font-size: 13px; line-height: 1.45; color: var(--cfm-soft); }

/* Ekvalaiser: riba : vahe = 5 : 2, ümarad otsad, 120 BPM. Liigub, kui raadio mängib. */
.eq-wrap { align-self: end; justify-self: end; width: 100%; max-width: 560px; height: clamp(240px, 54vh, 580px); }
.eq { --w: clamp(16px, 2.3vw, 34px); height: 100%; display: flex; align-items: flex-end; justify-content: flex-end; gap: calc(var(--w) * .4); }
.eq i { display: block; flex: none; width: var(--w); height: var(--h); border-radius: 999px; background: var(--cfm-lime); transform-origin: bottom; }
.eq i:nth-child(4n + 3) { background: var(--cfm-frost); }
.is-playing .eq i { animation: cfm-eq 1s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes cfm-eq { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.42); } }

/* Raadioskaala 88–108 MHz, nõel näitab jaama sagedust */
.tuner-wrap { padding-top: 40px; }
.tuner { position: relative; height: 64px; }
.ticks { display: flex; justify-content: space-between; align-items: flex-start; }
.ticks i { position: relative; display: block; width: 2px; border-radius: 1px; background: var(--cfm-tick); }
.ticks span { position: absolute; top: 36px; left: -20px; width: 42px; text-align: center; font-size: 14px; font-weight: 600; font-style: normal; color: var(--cfm-soft); }
.needle { position: absolute; top: -8px; width: 4px; height: 44px; margin-left: -2px; border-radius: 2px; background: var(--cfm-lime); }
.needle b { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--cfm-lime); }

.foot { padding-top: 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); font-size: 13px; color: var(--cfm-soft); }

/* Mobiil */
@media (max-width: 860px) {
  :root { --logo-h: 44px; } /* 145 px lai – üle brändi miinimumi 120 px */
  .top { padding-top: max(20px, env(safe-area-inset-top)); }
  .main { grid-template-columns: 1fr; gap: 28px; align-items: start; padding-block: 28px 8px; }
  .title { font-size: clamp(52px, 15vw, 96px); }
  .player { gap: 16px; padding: 16px 18px 16px 16px; }
  .play { width: 76px; height: 76px; }
  .track { font-size: 18px; }
  .eq-wrap { justify-self: stretch; max-width: none; height: 160px; }
  .eq { gap: 8px; }
  .eq i { flex: 1 1 0; width: auto; }
  .tuner-wrap { padding-top: 32px; }
  .ticks span { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .is-playing .eq i, [data-state="playing"] .live i { animation: none; }
}
