/* =====================================================================
   MÉDIATHÈQUE — L'ENFANT DES ÉTOILES

   Identité de l'association : fond blanc, bleu clair, or, gris.
   Les couleurs sont relevées sur le logo officiel — bleu #008BD2,
   gris du lettrage #A3A0A0 — plutôt qu'inventées.

   L'univers propre à chaque spectacle n'entre que par sa bannière, son
   logotype et une couleur d'accent décorative. La structure reste
   identique d'un spectacle à l'autre : personne ne doit réapprendre
   l'interface en changeant de titre.

   Contraste : le bleu du logo tombe à 3,4:1 sur blanc, insuffisant pour
   du texte. On garde donc #008BD2 pour les aplats et les pictogrammes,
   et une version assombrie pour tout ce qui se lit.
   ===================================================================== */

:root {
  /* --- Marque ------------------------------------------------------- */
  --bleu:        #008bd2;   /* aplats, pictogrammes, décor */
  --bleu-texte:  #00699e;   /* liens et libellés — 5,4:1 sur blanc */
  --bleu-fonce:  #005580;
  --bleu-voile:  #e8f5fc;
  --bleu-bord:   #b8e0f4;

  /* L'or de la marque n'est pas lisible en texte : #C8901A tombe à
     2,8:1 sur blanc. On sépare donc l'or décoratif de l'or écrit. */
  --or:          #c8901a;   /* traits, bordures, pictogrammes */
  --or-vif:      #e3b23c;   /* anneau, jauges, curseur du lecteur */
  --or-texte:    #8a6207;   /* seule variante admise pour du texte — 5,3:1 */
  --or-voile:    #fdf5e2;

  /* --- Gris --------------------------------------------------------- */
  --encre:       #26282d;
  --texte:       #3a3d44;
  --sourdine:    #6f747c;
  --gris-logo:   #464646;   /* gris du lettrage officiel */
  --gris-doux:   #a3a0a0;   /* pictogrammes discrets */
  --bord:        #e2e4e9;
  --fond:        #ffffff;
  --fond-doux:   #f6f7f9;
  --fond-carte:  #ffffff;

  --rouge:       #b3261e;
  --vert:        #1e7a4a;

  /* Couleur d'accent du spectacle en cours. Décorative uniquement :
     jamais appliquée à un bouton, dont le contraste ne peut pas être
     garanti pour une valeur choisie au back-office. */
  --accent:      var(--bleu);

  --rayon:       12px;
  --rayon-l:     18px;
  --texte-taille: clamp(15px, 1rem, 17px);
  --gouttiere:   20px;
  --max:         760px;

  --ombre:       0 1px 2px rgba(38, 40, 45, .06), 0 4px 14px rgba(38, 40, 45, .05);
  --ombre-haute: 0 2px 6px rgba(38, 40, 45, .08), 0 12px 32px rgba(38, 40, 45, .10);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  background: var(--fond);
  color: var(--texte);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: var(--texte-taille);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  overscroll-behavior-y: none;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; color: var(--encre); font-weight: 600; }
h1 { font-size: 1.6rem; letter-spacing: -.015em; }
h2 { font-size: 1.12rem; letter-spacing: -.005em; }
h3 { font-size: 1rem; }
p  { margin: 0 0 1em; max-width: 64ch; }
a  { color: var(--bleu-texte); }

:focus-visible {
  outline: 2px solid var(--bleu-texte);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Structure ------------------------------------------------------- */

#app {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gouttiere) 24px;
}

.entete {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 0 20px;
}
.logo-ede { height: 34px; width: auto; flex: none; }
.entete-texte { min-width: 0; flex: 1; }
.entete-texte .titre {
  font-size: .72rem; color: var(--sourdine);
  letter-spacing: .06em; text-transform: uppercase; font-weight: 600;
  white-space: nowrap;
}
/* Un nom de spectacle peut être long. Sans troncature, il pousse les
   boutons d'en-tête sur trois lignes et l'écran commence par un pâté. */
.entete-texte .sous {
  font-size: .92rem; color: var(--encre); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.entete-actions { margin-left: auto; display: flex; gap: 4px; flex: none; }
.entete-actions .btn { white-space: nowrap; }

/* Sur les écrans étroits, le nom du spectacle passe sous le logo plutôt
   que de disputer la place aux boutons. */
@media (max-width: 460px) {
  .entete { flex-wrap: wrap; row-gap: 4px; }
  .entete-texte { order: 3; flex-basis: 100%; }
  .entete-texte .titre { display: none; }
  .entete-actions { margin-left: auto; }
}

.retour {
  background: none; border: 0;
  color: var(--bleu-texte);
  font: inherit; font-size: .9rem;
  padding: 8px 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.retour:hover { color: var(--bleu-fonce); text-decoration: underline; }

/* --- L'anneau : élément signature ------------------------------------ */
/* Repris de l'univers de l'association : la lueur du réverbère. Sert
   d'indicateur de chargement et de repère décoratif. */

.anneau {
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 3px solid var(--or-vif);
  display: grid; place-items: center;
  flex: none;
  box-shadow: 0 0 0 6px var(--or-voile);
}
.anneau--petit { width: 34px; height: 34px; border-width: 2px; box-shadow: 0 0 0 4px var(--or-voile); }

.anneau-chargement {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 3px solid var(--bleu-bord);
  border-top-color: var(--bleu);
  animation: tourne 1s linear infinite;
  margin: 48px auto;
}
@keyframes tourne { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .anneau-chargement { animation-duration: 3s; }
  * { transition-duration: .01ms !important; }
}

/* --- Boutons --------------------------------------------------------- */

.btn {
  appearance: none; border: 0;
  border-radius: 999px;
  padding: 13px 22px;
  font: inherit; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px;
  transition: background .15s ease, box-shadow .15s ease, transform .1s ease;
}
.btn:active { transform: scale(.98); }

.btn--plein   { background: var(--bleu-texte); color: #fff; }
.btn--plein:hover { background: var(--bleu-fonce); }

.btn--contour { background: #fff; color: var(--encre);
                box-shadow: inset 0 0 0 1.5px var(--bord); }
.btn--contour:hover { background: var(--fond-doux); box-shadow: inset 0 0 0 1.5px var(--bleu-bord); }

.btn--discret { background: none; color: var(--bleu-texte);
                min-height: 40px; padding: 8px 12px; font-weight: 500; }
.btn--discret:hover { background: var(--bleu-voile); }

.btn--danger  { background: #fff; color: var(--rouge);
                box-shadow: inset 0 0 0 1.5px #eec9c6; }
.btn--danger:hover { background: #fdf2f1; }

.btn--large   { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* --- Formulaires ----------------------------------------------------- */

.champ { margin-bottom: 16px; }
.champ label {
  display: block; font-size: .85rem;
  color: var(--sourdine); margin-bottom: 6px; font-weight: 500;
}
.champ input[type=text],
.champ input[type=email],
.champ input[type=password] {
  width: 100%;
  padding: 13px 15px;
  border-radius: var(--rayon);
  border: 1.5px solid var(--bord);
  background: #fff;
  color: var(--encre);
  font: inherit;
  min-height: 50px;
}
.champ input:focus {
  border-color: var(--bleu);
  outline: none;
  box-shadow: 0 0 0 3px var(--bleu-voile);
}
.champ .aide { font-size: .8rem; color: var(--sourdine); margin-top: 6px; }

.case {
  display: flex; gap: 12px; align-items: flex-start;
  margin-bottom: 16px; cursor: pointer;
  font-size: .9rem; line-height: 1.45;
}
.case input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--bleu); }

.champ-code input {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.25rem;
  letter-spacing: .16em;
  text-align: center;
  text-transform: uppercase;
}

.champ-mdp { position: relative; }
.champ-mdp input { padding-right: 52px; }
.voir-mdp {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px;
  border: 0; background: none; color: var(--sourdine);
  cursor: pointer; display: grid; place-items: center; border-radius: 10px;
}
.voir-mdp:hover { color: var(--bleu-texte); background: var(--bleu-voile); }
.voir-mdp[aria-pressed="true"] { color: var(--bleu-texte); }

/* --- Messages -------------------------------------------------------- */

.message {
  border-radius: var(--rayon);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: .92rem;
  border-left: 3px solid;
}
.message--erreur { background: #fdf2f1; border-color: var(--rouge); color: #7d1a15; }
.message--succes { background: #eef8f2; border-color: var(--vert); color: #145634; }
.message--info   { background: var(--bleu-voile); border-color: var(--bleu); }

/* --- Cartes ---------------------------------------------------------- */

.carte {
  background: var(--fond-carte);
  border: 1px solid var(--bord);
  border-radius: var(--rayon-l);
  padding: 18px;
  margin-bottom: 14px;
  text-align: left;
  width: 100%;
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: block;
  box-shadow: var(--ombre);
}
.carte:hover { border-color: var(--bleu-bord); box-shadow: var(--ombre-haute); }
.carte--fixe { cursor: default; }
.carte--fixe:hover { border-color: var(--bord); box-shadow: var(--ombre); }

.carte-spectacle { padding: 0; overflow: hidden; }
.carte-spectacle .visuel {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--bleu-voile), #fff);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-start;
  padding: 18px 20px;
}
.carte-spectacle .corps { padding: 16px 18px 18px; }
.carte-spectacle .annee { font-size: .8rem; color: var(--sourdine); }
.carte-spectacle .nom { font-size: 1.2rem; font-weight: 600; margin: 2px 0 10px; color: var(--encre); }

.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce {
  font-size: .78rem; padding: 5px 11px; border-radius: 999px;
  background: var(--fond-doux); color: var(--sourdine);
}
.puce--or { background: var(--or-voile); color: var(--or-texte); font-weight: 500; }

/* --- Logos ----------------------------------------------------------- */

.logo-spectacle {
  width: min(56%, 300px);
  height: auto;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .35));
}

.banniere-spectacle {
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  border-radius: var(--rayon-l);
  margin: 6px 0 22px;
  display: flex;
  align-items: flex-start;
  padding: 20px 22px;
  border: 1px solid var(--bord);
}
.banniere-spectacle .logo-spectacle { width: min(58%, 340px); }

.visuellement-cache {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- Liste de pistes -------------------------------------------------- */

.piste {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border-radius: var(--rayon);
  background: none; border: 0;
  width: 100%; color: inherit; font: inherit;
  text-align: left; cursor: pointer; min-height: 60px;
}
.piste:hover { background: var(--fond-doux); }
.piste[aria-current="true"] { background: var(--bleu-voile); }
.piste[aria-current="true"] .piste-titre { color: var(--bleu-texte); }
.piste-num {
  width: 26px; text-align: right; color: var(--sourdine);
  font-variant-numeric: tabular-nums; font-size: .9rem; flex: none;
}
.piste-corps { flex: 1; min-width: 0; }
.piste-titre {
  font-weight: 500; color: var(--encre);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.piste-meta { font-size: .8rem; color: var(--sourdine); display: flex; gap: 10px; }
.piste[disabled], .piste[aria-disabled="true"] { opacity: .6; cursor: default; }

/* --- Lecteur ---------------------------------------------------------- */

.lecteur {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--bord);
  box-shadow: 0 -4px 24px rgba(38, 40, 45, .07);
  padding: 12px var(--gouttiere) calc(12px + env(safe-area-inset-bottom));
  z-index: 40;
}
.lecteur[hidden] { display: none; }
.lecteur-inner { max-width: var(--max); margin: 0 auto; }
.lecteur-haut { display: flex; align-items: center; gap: 14px; }
.lecteur-titre { flex: 1; min-width: 0; }
.lecteur-titre .t {
  font-weight: 600; color: var(--encre);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lecteur-titre .s { font-size: .8rem; color: var(--sourdine); }
.lecteur-cmd { display: flex; align-items: center; gap: 6px; }

.bouton-rond {
  width: 44px; height: 44px;
  border-radius: 50%; border: 0;
  background: var(--fond-doux);
  color: var(--encre);
  display: grid; place-items: center; cursor: pointer;
}
.bouton-rond:hover { background: var(--bleu-voile); color: var(--bleu-texte); }
.bouton-rond--principal {
  width: 52px; height: 52px;
  background: var(--bleu-texte); color: #fff;
}
.bouton-rond--principal:hover { background: var(--bleu-fonce); color: #fff; }
.bouton-rond[aria-pressed="true"] { color: var(--bleu-texte); background: var(--bleu-voile); }

.progression {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px;
  font-size: .75rem; color: var(--sourdine);
  font-variant-numeric: tabular-nums;
}
.progression input[type=range] { flex: 1; accent-color: var(--or-vif); height: 22px; }

/* --- Bandeau d'installation ------------------------------------------ */

.bandeau-install {
  border-radius: var(--rayon-l);
  padding: 18px;
  margin-bottom: 20px;
  background: var(--or-voile);
  border: 1px solid #f0dfae;
  display: flex; gap: 14px; align-items: flex-start;
}
.bandeau-install .texte { flex: 1; }
.bandeau-install h3 { margin: 0 0 4px; color: var(--or-texte); }
.bandeau-install p { margin: 0 0 12px; font-size: .9rem; color: var(--texte); }
.bandeau-install .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bandeau-install .anneau { box-shadow: none; }

/* --- Tutoriel --------------------------------------------------------- */

.etape { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--bord); }
.etape:last-child { border-bottom: 0; }
.etape-num {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bleu-voile); color: var(--bleu-texte);
  display: grid; place-items: center;
  font-size: .85rem; font-weight: 600; flex: none;
}
.etape-corps { flex: 1; }
.etape-corps strong { display: block; margin-bottom: 2px; color: var(--encre); }
.etape-corps span { font-size: .88rem; color: var(--sourdine); }

.onglets {
  display: flex; gap: 4px; margin-bottom: 18px;
  background: var(--fond-doux); padding: 4px; border-radius: 999px;
}
.onglets button {
  flex: 1; border: 0; background: none;
  color: var(--sourdine); font: inherit; font-size: .88rem;
  padding: 9px 8px; border-radius: 999px; cursor: pointer; min-height: 42px;
}
.onglets button[aria-selected="true"] {
  background: #fff; color: var(--encre); font-weight: 600; box-shadow: var(--ombre);
}

/* --- Téléchargements -------------------------------------------------- */

.jauge {
  height: 6px; border-radius: 999px;
  background: var(--fond-doux); overflow: hidden; margin: 10px 0 6px;
}
.jauge span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--bleu), var(--or-vif));
  transition: width .3s ease;
}

/* --- Divers ----------------------------------------------------------- */

.vide { text-align: center; padding: 40px 20px; color: var(--sourdine); }
.vide .anneau { margin: 0 auto 20px; }

.section { margin-bottom: 30px; }
.section-titre { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.section-titre .compte { font-size: .82rem; color: var(--sourdine); }

.pied {
  margin-top: 36px; padding-top: 20px;
  border-top: 1px solid var(--bord);
  font-size: .84rem; color: var(--sourdine);
  display: flex; flex-wrap: wrap; gap: 14px;
}
.pied button {
  background: none; border: 0; color: var(--bleu-texte);
  font: inherit; font-size: .84rem; cursor: pointer; padding: 0;
}
.pied button:hover { text-decoration: underline; }

.liste-def { margin: 0; }
.liste-def dt { font-size: .8rem; color: var(--sourdine); margin-top: 12px; }
.liste-def dd { margin: 2px 0 0; color: var(--encre); }

.rangee {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--bord);
}
.rangee:last-child { border-bottom: 0; }
.rangee .principal { flex: 1; min-width: 0; color: var(--encre); }
.rangee .secondaire { font-size: .82rem; color: var(--sourdine); }

.paroles { white-space: pre-wrap; line-height: 2; font-size: 1.02rem; max-width: 46ch; }

.svg-i { width: 22px; height: 22px; fill: none; stroke: currentColor;
         stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.svg-i--plein { fill: currentColor; stroke: none; }

/* --- Bandeau d'aperçu -------------------------------------------------- */

.bandeau-apercu {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: repeating-linear-gradient(-45deg,
    rgba(200, 144, 26, .13) 0 12px, rgba(200, 144, 26, .05) 12px 24px);
  border: 1px solid var(--or);
  border-radius: var(--rayon);
  padding: 12px 16px; margin: 14px 0 4px;
  font-size: .88rem;
}
.bandeau-apercu strong { color: var(--or-texte); }
.bandeau-apercu > div { flex: 1; min-width: 200px; }
.bandeau-apercu > div > div { color: var(--texte); margin-top: 2px; }
.bandeau-apercu .btn { min-height: 40px; padding: 8px 16px; }

/* --- Lecteur vidéo ----------------------------------------------------- */
/* Fond noir, seule exception à la palette : une captation de deux heures
   se regarde, et l'interface doit disparaître. */

.video-scene {
  position: fixed; inset: 0; z-index: 60;
  background: #000;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.video-scene[hidden] { display: none; }
.video-barre {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; color: #fff; flex: none;
}
.video-barre .bouton-rond { background: rgba(255,255,255,.14); color: #fff; }
.video-barre .bouton-rond:hover { background: rgba(255,255,255,.24); color: #fff; }
.video-titre {
  font-size: .95rem; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.video-scene video { flex: 1; width: 100%; min-height: 0; background: #000; object-fit: contain; }
.video-pied {
  flex: none; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  color: rgba(255,255,255,.65); font-size: .82rem;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; min-height: 42px;
}
.video-pied button {
  background: none; border: 0; color: #7fd0f5;
  font: inherit; font-size: .82rem; cursor: pointer;
  padding: 6px 10px; border-radius: 8px;
}
.video-pied button:hover { background: rgba(255,255,255,.12); }

/* --- Réseaux sociaux ---------------------------------------------------- */

.reseaux { display: flex; justify-content: center; gap: 4px; padding: 4px 20px 0; flex-wrap: wrap; }
.reseaux a {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  color: var(--gris-doux); border-radius: 50%;
  transition: color .15s ease, background .15s ease;
}
.reseaux a:hover { color: var(--bleu); background: var(--bleu-voile); }
.reseaux svg { width: 20px; height: 20px; fill: currentColor; }
/* Certaines marques se dessinent au trait, d'autres en aplat. La règle
   doit être en CSS et non en attribut : une déclaration de feuille de
   style l'emporte toujours sur un attribut de présentation. */
.reseaux svg.trait {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Crédit -------------------------------------------------------------- */

.credit {
  text-align: center;
  padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
  font-size: .72rem; letter-spacing: .01em;
}
.credit a { color: var(--gris-doux); text-decoration: none; }
.credit a:hover { color: var(--bleu-texte); text-decoration: underline; }

/* Le lecteur est fixé en bas et recouvrirait le crédit. On ne réserve la
   place que lorsqu'il est effectivement affiché. */
body.avec-lecteur .credit { margin-bottom: 118px; }

/* --- Écrans d'accueil et d'identification ----------------------------- */
/* Sur ces écrans, la marque passe devant : c'est la première chose que
   voit quelqu'un qui arrive avec un CD en main et ne sait pas encore où
   il est tombé. */

.entete--centre {
  justify-content: center;
  padding: 26px 0 22px;
}
.logo-ede--grand { height: 46px; }

.accueil { text-align: center; padding: 34px 0 30px; }
.accueil .logo-accueil {
  height: 62px; width: auto;
  margin: 0 auto 26px;
  display: block;
}
.accueil h1 { margin-bottom: .6em; }
.accueil p { margin-left: auto; margin-right: auto; }

@media (max-width: 380px) {
  .accueil .logo-accueil { height: 50px; }
  .logo-ede--grand { height: 38px; }
}

/* --- Variante d'un média ----------------------------------------------- */
/* Deux distributions donnent deux captations du même spectacle, souvent
   sous le même titre. Le sous-titre est alors la seule chose qui les
   distingue : il ne peut pas rester invisible. */

.piste-variante {
  font-size: .84rem;
  color: var(--bleu-texte);
  font-weight: 500;
  margin-top: 1px;
}
.section-note {
  font-size: .86rem;
  color: var(--sourdine);
  margin: -4px 0 10px;
}

/* Repli quand un spectacle n'a ni bannière ni logotype : le pictogramme
   de l'association, discret, plutôt qu'un cercle vide qui ne dit rien. */
.visuel-repli {
  height: 46%;
  width: auto;
  margin: auto;
  opacity: .5;
}
