/* ==========================================================
   STRUCTURE GÉNÉRALE
   ========================================================== */
   
@font-face {
  font-family: 'Amsterdam';
  src: url('../fonts/Amsterdam.woff2') format('woff2'),
       url('../fonts/Amsterdam.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Avenir';
  src: url('../fonts/Avenir.woff2') format('woff2'),
       url('../fonts/Avenir.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Avenir-regular';
  src: url('../fonts/Avenir-regular.woff2') format('woff2'),
       url('../fonts/Avenir-regular.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Qualy';
  src: url('../fonts/Qualy.woff2') format('woff2'),
       url('../fonts/Qualy.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* styles de polices spécifiques */
.lecon-wrapper .fs-115 {
  font-size: 115pt !important;
  font-family: "Amsterdam" !important;
  line-height: 1.5;
}

#site-header,#site-footer {display:none;}

.lecon-wrapper {
  /* Thème : sombre par défaut, clair via .is-light (toggle toolbar) */
  --player-bg: #2c3137;
  --player-ink: #ffffff;
  --player-decor: rgba(255,255,255,0.03);

  min-height: 100vh;
  background: var(--player-bg);
  color: var(--player-ink)!important;
  padding-bottom: 140px;
  font-family: 'Avenir-regular', system-ui, -apple-system, sans-serif;
  font-size:28pt;
  position: relative;
  overflow: hidden;
}

/* Titres */
.lecon-wrapper h2,
.lecon-wrapper .bloc-titre {
  font-size: 30pt;
  line-height: 1.25;
  /* font-family piloté par l'outil Apparence (lecon_appearance) */
  letter-spacing: 1pt;
}

.lecon-wrapper h3 {
    font-size: 32pt;
    font-weight: bold; /* sous-titre toujours en gras (graisse non pilotée) */
}

/* Décor léger */
.lecon-wrapper::before,
.lecon-wrapper::after {
  content: "";
  position: absolute;
  width: 120%;
  height: 200px;
  background: var(--player-decor);
  transform: rotate(-6deg);
  left: -10%;
  pointer-events: none;
}

.lecon-wrapper::before {
  top: -90px;
}

.lecon-wrapper::after {
  bottom: -140px;
}

/* Cas fond clair sans couleur inline */
.lecon-wrapper [style*="background"]:not([style*=";color"]) {
  color: #1f2933;
}

/* Cas couleur inline explicite → on respecte */
.lecon-wrapper [style*=";color:"] {
  color: unset;
}


/* ==========================================================
   HEADER
   ========================================================== */

/* ==========================
   BANDEAU LEÇON
   ========================== */

.lecon-banner {
  background: var(--player-bg);
  color: var(--player-ink);
  position:relative;
}

.lecon-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 80px;
  height: 100%;
 background: var(--category-color);
  clip-path: polygon(
    0% 0%,
    100% 0,
    0 100%
  );

  opacity: 0.18;
}


.lecon-banner-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 20px 40px 0px; /* ← air horizontal */
  position: relative;
  z-index: 2;
}


/* ← 
.lecon-back {
  position: absolute;
  top: 16px;
  left: 16px;
  font-size: 24px;
  color: #fff;
  text-decoration: none;
  z-index:9;
}
*/

/* gauche */
.lecon-banner-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.lecon-category-logo {
  height: 160px;
  max-height:160px;
}

.lecon-category-code {
  font-size: 58px;
  font-weight: 700;
  color: var(--category-color);
  margin-left: -60px;
  top: -4px;
  position: relative;
}

/* centre */
.lecon-title {
  text-align: center;
  font-family: 'Amsterdam', serif;
  font-size: 68px;
  margin: 0;
  color: var(--category-color);
}

.lecon-banner-right {
  position: absolute;
  right: 64px;
  bottom: 0; /* hauteur exacte de la banner-bar */
  display: flex;
  align-items: flex-end;
}

/* droite */
.lecon-decor {
  max-height: 96px;
  height:auto;
  bottom: 0;
}

.lecon-banner::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 420px;
  height: 80%;
  background: var(--category-color);
  clip-path: polygon(
    100% 0,
    0% 0%,
    100% 100%
  );
  opacity: 0.18;
}


/* barre couleur */
.lecon-banner-bar {
  height: 20px;
  background: var(--category-color);
  border-radius: 12px;
  max-width: 98%;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .lecon-banner::after {
    width: 100px;
  }
}

.tool-btn {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: var(--category-color);
  color: white;
  font-size: 18px;
}

/* PANEL */

.lecon-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  height: 100vh;
  background: white;
  box-shadow: -5px 0 25px rgba(0,0,0,0.15);
  transition: right 0.3s;
  z-index: 30;
  overflow-y: auto;
  padding: 20px;
  font-size: 1rem;
  color:#333;
  user-select: none;
}

.lecon-panel.is-open {
  right: 0;
}

.panel-search,
.panel-toc {
  display: none;
}

.panel-search.is-visible,
.panel-toc.is-visible {
  display: block;
}

/* sommaire hiérarchisé : 3 niveaux indentés */

.toc-item {
  cursor: pointer;
}

/* niveau 1 = chapitre : en avant, espacé du bloc précédent */
.toc-level-1 {
  margin-top: 14px;
  font-weight: 700;
  opacity: 1;
}

/* niveau 2 = sous-section */
.toc-level-2 {
  margin-top: 4px;
  margin-left: 16px;
  opacity: 0.92;
}

/* niveau 3 = sous-titre */
.toc-level-3 {
  margin-left: 32px;
  opacity: 0.72;
  font-size: 0.95em;
}

/* compat : anciennes classes si présentes */
.toc-title { margin-top: 12px; cursor: pointer; }
.toc-subtitle { margin-left: 15px; opacity: 0.8; cursor: pointer; }

/* recherche */

.search-results button {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 10px;
}

.lecon-toolbar {
  position: fixed;
  cursor: grab;
  bottom: 24px;
  right: 24px;

  display: flex;
  align-items: center;
  gap: 12px;

  padding: 10px 14px;

  background: var(--category-color);
  color: white;

  border-radius: 14px;

  box-shadow: 0 10px 30px rgba(0,0,0,0.2);

  z-index: 50;
}
.lecon-toolbar.dragging {
  cursor: grabbing;
}

/* boutons */

.lecon-toolbar button {

  border: none;
  background: none;
  color: white;

  font-size: 20px;

  cursor: pointer;
}

/* progress : champ de page éditable + « / total », dans cet ordre,
   identique sur desktop / tablette / mobile */

.toolbar-progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  white-space: nowrap;
}

.toolbar-progress .progress-sep,
.toolbar-progress .total-pages {
  color: #fff;
}

/* champ de saisie = page courante (affichage) + saut direct (saisie).
   Sélecteur renforcé (.lecon-wrapper + input[type=number]) pour passer
   AU-DESSUS du reset.css du thème, qui cible input[type="number"]
   (spécificité 0,1,1) avec width:100%, border et padding .5rem 1rem. */
.lecon-wrapper .lecon-toolbar input.jump-input[type="number"] {
  width: 44px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
  padding: .2rem;
  box-sizing: border-box;
  background: #fff;
  color: #16181c;
  /* flèches up/down natives retirées (laides, redondantes) */
  -moz-appearance: textfield;
  appearance: textfield;
}
.lecon-wrapper .lecon-toolbar input.jump-input[type="number"]::-webkit-outer-spin-button,
.lecon-wrapper .lecon-toolbar input.jump-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* icônes */

.tool-btn {

  font-size: 18px;
}

/* séparateur */

.toolbar-divider {

  width: 1px;
  height: 18px;

  background: rgba(255,255,255,0.4);
}

.search-highlight {
  background: #ffe066;
  padding: 0 2px;
  border-radius: 2px;
}

/* ==========================================================
   PAGES / PAGINATION
   ========================================================== */

.lecon-pages {
  padding: 32px 16px;
   user-select: none;
}

.lecon-page {
  display: none;
  max-width: 1340px;
  margin: 0 auto;
  width:100%;
}

.lecon-page.is-active {
  display: block;
}

.lecon-page.is-active > .module {
    max-width: 98%;
}

/* ==========================================================
   MODULES / BLOCS
   ========================================================== */

.module {
  margin-bottom: 32px;
}

/* RÈGLE CRITIQUE : images toujours contenues dans leur cadre */
.module img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
}


/* ==========================================================
   TITRES & TEXTE
   ========================================================== */

.bloc-title {
  text-align: center;
  margin-bottom: 32px;
}

.texte-simple {
  text-align: left;
  line-height: 1.2;
}


/* ==========================================================
   IMAGE SEULE
   ========================================================== */

.image-seule {
  text-align: center!important;
}

.image-seule img {
  width: 100%;
  max-width: 800px;
  height: auto;
  margin: 0 auto;
  display: block;
}


/* ==========================================================
   IMAGE + TEXTE / TEXTE + IMAGE
   ========================================================== */

.image-texte,
.texte-image {
  display: flex;
  align-items: center;
  gap: 80px;
}

/* (cadre 320px figé supprimé : la largeur de colonne est pilotée
   par le variant du wrapper .bloc-image — cf. section v15) */

/* Texte prioritaire */
.image-texte .texte,
.texte-image .texte {
  flex: 1;
}


/* ==========================================================
   BLOCS MULTI-IMAGES
   ========================================================== */

.deux_images{
    display:flex;
    justify-content:center;
    align-items:center;
    gap:40px;
    flex-wrap:wrap;
}

.deux_images .bloc-image,
.trois_images .bloc-image {
    flex: 0 1 auto;
    min-width: 0;
}

.deux_images .bloc-image img,
.trois_images .bloc-image img {
    width: auto;
    max-width: 100%;
    height: auto;
}

/* plafond = taille native du variant */
.deux_images .bloc-image.illustration img,
.trois_images .bloc-image.illustration img { max-width: min(100%, 400px); }

.deux_images .bloc-image.standard img,
.trois_images .bloc-image.standard img { max-width: min(100%, 600px); }

.deux_images .bloc-image.schema img,
.trois_images .bloc-image.schema img { max-width: min(100%, 1200px); }

.deux_images .bloc-image.full img,
.trois_images .bloc-image.full img { max-width: min(100%, 1600px); }

.deux_images .bloc-image.chapter_end img,
.trois_images .bloc-image.chapter_end img { max-width: min(100%, 1780px); }

.trois_images{
    display:flex;
    justify-content:center;
    align-items:center;
    gap:40px;
    flex-wrap:wrap;
}

/* (cap fixe 380px supprimé : géré par les plafonds par variant) */


/* ==========================================================
   TEXTE - IMAGE - TEXTE
   ========================================================== */

.texte_image_texte {
  display: flex;
  align-items: center;
  gap: 16px;
}

.texte_image_texte .texte {
  flex: 1;
}

.texte_image_texte img {
  flex: 0 0 280px;
  width: 280px;
  height: auto;
}


/* ==========================================================
   IMAGE - TEXTE - IMAGE
   ========================================================== */

.image_texte_image {
  display: flex;
  align-items: center;
  gap: 16px;
}

.image_texte_image img {
  flex: 0 0 240px;
  width: 240px;
  height: auto;
}

.image_texte_image .texte {
  flex: 1;
}


/* ==========================================================
   NAVIGATION & PROGRESSION
   ========================================================== */

.lecon-navigation {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  z-index: 10;
  background: var(--category-color);
  color: #fff;
  border-radius: 12px;
  opacity: 0.9;
}

.lecon-progress-inline {
  font-size: 15px;
  text-align: center;
}


.nav-prev,
.nav-next {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  opacity: 0.8;
  padding: 0 20px;
}

.nav-prev:disabled,
.nav-next:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ==========================================================
   TOOLBAR : navigation, survol, masquage en bout
   Scopé sous .lecon-wrapper pour écraser le reset.css du thème.
   Survol = assombrissement de la couleur de catégorie (color-mix),
   avec repli rgba pour les navigateurs sans color-mix.
   ========================================================== */

/* flèches + début/fin : même base */
.lecon-wrapper .lecon-toolbar .nav-first,
.lecon-wrapper .lecon-toolbar .nav-prev,
.lecon-wrapper .lecon-toolbar .nav-next,
.lecon-wrapper .lecon-toolbar .nav-last {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
  padding: 4px 14px;
  border-radius: 8px;
  transition: background-color .15s ease, opacity .15s ease;
}

.lecon-wrapper .lecon-toolbar .nav-first { padding-right: 6px; }
.lecon-wrapper .lecon-toolbar .nav-last  { padding-left: 6px; }

/* survol : teinte plus foncée de la couleur de catégorie */
.lecon-wrapper .lecon-toolbar .nav-first:not(:disabled):hover,
.lecon-wrapper .lecon-toolbar .nav-prev:not(:disabled):hover,
.lecon-wrapper .lecon-toolbar .nav-next:not(:disabled):hover,
.lecon-wrapper .lecon-toolbar .nav-last:not(:disabled):hover,
.lecon-wrapper .lecon-toolbar .tool-btn:hover {
  background: rgba(0, 0, 0, 0.22); /* repli */
  background: color-mix(in srgb, var(--category-color) 78%, #000 22%);
  opacity: 1;
}

.lecon-wrapper .lecon-toolbar .nav-first:not(:disabled):active,
.lecon-wrapper .lecon-toolbar .nav-prev:not(:disabled):active,
.lecon-wrapper .lecon-toolbar .nav-next:not(:disabled):active,
.lecon-wrapper .lecon-toolbar .nav-last:not(:disabled):active,
.lecon-wrapper .lecon-toolbar .tool-btn:active {
  background: rgba(0, 0, 0, 0.32);
  background: color-mix(in srgb, var(--category-color) 66%, #000 34%);
}

/* boutons outils (loupe, sommaire, thème) */
.lecon-wrapper .lecon-toolbar .tool-btn {
  background: transparent;
  border: none;
  color: #fff;
  border-radius: 8px;
  transition: background-color .15s ease;
}

/* indication de désactivation (repli si non masqué) */
.lecon-wrapper .lecon-toolbar .nav-first:disabled,
.lecon-wrapper .lecon-toolbar .nav-prev:disabled,
.lecon-wrapper .lecon-toolbar .nav-next:disabled,
.lecon-wrapper .lecon-toolbar .nav-last:disabled {
  opacity: 0.3;
  cursor: default;
}

/* masquage complet en bout de course (page 1 / dernière page) */
.lecon-wrapper .lecon-toolbar .is-hidden {
  display: none !important;
}

/* focus clavier visible */
.lecon-wrapper .lecon-toolbar button:focus-visible {
  outline: 2px solid rgba(255,255,255,0.5);
  outline-offset: 1px;
}

/* ----------------------------------------------------------
   TOOLBAR — adaptation mobile
   Avec les boutons début/fin, la barre dépassait la largeur
   d'écran et masquait loupe / sommaire / thème. On contraint
   la largeur, on resserre les espacements et on masque le
   champ de saisie numérique (les flèches + le compteur suffisent).
   ---------------------------------------------------------- */
@media (max-width: 768px) {

  .lecon-wrapper .lecon-toolbar {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
    width: auto;
    gap: 4px;
    padding: 8px 8px;
    justify-content: space-between;
    flex-wrap: nowrap;
  }

  /* champ de saisie rétréci sur mobile */
  .lecon-wrapper .lecon-toolbar input.jump-input[type="number"] {
    width: 46px;
    font-size: 13px;
  }

  .lecon-wrapper .lecon-toolbar .toolbar-progress {
    font-size: 13px;
    gap: 4px;
  }

  /* flèches plus compactes */
  .lecon-wrapper .lecon-toolbar .nav-first,
  .lecon-wrapper .lecon-toolbar .nav-prev,
  .lecon-wrapper .lecon-toolbar .nav-next,
  .lecon-wrapper .lecon-toolbar .nav-last {
    padding: 4px 8px;
    font-size: 20px;
  }

  .lecon-wrapper .lecon-toolbar .tool-btn {
    padding: 4px 7px;
  }

  /* le séparateur prend de la place pour rien sur petit écran */
  .lecon-wrapper .lecon-toolbar .toolbar-divider {
    margin: 0 2px;
  }
}

/* très petits écrans : on resserre encore */
@media (max-width: 380px) {
  .lecon-wrapper .lecon-toolbar { gap: 2px; padding: 6px; }
  .lecon-wrapper .lecon-toolbar .nav-first,
  .lecon-wrapper .lecon-toolbar .nav-prev,
  .lecon-wrapper .lecon-toolbar .nav-next,
  .lecon-wrapper .lecon-toolbar .nav-last { padding: 4px 6px; }
}

.lecon-pages {
  cursor: grab;
}

.lecon-pages:active {
  cursor: grabbing;
}

.nav-dots {
  display: flex;
  gap: 8px;
}

.nav-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #aaaaaa;
  cursor: pointer;
}

.nav-dot.is-active {
  background: #2dd4bf;
}


/* ==========================================================
   ANIMATION DÉFILEMENT
   ========================================================== */

.lecon-page {
  transition: opacity 0.35s ease, transform 0.35s ease;
  opacity: 0;
  transform: translateX(40px);
  pointer-events: none;
}

.lecon-page.is-active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* optionnel : page précédente */
.lecon-page.is-exiting-left {
  transform: translateX(-40px);
  opacity: 0;
}

/* optionnel : page suivante */
.lecon-page.is-exiting-right {
  transform: translateX(40px);
  opacity: 0;
}



/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 768px) {

  .image-texte,
  .texte-image,
  .deux_images,
  .trois_images,
  .texte_image_texte,
  .image_texte_image {
    flex-direction: column;
    text-align: center;
    margin:0 auto;
  }

  .image-texte img,
  .texte-image img,
  .texte_image_texte img,
  .image_texte_image img,
  .deux_images img,
  .trois_images img {
    width: auto;
    max-width: 100%;
    height: auto;
  }
  
}

/* ==========================================================
   MODE (CENTRAGE VERTICAL)
   ========================================================== */

@media (min-width: 768px) {

  /* La page active occupe tout le viewport */
  .lecon-page.is-active {
    min-height: calc(100vh - 300px); /* header + navigation */
    display: flex;
    flex-direction: column;
    justify-content: center; /* centrage vertical */
  }

  /* width:100% explicite : les marges auto centrent la boîte
     (jeu du max-width 98%) sans la replier sur son contenu,
     comme le faisait margin auto seul en flex colonne */
  .lecon-page.is-active > .module {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  /* Si le contenu est trop grand → scroll naturel */
  .lecon-page.is-active {
    overflow-y: auto;
  }
}

@media (min-width: 1280px) { 

.lecon-wrapper { 
  font-size:28pt;
  }
/* Titres — tailles pilotées par l'outil Apparence (lecon_appearance) */
.lecon-wrapper h2,
.lecon-wrapper .bloc-titre {
  display: block !important;
}
}

/* ==========================================================
   TYPOGRAPHIE RESPONSIVE – MOBILE & TABLETTE
   ========================================================== */

@media (max-width: 1024px) {
    .lecon-title {
  font-size: 54px;
    }
    
    .lecon-banner-right {
  display: none;
    }

  /* Titre principal de page */
  .lecon-wrapper h2,
  .lecon-wrapper .bloc-title {
    font-size: 24pt!important;
    line-height: 1.3;
    margin-bottom: 40px;
    display:block!important;
    
  }

  /* Titres secondaires */
  .lecon-wrapper h3 {
    font-size: 22pt;
    line-height: 1.3;
    margin-bottom: 20px;
  }

  /* Texte courant */
  .lecon-wrapper {
    font-size: 20pt;
    line-height: 1.2;
  }
  

 /* Espacement général des modules */
  .lecon-wrapper .module {
    margin-bottom: 40px;
  }
}

@media (max-width: 480px) {  
    .lecon-banner::before {
  width: 48px;}
    .lecon-title {
  font-size: 36px;
    }
    .lecon-banner-inner {
  padding: 20px 20px 0px;
    }
.lecon-category-logo {
  height: 100px!important;
}
.lecon-category-code {
  font-size: 36px;
  margin-left: -44px;
  top: -2px;
}
  .lecon-wrapper h2,
  .lecon-wrapper .bloc-title {
    font-size: 18pt;
  }

  .lecon-wrapper h3 {
    font-size: 18pt;
  } 
  .lecon-wrapper {
    font-size: 16pt;
    line-height: 1.2;
  }
}
/* interligne du player : 1.2 partout (le thème impose 1.5) */
.lecon-wrapper {
  line-height: 1.2;
}

/* alignement par défaut : gauche. Un centrage doit être explicite
   (style inline text-align:center, prioritaire sur cette règle) */
.lecon-wrapper p {
  text-align: left;
}

/* espacement des paragraphes (le reset.css du thème le met à 0),
   sauf le premier de chaque conteneur (pas d'air en tête de bloc) */
.lecon-wrapper p {
  margin-block-start: 3rem;
}

.lecon-wrapper p:first-child {
  margin-block-start: 0;
}

/* ==========================================================
   GRAS RÉEL : Avenir.woff est en fait AvenirNext BOLD (700).
   On le déclare comme graisse bold de la famille du player,
   sinon <strong> n'a droit qu'à un faux gras simulé, quasi
   invisible. (Corrige la « perte » du gras à l'import.)
   ========================================================== */

@font-face {
  font-family: 'Avenir-regular';
  src: url('../fonts/Avenir.woff2') format('woff2'),
       url('../fonts/Avenir.woff') format('woff');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================
   ÉDITEUR V15 — NOUVELLES CLASSES IMAGES
   NB : dans le player, variant + classes sont posés sur le
   wrapper .bloc-image (cf. lecon_render_image_group), les
   sélecteurs ciblent donc .bloc-image.classe img
   ========================================================== */

/* ---------- Largeur de colonne pilotée par le variant ----------
   Dans image-texte / texte-image : l'image occupe une vraie colonne,
   le variant définit sa part. Remplace le 320px fixe historique.
   Les classes icone/miniature-* (déclarées plus bas) gardent la
   priorité à spécificité égale (ordre du fichier). */

/* standard / schema / full : 2 colonnes égales */
.image-texte .bloc-image.standard,
.texte-image .bloc-image.standard,
.image-texte .bloc-image.schema,
.texte-image .bloc-image.schema,
.image-texte .bloc-image.full,
.texte-image .bloc-image.full {
  flex: 0 0 50%;
  max-width: 50%;
}

/* illustration : colonne image plus étroite, plafonnée à 400px */
.image-texte .bloc-image.illustration,
.texte-image .bloc-image.illustration {
  flex: 0 0 33%;
  max-width: 400px;
}

/* texte aligné à gauche dans les blocs côte à côte */
.image-texte .texte,
.texte-image .texte {
  text-align: left;
}

/* l'image remplit sa colonne, ratio préservé */
.image-texte .bloc-image.standard img,
.texte-image .bloc-image.standard img,
.image-texte .bloc-image.schema img,
.texte-image .bloc-image.schema img,
.image-texte .bloc-image.full img,
.texte-image .bloc-image.full img,
.image-texte .bloc-image.illustration img,
.texte-image .bloc-image.illustration img {
  width: 100% !important;
  height: auto !important;
}

/* mobile : on repasse en pile, pleine largeur (le flex-basis 50%
   s'appliquerait à la hauteur en direction colonne) */
@media (max-width: 768px) {
  .image-texte .bloc-image.standard,
  .texte-image .bloc-image.standard,
  .image-texte .bloc-image.schema,
  .texte-image .bloc-image.schema,
  .image-texte .bloc-image.full,
  .texte-image .bloc-image.full,
  .image-texte .bloc-image.illustration,
  .texte-image .bloc-image.illustration {
    flex: 0 0 auto;
    max-width: 100%;
    width: 100%;
  }
  .image-texte .bloc-image.illustration,
  .texte-image .bloc-image.illustration {
    max-width: 400px;
  }
}

/* ---------- Image seule : plafond piloté par le variant ----------
   Remplace le plafond unique de 800px. Les tailles WP générées
   (lesson-illustration 400, lesson-standard 600, lesson-schema 1200,
   lesson-full 1600, lesson-chapter-end 1780) suivent via srcset. */

.image-seule .bloc-image.illustration img {
  max-width: 400px;
}

.image-seule .bloc-image.standard img {
  max-width: 600px; /* aligné sur le variant standard (lesson-standard 600) */
}

.image-seule .bloc-image.schema img {
  max-width: 1200px;
}

.image-seule .bloc-image.full img {
  max-width: 1600px; /* lesson-full */
}

.image-seule .bloc-image.chapter_end img {
  max-width: 1780px; /* lesson-chapter-end */
}

/* ---------- Tailles utilitaires ---------- */

.lecon-wrapper .bloc-image.icone img {
  width: 80px !important;
  height: auto !important;
}

.lecon-wrapper .bloc-image.miniature img {
  width: 120px !important;
  height: auto !important;
}

.lecon-wrapper .bloc-image.miniature-180 img {
  width: 180px !important;
  height: auto !important;
}

.lecon-wrapper .bloc-image.miniature-240 img {
  width: 240px !important;
  height: auto !important;
}

.lecon-wrapper .bloc-image.miniature-300 img {
  width: 300px !important;
  height: auto !important;
}

/* le wrapper ne réserve plus la largeur standard (320px) */
.image-texte .bloc-image.icone,
.texte-image .bloc-image.icone,
.image-texte .bloc-image.miniature,
.texte-image .bloc-image.miniature,
.image-texte .bloc-image.miniature-180,
.texte-image .bloc-image.miniature-180,
.image-texte .bloc-image.miniature-240,
.texte-image .bloc-image.miniature-240,
.image-texte .bloc-image.miniature-300,
.texte-image .bloc-image.miniature-300 {
  flex: 0 0 auto;
}

/* icône : petite image devant le texte, alignée et serrée */
.image-texte:has(> .bloc-image.icone),
.texte-image:has(> .bloc-image.icone) {
  align-items: center;
  gap: 32px;
}

/* ---------- no-radius (tableaux, schémas…) ---------- */

.lecon-wrapper .bloc-image.no-radius img,
.lecon-wrapper .no-radius,
.lecon-wrapper .no-radius img {
  border-radius: unset !important;
}

/* ---------- fusion : image intégrée au bloc texte ----------
   Le texte (et son highlight-bg) occupe TOUTE la largeur du
   module, comme un bloc texte simple ; l'image est posée en
   absolu, à cheval sur le bord du cartouche. */

.image-texte:has(> .bloc-image.fusion),
.texte-image:has(> .bloc-image.fusion) {
  display: block;
  position: relative;
}

.image-texte > .bloc-image.fusion,
.texte-image > .bloc-image.fusion {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  margin: 0;
}

/* image au bord du module ; le cartouche démarre sous sa moitié,
   l'image est donc à cheval sur son bord sans sortir de la page
   (un débord négatif serait rogné par l'overflow de .lecon-page) */
.image-texte > .bloc-image.fusion { left: 0; }
.texte-image > .bloc-image.fusion { right: 0; }

.image-texte:has(> .bloc-image.fusion) .texte,
.texte-image:has(> .bloc-image.fusion) .texte {
  width: auto;
  max-width: 100%;
}

.image-texte:has(> .bloc-image.fusion) .texte { margin-left: 60px; }
.texte-image:has(> .bloc-image.fusion) .texte { margin-right: 60px; }

.image-texte:has(> .bloc-image.fusion) .texte .highlight-bg { padding-left: 84px; }
.texte-image:has(> .bloc-image.fusion) .texte .highlight-bg { padding-right: 84px; }

/* mobile : retour au flux, pas de chevauchement */
@media (max-width: 768px) {
  .image-texte > .bloc-image.fusion,
  .texte-image > .bloc-image.fusion {
    position: static;
    transform: none;
    margin: 0 auto 12px;
  }
  .image-texte:has(> .bloc-image.fusion) .texte .highlight-bg,
  .texte-image:has(> .bloc-image.fusion) .texte .highlight-bg {
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* ---------- adjacente : image juste à côté du bloc ---------- */

.image-texte:has(> .bloc-image.adjacente),
.texte-image:has(> .bloc-image.adjacente),
.image-texte:has(> .bloc-image.adjacente-gauche),
.texte-image:has(> .bloc-image.adjacente-gauche),
.image-texte:has(> .bloc-image.adjacente-droite),
.texte-image:has(> .bloc-image.adjacente-droite) {
  gap: 24px;
  justify-content: flex-start;
}

/* forcer le côté indépendamment du type de bloc */
.module .bloc-image.adjacente-gauche { order: -1; }
.module .bloc-image.adjacente-droite { order: 99; }

/* image seule "adjacente" : on la cale sur le côté de la page */
.lecon-page > .module.image:has(.bloc-image.adjacente-gauche) { align-self: flex-start; }
.lecon-page > .module.image:has(.bloc-image.adjacente-droite) { align-self: flex-end; }

/* ---------- inside : image posée dans l'élément parent ---------- */

.image-texte:has(.bloc-image.inside),
.texte-image:has(.bloc-image.inside),
.image-seule:has(.bloc-image.inside),
.texte_image_texte:has(.bloc-image.inside),
.image_texte_image:has(.bloc-image.inside) {
  position: relative;
}

.lecon-wrapper .bloc-image.inside {
  position: absolute;
  right: 24px;
  bottom: 16px;
  flex: 0 0 auto;
}

/* ==========================================================
   ÉDITEUR V15 — "previous-left"
   (bloc 3 colonnes : l'image remonte dans la ligne précédente,
   colonne gauche — mappé sur le layout image_texte_image)
   ========================================================== */

.image_texte_image:has(> .bloc-image.previous-left) {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  gap: 1rem;
  align-items: stretch;
}

.image_texte_image:has(> .bloc-image.previous-left) > .bloc-image.previous-left {
  grid-column: 1;
  grid-row: 2;
}

.image_texte_image:has(> .bloc-image.previous-left) > .texte {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
}

.image_texte_image:has(> .bloc-image.previous-left) > .bloc-image:not(.previous-left) {
  grid-column: 2;
  grid-row: 1 / 3;
}

.image_texte_image:has(> .bloc-image.previous-left) img {
  width: 100% !important;
  height: auto !important;
  max-width: 100%;
}

.image_texte_image:has(> .bloc-image.previous-left) > .bloc-image:not(.previous-left) img {
  height: 100% !important;
  object-fit: cover;
}

@media (max-width: 768px) {
  .image_texte_image:has(> .bloc-image.previous-left) {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .image_texte_image:has(> .bloc-image.previous-left) > .bloc-image,
  .image_texte_image:has(> .bloc-image.previous-left) > .texte {
    grid-column: 1;
    grid-row: auto;
  }
  .image_texte_image:has(> .bloc-image.previous-left) > .bloc-image:not(.previous-left) img {
    height: auto !important;
    object-fit: contain;
  }
}

/* ==========================================================
   ÉDITEUR V15 — GALERIE AVEC LÉGENDES
   ========================================================== */

/* le module galerie occupe toute la largeur de page
   (les marges auto annulent l'étirement flex → on force) */
.lecon-wrapper .module.galerie_legendes {
  width: 100%;
}

.galerie-legendes {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  justify-content: center;
  align-items: flex-start;
  padding: 8px 0;
}

.galerie-legendes .galerie-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 calc(25% - 0.9rem);   /* 4 par ligne par défaut */
  min-width: 0;
  margin: 0;                       /* reset figure */
}

.galerie-legendes .galerie-item .bloc-image {
  width: 100%;
  text-align: center;
}

.galerie-legendes .galerie-item img {
  max-width: 100%;
  width: 100%;
  height: auto;
  border-radius: 18px;
  object-fit: contain;
  margin: 0 auto;
}

/* l'image ne dépasse jamais la taille native de son variant,
   même si la cellule de galerie est plus large */
.galerie-legendes .bloc-image.illustration img { max-width: 400px; }
.galerie-legendes .bloc-image.standard img     { max-width: 600px; }
.galerie-legendes .bloc-image.schema img       { max-width: 1200px; }

.galerie-legendes .galerie-legende {
  font-size: 0.55em;
  text-align: center;
  line-height: 1.3;
  /* neutralise le reset.css du thème parent (figcaption #333…) */
  color: inherit;
  font-style: italic;
  margin: 0;
}

/* largeur des items pilotée par le variant des images */
/* illustration : les items se partagent toute la ligne
   (3 items → 3 colonnes pleines, 4+ → 4 par ligne) */
.galerie-legendes:has(.bloc-image.illustration) .galerie-item {
  flex: 1 1 calc(25% - 0.9rem);
  max-width: none;
}

.galerie-legendes:has(.bloc-image.standard) .galerie-item,
.galerie-legendes:has(.bloc-image.schema) .galerie-item {
  flex: 0 0 calc(50% - 0.6rem);
  max-width: none;
}

.galerie-legendes:has(.bloc-image.full) .galerie-item {
  flex: 0 0 100%;
  max-width: 100%;
}

/* (les classes miniature-* s'appliquent telles quelles dans la
   galerie : largeur fixe globale + max-width:100% de la cellule) */

/* tablette : 3 colonnes max */
@media (max-width: 820px) {
  .galerie-legendes .galerie-item {
    flex: 1 1 calc(33.33% - 0.8rem);
  }
  .galerie-legendes:has(.bloc-image.standard) .galerie-item,
  .galerie-legendes:has(.bloc-image.schema) .galerie-item {
    flex: 0 0 calc(50% - 0.6rem);
  }
}

/* mobile : un item par ligne, pleine largeur — jamais côte à côte */
@media (max-width: 768px) {
  .galerie-legendes .galerie-item,
  .galerie-legendes:has(.bloc-image.illustration) .galerie-item,
  .galerie-legendes:has(.bloc-image.standard) .galerie-item,
  .galerie-legendes:has(.bloc-image.schema) .galerie-item,
  .galerie-legendes:has(.bloc-image.full) .galerie-item {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* ==========================================================
   ÉDITEUR V15 — CLASSES DE CONTENU (texte / fond / cadre)
   ========================================================== */

/* fond surligné (couleur fournie en style inline) */
.lecon-wrapper .highlight-bg {
  display: block;
  padding: 12px 20px;
  border-radius: 14px;
}

/* encadrement type "secourisme" */
.lecon-wrapper .encadrement {
  border: 4px solid #1072aa;
  border-radius: 16px;
  padding: 8px 6px;
}

/* polices */
.lecon-wrapper .amster {
  font-family: 'Amsterdam', serif !important;
  line-height: 1.5;
}

.lecon-wrapper .amster-120 {
  font-family: 'Amsterdam', serif !important;
  font-size: 120pt !important;
  line-height: 1.5;
}

/* taille augmentée (relative à la taille courante du player) */
.lecon-wrapper .x2 {
  font-size: 1.5em !important;
}

/* badge de format (réutilisé par l'admin si besoin) */
.format-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  white-space: nowrap;
}

.format-badge.v2 {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #5b21b6;
}


/* ==========================================================
   TITRE DE PAGE INTÉGRÉ AU BANDEAU (façon diapositive)
   Le JS place le 1er bloc titre de la page active dans la
   barre colorée ; le bloc d'origine est masqué dans la page.
   ========================================================== */

.module.titre.is-in-banner {
  display: none !important;
}

.lecon-banner-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: auto;
  min-height: 20px;
  padding: 4px 36px;
}

.lecon-banner-page-title {
  /* font-family piloté par l'outil Apparence (lecon_appearance) */
  font-weight: bold;
  color: #ffffff;
  font-size: 20pt;
  line-height: 1.15;
  text-align: right;
}

@media (max-width: 1024px) {
  .lecon-banner-page-title { font-size: 16pt; }
}

@media (max-width: 480px) {
  .lecon-banner-bar { padding: 4px 16px; }
  .lecon-banner-page-title { font-size: 13pt; }
}


/* icône SVG de la toolbar : centrée, taille fixe quel que soit l'OS */
.tool-btn svg {
  display: block;
  margin: 0 auto;
}


/* ==========================================================
   MODE CLAIR / SOMBRE
   ========================================================== */

.lecon-wrapper.is-light {
  --player-bg: #e3e4e6;
  --player-ink: #1f2933;
  --player-decor: rgba(0, 0, 0, 0.05);
}

/* icône du toggle : lune en sombre, soleil en clair */
.theme-toggle .icon-sun { display: none; }
.lecon-wrapper.is-light .theme-toggle .icon-moon { display: none; }
.lecon-wrapper.is-light .theme-toggle .icon-sun { display: block; }

/* ==========================================================
   TOOLBAR : centrage des icônes
   ========================================================== */

.lecon-toolbar .tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}


/* ==========================================================
   TEXTE ↔ TEXTE : 2 colonnes côte à côte
   (règle absente du CSS d'origine — les colonnes s'empilaient)
   ========================================================== */

.texte-texte {
  display: flex;
  gap: 48px;
  align-items: center;
}

.texte-texte .texte {
  flex: 1 1 0;
  min-width: 0;
}

@media (max-width: 768px) {
  .texte-texte {
    flex-direction: column;
    gap: 16px;
  }
}

/* TEXTE ↔ TEXTE ↔ TEXTE : 3 colonnes côte à côte */
.texte-texte-texte {
  display: flex;
  gap: 32px;
  align-items: center;
}

.texte-texte-texte .texte {
  flex: 1 1 0;
  min-width: 0;
}

@media (max-width: 768px) {
  .texte-texte-texte {
    flex-direction: column;
    gap: 16px;
  }
}

/* police Amsterdam 115pt (classe présente dans certains contenus) */
.lecon-wrapper .amster-115 {
  font-family: 'Amsterdam', serif !important;
  font-size: 115pt !important;
  line-height: 1.5;
}
