/* =========================================================
   Radiomaker - feuille de style (refonte 2026)
   Révision : optimisation performance + accessibilité AA

   primary #e84545 (décoratif) · primary-dark #c93838 (texte)
   ink #131110 · ink-soft #2A2622 · cream #FAF8F5
   Titres : Archivo · Texte : Instrument Sans
   ========================================================= */

:root {
  /* Rouge vif : réservé aux éléments DÉCORATIFS (pastilles, waveform,
     curseurs, liserés). Aucun texte ne repose dessus. */
  --rm-primary:      #e84545;

  /* Rouge foncé : dès qu'il y a du texte, en couleur ou en fond.
     4,95:1 sur crème et 5,0:1 pour du blanc posé dessus → AA validé.
     C'est la teinte « primary-dark » déjà présente dans votre palette. */
  --rm-primary-text: #c93838;
  --rm-primary-hover:#b02f2f;

  /* Note : sur fond sombre on REVIENT à --rm-primary (#e84545).
     Il y donne 4,81:1, donc conforme : il n'a jamais eu besoin
     d'être modifié là. Seul le fond crème posait problème. */
}

/* =========================================================
   POLICES AUTO-HÉBERGÉES
   Remplacent l'appel à fonts.googleapis.com : deux origines
   tierces et une chaîne de requêtes en moins.

   ⚠ Déposez les .woff2 dans assets/fonts/ (voir DEPLOIEMENT.md).
     Si les fichiers manquent, le navigateur retombe proprement
     sur la police système : le site reste lisible.
   ========================================================= */
@font-face {
  font-family: 'Archivo'; font-style: normal; font-weight: 500;
  font-display: swap; src: url('../fonts/archivo-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Archivo'; font-style: normal; font-weight: 600;
  font-display: swap; src: url('../fonts/archivo-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Archivo'; font-style: normal; font-weight: 700;
  font-display: swap; src: url('../fonts/archivo-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Archivo'; font-style: normal; font-weight: 800;
  font-display: swap; src: url('../fonts/archivo-800.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Sans'; font-style: normal; font-weight: 400;
  font-display: swap; src: url('../fonts/instrument-sans-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Sans'; font-style: normal; font-weight: 500;
  font-display: swap; src: url('../fonts/instrument-sans-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Sans'; font-style: normal; font-weight: 600;
  font-display: swap; src: url('../fonts/instrument-sans-600.woff2') format('woff2');
}

html { scroll-behavior: smooth; }
body {
  background: #FAF8F5;
  color: #131110;
  font-family: 'Instrument Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.font-display { font-family: 'Archivo', system-ui, sans-serif; }
[id] { scroll-margin-top: 90px; }

/* =========================================================
   ROUGE DE MARQUE — #e84545 PARTOUT
   ---------------------------------------------------------
   Choix esthétique assumé : on garde le rouge vif d'origine,
   plus dynamique, sur tous les fonds. Aucune surcharge n'est
   appliquée : les classes text-primary / bg-primary du build
   Tailwind s'appliquent telles quelles.

   Ce que ça coûte, en chiffres :
     · #e84545 sur crème #FAF8F5 .... 3,69:1
       → conforme pour les GRANDS textes (seuil 3:1) :
         vos titres rouges, les gros chiffres.
       → sous le seuil pour les petits textes (4,5:1) :
         les intitulés « STUDIO DE PRODUCTION RADIO »,
         « LES VOIX DE L'AGENCE », les liens « Découvrir → ».
     · #e84545 sur encre #131110 ... 4,81:1  → conforme partout,
       footer et sections noires comprises.
     · Blanc sur bouton rouge ...... 3,91:1  → conforme pour un
       libellé en gros et gras, limite en 18 px.

   Comptez 93-96 en accessibilité au lieu de 100. Rien d'autre
   n'est affecté : structure, clavier, lecteurs d'écran et
   navigation agentique restent intacts.

   POUR REPASSER EN MODE CONFORME
   Décommentez le bloc ci-dessous : le rouge devient #c93838 sur
   fond clair, et le lien légal du footer passe en crème.
   ========================================================= */

/*
.text-primary              { color: var(--rm-primary-text); }
.hover\:text-primary:hover { color: var(--rm-primary-text); }
.bg-primary                { background-color: var(--rm-primary-text); }
.hover\:bg-primary:hover   { background-color: var(--rm-primary-text); }
.hover\:bg-primary-dark:hover { background-color: var(--rm-primary-hover); }
.border-primary            { border-color: var(--rm-primary-text); }
footer .text-primary,
footer .hover\:text-cream:hover { color: #FAF8F5; }
*/

/* Classes absentes du build Tailwind, définies ici */
.text-primary-dark { color: var(--rm-primary-text); }
.bg-primary-dark   { background-color: var(--rm-primary-text); }

/* =========================================================
   LIEN D'ÉVITEMENT (« Aller au contenu »)
   Invisible jusqu'à ce qu'il reçoive le focus clavier.
   .sr-only n'existe pas dans le build Tailwind : défini ici.
   ========================================================= */
.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;
}
.rm-skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--rm-primary); color: #fff;
  padding: .75rem 1.25rem; border-radius: 0 0 .5rem 0;
  font-weight: 600; text-decoration: none;
}
.rm-skip:focus { left: 0; }

/* =========================================================
   ICÔNES — réservation d'espace
   Empêche le moindre décalage si la fonte d'icônes arrive
   après le texte. Préserve le CLS à 0.
   ========================================================= */
[class^="ri-"], [class*=" ri-"] {
  display: inline-block;
  min-width: 1em;
  text-align: center;
  font-style: normal;
}

/* ---- Header : légère condensation au scroll ---- */
header { transition: box-shadow .3s ease; }
header.scrolled { box-shadow: 0 1px 0 rgba(19,17,16,.06), 0 10px 30px -20px rgba(19,17,16,.35); }

/* ---- Signature : waveform (respire au repos, s'anime en lecture) ---- */
.wave { display: flex; align-items: flex-end; gap: 3px; height: 40px; }
.wave span {
  flex: 1 1 0; border-radius: 2px; background: #4A4540;
  transform-origin: bottom; transition: background .3s ease;
  animation: idle 3.4s ease-in-out infinite;
  will-change: transform;
}
.wave span.on { background: var(--rm-primary); }
.is-playing .wave span { animation: bar 850ms ease-in-out infinite; }
@keyframes idle { 0%,100% { transform: scaleY(.82); } 50% { transform: scaleY(1); } }
@keyframes bar  { 0%,100% { transform: scaleY(.5);  } 50% { transform: scaleY(1); } }

/* =========================================================
   ANNEAU DU BOUTON DE LECTURE
   Ancienne version : animation sur box-shadow → repaint à
   chaque frame, signalée par Lighthouse (« animations non
   composées »). Nouvelle version : transform + opacity,
   entièrement gérées par le compositeur GPU.
   ========================================================= */
#playerPlay { position: relative; }
#playerPlay::after {
  content: ""; position: absolute; inset: 0; border-radius: 9999px;
  background: rgba(232,69,69,.45);
  animation: ring 2.4s ease-out infinite;
  will-change: transform, opacity;
  pointer-events: none;
  z-index: -1;
}
.is-playing #playerPlay::after { animation: none; opacity: 0; }
@keyframes ring {
  0%   { transform: scale(1);    opacity: .45; }
  70%  { transform: scale(1.75); opacity: 0;   }
  100% { transform: scale(1.75); opacity: 0;   }
}

/* ---- Rail horizontal (nouveautés, castings) ---- */
.rail { scroll-snap-type: x mandatory; scrollbar-width: none; -ms-overflow-style: none; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }

/* ---- Cartes du rail : la pastille play se remplit au survol ---- */
.rail-card span { transition: background .3s ease; }
.rail-card .ri-play-fill { transition: color .3s ease; }

/* ---- Entrée orchestrée au chargement (hero) ---- */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.rise   { animation: rise .8s cubic-bezier(.2,.7,.2,1) both; }
.rise-1 { animation-delay: .05s; }
.rise-2 { animation-delay: .16s; }
.rise-3 { animation-delay: .27s; }
.rise-4 { animation-delay: .38s; }
.rise-5 { animation-delay: .50s; }

/* ---- Révélations au scroll (keyframes : n'entrent pas en conflit
   avec les classes transition-* de Tailwind) ---- */
/* Les animations d'apparition ne masquent le contenu QUE si le JS est actif
   (classe « js » posée dans le <head>). Sans JS, tout reste visible. */
.js .reveal { opacity: 0; }
.reveal.in { animation: revealIn .7s cubic-bezier(.2,.7,.2,1) forwards; }
.js .reveal-group > * { opacity: 0; }
.reveal-group.in > * { animation: revealIn .6s cubic-bezier(.2,.7,.2,1) forwards; }
.reveal-group.in > *:nth-child(2){ animation-delay:.08s }
.reveal-group.in > *:nth-child(3){ animation-delay:.16s }
.reveal-group.in > *:nth-child(4){ animation-delay:.24s }
.reveal-group.in > *:nth-child(5){ animation-delay:.32s }
.reveal-group.in > *:nth-child(6){ animation-delay:.40s }
@keyframes revealIn { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }

/* =========================================================
   INDICATEUR « ON AIR »
   Ancienne version : box-shadow animé → non composé.
   Nouvelle version : halo en pseudo-élément, transform + opacity.
   ========================================================= */
.on-air-dot {
  position: relative;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--rm-primary);
  flex-shrink: 0;
}
.on-air-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: rgba(232,69,69,.55);
  animation: onair 1.9s ease-out infinite;
  will-change: transform, opacity;
  pointer-events: none;
}
@keyframes onair {
  0%   { transform: scale(1); opacity: .55; }
  70%  { transform: scale(3); opacity: 0;   }
  100% { transform: scale(3); opacity: 0;   }
}

/* ---- Lecteur audio global (sticky, pages avec extraits) ---- */
#gplayer input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 5px; border-radius: 3px; background: rgba(255,255,255,.2); outline: none; cursor: pointer;
}
#gplayer input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--rm-primary); cursor: pointer;
}
#gplayer input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border: none; border-radius: 50%; background: var(--rm-primary); cursor: pointer;
}

/* ---- Accessibilité ---- */
a:focus-visible, button:focus-visible,
[role="button"]:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--rm-primary); outline-offset: 3px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .wave span, .is-playing .wave span, #playerPlay::after, .rise,
  .on-air-dot::after { animation: none !important; }
  #playerPlay::after, .on-air-dot::after { opacity: 0 !important; }
  .rise { opacity: 1; transform: none; }
  .reveal, .reveal-group > * { opacity: 1 !important; transform: none !important; animation: none !important; }
}

/* ---- Bandeau logos partenaires (défilement infini) ---- */
@keyframes infinite-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.animate-infinite-scroll { animation: infinite-scroll 60s linear infinite; will-change: transform; }
.logo-track:hover { animation-play-state: paused; }
.logo-track img { flex-shrink: 0; }
@media (prefers-reduced-motion: reduce) {
  .animate-infinite-scroll { animation: none; flex-wrap: wrap; justify-content: center; }
}

/* ---- Cartouche en cours de lecture : bouton play/pause toujours visible ---- */
.playing [class*="group-hover:opacity-100"] { opacity: 1 !important; transform: none !important; }


/* =========================================================
   Dernières productions — cartes vives par catégorie
   Chaque .rail-card reçoit --cat (couleur) et --cat-ink (#fff ou encre,
   calculé côté PHP selon la luminosité pour rester lisible)

   Le soulèvement au survol passe de « top » à « translateY » :
   rendu identique, mais composé par le GPU au lieu de déclencher
   un recalcul de mise en page à chaque frame.
   ========================================================= */
.rail-card {
  position: relative;
  background: var(--cat-tint, #fff);
  border: 1px solid var(--cat-line, #ECE7E0);
  transition: transform .34s cubic-bezier(.34,1.56,.64,1),
              background .22s ease, border-color .22s ease;
}
.rail-card:hover {
  transform: translateY(-4px);
  background: var(--cat-tint-2, var(--cat-tint, #fff));
  border-color: var(--cat, #131110);
}

.rail-chip {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
  background: var(--cat-solid, var(--cat, #131110)); color: var(--cat-ink, #fff);
  white-space: nowrap;
}
.rail-new {
  font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #131110; background: #F4E37A; padding: 3px 7px; border-radius: 999px; white-space: nowrap;
}

/* Médaillon plein : icône au repos, play au survol, équaliseur en lecture.
   Le sélecteur ne cible plus la balise « span » : le script convertit
   ce médaillon en <button> réel pour l'accessibilité. */
.rail-med {
  position: relative; width: 40px; height: 40px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
  background: var(--cat-solid, var(--cat, #131110)); color: var(--cat-ink, #fff);
  border: 0; padding: 0; cursor: pointer;
}
.rail-med .rm-play, .rail-med .rail-eq { display: none; }
.rail-card:hover .rail-med .rm-icon { display: none; }
.rail-card:hover .rail-med .rm-play { display: block; }

/* État "en lecture" : la classe .playing est ajoutée à la carte active par le JS du lecteur */
.rail-card.playing .rail-med .rm-icon,
.rail-card.playing:hover .rail-med .rm-play { display: none; }
.rail-card.playing .rail-med .rail-eq { display: flex; }

/* Équaliseur : hauteur fixe + scaleY (composé) au lieu d'animer height */
.rail-eq { align-items: flex-end; gap: 2px; height: 16px; }
.rail-eq i {
  width: 3px; height: 100%; min-width: 0;
  background: var(--cat-ink, #fff); border-radius: 2px;
  transform-origin: bottom; transform: scaleY(.35);
  animation: raileq .8s ease-in-out infinite;
  will-change: transform;
}
.rail-eq i:nth-child(2) { animation-delay: .15s; }
.rail-eq i:nth-child(3) { animation-delay: .30s; }
.rail-eq i:nth-child(4) { animation-delay: .45s; }
@keyframes raileq { 0%,100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }

@media (prefers-reduced-motion: reduce) {
  .rail-eq i { animation: none !important; transform: scaleY(.7) !important; }
  .rail-card { transition: none !important; }
  .rail-card:hover { transform: none !important; }
}

/* Médaillon dans la couleur de catégorie, y compris au survol
   (neutralise l'ancien remplissage rouge hérité du premier design de rail) */
.rail-card:hover .rail-med { background: var(--cat-solid, var(--cat, #131110)); }
.rail-card:hover .rail-med .rm-play { color: var(--cat-ink, #fff); }

/* =========================================================
   BOUTON DE LECTURE DES CARTES
   Le script convertit la pastille décorative en <button> réel.
   Sur certaines cartes (page d'accueil), cette pastille est en
   opacity-0 et ne se révèle qu'au survol : au clavier, il n'y a
   pas de survol. Cette règle la rend visible dès qu'elle reçoit
   le focus, sans quoi l'utilisateur naviguerait à l'aveugle.
   ========================================================= */
.rm-play-btn { cursor: pointer; }
.rm-play-btn:focus-visible {
  opacity: 1 !important;
  transform: none !important;
  outline: 2px solid var(--rm-primary);
  outline-offset: 3px;
}
/* La carte parente laisse aussi apparaître sa pastille au focus clavier */
.audio-card:focus-within [class*="opacity-0"],
.voice-card:focus-within [class*="opacity-0"] { opacity: 1 !important; transform: none !important; }
