/* Fonts locales de la charte LOGDIAL. AlleyOop sert aux titres display,
   GaramondLogdial sert au texte courant et aux descriptions. */
@font-face {
  font-family: "AlleyOop";
  src: url("font/Alley-Oop.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "GaramondLogdial";
  src: url("font/Garamond.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Variables globales : couleurs, typos, espacements réutilisés partout. */
:root {
  color-scheme: dark;
  --bg: #003b73;
  --panel: rgba(0, 42, 82, 0.74);
  --panel-soft: rgba(255, 255, 255, 0.1);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  --line: rgba(255, 255, 255, 0.22);
  --accent: #ffffff;
  --accent-strong: #dceeff;
  --danger: #d81919;
  --sea: #8cc9ff;
  --ink: #003b73;
  --radius: 8px;
  --font-display: "AlleyOop", Arial, Helvetica, sans-serif;
  --font-body: "GaramondLogdial", Garamond, "Times New Roman", serif;
  --display-spacing: 0.06em;
  font-family: var(--font-body);
}

/* Base CSS simple pour éviter les calculs de largeur pénibles. */
* {
  box-sizing: border-box;
}

/* Fond général : bleu principal LOGDIAL avec un léger relief. */
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.16), transparent 28%),
    linear-gradient(145deg, #003b73 0%, #004b8f 42%, #002c56 100%),
    var(--bg);
  color: var(--text);
}

/* Les contrôles héritent de la typo définie par leur bloc parent. */
button,
audio {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

/* Largeur max de l'app et respiration autour de l'écran. */
.radio-shell {
  width: min(1180px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

/* Premier écran : pochette à gauche, lecteur radio à droite. */
.hero {
  min-height: 620px;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(440px, 1.1fr);
  align-items: center;
  gap: 58px;
  border-bottom: 1px solid var(--line);
}

/* Bloc pochette épisode. */
.artwork-zone {
  position: relative;
}

/* Cadre carré qui reçoit l'image Ausha de l'épisode courant. */
.artwork-frame {
  position: relative;
  aspect-ratio: 1;
  width: min(100%, 470px);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
}

.artwork-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vinyl-shadow {
  position: absolute;
  inset: auto 20px 18px 20px;
  height: 18px;
  background: rgba(0, 0, 0, 0.42);
  filter: blur(18px);
}

/* Colonne contenant toutes les informations de lecture. */
.player-zone {
  min-width: 0;
}

/* Plusieurs lignes utilisent la même logique flex. */
.station-line,
.controls-row,
.progress-meta,
.section-heading,
.next-strip {
  display: flex;
  align-items: center;
}

.station-line {
  gap: 14px;
  margin-bottom: 18px;
}

/* Badge LIVE : fond blanc, texte et point rouges. */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--danger);
  font-weight: 800;
  letter-spacing: var(--display-spacing);
  font-family: var(--font-display);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(216, 25, 25, 0.16);
}

.sync-status {
  color: var(--muted);
  font-size: 0.92rem;
}

/* Nom de station et titre épisode : typo display sans accents côté JS. */
.station-name {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: var(--display-spacing);
  text-transform: uppercase;
  font-family: var(--font-display);
}

h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(2.4rem, 4.8vw, 5.25rem);
  line-height: 0.95;
  letter-spacing: var(--display-spacing);
  font-family: var(--font-display);
}

/* Texte descriptif de l'épisode en cours, en Garamond. */
.episode-description {
  min-height: 74px;
  margin: 24px 0 28px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
  max-width: 680px;
}

/* Progression dans l'épisode actuellement diffusé. */
.progress-block {
  width: 100%;
  max-width: 720px;
}

.progress-meta {
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 10px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--sea));
  transition: width 180ms linear;
}

/* Zone des boutons de lecture et du volume. */
.controls-row {
  gap: 12px;
  margin-top: 26px;
  flex-wrap: wrap;
}

/* Bouton principal pour rejoindre ou mettre en pause le direct. */
.primary-control {
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--ink);
  font-weight: 850;
  font-family: var(--font-display);
}

.primary-control:hover {
  background: var(--accent-strong);
}

.icon-button {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 1.25rem;
  font-family: var(--font-display);
}

.icon-button:hover {
  border-color: rgba(255, 255, 255, 0.5);
}

/* Contrôle de volume : slider 0-100 + valeur numérique. */
.volume-control {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--text);
  font-family: var(--font-body);
}

.volume-control input {
  width: 150px;
  accent-color: var(--accent);
}

.volume-control span {
  min-width: 28px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Bande "À suivre" juste sous le lecteur principal. */
.next-strip {
  gap: 12px;
  min-height: 52px;
  margin-top: 30px;
  padding: 0 16px;
  border-left: 4px solid var(--sea);
  background: rgba(255, 255, 255, 0.09);
}

.next-strip span {
  color: var(--muted);
  white-space: nowrap;
}

.next-strip strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Reactions live entre le lecteur et la file de diffusion. */
.reaction-section {
  position: relative;
  padding: 24px 0 0;
}

.reaction-line {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
}

.reaction-label {
  color: var(--muted);
  font-family: var(--font-body);
}

.reaction-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reaction-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  overflow: hidden;
}

.reaction-button:hover {
  transform: translateY(-1px);
}

.reaction-button img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  display: block;
}

.reaction-status {
  color: var(--muted);
  font-size: 0.92rem;
}

.reaction-stream {
  position: absolute;
  right: 24px;
  bottom: 8px;
  width: 180px;
  height: 120px;
  pointer-events: none;
  overflow: hidden;
}

.reaction-bubble {
  position: absolute;
  right: 18px;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: transparent;
  animation: reaction-rise 4s ease-out forwards;
  animation-delay: var(--reaction-delay);
}

.reaction-bubble img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
}

@keyframes reaction-rise {
  0% {
    opacity: 0;
    transform: translate3d(0, 16px, 0) scale(0.72);
  }

  14% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate3d(var(--reaction-x), -105px, 0) scale(1.16);
  }
}

/* Tableau de debug/test temporaire en bas de page. */
.info-band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 34px 0 0;
  border: 1px solid var(--line);
  background: var(--line);
}

.info-band > div {
  min-height: 86px;
  padding: 18px;
  background: rgba(0, 35, 68, 0.76);
}

.info-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.info-band strong {
  font-size: 1.06rem;
}

/* File de diffusion : uniquement les deux prochains épisodes. */
.queue-section {
  padding: 34px 0 0;
}

.section-heading {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: var(--display-spacing);
  font-family: var(--font-display);
}

#queueHint {
  color: var(--muted);
}

.queue {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* Carte d'un épisode à venir. */
.queue-item {
  min-height: 168px;
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.queue-item.is-current {
  border-color: var(--line);
  background: var(--panel);
}

.queue-item img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 6px;
}

.queue-title {
  margin: 0 0 8px;
  font-weight: 700;
  line-height: 1.25;
  font-family: var(--font-body);
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

/* Ligne de durée/type "Dans 1 épisode". */
.queue-meta {
  color: var(--muted);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

/* Description courte, volontairement limitée à 4 lignes. */
.queue-description {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Couleur utilisée quand un statut devient une erreur. */
.error-state {
  color: #ffd4d1;
}

/* Responsive tablette : l'app passe en une colonne. */
@media (max-width: 920px) {
  .radio-shell {
    width: min(100% - 28px, 720px);
    padding-top: 22px;
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 28px;
    padding-bottom: 28px;
  }

  .artwork-frame {
    width: min(100%, 380px);
  }

  h1 {
    font-size: clamp(2.1rem, 10vw, 4rem);
  }

  .info-band,
  .queue {
    grid-template-columns: 1fr 1fr;
  }
}

/* Responsive mobile : cartes et tableau en une seule colonne. */
@media (max-width: 580px) {
  .info-band,
  .queue {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .next-strip,
  .reaction-line {
    align-items: flex-start;
    flex-direction: column;
  }

  .next-strip {
    justify-content: center;
    padding: 12px 16px;
  }

  .next-strip strong {
    white-space: normal;
  }

  .reaction-stream {
    right: 8px;
  }
}
