/* QasbaGuard — lecture audio d'un article du Magazine (charge seulement dans un article qui a un fichier audio).
   Couleurs de la citadelle (variables de site.css) : or et sable sur fond de nuit. Proprietes logiques : marche
   aussi de droite a gauche (arabe). Le lecteur reste cache (attribut hidden) tant que le script n'a pas lu le minutage. */
.lec { margin: -8px 0 28px; }
.lec-boite { position: relative; display: grid; gap: 10px; padding: 14px 16px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--night-2); min-width: 0; }
.lec-ligne { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lec-jouer { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border: 0; border-radius: 50%; background: var(--gold); color: #1d1405; cursor: pointer; transition: transform .15s ease, background .15s ease; }
.lec-jouer:hover { background: #f2c868; }
.lec-jouer:active { transform: scale(.96); }
.lec-jouer svg { width: 26px; height: 26px; }
.lec-i-pause, .lec-en-cours .lec-i-jouer { display: none; }
.lec-en-cours .lec-i-pause { display: block; }
.lec-info { flex: 1; min-width: 0; overflow: hidden; }
.lec-titre { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; color: var(--sand); line-height: 1.3; }
.lec-titre svg { flex: none; width: 18px; height: 18px; color: var(--gold); }
.lec-titre span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lec-temps { margin-top: 2px; font: 400 .84rem/1.3 var(--f-mono); color: var(--sand-2); white-space: nowrap; }
.lec-cmd { flex: none; display: flex; align-items: center; gap: 6px; }
.lec-saut, .lec-vitesse { display: inline-flex; align-items: center; justify-content: center; gap: 1px; height: 40px; min-width: 40px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--sand); font: 600 .8rem/1 var(--f-body); cursor: pointer; }
.lec-saut svg { width: 17px; height: 17px; }
.lec-saut:hover, .lec-vitesse:hover { border-color: var(--gold); color: var(--gold); }
.lec-vitesse { min-width: 52px; }
/* Barre de progression et reperes des chapitres (un par intertitre) */
.lec-progres { position: relative; display: flex; align-items: center; height: 26px; cursor: pointer; touch-action: none; border-radius: 6px; }
.lec-piste { position: absolute; inset-inline: 0; height: 6px; overflow: hidden; border-radius: 3px; background: var(--night-3); }
.lec-rempli { width: 0; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--ochre-2), var(--gold)); }
[dir="rtl"] .lec-rempli { background: linear-gradient(270deg, var(--ochre-2), var(--gold)); }
.lec-chapitres { position: absolute; inset: 0; pointer-events: none; }
.lec-chap { position: absolute; top: 0; bottom: 0; width: 24px; margin-inline-start: -12px; padding: 0; border: 0; background: transparent; cursor: pointer; pointer-events: auto; }
.lec-chap::before { content: ""; position: absolute; top: 6px; bottom: 6px; left: 50%; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--sand); opacity: .7; }
.lec-chap:hover::before, .lec-chap:focus-visible::before { background: var(--gold); opacity: 1; top: 3px; bottom: 3px; }
.lec-bas { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; min-width: 0; }
.lec-lien { padding: 4px 0; border: 0; background: none; color: var(--gold); font: 600 .9rem/1.3 var(--f-body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.lec-lien:hover { color: var(--sand); }
.lec-ia { margin-inline-start: auto; font-size: .78rem; line-height: 1.3; color: var(--mute); }
.lec-suivre { justify-self: start; padding: 8px 14px; border: 1px solid var(--gold); border-radius: 999px; background: var(--night); color: var(--gold); font: 600 .88rem/1.2 var(--f-body); cursor: pointer; }
.lec-suivre:hover { background: var(--gold); color: #1d1405; }

/* Lecteur colle en bas de l'ecran pendant la lecture */
.lec-colle .lec-boite { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; max-width: 820px; margin: 0 auto; gap: 6px;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  border-bottom: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, .45); }
.lec-colle .lec-jouer { width: 46px; height: 46px; }
.lec-colle .lec-bas [data-lec-seule], .lec-colle .lec-bas [data-lec-reprendre] { display: none; }
.lec-colle .lec-ia { font-size: .72rem; }
.lec-colle .lec-suivre { position: absolute; bottom: calc(100% + 10px); inset-inline-end: 16px; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
body.lec-docke { padding-bottom: calc(var(--lec-h, 130px) + 20px); }
/* Barre du choix de langue (premiere visite) et messages : au-dessus du lecteur colle, jamais dessous */
body.lec-docke .langbar { bottom: calc(var(--lec-h, 130px) + 10px); }
body.lec-docke .toast { bottom: calc(var(--lec-h, 130px) + 16px); }

/* Texte : phrase et mot en cours (or doux), phrases cliquables */
.lec-pret .lp { border-radius: 4px; -webkit-box-decoration-break: clone; box-decoration-break: clone; transition: background-color .15s ease, color .15s ease; }
/* Indice au survol seulement une fois l'ecoute lancee : pendant une lecture silencieuse, le texte ne clignote pas sous la souris */
@media (hover: hover) { .lec-actif .lp:hover { background: rgba(232, 184, 77, .07); cursor: pointer; } }
.lp.lec-ph-on { background: rgba(232, 184, 77, .13); color: var(--sand); }
.lp.lec-ph-on:hover { background: rgba(232, 184, 77, .13); }
.lm { border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.lm.lec-m-on { background: rgba(232, 184, 77, .4); color: var(--sand); box-shadow: 0 0 0 1px rgba(232, 184, 77, .4); }
.prose .lp.lec-ph-on strong { color: #fff4dc; }

/* Mode « ecoute seule » : le titre, le lecteur et l'image d'ouverture ; le texte est replie */
.lec-seule .mag-tete .lead, .lec-seule .mag-corps > :not(.mag-vis-ouverture) { display: none; }
.lec-seule .mag-tete { border-bottom: 0; margin-bottom: 18px; padding-bottom: 10px; }
.lec-seule .lec { margin-bottom: 22px; }

@media (max-width: 480px) {
  .lec-boite { padding: 12px 12px 8px; }
  .lec-ligne { gap: 8px; }
  .lec-jouer, .lec-colle .lec-jouer { width: 46px; height: 46px; }
  .lec-cmd { gap: 4px; }
  .lec-saut, .lec-vitesse { height: 38px; min-width: 38px; padding: 0 5px; font-size: .76rem; }
  .lec-vitesse { min-width: 44px; }
  .lec-temps { font-size: .76rem; }
  .lec-titre { font-size: .92rem; gap: 6px; }
  .lec-titre span { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; line-height: 1.25; }
  .lec-titre svg { width: 16px; height: 16px; }
  .lec-colle .lec-boite { padding-left: max(10px, env(safe-area-inset-left, 0px)); padding-right: max(10px, env(safe-area-inset-right, 0px)); }
}
@media (prefers-reduced-motion: reduce) { .lec-pret .lp, .lec-jouer { transition: none; } }
@media print { .lec { display: none !important; } body.lec-docke { padding-bottom: 0; } }

/* Invitation a l'ecoute dans l'en-tete de l'article : visible des l'ouverture, meme sur telephone (demande d'Ilias du 23/11/2026).
   Pastille de nuit bordee d'or, rond dore « lecture » qui pulse trois fois (jamais si l'appareil demande moins d'animations),
   casque et duree. Un toucher lance la lecture ; le lecteur se colle alors en bas de l'ecran. */
.lec-invite { display: inline-flex; align-items: center; gap: 12px; width: fit-content; max-width: 100%; align-self: flex-start; justify-self: start; margin: 6px 0 18px; padding: 6px; padding-inline-end: 18px;
  border: 1px solid rgba(232, 184, 77, .55); border-radius: 999px; background: linear-gradient(135deg, rgba(232, 184, 77, .18), rgba(232, 184, 77, .05));
  color: var(--sand); font: 600 1rem/1.2 var(--f-body); text-align: start; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.lec-invite[hidden] { display: none; }
.lec-invite:hover, .lec-invite:focus-visible { border-color: var(--gold); background: linear-gradient(135deg, rgba(232, 184, 77, .3), rgba(232, 184, 77, .08)); }
.lec-invite:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.lec-invite-rond { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--gold); color: #1d1405;
  animation: lec-pouls 2.4s ease-out .8s 3; }
.lec-invite-rond svg { width: 20px; height: 20px; }
.lec-invite .lec-i-pause, .lec-invite.lec-en-cours .lec-i-jouer { display: none; }
.lec-invite.lec-en-cours .lec-i-pause { display: block; }
.lec-invite.lec-en-cours .lec-invite-rond { animation: none; }
.lec-invite-txt { min-width: 0; }
.lec-invite-duree { flex: none; display: inline-flex; align-items: center; gap: 6px; padding-inline-start: 12px; border-inline-start: 1px solid rgba(232, 184, 77, .35);
  font: 400 .88rem/1 var(--f-mono); color: var(--sand-2); }
.lec-invite-duree svg { width: 16px; height: 16px; color: var(--gold); }
@keyframes lec-pouls { 0% { box-shadow: 0 0 0 0 rgba(232, 184, 77, .55); } 70% { box-shadow: 0 0 0 12px rgba(232, 184, 77, 0); } 100% { box-shadow: 0 0 0 0 rgba(232, 184, 77, 0); } }
@media (prefers-reduced-motion: reduce) { .lec-invite-rond { animation: none; } }
@media print { .lec-invite { display: none !important; } }
