/* COUCHE CSS « outil » — tout le CSS livré par l'outil (moteur, Takoprez, éditeur) vit dans UNE
   couche, dans l'ordre de chargement : entre ses feuilles, la cascade est celle d'avant les couches
   (spécificité, puis ordre). Une feuille HORS couche — une charte, un ajout d'auteur ou de client —
   l'emporte donc toujours sur l'outil, sans course à la spécificité ni !important. Preuve :
   tools/audit-styles.js (styles calculés identiques). Voir docs/GUIDE.md, « Couches CSS ». */
@layer outil {

/* `hidden` est TOUJOURS respecté (21/09) : des règles « display: flex » l'écrasaient — les boutons
   Audio et Sous-titres restaient affichés sur les pages sans son, et le menu fermé, seulement
   poussé hors de l'écran, restait atteignable au clavier. */
[hidden] { display: none !important; }

/* ============================================================
   core/player.css — Coquille du player, thème « Aurora »
   ------------------------------------------------------------
   Fond indigo nuit + aurores en dérive lente + grain.
   Display : Unbounded · Corps : Space Grotesk (repli system-ui).
   Identité : gradient violet → corail → solaire.
   ============================================================ */

:root {
  --fond: #0d0a1f;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-bord: rgba(255, 255, 255, 0.1);
  --violet: #7c5cff;
  --corail: #ff5c8a;
  --solaire: #ffc24b;
  --menthe: #4be0c3;
  --texte: #f2efff;
  --attenue: #9a93c4;
  /* Le dégradé dérive de l'accent du module : sans cela, un module à l'accent
     bleu affichait ses boutons dans les couleurs du thème par défaut. */
  --gradient: linear-gradient(100deg, var(--violet), var(--violet) 55%, var(--violet));   /* REPLI sans color-mix */
  --gradient: linear-gradient(100deg, var(--violet), color-mix(in srgb, var(--violet) 70%, #fff) 55%, color-mix(in srgb, var(--violet) 85%, #000));
  --police-titre: "Aptos", "Segoe UI", system-ui, -apple-system, sans-serif;
  --police-corps: "Aptos", "Segoe UI", system-ui, -apple-system, sans-serif;
  --rayon: 16px;
  --hauteur-entete: 60px;
  --hauteur-barre: 68px;
  /* Alias conservés pour les contenus existants */
  --pl-encre: var(--texte);
  --pl-accent: var(--violet);
  --pl-papier: var(--fond);
  --pl-alerte: var(--corail);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--police-corps);
  color: var(--texte);
  background: var(--fond);
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; }

::selection { background: var(--violet); color: #fff; }

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

/* ================= Fond : aurores + grain ================= */
.pl-aurore {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.pl-aurore span {
  position: absolute;
  width: 55vmax;
  height: 55vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  animation: derive 26s ease-in-out infinite alternate;
}

.pl-aurore span:nth-child(1) { background: var(--violet);  top: -20%; left: -12%; }
.pl-aurore span:nth-child(2) { background: var(--corail);  bottom: -28%; right: -14%; animation-duration: 32s; animation-delay: -8s; }
.pl-aurore span:nth-child(3) { background: var(--menthe);  top: 30%; left: 55%; width: 34vmax; height: 34vmax; opacity: 0.18; animation-duration: 22s; animation-delay: -15s; }

@keyframes derive {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(9vw, -7vh) scale(1.15); }
}

/* Grain subtil par-dessus les aurores */
.pl-grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* Tout le reste de l'interface au-dessus du fond */
.pl-entete, .pl-scene, .pl-sous-titres, .pl-barre { position: relative; z-index: 2; }
/* L'en-tête (et son rail déroulant) passe au-dessus de la scène */
.pl-entete { z-index: 10; }

/* ================= En-tête ================= */
.pl-entete {
  flex: 0 0 var(--hauteur-entete);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: var(--chrome-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--surface-bord);
}

.pl-titres {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.pl-titre-module {
  font-family: var(--police-titre);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--texte); /* repli si background-clip non supporté */
}

.pl-titre-chapitre {
  font-size: 12px;
  color: var(--attenue);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Rail de progression : boutons cliquables + infobulle au survol */
.pl-rail {
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  display: flex;
  gap: 5px;
  padding: 0 5px;
  height: 5px;
  z-index: 20;
}

.pl-rail-segment {
  position: relative;
  flex: 1;
  height: 5px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  /* Zone de survol agrandie vers le bas sans décaler la barre visible */
  margin-bottom: -14px;
  padding-bottom: 14px;
}

.pl-rail-segment[disabled] { cursor: not-allowed; }

/* La barre visible : une piste fine qui contient la jauge */
.pl-rail-piste {
  display: block;
  position: relative;
  height: 5px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 3px;
  overflow: hidden;
  transition: height 0.15s ease, background 0.2s;
}

.pl-rail-jauge {
  position: absolute;
  inset: 0;
  background: var(--gradient);
  background-size: 300% 100%;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s cubic-bezier(0.6, 0, 0.2, 1);
  animation: coule 5s linear infinite;
}

.pl-rail-segment.est-fait .pl-rail-jauge { transform: scaleX(1); }

.pl-rail-segment.est-courant .pl-rail-piste {
  background: rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 5px var(--violet);   /* REPLI sans color-mix */
  box-shadow: 0 0 5px color-mix(in srgb, var(--violet) 35%, transparent);
}

/* La vue courante a une jauge partielle animée pour se distinguer */
.pl-rail-segment.est-courant:not(.est-fait) .pl-rail-jauge {
  transform: scaleX(0.5);
  opacity: 0.7;
}

/* Feedback de survol : la barre s'épaissit légèrement */
.pl-rail-segment:hover:not([disabled]) .pl-rail-piste { height: 8px; }
.pl-rail-segment.est-verrouillee .pl-rail-piste { opacity: 0.5; }

/* ---------------- Infobulle (toute la carte est cliquable) ----------------
   L'enveloppe .pl-rail-infobulle sert de zone de positionnement ET de « pont »
   cliquable : elle touche le bas du bouton (top:100%) et son padding-top
   transparent comble l'espace visuel sans créer de zone morte au survol.
   La carte visible (.pl-rail-carte) est à l'intérieur. */
.pl-rail-infobulle {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  padding-top: 8px;                 /* pont transparent, cliquable */
  /* largeur du contenu, BORNÉE : « min-width: max-content » l'emportait sur max-width — un nom de page
     long élargissait l'infobulle (invisible, mais mise en page) au-delà de l'écran, et la page
     glissait de côté sur téléphone (94 px à 360 px, mesuré sur un module tiers, 28/09) */
  width: max-content;
  max-width: 260px;
  opacity: 0;
  pointer-events: none;             /* inerte au repos : ne bloque pas la page */
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.3, 1.2, 0.4, 1);
  z-index: 25;
}

.pl-rail-carte {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  background: var(--infobulle-bg);
  border: 1px solid var(--surface-bord);
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* Petite flèche vers la barre */
.pl-rail-carte::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: var(--infobulle-bg);
}

/* Ancrage aux extrémités pour ne pas déborder du viewport */
.pl-rail-segment--debut .pl-rail-infobulle { left: 0; transform: translateX(0) translateY(-6px); }
.pl-rail-segment--debut .pl-rail-carte::before { left: 20px; }
.pl-rail-segment--fin .pl-rail-infobulle { left: auto; right: 0; transform: translateX(0) translateY(-6px); }
.pl-rail-segment--fin .pl-rail-carte::before { left: auto; right: 20px; transform: none; }

/* Au survol / focus : la carte apparaît ET devient cliquable */
.pl-rail-segment:hover .pl-rail-infobulle,
.pl-rail-segment:focus-visible .pl-rail-infobulle {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.pl-rail-segment--debut:hover .pl-rail-infobulle,
.pl-rail-segment--debut:focus-visible .pl-rail-infobulle,
.pl-rail-segment--fin:hover .pl-rail-infobulle,
.pl-rail-segment--fin:focus-visible .pl-rail-infobulle {
  transform: translateX(0) translateY(0);
}

/* La carte affiche le curseur main (et interdit sur segment verrouillé) */
.pl-rail-infobulle { cursor: pointer; }
.pl-rail-segment.est-verrouillee .pl-rail-infobulle { cursor: not-allowed; }

.pl-rail-num {
  font-family: var(--police-titre, inherit);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  color: var(--violet);
}

.pl-rail-textes { display: flex; flex-direction: column; gap: 2px; text-align: left; }

.pl-rail-chapitre {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--attenue);
}

.pl-rail-page {
  font-size: 13px;
  font-weight: 600;
  color: var(--texte);
  line-height: 1.25;
}

.pl-rail-cadenas { display: none; font-size: 12px; }
.pl-rail-segment.est-verrouillee .pl-rail-cadenas { display: inline; }

@keyframes coule {
  from { background-position: 0% 0; }
  to   { background-position: 300% 0; }
}

/* Sur petits écrans tactiles, l'infobulle reste utile au tap (focus) */
@media (max-width: 560px) {
  .pl-rail-infobulle { max-width: 200px; }
  .pl-rail-page { font-size: 12px; }
}

/* ================= Boutons icône ================= */
.pl-btn-icone {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--surface-bord);
  border-radius: 12px;
  background: var(--surface);
  color: var(--texte);
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
}

.pl-btn-icone:hover {
  border-color: var(--violet);
  background: var(--violet);   /* REPLI si color-mix absent */
  background: var(--violet);   /* REPLI sans color-mix */
  background: color-mix(in srgb, var(--violet) 16%, transparent);
}

.pl-btn-cc {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  width: 38px;
  height: 30px;
}

.pl-btn-cc.est-inactif { opacity: 0.35; }

/* ================= Menu (sommaire) ================= */
.pl-voile {
  position: fixed;
  inset: 0;
  background: var(--voile-bg);
  backdrop-filter: blur(3px);
  z-index: 30;
}

.pl-menu {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: min(360px, 90vw);
  background: var(--menu-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--surface-bord);
  color: var(--texte);
  z-index: 31;
  transform: translateX(-102%);
  transition: transform 0.35s cubic-bezier(0.7, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.pl-menu.est-ouvert { transform: translateX(0); }

.pl-menu-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 16px 22px;
  font-family: var(--police-titre);
  font-weight: 700;
  font-size: 14px;
  border-bottom: 1px solid var(--surface-bord);
}

.pl-menu-liste {
  list-style: none;
  margin: 0;
  padding: 12px 0 24px;
  overflow-y: auto;
  counter-reset: chapitre;
}

.pl-menu-chapitre { counter-increment: chapitre; }

.pl-menu-chapitre-titre {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 18px 22px 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--attenue);
}

/* Gros numéro de chapitre en contour gradient */
.pl-menu-chapitre-titre::before {
  content: "0" counter(chapitre);
  font-family: var(--police-titre);
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.9;
}

.pl-menu-pages { list-style: none; margin: 0; padding: 0; }

/* Entrée en cascade des items quand le menu s'ouvre */
.pl-menu.est-ouvert .pl-menu-page {
  animation: menu-item 0.4s cubic-bezier(0.3, 1.2, 0.4, 1) both;
  animation-delay: calc(var(--i, 0) * 40ms + 80ms);
}

@keyframes menu-item {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: none; }
}

.pl-menu-page {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 22px;
  border: none;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  transition: background 0.15s, padding-left 0.2s;
}

.pl-menu-page:hover:not(:disabled) {
  background: color-mix(in srgb, var(--violet) 14%, transparent);
  padding-left: 28px;
}

.pl-menu-page.est-courante {
  background: linear-gradient(90deg, color-mix(in srgb, var(--violet) 30%, transparent), transparent);
}

.pl-menu-page.est-visitee .pl-menu-etat { color: var(--menthe); }
.pl-menu-page:disabled { opacity: 0.35; cursor: not-allowed; }

.pl-menu-etat {
  flex: 0 0 18px;
  font-size: 13px;
  text-align: center;
}

/* ================= Scène ================= */
.pl-scene {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  outline: none;
}

.pl-scene[data-mode="defilement"] .page + .page {
  border-top: 1px solid var(--surface-bord);
}

/* ================= Sous-titres ================= */
.pl-sous-titres {
  flex: 0 0 auto;
  padding: 12px 22px;
  background: var(--chrome-bg);
  backdrop-filter: blur(12px);
  text-align: center;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.5;
  white-space: pre-line;
  border-top: 2px solid transparent;
  border-image: var(--gradient) 1;
  text-shadow: 0 0 24px color-mix(in srgb, var(--violet) 60%, transparent);
}

/* Chaque réplique glisse depuis le bas */
.pl-sous-titres span {
  display: inline-block;
  animation: replique 0.35s cubic-bezier(0.2, 1, 0.3, 1);
}

@keyframes replique {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ================= Barre de navigation ================= */
.pl-barre {
  flex: 0 0 var(--hauteur-barre);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  background: var(--chrome-bg);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--surface-bord);
}

.pl-zone-audio {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 96px;
}

/* Égaliseur animé pendant la lecture de la voix off */
.pl-eq {
  display: none;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
}

.pl-btn-icone.est-en-lecture ~ .pl-eq,
.pl-zone-audio.est-en-lecture .pl-eq { display: inline-flex; }

.pl-eq i {
  width: 4px;
  border-radius: 2px;
  background: var(--gradient);
  animation: eq 0.9s ease-in-out infinite alternate;
}

.pl-eq i:nth-child(1) { height: 40%; animation-delay: 0s; }
.pl-eq i:nth-child(2) { height: 100%; animation-delay: 0.15s; }
.pl-eq i:nth-child(3) { height: 65%; animation-delay: 0.3s; }
.pl-eq i:nth-child(4) { height: 85%; animation-delay: 0.45s; }

@keyframes eq {
  from { transform: scaleY(0.3); }
  to   { transform: scaleY(1); }
}

.pl-pagination {
  font-size: 13px;
  font-weight: 700;
  color: var(--attenue);
  font-variant-numeric: tabular-nums;
  padding: 6px 14px;
  border: 1px solid var(--surface-bord);
  border-radius: 999px;
  background: var(--surface);
}

.pl-zone-nav { display: flex; gap: 10px; }

.pl-btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1.5px solid var(--violet);
  border-radius: 999px;
  background: var(--violet);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.pl-btn-nav:hover:not(:disabled) { background: #fff; color: #111; border-color: var(--violet); }

.pl-btn-nav--principal {
  background: var(--violet);
  border: 1.5px solid var(--violet);
  color: #fff;
}

.pl-btn-nav--principal:hover:not(:disabled) { background: #fff; color: #111; border-color: var(--violet); box-shadow: none; }

.pl-btn-nav:disabled { opacity: 0.35; cursor: not-allowed; }

/* Bandeaux de navigation masqués : en-tête et barre transparents, boutons conservés */
body.pl-nav--sans-bandeau .pl-entete,
body.pl-nav--sans-bandeau .pl-barre {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
}

/* ===== Bandeaux SUPERPOSÉS (flous ou masqués) — 21/09 =====
   Masquer ne retirait que le fond : les barres gardaient leur hauteur et le contenu restait
   coincé entre elles. Ici, la scène occupe toute la hauteur et les barres sont des calques. */
body.pl-nav--superpose .pl-entete, body.pl-nav--superpose .pl-barre { position: fixed; left: 0; right: 0; z-index: 20; }
body.pl-nav--superpose .pl-entete { top: 0; height: var(--hauteur-entete); }
body.pl-nav--superpose .pl-barre { bottom: 0; height: var(--hauteur-barre); }
/* le contenu ne se cache pas dessous… */
body.pl-nav--superpose .pl-scene > .page:first-of-type { padding-top: calc(var(--page-pad-haut, 56px) + var(--hauteur-entete)); }
body.pl-nav--superpose .pl-scene > .page:last-of-type { padding-bottom: calc(88px + var(--hauteur-barre)); }
/* …sauf une section pleine largeur en tête de page, qui remonte jusqu'en haut de l'écran */
body.pl-nav--superpose .pl-scene > .page:first-of-type > .page-section--pleine.page-section--en-tete { margin-top: calc(-1 * (var(--page-pad-haut, 56px) + var(--hauteur-entete))); }
/* Flous : verre dépoli */
body.pl-nav--flou .pl-entete, body.pl-nav--flou .pl-barre {
  background: color-mix(in srgb, var(--fond) 55%, transparent);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-color: color-mix(in srgb, var(--texte) 10%, transparent);
}
/* Masqués : plus de bandeau — seuls les boutons (déjà en pastilles) flottent ; les libellés
   (titre du module, chapitre), illisibles sur une image, disparaissent. */
body.pl-nav--sans-bandeau .pl-entete .pl-titres, body.pl-nav--sans-bandeau .pl-entete .pl-titre-module,
body.pl-nav--sans-bandeau .pl-entete [class*="titre"] { visibility: hidden; }
body.pl-nav--sans-bandeau .pl-entete, body.pl-nav--sans-bandeau .pl-barre { pointer-events: none; }
body.pl-nav--sans-bandeau .pl-entete > *, body.pl-nav--sans-bandeau .pl-barre > * { pointer-events: auto; }

/* Une page avec son propre fond masque le fond décoratif du player (aurore + grain)
   pour éviter que le rose/bleu décoratif transparaisse par-dessus. */
body:has(.page.a-fond) .pl-aurore,
body:has(.page.a-fond) .pl-grain { opacity: 0; }

/* ================= Responsive & accessibilité ================= */
@media (max-width: 560px) {
  .pl-btn-nav span { display: none; }
  .pl-btn-nav { padding: 11px 14px; }
  .pl-titre-chapitre { display: none; }
  .pl-aurore span { filter: blur(60px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .pl-scene { scroll-behavior: auto; }
}

/* ============================================================
   Réglages de navigation (position + style des boutons)
   ============================================================ */
/* Style « flèche seule » : on masque le libellé texte, on garde le SVG */
.pl-nav--fleche .pl-btn-nav span:not(svg) { display: none; }
.pl-nav--fleche .pl-btn-nav { padding: 11px 14px; }

/* Position « centrés verticalement » : boutons fixes sur les côtés */
.pl-nav--centre .pl-zone-nav { position: static; }
.pl-nav--centre #btnPrecedent,
.pl-nav--centre #btnSuivant {
  position: fixed; top: var(--scene-mid, 50%); transform: translateY(-50%); z-index: 40;
  box-shadow: 0 6px 22px rgba(0,0,0,.28);
  transition: background .18s, color .18s, border-color .18s;
}
.pl-nav--centre #btnPrecedent:hover:not(:disabled),
.pl-nav--centre #btnSuivant:hover:not(:disabled) { transform: translateY(-50%); }
.pl-nav--centre #btnPrecedent { left: 18px; }
.pl-nav--centre #btnSuivant { right: 18px; }
.pl-nav--centre.pl-nav--fleche #btnPrecedent,
.pl-nav--centre.pl-nav--fleche #btnSuivant { border-radius: 50%; width: 52px; height: 52px; justify-content: center; padding: 0; }

/* ── Progression masquée (réglage) : cache le rail de progression, garde la nav ── */
body.pl-sans-progression .pl-rail { display: none; }

/* ── Chrome masqué (réglage « site mono-page ») : plus d'en-tête, de nav ni de barre ── */
body.pl-sans-chrome .pl-entete,
body.pl-sans-chrome .pl-barre { display: none; }
body.pl-sans-chrome .pl-scene { padding-top: 0; }

/* ── UX-3 : le bouton « Suivant » bloqué par le verrou explique quoi faire ── */
body.pl-verrou-actif .pl-btn-nav--principal { position: relative; cursor: not-allowed; }
body.pl-verrou-actif .pl-btn-nav--principal::after {
  display: none;   /* doublon du motif (#motifVerrou), qui le dit déjà, dans la langue du module */
  content: "⌄ " attr(data-motif); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-size: 11px; font-weight: 600; color: #fff; background: var(--violet, #5b3fa0);
  padding: 4px 10px; border-radius: 14px; opacity: .95; pointer-events: none; animation: pl-hint-bob 1.6s ease-in-out infinite;
}
@keyframes pl-hint-bob { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(3px); } }
@media (prefers-reduced-motion: reduce) { body.pl-verrou-actif .pl-btn-nav--principal::after { animation: none; } }

/* UX-4 : focus visible sur les zones de scroll navigables au clavier */
.drag-rail:focus-visible { outline: 2px solid var(--violet, #5b3fa0); outline-offset: 3px; }

/* ============================================================================
   PRÉFÉRENCES D'AFFICHAGE
   Chaque règle est conditionnée à un attribut sur <html> : sans préférence
   active, AUCUNE de ces règles ne s'applique et le module rend exactement
   comme avant. C'est ce qui permet d'ajouter ces réglages sans risque pour
   l'apparence existante.
   ========================================================================== */

/* -- Le bouton et son panneau ---------------------------------------------- */
.pl-btn-prefs { opacity: .72; }
.pl-btn-prefs:hover, .pl-btn-prefs[aria-expanded="true"] { opacity: 1; }
.pl-prefs {
  position: absolute; right: 14px; bottom: calc(var(--hauteur-barre) + 8px);
  z-index: 40; width: 232px; padding: 14px 16px;
  border-radius: 14px; background: var(--surface, #1b1b20);
  border: 1px solid var(--surface-bord, rgba(255,255,255,.14));
  box-shadow: 0 12px 34px rgba(0,0,0,.34);
  font-size: 13px; color: var(--texte);
}
.pl-prefs-titre {
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  opacity: .58; margin-bottom: 11px; font-weight: 700;
}
.pl-pref { margin-bottom: 13px; }
.pl-pref-lib { display: block; margin-bottom: 6px; font-size: 12.5px; }
.pl-pref-choix { display: flex; gap: 5px; }
.pl-pref-choix button {
  flex: 1; font: inherit; font-size: 11.5px; padding: 7px 4px; cursor: pointer;
  border-radius: 8px; color: inherit;
  border: 1px solid var(--surface-bord, rgba(255,255,255,.18));
  background: transparent; min-height: 30px;
}
.pl-pref-choix button[aria-pressed="true"] {
  background: var(--violet); border-color: var(--violet); color: #fff; font-weight: 700;
}
.pl-pref-bascule {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  margin-bottom: 9px; min-height: 26px;
}
.pl-pref-bascule input { width: 24px; height: 24px; accent-color: var(--violet); flex: none; }
.pl-prefs-reset {
  width: 100%; margin-top: 4px; font: inherit; font-size: 11.5px; cursor: pointer;
  padding: 7px; border-radius: 8px; min-height: 30px;
  border: 1px solid var(--surface-bord, rgba(255,255,255,.18));
  background: transparent; color: inherit; opacity: .78;
}
.pl-prefs-reset:hover { opacity: 1; }
.pl-prefs button:focus-visible, .pl-prefs input:focus-visible {
  outline: 2px solid var(--violet); outline-offset: 2px;
}

/* -- Taille du texte -------------------------------------------------------
   On agit sur la taille de RÉFÉRENCE, pas sur chaque règle : toute la
   typographie suit proportionnellement, y compris les blocs, sans qu'aucune
   valeur ait été réécrite. Les tailles en px du projet sont converties par
   l'échelle ci-dessous plutôt que forcées une à une. */
html[data-pref-taille="1"] .page { font-size: 112%; }
html[data-pref-taille="2"] .page { font-size: 126%; }
html[data-pref-taille="1"] .page .bloc-texte,
html[data-pref-taille="1"] .page .bloc-texte--puces li { font-size: 1.12em; }
html[data-pref-taille="2"] .page .bloc-texte,
html[data-pref-taille="2"] .page .bloc-texte--puces li { font-size: 1.26em; }

/* -- Contraste renforcé ----------------------------------------------------
   On ne repeint pas le module : on renforce ce qui est faible — textes
   atténués, bordures ténues, voiles d'image — et on rend le focus franc.
   L'identité visuelle est conservée. */
html[data-pref-contraste] .page { --attenue: var(--texte); }
html[data-pref-contraste] .page .bloc-texte,
html[data-pref-contraste] .page p,
html[data-pref-contraste] .page li { opacity: 1; }
html[data-pref-contraste] .page [style*="opacity"] { opacity: 1 !important; }
html[data-pref-contraste] .page { --surface-bord: currentColor; }
html[data-pref-contraste] .page .page-section[data-effet] > .section-voile,
html[data-pref-contraste] .page .a-fond-image { --fond-voile-min: .22; }   /* voile plancher (l'image n'est plus un ::before) */
html[data-pref-contraste] *:focus-visible {
  outline: 3px solid var(--violet) !important; outline-offset: 2px !important;
}

/* -- Animations réduites ---------------------------------------------------
   Même effet que prefers-reduced-motion, mais déclenché par l'apprenant :
   tout le monde n'a pas réglé son système, et le besoin peut être ponctuel. */
html[data-pref-mouvement="reduit"] *,
html[data-pref-mouvement="reduit"] *::before,
html[data-pref-mouvement="reduit"] *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
  scroll-behavior: auto !important;
}
html[data-pref-mouvement="reduit"] .section-parallaxe { transform: none !important; }
html[data-pref-mouvement="reduit"] .page-section.est-epinglee { position: relative; }

/* -- Espacement du texte (WCAG 1.4.12) -------------------------------------
   Le critère demande que le contenu SUPPORTE cette surcharge sans perte.
   L'offrir comme préférence est un pas de plus : l'apprenant l'applique
   lui-même plutôt que d'avoir à installer une extension. */
html[data-pref-lisibilite] .page .bloc-texte,
html[data-pref-lisibilite] .page p,
html[data-pref-lisibilite] .page li {
  line-height: 1.85 !important;
  letter-spacing: .06em !important;
  word-spacing: .16em !important;
}
html[data-pref-lisibilite] .page p + p,
html[data-pref-lisibilite] .page .bloc-texte + .bloc-texte { margin-top: 1.6em !important; }
/* …et son CONTENU ne remonte pas sous la barre : la hauteur de l'en-tête s'ajoute à sa marge intérieure */
body.pl-nav--superpose .pl-scene > .page:first-of-type > .page-section--pleine.page-section--en-tete { padding-top: calc(var(--marge-haut, 0px) + var(--hauteur-entete)); }

/* ===== Popups (sections-popups) ===== */
.pl-popup { position: fixed; inset: 0; z-index: 80; display: grid; }
.pl-popup-voile { position: absolute; inset: 0; background: rgba(8, 12, 18, .5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: pl-pop-voile .2s ease-out; }   /* derrière : flouté et assombri (réglage d origine, 21/09) */
.pl-popup-panneau { position: relative; z-index: 1; background: var(--fond); color: var(--texte); box-shadow: 0 30px 80px -20px rgba(0,0,0,.55); overflow-y: auto; outline: none; }
.pl-popup-panneau:focus-visible { outline: 3px solid var(--violet); outline-offset: -3px; }
.pl-popup[data-style="fenetre"] { place-items: center; padding: 4vh 4vw; }
.pl-popup[data-style="fenetre"] .pl-popup-panneau { width: min(880px, 100%); max-height: 92vh; border-radius: 20px; animation: pl-pop-fenetre .24s cubic-bezier(.2, .8, .2, 1); }
.pl-popup[data-style="tiroir"] { justify-items: end; }
.pl-popup[data-style="tiroir"] .pl-popup-panneau { width: min(560px, 100%); height: 100%; border-radius: 20px 0 0 20px; animation: pl-pop-tiroir .28s cubic-bezier(.2, .8, .2, 1); }
.pl-popup-fermer { position: sticky; top: 10px; float: right; margin: 10px 10px 0 0; z-index: 3; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--surface-bord); background: color-mix(in srgb, var(--fond) 85%, transparent); color: var(--texte); font-size: 22px; line-height: 1; cursor: pointer; }
.pl-popup-fermer:hover { background: var(--violet); color: #fff; border-color: var(--violet); }
/* la SECTION remplit le panneau (son fond aussi) et porte la marge intérieure ; aucune règle
   « pleine largeur » de la page ne doit la faire déborder du panneau */
.pl-popup-corps.page { max-width: none; margin: 0; padding: 0; min-height: 100%; display: grid; }
.pl-popup-corps > .page-section { margin: 0 !important; width: auto !important; min-height: 100%;
  padding: max(32px, var(--marge-haut, 0px)) 28px max(32px, var(--marge-bas, 0px)) !important; }
.pl-popup-fermer { position: absolute; top: 12px; right: 12px; float: none; margin: 0; }
.pl-popup-panneau { display: flex; flex-direction: column; }
@keyframes pl-pop-voile { from { opacity: 0; } }
@keyframes pl-pop-fenetre { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes pl-pop-tiroir { from { transform: translateX(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pl-popup-voile, .pl-popup-panneau { animation: none !important; } }
@media (max-width: 640px) { .pl-popup[data-style="fenetre"] { padding: 0; align-items: end; } .pl-popup[data-style="fenetre"] .pl-popup-panneau { border-radius: 20px 20px 0 0; max-height: 90vh; } .pl-popup[data-style="tiroir"] .pl-popup-panneau { border-radius: 0; } }
.pl-popup-corps { flex: 1 0 auto; }   /* le corps (et la section qu'il étire) occupe toute la hauteur du tiroir */
.pl-popup-corps.page--grille { align-content: stretch; grid-template-columns: minmax(0, 1fr); }   /* la grille de page alignait en haut : la section ne pouvait pas remplir le tiroir */

/* ===== Jauge du module (en-tête ; grand format dans le bloc Score) ===== */
.pl-jauge { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; margin-inline: 8px; border-radius: 999px;
  border: 1px solid var(--surface-bord); background: color-mix(in srgb, var(--fond) 70%, transparent); color: var(--texte); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pl-jauge-ico { display: inline-flex; color: var(--violet); }
.pl-jauge-piste { position: relative; width: 72px; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--texte) 14%, transparent); overflow: hidden; }
.pl-jauge-niveau { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--violet); transition: width .7s cubic-bezier(.2, .8, .2, 1); }
.pl-jauge-anneau { width: 22px; height: 22px; transform: rotate(-90deg); }
.pl-jauge-anneau circle { fill: none; stroke-width: 4; }
.pl-jauge-fond { stroke: color-mix(in srgb, var(--texte) 14%, transparent); }
.pl-jauge-arc { stroke: var(--violet); stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray .7s cubic-bezier(.2, .8, .2, 1); }
.pl-jauge-val { font-variant-numeric: tabular-nums; min-width: 3.4em; text-align: right; }
.pl-jauge.monte .pl-jauge-val, .pl-jauge.monte .pl-jauge-ico { animation: pl-jauge-pulse .9s ease-out; }
.pl-jauge.baisse { animation: pl-jauge-secousse .45s ease-in-out; }
@keyframes pl-jauge-pulse { 30% { transform: scale(1.18); } }
@keyframes pl-jauge-secousse { 20%, 60% { transform: translateX(-3px); } 40%, 80% { transform: translateX(3px); } }
.pl-jauge--grand { height: auto; padding: 18px 22px; gap: 14px; font-size: 16px; border-radius: 16px; margin: 14px 0; }
.pl-jauge--grand { max-width: 100%; flex-wrap: wrap; box-sizing: border-box; }   /* zone étroite (bilan) : elle débordait */
.pl-jauge--grand .pl-jauge-piste { flex: 1 1 120px; width: auto; min-width: 80px; max-width: 320px; height: 10px; border-radius: 5px; }
.pl-jauge--grand .pl-jauge-anneau { width: 56px; height: 56px; }
.pl-jauge--grand .pl-jauge-val { font-size: 22px; }
.pl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 640px) { .pl-jauge:not(.pl-jauge--grand) .pl-jauge-lib { display: none; } .pl-jauge:not(.pl-jauge--grand) .pl-jauge-piste { width: 44px; } }
@media (prefers-reduced-motion: reduce) { .pl-jauge-niveau, .pl-jauge-arc { transition: none; } .pl-jauge.monte *, .pl-jauge.baisse { animation: none !important; } }
.pl-entete .pl-jauge { margin-left: auto; }   /* à droite, contre le bouton de thème */
.pl-entete .pl-jauge + .pl-btn-theme { margin-left: 0; }   /* le bouton de thème poussait aussi : l'espace se partageait et la jauge se retrouvait au milieu */

/* ===== Passage à la suite : motif du blocage, doublon retiré, interactions à faire (23/09) ===== */
.pl-motif-verrou { position: absolute; right: 16px; bottom: calc(100% + 6px); margin: 0; max-width: min(420px, 70vw);
  padding: 7px 12px; border-radius: 8px; background: var(--infobulle-bg, rgba(20,17,15,.92)); color: var(--texte, #fff); border: 1px solid var(--surface-bord, transparent);   /* texte du thème : en blanc, il disparaissait sur l'infobulle claire */
  font-size: 12.5px; line-height: 1.35; box-shadow: 0 10px 26px -12px rgba(0,0,0,.6); }
.pl-motif-verrou[hidden] { display: none; }
body.pl-nav-masquee #btnSuivant, body.pl-nav-masquee #btnPrecedent { display: none; }
.pl-a-faire { animation: pl-a-faire 2.2s ease-out 1; border-radius: 10px; }
@keyframes pl-a-faire { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 15%, 60% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--violet) 55%, transparent); } }
@media (prefers-reduced-motion: reduce) { .pl-a-faire { animation: none; outline: 3px solid var(--violet); outline-offset: 3px; } }

/* Une interaction à la fois : ce qui suit l'interaction en cours est masqué (mais toujours compté
   comme « à faire » — d'où une classe plutôt que l'attribut « hidden »). */
#scene .page-bloc.pl-a-venir { display: none; }
#scene .page-section:has(.page-bloc):not(:has(.page-bloc:not(.pl-a-venir))) { display: none; }   /* une bande dont tous les blocs attendent : sa couleur ne reste pas seule à l’écran */

/* Logo du client dans l'en-tête (23/09) : hauteur réglée par l'auteur, largeur libre. */
.pl-logo { width: auto; max-width: 180px; object-fit: contain; margin-inline: 4px 10px; flex: none; }
@media (max-width: 640px) { .pl-logo { max-width: 110px; } }

/* Zone tactile des segments de progression : 44 px de haut, invisible, centrée sur le segment.
   Le trait garde ses 5 px ; seul le doigt gagne de la place (mesuré : 14 px avant, 23/09). */
@media (pointer: coarse), (max-width: 820px) {
  /* le segment MESURE 44 px (donc visable au doigt) mais n'occupe que sa hauteur d'origine :
     les marges négatives annulent l'espace pris. Une surcouche invisible ne suffisait pas —
     elle n'agrandit pas l'élément, et l'audit mesurait toujours 14 px. */
  .pl-rail-segment { position: relative; height: 44px; margin-block: -19px; display: flex; align-items: center; }
  .pl-rail-segment > .pl-rail-piste { width: 100%; }   /* le TRAIT seul : « > * » donnait aussi 100 % à l'infobulle */
}

/* Boutons ronds de l'en-tête : 39,x px mesurés sur téléphone 360, sous la cible de 40.
   44 px sur écran tactile, la recommandation d'usage (23/09). */
@media (pointer: coarse), (max-width: 820px) {
  .pl-btn-icone { min-width: 44px; min-height: 44px; }
}

/* ===== Hauteur de l'en-tête : petit (défaut), moyen (bandeau du brand book), grand (23/09) ===== */
body.pl-entete--moyen { --hauteur-entete: 84px; }
body.pl-entete--grand { --hauteur-entete: 116px; }
body.pl-entete--moyen .pl-logo { max-width: 220px; }
body.pl-entete--grand .pl-logo { max-width: 280px; }
body.pl-entete--moyen .pl-titres .pl-titre, body.pl-entete--grand .pl-titres .pl-titre { font-size: 1.12em; }
@media (max-width: 820px) { body.pl-entete--grand { --hauteur-entete: 92px; } }

/* MOBILE — la barre de progression devient un INDICATEUR : sur téléphone, 30 segments font 7 à 20 px
   de large, impossibles à viser (et un doigt qui glisse changeait de page). On y navigue par
   Précédent / Suivant et le sommaire ; les segments restent lisibles, pas cliquables. */
@media (max-width: 820px) {
  .pl-rail-segment { pointer-events: none; }
  .pl-rail-segment:focus { outline: none; }
}

}   /* fin @layer outil */
