/* ==========================================================================
   Design IWL : contenu des leçons (conteneur .iwl-lesson)
   Chargé sur le site ET dans le lecteur de cours MasterStudy.
   Le sélecteur :not(#iwl-l) donne aux règles une priorité supérieure à celles
   du lecteur (iwl-course-player.css) sans recourir à !important.
   Ne pas recopier ce CSS dans « CSS additionnel » ni dans les leçons.
   ========================================================================== */
.iwl-lesson:not(#iwl-l) {
  --iwl-navy: #172D7B;
  --iwl-navy-dark: #0F1F5C;
  --iwl-ink: #2B2F3A;
  --iwl-muted: #5A5F6E;
  --iwl-coral: #FA7066;
  --iwl-coral-hover: #E85A50;
  --iwl-yellow: #FBC66A;
  --iwl-teal: #75C1BA;
  --iwl-purple: #975AD3;
  --iwl-pink: #FFD4DB;
  --iwl-cream: #FCF7EE;
  --iwl-line: #ECE6DA;
  --iwl-white: #FFFFFF;
  --iwl-radius: 16px;
  --iwl-title: 'Montserrat', system-ui, sans-serif;
  --iwl-text: 'Nunito', system-ui, sans-serif;
  --iwl-hand: 'Caveat', cursive;

  box-sizing: border-box;
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 28px;
  background: var(--iwl-white);
  color: var(--iwl-ink);
  font-family: var(--iwl-text);
  font-size: 17px;
  line-height: 1.7;
  border-radius: var(--iwl-radius);
}
.iwl-lesson:not(#iwl-l) *, .iwl-lesson:not(#iwl-l) *::before, .iwl-lesson:not(#iwl-l) *::after { box-sizing: border-box; }

/* ---------- Typographie (spécificité renforcée face au thème) ---------- */
.iwl-lesson:not(#iwl-l) p,
.iwl-lesson:not(#iwl-l) li { font-family: var(--iwl-text); font-size: 17px; line-height: 1.7; color: var(--iwl-ink); margin: 0 0 14px; }
.iwl-lesson:not(#iwl-l) h2,
.iwl-lesson:not(#iwl-l) h3 { font-family: var(--iwl-title); color: var(--iwl-navy); line-height: 1.25; margin: 40px 0 14px; letter-spacing: -0.01em; }
.iwl-lesson:not(#iwl-l) h2 { font-size: 26px; font-weight: 900; }
.iwl-lesson:not(#iwl-l) h3 { font-size: 20px; font-weight: 800; margin-top: 28px; }
.iwl-lesson:not(#iwl-l) h2::after { content: ""; display: block; width: 56px; height: 5px; margin-top: 10px; border-radius: 3px; background: var(--iwl-coral); }
.iwl-lesson:not(#iwl-l) a { color: var(--iwl-navy); font-weight: 700; text-decoration: underline; text-decoration-color: var(--iwl-coral); text-underline-offset: 3px; }
.iwl-lesson:not(#iwl-l) a:hover { color: var(--iwl-coral-hover); }
.iwl-lesson:not(#iwl-l) strong { font-weight: 800; color: var(--iwl-navy); }
.iwl-lesson:not(#iwl-l) > :first-child { margin-top: 0; }

/* Surlignage façon feutre */
.iwl-lesson:not(#iwl-l) .iwl-mark { padding: 0 4px; border-radius: 4px; background: linear-gradient(transparent 55%, var(--iwl-yellow) 55%); }
.iwl-lesson:not(#iwl-l) .iwl-mark--pink { background: linear-gradient(transparent 55%, var(--iwl-pink) 55%); }
.iwl-lesson:not(#iwl-l) .iwl-mark--teal { background: linear-gradient(transparent 55%, #BFE3DF 55%); }

/* Annotation manuscrite */
.iwl-lesson:not(#iwl-l) .iwl-note { font-family: var(--iwl-hand); font-size: 24px; line-height: 1.3; color: var(--iwl-purple); margin: 6px 0 18px; }

/* Touches clavier */
.iwl-lesson:not(#iwl-l) kbd {
  display: inline-block; min-width: 1.9em; padding: 1px 8px; margin: 0 2px;
  font-family: var(--iwl-title); font-size: 0.8em; font-weight: 700; text-align: center;
  color: var(--iwl-navy); background: var(--iwl-white);
  border: 1px solid #CFC7B8; border-bottom-width: 3px; border-radius: 6px;
}

/* ---------- En-tête de leçon ---------- */
.iwl-lesson:not(#iwl-l) .iwl-lesson__head { padding: 26px 26px 22px; margin-bottom: 30px; background: var(--iwl-cream); border: 1px solid var(--iwl-line); border-radius: var(--iwl-radius); }
.iwl-lesson:not(#iwl-l) .iwl-kicker { display: inline-block; margin: 0 0 12px; padding: 4px 12px; font-family: var(--iwl-title); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--iwl-navy-dark); background: var(--iwl-yellow); border-radius: 999px; }
.iwl-lesson:not(#iwl-l) .iwl-lead { font-size: 19px; font-weight: 600; margin-bottom: 18px; }
.iwl-lesson:not(#iwl-l) .iwl-meta { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.iwl-lesson:not(#iwl-l) .iwl-meta li { margin: 0; padding: 5px 12px; font-size: 14px; font-weight: 700; color: var(--iwl-navy); background: var(--iwl-white); border: 1px solid var(--iwl-line); border-radius: 999px; }

/* ---------- Objectifs ---------- */
.iwl-lesson:not(#iwl-l) .iwl-goals { padding: 22px 24px; margin: 0 0 28px; border-left: 6px solid var(--iwl-teal); background: #EEF7F6; border-radius: 0 var(--iwl-radius) var(--iwl-radius) 0; }
.iwl-lesson:not(#iwl-l) .iwl-goals h2 { margin: 0 0 10px; font-size: 18px; }
.iwl-lesson:not(#iwl-l) .iwl-goals h2::after { display: none; }
.iwl-lesson:not(#iwl-l) .iwl-goals ul { list-style: none; padding: 0; margin: 0; }
.iwl-lesson:not(#iwl-l) .iwl-goals li { position: relative; padding-left: 30px; margin-bottom: 8px; }
.iwl-lesson:not(#iwl-l) .iwl-goals li::before { content: "✓"; position: absolute; left: 0; top: 1px; width: 21px; height: 21px; font-size: 13px; font-weight: 900; line-height: 21px; text-align: center; color: var(--iwl-white); background: var(--iwl-teal); border-radius: 50%; }

/* ---------- Étapes numérotées ---------- */
.iwl-lesson:not(#iwl-l) .iwl-steps { list-style: none; counter-reset: iwl-step; padding: 0; margin: 0 0 24px; }
.iwl-lesson:not(#iwl-l) .iwl-steps > li { counter-increment: iwl-step; position: relative; padding: 14px 16px 14px 62px; margin-bottom: 10px; background: var(--iwl-cream); border: 1px solid var(--iwl-line); border-radius: 12px; }
.iwl-lesson:not(#iwl-l) .iwl-steps > li::before { content: counter(iwl-step); position: absolute; left: 14px; top: 12px; width: 34px; height: 34px; font-family: var(--iwl-title); font-weight: 900; line-height: 34px; text-align: center; color: var(--iwl-navy-dark); background: var(--iwl-coral); border-radius: 50%; }

/* ---------- Encadrés ---------- */
.iwl-lesson:not(#iwl-l) .iwl-callout { padding: 18px 22px; margin: 0 0 24px; border-radius: var(--iwl-radius); border: 2px solid; }
.iwl-lesson:not(#iwl-l) .iwl-callout > :last-child { margin-bottom: 0; }
.iwl-lesson:not(#iwl-l) .iwl-callout__title { margin: 0 0 6px; font-family: var(--iwl-title); font-size: 14px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.iwl-lesson:not(#iwl-l) .iwl-callout--tip  { background: #EEF7F6; border-color: var(--iwl-teal); }
.iwl-lesson:not(#iwl-l) .iwl-callout--warn { background: #FFF0EE; border-color: var(--iwl-coral); }
.iwl-lesson:not(#iwl-l) .iwl-callout--key  { background: #FFF6E4; border-color: var(--iwl-yellow); }
.iwl-lesson:not(#iwl-l) .iwl-callout--tip  .iwl-callout__title { color: #1F6E67; }
.iwl-lesson:not(#iwl-l) .iwl-callout--warn .iwl-callout__title { color: #B23A31; }
.iwl-lesson:not(#iwl-l) .iwl-callout--key  .iwl-callout__title { color: #8A5A00; }

/* ---------- Image / capture d'écran ---------- */
.iwl-lesson:not(#iwl-l) .iwl-figure { margin: 0 0 26px; padding: 10px; background: var(--iwl-white); border: 1px solid var(--iwl-line); border-radius: var(--iwl-radius); box-shadow: 0 6px 20px rgba(23, 45, 123, 0.08); }
.iwl-lesson:not(#iwl-l) .iwl-figure img { display: block; width: 100%; height: auto; border-radius: 10px; }
.iwl-lesson:not(#iwl-l) .iwl-figure figcaption { padding: 10px 6px 2px; font-size: 14px; color: var(--iwl-muted); }

/* ---------- Tableau ---------- */
.iwl-lesson:not(#iwl-l) .iwl-table { overflow-x: auto; margin: 0 0 26px; border: 1px solid var(--iwl-line); border-radius: var(--iwl-radius); }
.iwl-lesson:not(#iwl-l) .iwl-table table { width: 100%; margin: 0; border-collapse: collapse; font-size: 15px; }
.iwl-lesson:not(#iwl-l) .iwl-table th { padding: 12px 14px; font-family: var(--iwl-title); font-weight: 800; text-align: left; color: var(--iwl-white); background: var(--iwl-navy); border: 0; }
.iwl-lesson:not(#iwl-l) .iwl-table td { padding: 11px 14px; vertical-align: top; color: var(--iwl-ink); border: 0; border-top: 1px solid var(--iwl-line); }
.iwl-lesson:not(#iwl-l) .iwl-table tr:nth-child(even) td { background: var(--iwl-cream); }

/* ---------- Exercice ---------- */
.iwl-lesson:not(#iwl-l) .iwl-exercise { position: relative; padding: 24px 24px 18px; margin: 34px 0 26px; background: var(--iwl-cream); border: 2px dashed var(--iwl-purple); border-radius: var(--iwl-radius); }
.iwl-lesson:not(#iwl-l) .iwl-exercise h2 { margin-top: 0; font-size: 22px; }
.iwl-lesson:not(#iwl-l) .iwl-exercise h2::after { background: var(--iwl-purple); }

/* ---------- Auto-évaluation (questions dépliables) ---------- */
.iwl-lesson:not(#iwl-l) .iwl-check { margin: 0 0 10px; background: var(--iwl-white); border: 1px solid var(--iwl-line); border-radius: 12px; }
.iwl-lesson:not(#iwl-l) .iwl-check summary { cursor: pointer; list-style: none; position: relative; padding: 14px 50px 14px 18px; font-family: var(--iwl-title); font-size: 16px; font-weight: 800; color: var(--iwl-navy); }
.iwl-lesson:not(#iwl-l) .iwl-check summary::-webkit-details-marker { display: none; }
.iwl-lesson:not(#iwl-l) .iwl-check summary::after { content: "+"; position: absolute; right: 16px; top: 50%; width: 26px; height: 26px; margin-top: -13px; font-size: 18px; line-height: 26px; text-align: center; color: var(--iwl-navy-dark); background: var(--iwl-yellow); border-radius: 50%; }
.iwl-lesson:not(#iwl-l) .iwl-check[open] summary::after { content: "–"; }
.iwl-lesson:not(#iwl-l) .iwl-check summary:focus-visible { outline: 3px solid var(--iwl-coral); outline-offset: 2px; border-radius: 12px; }
.iwl-lesson:not(#iwl-l) .iwl-check p { padding: 0 18px 14px; margin: 0; }

/* ---------- Récapitulatif ---------- */
.iwl-lesson:not(#iwl-l) .iwl-recap { padding: 26px 26px 18px; margin: 36px 0 0; background: var(--iwl-navy); border-radius: var(--iwl-radius); }
.iwl-lesson:not(#iwl-l) .iwl-recap h2 { margin-top: 0; color: var(--iwl-white); font-size: 22px; }
.iwl-lesson:not(#iwl-l) .iwl-recap h2::after { background: var(--iwl-yellow); }
.iwl-lesson:not(#iwl-l) .iwl-recap p,
.iwl-lesson:not(#iwl-l) .iwl-recap li { color: #E8ECF8; }
.iwl-lesson:not(#iwl-l) .iwl-recap strong { color: var(--iwl-yellow); }
.iwl-lesson:not(#iwl-l) .iwl-recap ul li::marker { color: var(--iwl-yellow); }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .iwl-lesson:not(#iwl-l) { padding: 22px 16px; border-radius: 0; }
  .iwl-lesson:not(#iwl-l) p, .iwl-lesson:not(#iwl-l) li { font-size: 16px; }
  .iwl-lesson:not(#iwl-l) h2 { font-size: 22px; }
  .iwl-lesson:not(#iwl-l) .iwl-lesson__head, .iwl-lesson:not(#iwl-l) .iwl-recap, .iwl-lesson:not(#iwl-l) .iwl-exercise { padding: 20px 16px 14px; }
  .iwl-lesson:not(#iwl-l) .iwl-steps > li { padding-left: 56px; }
}

/* ==========================================================================
   Composants complémentaires (cours techniques : code, quiz, sommaire)
   ========================================================================== */
.iwl-lesson:not(#iwl-l) ol { padding-left: 24px; margin: 0 0 16px; }
.iwl-lesson:not(#iwl-l) ol li::marker { color: var(--iwl-navy); font-weight: 800; }
.iwl-lesson:not(#iwl-l) em { font-style: italic; }
.iwl-lesson:not(#iwl-l) .iwl-prereq { margin: 14px 0 0; font-size: 15px; color: var(--iwl-muted); }
.iwl-lesson:not(#iwl-l) .iwl-steps ul { margin: 8px 0 0; }
.iwl-lesson:not(#iwl-l) .iwl-steps ul li { margin-bottom: 6px; }

/* Pastille numérotée (légendes de schémas) */
.iwl-lesson:not(#iwl-l) .iwl-num { display: inline-block; min-width: 26px; height: 26px; padding: 0 6px; font-family: var(--iwl-title); font-size: 13px; font-weight: 900; line-height: 26px; text-align: center; color: var(--iwl-navy-dark); background: var(--iwl-coral); border-radius: 13px; }

/* Code en ligne et blocs de code */
.iwl-lesson:not(#iwl-l) code { font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace; font-size: 0.88em; padding: 1px 6px; color: var(--iwl-navy-dark); background: var(--iwl-cream); border: 1px solid var(--iwl-line); border-radius: 5px; overflow-wrap: anywhere; }
.iwl-lesson:not(#iwl-l) .iwl-code { margin: 0 0 24px; padding: 16px 18px; overflow-x: auto; background: #141B3D; border-radius: 12px; border-left: 5px solid var(--iwl-coral); }
.iwl-lesson:not(#iwl-l) .iwl-code code { display: block; padding: 0; font-size: 14px; line-height: 1.6; color: #E8ECF8; background: none; border: 0; white-space: pre; overflow-wrap: normal; }
.iwl-lesson:not(#iwl-l) .iwl-table code { white-space: nowrap; }

/* Quiz de validation */
.iwl-lesson:not(#iwl-l) .iwl-quiz { margin: 0 0 26px; }
.iwl-lesson:not(#iwl-l) .iwl-quiz__q { padding: 20px 22px 16px; margin: 0 0 14px; background: var(--iwl-cream); border: 1px solid var(--iwl-line); border-radius: var(--iwl-radius); }
.iwl-lesson:not(#iwl-l) .iwl-quiz__q > p { margin-bottom: 12px; }
.iwl-lesson:not(#iwl-l) .iwl-options { list-style: none; counter-reset: iwl-opt; padding: 0; }
.iwl-lesson:not(#iwl-l) .iwl-options li { counter-increment: iwl-opt; position: relative; padding: 9px 14px 9px 50px; margin: 0 0 8px; background: var(--iwl-white); border: 1px solid var(--iwl-line); border-radius: 10px; }
.iwl-lesson:not(#iwl-l) .iwl-options li::before { content: counter(iwl-opt); position: absolute; left: 12px; top: 8px; width: 26px; height: 26px; font-family: var(--iwl-title); font-size: 13px; font-weight: 900; line-height: 26px; text-align: center; color: var(--iwl-navy); background: var(--iwl-cream); border: 1px solid var(--iwl-line); border-radius: 50%; }
.iwl-lesson:not(#iwl-l) .iwl-answer summary { display: inline-block; cursor: pointer; padding: 6px 16px; font-family: var(--iwl-title); font-size: 14px; font-weight: 800; color: var(--iwl-navy-dark); background: var(--iwl-yellow); border-radius: 999px; }
.iwl-lesson:not(#iwl-l) .iwl-answer summary::-webkit-details-marker { display: none; }
.iwl-lesson:not(#iwl-l) .iwl-answer summary:focus-visible { outline: 3px solid var(--iwl-coral); outline-offset: 2px; }
.iwl-lesson:not(#iwl-l) .iwl-answer p { margin: 12px 0 0; padding: 12px 16px; background: #EEF7F6; border-left: 4px solid var(--iwl-teal); border-radius: 0 10px 10px 0; }

/* Liste de contrôle */
.iwl-lesson:not(#iwl-l) .iwl-checklist { list-style: none; padding: 0; }
.iwl-lesson:not(#iwl-l) .iwl-checklist li { position: relative; padding: 10px 14px 10px 48px; margin: 0 0 8px; background: var(--iwl-cream); border-radius: 10px; }
.iwl-lesson:not(#iwl-l) .iwl-checklist li::before { content: ""; position: absolute; left: 14px; top: 13px; width: 20px; height: 20px; background: var(--iwl-white); border: 2px solid var(--iwl-teal); border-radius: 5px; }

/* Titre d'exercice en encadré */
.iwl-lesson:not(#iwl-l) .iwl-exercise .iwl-callout__title { color: var(--iwl-purple); }
.iwl-lesson:not(#iwl-l) .iwl-exercise > :last-child { margin-bottom: 0; }

/* Sommaire de cours */
.iwl-lesson:not(#iwl-l) .iwl-toc { list-style: none; counter-reset: iwl-toc -1; padding: 0; }
.iwl-lesson:not(#iwl-l) .iwl-toc > li { counter-increment: iwl-toc; position: relative; padding: 16px 18px 16px 68px; margin: 0 0 10px; background: var(--iwl-cream); border: 1px solid var(--iwl-line); border-radius: 12px; }
.iwl-lesson:not(#iwl-l) .iwl-toc > li::before { content: counter(iwl-toc, decimal-leading-zero); position: absolute; left: 16px; top: 15px; width: 38px; height: 38px; font-family: var(--iwl-title); font-size: 14px; font-weight: 900; line-height: 38px; text-align: center; color: var(--iwl-navy-dark); background: var(--iwl-yellow); border-radius: 50%; }
.iwl-lesson:not(#iwl-l) .iwl-toc strong { display: block; margin-bottom: 4px; font-family: var(--iwl-title); font-size: 17px; }
.iwl-lesson:not(#iwl-l) .iwl-toc span { display: block; font-size: 15px; color: var(--iwl-muted); }

/* Pied de leçon */
.iwl-lesson:not(#iwl-l) .iwl-footer { margin: 44px 0 0; padding-top: 14px; font-size: 13px; color: var(--iwl-muted); border-top: 1px solid var(--iwl-line); }

@media (max-width: 640px) {
  .iwl-lesson:not(#iwl-l) .iwl-quiz__q { padding: 16px 14px 12px; }
  .iwl-lesson:not(#iwl-l) .iwl-toc > li { padding-left: 60px; }
}

/* ==========================================================================
   Listes à puces simples (même puce que le lecteur de cours)
   ========================================================================== */
.iwl-lesson:not(#iwl-l) ul:not([class]) { list-style: none; padding-left: 0; margin: 0 0 16px; }
.iwl-lesson:not(#iwl-l) ul:not([class]) > li { position: relative; padding-left: 30px; margin: 0 0 8px; }
.iwl-lesson:not(#iwl-l) ul:not([class]) > li::before { content: ""; position: absolute; left: 4px; top: .55em; width: 14px; height: 14px; border-radius: 50%; background: var(--iwl-coral); box-shadow: inset 0 0 0 4px #FFE3E0; }
.iwl-lesson:not(#iwl-l) .iwl-steps ul:not([class]) { margin: 8px 0 0; }
.iwl-lesson:not(#iwl-l) .iwl-goals ul:not([class]) { margin: 0; }
.iwl-lesson:not(#iwl-l) .iwl-goals ul:not([class]) > li::before { content: "✓"; left: 0; top: 1px; width: 21px; height: 21px; font-size: 13px; font-weight: 900; line-height: 21px; text-align: center; color: var(--iwl-white); background: var(--iwl-teal); border-radius: 50%; box-shadow: none; }

/* Neutralise la puce du lecteur sur les listes de composants */
.iwl-lesson:not(#iwl-l) .iwl-meta li::before { content: none; }
.iwl-lesson:not(#iwl-l) .iwl-goals li::before,
.iwl-lesson:not(#iwl-l) .iwl-checklist li::before { box-shadow: none; }
.iwl-lesson:not(#iwl-l) .iwl-meta li,
.iwl-lesson:not(#iwl-l) .iwl-steps > li,
.iwl-lesson:not(#iwl-l) .iwl-options li,
.iwl-lesson:not(#iwl-l) .iwl-toc > li { list-style: none; }
.iwl-lesson:not(#iwl-l) .iwl-steps > li::marker,
.iwl-lesson:not(#iwl-l) .iwl-options li::marker,
.iwl-lesson:not(#iwl-l) .iwl-toc > li::marker { content: none; }

/* Tableaux : la bordure arrondie est portée par .iwl-table */
.iwl-lesson:not(#iwl-l) .iwl-table table { border: 0; border-radius: 0; overflow: visible; border-spacing: 0; }
.iwl-lesson:not(#iwl-l) .iwl-figure img { margin: 0; }

/* ==========================================================================
   Intégration dans le lecteur de cours MasterStudy
   Mode clair : la carte blanche du lecteur suffit, .iwl-lesson devient transparent.
   Mode sombre : .iwl-lesson garde sa carte blanche pour rester lisible.
   ========================================================================== */
.masterstudy-course-player-content:not(.masterstudy-course-player-content_dark-mode) .masterstudy-course-player-lesson .iwl-lesson:not(#iwl-l) {
  max-width: none;
  padding: 0;
  background: transparent;
  border-radius: 0;
}
.masterstudy-course-player-content_dark-mode .masterstudy-course-player-lesson .iwl-lesson:not(#iwl-l) { max-width: none; }
