/* =====================================================================
   Radio Diffusion — lecteur public
   Registre visuel : le lagon de Mayotte. Bleu-vert profond, jaune
   soleil pour l'action. Le bouton de lecture est le héros de la page :
   sur une webradio, tout le reste est secondaire.
   Mobile d'abord.
   ===================================================================== */

:root {
  --deep:  #0b2f38;
  --mid:   #12414c;
  --lift:  #17505d;
  --line:  #24626f;
  --pale:  #e9f2f1;
  --dim:   #8fb2b6;
  --sun:   #ffc94d;
  --sun-d: #e0a92c;
  --bad:   #ff8e72;

  --display: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--mid) 0%, var(--deep) 62%)
    var(--deep);
  color: var(--pale);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}

:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- top */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 20px 14px;
}

.wordmark {
  font-family: var(--display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -.015em;
}

.tz {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--dim);
}

main { flex: 1; }

/* --------------------------------------------------------------- deck */

.deck {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px 20px 40px;
  text-align: center;
}

/* Pastille d'état : reprend la convention d'antenne */
.onair {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 5px 12px 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dim);
}

.onair .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
}

.onair[data-state="live"] {
  color: var(--pale);
  border-color: var(--sun);
}

.onair[data-state="live"] .dot {
  background: var(--sun);
  box-shadow: 0 0 0 0 rgba(255, 201, 77, .7);
  animation: pulse 2.4s ease-out infinite;
}

.onair[data-state="error"] { color: var(--bad); border-color: var(--bad); }
.onair[data-state="error"] .dot { background: var(--bad); }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 201, 77, .55); }
  70%  { box-shadow: 0 0 0 11px rgba(255, 201, 77, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 201, 77, 0); }
}

/* --- le bouton : élément signature de la page --- */

.play {
  position: relative;
  width: 132px;
  height: 132px;
  border: 0;
  border-radius: 50%;
  background: var(--sun);
  color: var(--deep);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow:
    0 0 0 1px rgba(255, 201, 77, .35),
    0 0 0 12px rgba(255, 201, 77, .07),
    0 14px 32px -10px rgba(0, 0, 0, .55);
  transition: transform .14s ease, background .14s ease;
}

.play:hover { background: var(--sun-d); }
.play:active { transform: scale(.97); }

.play svg { width: 52px; height: 52px; fill: currentColor; }

/* Un seul pictogramme visible selon l'état */
.play .ico-pause,
.play .spinner { display: none; }
.play[data-state="playing"] .ico-play { display: none; }
.play[data-state="playing"] .ico-pause { display: block; }
.play[data-state="loading"] .ico-play,
.play[data-state="loading"] .ico-pause { display: none; }
.play[data-state="loading"] .spinner { display: block; }

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(11, 47, 56, .25);
  border-top-color: var(--deep);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

/* --- titre et programme --- */

.now { min-height: 62px; }

.track {
  margin: 0 0 4px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -.01em;
  text-wrap: balance;
}

.prog {
  margin: 0;
  font-size: 14px;
  color: var(--dim);
}

/* --- volume --- */

.vol {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(280px, 100%);
}

.mute {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--dim);
  cursor: pointer;
}

.mute svg { width: 20px; height: 20px; fill: currentColor; }
.mute[aria-pressed="true"] { color: var(--bad); border-color: var(--bad); }

#volume {
  flex: 1;
  height: 30px;
  accent-color: var(--sun);
  background: none;
  cursor: pointer;
}

.err {
  margin: 0;
  max-width: 34ch;
  font-size: 14px;
  color: var(--bad);
}

/* -------------------------------------------------------------- grille */

.grid-block {
  padding: 4px 20px calc(28px + env(safe-area-inset-bottom));
  max-width: 620px;
  margin: 0 auto;
  width: 100%;
}

.grid-block h2 {
  margin: 0 0 14px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
}

.slots { list-style: none; margin: 0; padding: 0; }

.slot {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.slot:last-child { border-bottom: 1px solid var(--line); }

.slot .hours {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--dim);
}

.slot .what { font-size: 15px; font-weight: 500; }
.slot .what small {
  display: block;
  font-weight: 400;
  font-size: 13px;
  color: var(--dim);
}

/* Créneau en cours : marqué, pas juste coloré */
.slot[data-live="true"] {
  background: linear-gradient(90deg, rgba(255,201,77,.1), transparent 70%);
  box-shadow: inset 3px 0 0 var(--sun);
  padding-left: 12px;
  margin-left: -12px;
}

.slot[data-live="true"] .hours { color: var(--sun); }

.foot-note {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--dim);
}

/* -------------------------------------------------------------- bottom */

.bottom {
  padding: 16px 20px calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  text-align: center;
}

.bottom p { margin: 0; font-size: 13px; color: var(--dim); }

/* ------------------------------------------------------------ desktop */

@media (min-width: 720px) {
  .deck { padding-top: 44px; gap: 24px; }
  .play { width: 152px; height: 152px; }
  .play svg { width: 60px; height: 60px; }
  .track { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
