/* RadioInternet.ca — Lecteur d’article beau (v1.0.0)
   Amélioration progressive des blocs audio d’articles.
   Aucun style global : tout est préfixé .ria-player. */

.ria-player {
  --ria-progress: 0%;
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 16px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: 1.25rem 0;
  padding: 16px;
  overflow: hidden;
  color: #ffffff;
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(139, 92, 246, 0.28) 0%, rgba(139, 92, 246, 0) 55%),
    radial-gradient(120% 160% at 100% 100%, rgba(255, 46, 158, 0.22) 0%, rgba(255, 46, 158, 0) 55%),
    #04060d;
  border: 1px solid rgba(139, 92, 246, 0.5);
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  font-family: inherit;
}

.ria-player *,
.ria-player *::before,
.ria-player *::after {
  box-sizing: border-box;
}

.ria-player__cover {
  flex: 0 0 112px;
  width: 112px;
  height: 112px;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #ff2e9e, #8b5cf6);
  border-radius: 16px;
}

.ria-player__cover[hidden] {
  display: none;
}

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

.ria-player__main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}

.ria-player__eyebrow {
  margin: 0 0 2px;
  color: #ff7ac2;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.ria-player__title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ria-player__status {
  margin: 2px 0 0;
  color: #cfc9ff;
  font-size: 0.82rem;
  line-height: 1.25;
}

.ria-player__progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ria-player__time {
  flex: 0 0 auto;
  min-width: 3.2ch;
  color: #e9e6ff;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
}

.ria-player__progress {
  flex: 1 1 auto;
  min-width: 0;
  height: 28px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.ria-player__progress:disabled {
  cursor: wait;
  opacity: 0.55;
}

.ria-player__progress::-webkit-slider-runnable-track {
  height: 8px;
  background: linear-gradient(90deg, #ff2e9e 0%, #8b5cf6 var(--ria-progress), rgba(255, 255, 255, 0.18) var(--ria-progress));
  border-radius: 999px;
}

.ria-player__progress::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -6px;
  background: #ffffff;
  border: 3px solid #ff2e9e;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  -webkit-appearance: none;
  appearance: none;
}

.ria-player__progress::-moz-range-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.ria-player__progress::-moz-range-progress {
  height: 8px;
  background: linear-gradient(90deg, #ff2e9e, #8b5cf6);
  border-radius: 999px;
}

.ria-player__progress::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #ffffff;
  border: 3px solid #ff2e9e;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.ria-player__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ria-player__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 52px;
  min-height: 52px;
  padding: 0 10px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.ria-player__button:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.4);
}

.ria-player__button:active {
  transform: scale(0.97);
}

.ria-player__button svg {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.ria-player__button--play {
  width: 64px;
  min-width: 64px;
  height: 64px;
  min-height: 64px;
  padding: 0;
  background: linear-gradient(135deg, #ff2e9e 0%, #8b5cf6 100%);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 10px 24px rgba(255, 46, 158, 0.35);
}

.ria-player__button--play:hover {
  background: linear-gradient(135deg, #ff4cad 0%, #9d70ff 100%);
}

.ria-player__button--play svg {
  width: 28px;
  height: 28px;
}

.ria-player[data-state="loading"] .ria-player__button--play svg {
  display: none;
}

.ria-player[data-state="loading"] .ria-player__button--play::after {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  content: "";
  animation: ria-spin 0.8s linear infinite;
}

.ria-player__button--speed {
  min-width: 58px;
  font-variant-numeric: tabular-nums;
}

.ria-player__volume {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: auto;
  color: #e9e6ff;
}

.ria-player__volume svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.ria-player__volume input[type="range"] {
  width: 96px;
  min-width: 0;
  accent-color: #ff2e9e;
  cursor: pointer;
}

.ria-player__caption {
  margin: 0;
  color: #cfc9ff;
  font-size: 0.85rem;
  line-height: 1.35;
}

/* L’élément audio d’origine reste dans le DOM (lecture réelle + repli),
   mais il est masqué seulement après une amélioration réussie. */
.ria-player__audio {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Si le fichier audio échoue : on réaffiche le lecteur natif dans la carte. */
.ria-player--failed .ria-player__controls,
.ria-player--failed .ria-player__progress-row {
  display: none;
}

.ria-player--failed .ria-player__audio {
  position: static !important;
  width: 100% !important;
  height: 54px !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.ria-player__button:focus-visible,
.ria-player__progress:focus-visible,
.ria-player__volume input[type="range"]:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

.ria-player .screen-reader-text,
.ria-player .ria-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

@media (max-width: 640px) {
  .ria-player {
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
  }

  .ria-player__cover {
    flex-basis: 76px;
    width: 76px;
    height: 76px;
    border-radius: 13px;
  }

  .ria-player__title {
    font-size: 0.96rem;
  }

  .ria-player__volume {
    display: none;
  }

  .ria-player__button {
    min-width: 50px;
    min-height: 50px;
  }

  .ria-player__button--play {
    width: 62px;
    min-width: 62px;
    height: 62px;
    min-height: 62px;
  }
}

@media (max-width: 380px) {
  .ria-player {
    gap: 10px;
    padding: 12px;
  }

  .ria-player__cover {
    flex-basis: 64px;
    width: 64px;
    height: 64px;
  }

  .ria-player__controls {
    gap: 8px;
  }

  .ria-player__time {
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ria-player__button {
    transition: none;
  }

  .ria-player[data-state="loading"] .ria-player__button--play::after {
    animation-duration: 1.6s;
  }
}
