/* Leçons synchronisées depuis le livre (dépôt livres-code) : même présentation que le livre,
   adaptée à l'écran. Le style en ligne des figures (largeur, flottant) vient du livre. */
.tp-lecon {
  --tp-filet: #d6d8dc;
  --tp-piege: #c62828; --tp-piege-fond: #fdecea;
  --tp-astuce: #2e7d32; --tp-astuce-fond: #edf7ee;
  --tp-note: #1565c0; --tp-note-fond: #eaf2fb;
  --tp-danger: #e65100; --tp-danger-fond: #fff3e0;
  --tp-retenir: #6a1b9a; --tp-retenir-fond: #f4ecf8;
  --tp-exemple: #455a64; --tp-exemple-fond: #f3f5f6;
  line-height: 1.65;
}
.tp-lecon::after { content: ""; display: block; clear: both; }
.tp-lecon h2 { clear: both; margin: 1.8em 0 0.6em; font-size: 1.35em; line-height: 1.3; }
.tp-lecon h2:first-child { margin-top: 0; }
.tp-lecon h3 { margin: 1.4em 0 0.5em; font-size: 1.12em; }
.tp-lecon .tp-clear { clear: both; height: 0; }

/* Figures */
.tp-lecon figure { margin-left: 0; margin-right: 0; }
.tp-lecon .tp-fig img { max-width: 100%; height: auto; }
.tp-lecon figcaption { font-size: 0.85em; line-height: 1.35; color: #555; text-align: center; margin-top: 0.4em; }
.tp-lecon .tp-img { text-align: center; }
.tp-lecon .tp-img img { max-width: 100%; height: auto; border-radius: 6px; }

/* Grilles de panneaux ou de photos */
.tp-lecon .tp-grille { margin: 1em 0; }
.tp-lecon .tp-grille figure { margin: 0; }
.tp-lecon .tp-grille img { max-width: 100%; }

/* Tableaux */
.tp-lecon .tp-tableau { overflow-x: auto; margin: 1em 0 1.2em; }
.tp-lecon table { width: 100%; border-collapse: collapse; font-size: 0.95em; }
.tp-lecon th, .tp-lecon td { border: 1px solid var(--tp-filet); padding: 0.45em 0.6em; vertical-align: top; text-align: left; }
.tp-lecon th { background: #eef2f6; }

/* Encadrés « À retenir », « Piège »… */
.tp-lecon blockquote {
  margin: 1.2em 0; padding: 0.8em 1.1em;
  border-left: 4px solid var(--tp-note); background: var(--tp-note-fond);
  border-radius: 0 8px 8px 0; font-style: normal;
}
.tp-lecon blockquote p:last-child { margin-bottom: 0; }
.tp-lecon .tp-encadre-titre { font-weight: 700; font-size: 0.9em; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.35em; color: var(--tp-note); }
.tp-lecon .tp-encadre-piege { border-color: var(--tp-piege); background: var(--tp-piege-fond); }
.tp-lecon .tp-encadre-piege .tp-encadre-titre { color: var(--tp-piege); }
.tp-lecon .tp-encadre-astuce { border-color: var(--tp-astuce); background: var(--tp-astuce-fond); }
.tp-lecon .tp-encadre-astuce .tp-encadre-titre { color: var(--tp-astuce); }
.tp-lecon .tp-encadre-danger { border-color: var(--tp-danger); background: var(--tp-danger-fond); }
.tp-lecon .tp-encadre-danger .tp-encadre-titre { color: var(--tp-danger); }
.tp-lecon .tp-encadre-retenir { border-color: var(--tp-retenir); background: var(--tp-retenir-fond); }
.tp-lecon .tp-encadre-retenir .tp-encadre-titre { color: var(--tp-retenir); }
.tp-lecon .tp-encadre-exemple { border-color: var(--tp-exemple); background: var(--tp-exemple-fond); }
.tp-lecon .tp-encadre-exemple .tp-encadre-titre { color: var(--tp-exemple); }

/* Mobile : les figures flottantes passent au-dessus du texte, les grilles larges sur 2 colonnes. */
@media (max-width: 640px) {
  .tp-lecon .tp-fig-droite, .tp-lecon .tp-fig-gauche {
    float: none !important; width: auto !important; max-width: 420px; margin: 0.8em auto 1em !important;
  }
  .tp-lecon .tp-grille-large { grid-template-columns: repeat(2, 1fr) !important; }
  .tp-lecon .tp-grille[style*="width:"] { width: 100% !important; }
}
