/* =====================================================================
   fiche.css — la mise en page des documents (leçons, exercices, évaluations)
   Ce fichier sert à la fois dans l'éditeur ET pour fabriquer le PDF :
   ce qu'on voit à l'écran est donc ce qui sera imprimé.
   ===================================================================== */

/* ---------- Polices ---------- */
@font-face { font-family: "Poppins"; font-weight: 400; src: url("../fonts/poppins-latin-400-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Poppins"; font-weight: 400; font-style: italic; src: url("../fonts/poppins-latin-400-italic.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Poppins"; font-weight: 500; src: url("../fonts/poppins-latin-500-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Poppins"; font-weight: 600; src: url("../fonts/poppins-latin-600-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Poppins"; font-weight: 700; src: url("../fonts/poppins-latin-700-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Londrina Solid"; font-weight: 400; src: url("../fonts/londrina-solid-latin-400-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Londrina Solid"; font-weight: 900; src: url("../fonts/londrina-solid-latin-900-normal.woff2") format("woff2"); font-display: swap; }

/* ---------- Couleurs et tailles ---------- */
.fiche {
  --bleu: #1ea0e6;        /* bleu vif : titres, filets */
  --bleu-fonce: #0b72b5;  /* bleu foncé : mots-clés */
  --bleu-clair: #e6f3fc;  /* fond des encadrés bleus */
  --orange: #f5921e;
  --creme: #fdf1de;       /* fond des encadrés orange */
  --noir: #1b1b1b;
  --gris: #777;
  --trait: #dcdcdc;

  font-family: "Poppins", Arial, sans-serif;
  font-size: 11.5pt;
  line-height: 1.55;
  color: var(--noir);
  width: 180mm;            /* A4 (210 mm) moins les marges */
  box-sizing: border-box;
}
.fiche.paysage { width: 267mm; }
.fiche *, .fiche *::before, .fiche *::after { box-sizing: border-box; }

/* Option « confort de lecture » (dys) : texte plus gros, plus aéré */
.fiche.confort { font-size: 13.5pt; line-height: 1.8; letter-spacing: .02em; word-spacing: .12em; }

/* ---------- Texte courant ---------- */
.fiche p { margin: 0 0 3.5mm; }
.fiche > p, .fiche > ul, .fiche > ol { margin-bottom: 8mm; }
.fiche ul, .fiche ol { margin: 0 0 3mm; padding-left: 6mm; }
.fiche li { margin-bottom: 1.2mm; }
.fiche .cle { color: var(--bleu-fonce); font-weight: 700; }      /* mot-clé */
.fiche mark { background: #fff1a8; padding: 0 .15em; border-radius: 2px; }
.fiche a { color: var(--bleu-fonce); }
.fiche .petit { font-size: .82em; color: var(--gris); }

/* ---------- En-tête du document ---------- */
.fiche .entete {
  display: flex; align-items: center; gap: 7mm;
  border: 0.55mm solid var(--noir); border-bottom: 1.4mm solid var(--bleu);
  border-radius: 3mm; padding: 8mm 10mm 10mm; margin-bottom: 14mm;
}
.fiche .entete img.logo { width: 38mm; height: auto; flex: none; }
.fiche .entete .titres { flex: 1; min-width: 0; }
.fiche .surtitre {
  display: inline-block; font-family: "Londrina Solid", sans-serif; font-size: 12pt; letter-spacing: .06em;
  text-transform: uppercase; border: 0.45mm solid var(--noir); border-radius: 1mm; padding: .2mm 3mm;
  box-shadow: .8mm .8mm 0 var(--orange); margin-bottom: 2.5mm;
}
.fiche h1 {
  font-family: "Londrina Solid", sans-serif; font-weight: 900; font-size: 30pt; line-height: 1.05;
  text-transform: uppercase; margin: 0; padding-bottom: 3.5mm; position: relative;
}
.fiche h1::after { content: ""; position: absolute; left: 0; bottom: 0; width: 32mm; height: 1mm; border-radius: 1mm; background: var(--orange); }
.fiche h1.long { font-size: 23pt; }      /* titre long : écrit plus petit */
.fiche .bleu { color: var(--bleu); }
.fiche .orange { color: var(--orange); }

/* ---------- Titres de parties ---------- */
.fiche h2 {
  font-family: "Londrina Solid", sans-serif; font-weight: 900; font-size: 19pt; line-height: 1.15;
  text-transform: uppercase; margin: 12mm 0 5mm; display: flex; align-items: center; gap: 3mm;
  break-after: avoid; break-inside: avoid;
}
.fiche h2 .num {
  flex: none; min-width: 8.5mm; height: 8.5mm; padding: 0 1.5mm; border-radius: 1.4mm;
  background: var(--orange); border: 0.35mm solid #c96f08; box-shadow: .6mm .6mm 0 var(--noir);
  display: inline-flex; align-items: center; justify-content: center; font-size: 16pt;
}
.fiche h3 { font-size: 13pt; font-weight: 700; margin: 8mm 0 4mm; break-after: avoid; }
.fiche h3 .lettre, .fiche .q-num { color: var(--bleu-fonce); }
.fiche .pts {
  margin-left: auto; font-family: "Poppins", sans-serif; font-size: 8.5pt; font-weight: 700; text-transform: none;
  color: #b8690a; background: var(--creme); border: 0.3mm solid var(--orange); border-radius: 4mm; padding: .3mm 3mm;
}

/* ---------- Encadrés ---------- */
.fiche .encadre { border-radius: 2mm; padding: 4.5mm 5.5mm; margin: 0 0 9mm; break-inside: avoid; }
.fiche .encadre > :last-child { margin-bottom: 0; }
.fiche .encadre-titre {
  font-family: "Londrina Solid", sans-serif; font-size: 14pt; letter-spacing: .05em; text-transform: uppercase;
  margin: 0 0 1.5mm; color: var(--bleu-fonce);
}
/* Le petit « plus » est dessiné en CSS (deux barres croisées), pas avec un caractère */
.fiche .encadre-titre::before, .fiche .consigne::before, .fiche .encadre li::before {
  content: ""; display: inline-block; width: .72em; height: .72em; margin-right: .5em; color: var(--bleu);
  background: linear-gradient(currentColor, currentColor) center / 100% 32% no-repeat, linear-gradient(currentColor, currentColor) center / 32% 100% no-repeat;
}
.fiche .probleme, .fiche .consigne, .fiche .info { background: var(--bleu-clair); }
.fiche .consigne { padding: 2.2mm 5mm; font-weight: 600; margin-bottom: 4mm; }
.fiche .retenir { background: var(--bleu-clair); border: 0.5mm solid var(--bleu); }
.fiche .exemple { border: 0.55mm solid var(--noir); }
.fiche .exemple .encadre-titre { color: var(--noir); }
.fiche .exemple .encadre-titre::before, .fiche .essentiel .encadre-titre::before { color: var(--orange); }
.fiche .essentiel, .fiche .methode { background: var(--creme); border: 0.3mm solid #f3c98c; border-bottom-width: .7mm; }
.fiche .essentiel .encadre-titre, .fiche .methode .encadre-titre { color: #c06d08; }
.fiche .methode .encadre-titre::before { display: none; }
.fiche .essentiel ul, .fiche .methode ul, .fiche .info ul { list-style: none; padding-left: 5mm; }
.fiche .essentiel li::before, .fiche .methode li::before, .fiche .info li::before { color: var(--orange); font-size: .75em; margin-left: -5mm; margin-right: 2.5mm; }

/* ---------- Cartes de vocabulaire ---------- */
.fiche .mots { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5mm; margin-bottom: 9mm; }
.fiche .mot { border: 0.3mm solid var(--trait); border-bottom-width: .6mm; border-radius: 2mm; padding: 2.5mm 3.5mm; break-inside: avoid; }
.fiche .mot strong { display: block; color: var(--bleu-fonce); margin-bottom: 1mm; }
.fiche .mot p { margin: 0; font-size: .95em; }

/* ---------- Chiffres clés ---------- */
.fiche .chiffres { display: flex; flex-wrap: wrap; gap: 3mm; margin-bottom: 9mm; }
.fiche .chiffre { background: var(--bleu-clair); border-radius: 2mm; padding: 3mm 4mm; width: 56mm; break-inside: avoid; }
.fiche .chiffre strong { display: block; font-family: "Londrina Solid", sans-serif; font-weight: 900; font-size: 19pt; line-height: 1.1; color: var(--bleu-fonce); margin-bottom: 1mm; }
.fiche .chiffre p { margin: 0; font-size: .85em; line-height: 1.4; }

/* ---------- Schéma en étapes ---------- */
.fiche .schema { display: flex; align-items: stretch; gap: 9mm; }
.fiche .etape {
  flex: 1; border: 0.55mm solid var(--noir); border-radius: 1.6mm; background: #fff; padding: 3mm 2mm;
  text-align: center; font-weight: 600; font-size: .92em; display: flex; align-items: center; justify-content: center; position: relative;
}
.fiche .etape + .etape::before {   /* flèche orange entre deux étapes */
  content: ""; position: absolute; left: -6.5mm; top: 50%; width: 3mm; height: 3mm; margin-top: -1.5mm;
  border-top: 0.5mm solid var(--orange); border-right: 0.5mm solid var(--orange); transform: rotate(45deg);
}

/* ---------- Repères à localiser ---------- */
.fiche .reperes { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5mm 8mm; margin-bottom: 7mm; }
.fiche .repere { margin: 0; padding-left: 6mm; position: relative; font-size: .93em; break-inside: avoid; }
.fiche .repere::before { content: ""; position: absolute; left: 0; top: .35em; width: 3mm; height: 3mm; border-radius: 50%; border: 0.9mm solid var(--orange); }

/* ---------- Images, cartes et documents ---------- */
.fiche figure { margin: 0 0 9mm; break-inside: avoid; }
.fiche figure img { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 1.5mm; }
.fiche figure.cadre img { border: 0.55mm solid var(--noir); }
.fiche figcaption { font-size: .8em; color: var(--gris); margin-top: 2mm; }
.fiche .titre-carte { font-weight: 700; margin: 0 0 2mm; }
.fiche .doc { border: 0.55mm solid var(--noir); border-radius: 2mm; padding: 4mm 5mm; margin-bottom: 6mm; break-inside: avoid; }
.fiche .doc-titre { font-weight: 700; margin: 0 0 1mm; }
.fiche .doc-num { display: inline-block; border: 0.4mm solid var(--noir); border-radius: 1mm; font-size: .8em; padding: 0 2mm; margin-right: 2.5mm; }
.fiche .doc-nature, .fiche .source { font-size: .8em; color: var(--gris); margin: 0 0 2.5mm; }
.fiche .source { margin: 2.5mm 0 0; }

/* ---------- Tableaux ---------- */
.fiche table { width: 100%; border-collapse: collapse; margin: 0 0 4mm; font-size: .92em; }
.fiche th { text-align: left; font-weight: 700; border-top: 0.5mm solid var(--noir); border-bottom: 0.4mm solid var(--noir); padding: 2.5mm; vertical-align: bottom; }
.fiche td { padding: 2.2mm 2.5mm; border-bottom: 0.25mm solid var(--trait); vertical-align: middle; }
.fiche tbody tr:nth-child(even) td { background: var(--bleu-clair); }
.fiche td.centre, .fiche th.centre { text-align: center; }

/* ---------- Exercices ---------- */
.fiche .case {                                   /* case à cocher (un clic dans l'éditeur la coche) */
  display: inline-block; width: 3.4mm; height: 3.4mm; border: 0.4mm solid var(--noir); border-radius: .6mm;
  vertical-align: -0.4mm; margin-right: 1.5mm; background: #fff; cursor: pointer; position: relative;
}
.fiche .case.coche { background: var(--bleu); border-color: var(--bleu-fonce); }
.fiche .case.coche::after { content: ""; position: absolute; left: .85mm; top: .1mm; width: 1mm; height: 1.9mm; border-right: 0.45mm solid #fff; border-bottom: 0.45mm solid #fff; transform: rotate(40deg); }
.fiche .question { font-weight: 600; margin: 5mm 0 2mm; padding-top: 3mm; border-top: 0.25mm dotted #bbb; break-after: avoid; }
.fiche .question:first-of-type { border-top: 0; padding-top: 0; }
.fiche ul.choix { list-style: none; padding-left: 3mm; margin-bottom: 4mm; break-inside: avoid; }
.fiche ul.choix li { margin-bottom: 1.6mm; }
.fiche ul.choix b { color: var(--bleu-fonce); margin-right: 1.5mm; }
.fiche .vf { display: flex; align-items: center; gap: 5mm; padding: 2.5mm 3mm; border-radius: 1.5mm; margin: 0; break-inside: avoid; }
.fiche .vf:nth-of-type(even) { background: var(--bleu-clair); }
.fiche .vf .texte { flex: 1; }
.fiche .vf .rep { flex: none; font-weight: 600; white-space: nowrap; }
/* break-inside: avoid = ne pas couper ce bloc entre deux pages */
.fiche .banque { break-inside: avoid; background: var(--creme); border: 0.3mm dashed var(--orange); border-radius: 2mm; padding: 3mm 4mm; margin-bottom: 4mm; display: flex; flex-wrap: wrap; gap: 2.5mm; }
.fiche .banque span { background: #fff; border: 0.3mm solid var(--orange); border-radius: 4mm; padding: .3mm 4mm; font-weight: 600; font-size: .92em; }
.fiche .trous { line-height: 2.5; }
.fiche .trou { display: inline-block; min-width: 28mm; border-bottom: 0.35mm solid var(--noir); margin: 0 1.5mm; text-align: center; color: var(--bleu-fonce); font-weight: 600; line-height: 1.3; }
.fiche table.relier td { border: 0; background: none !important; padding: 1.2mm 0; }
.fiche table.relier td:first-child { width: 34%; }
.fiche table.relier tr { break-inside: avoid; }
.fiche table.relier .boite { border: 0.3mm solid var(--trait); border-bottom-width: .6mm; border-radius: 1.5mm; padding: 2mm 3mm; }
.fiche table.relier .point { width: 16mm; height: 8mm; background: radial-gradient(circle, var(--noir) 0 1mm, transparent 1.1mm) 25% 50% / 50% 100% no-repeat, radial-gradient(circle, var(--noir) 0 1mm, transparent 1.1mm) 75% 50% / 50% 100% no-repeat !important; }

/* Lignes pour écrire la réponse */
.fiche .lignes {
  height: 28mm; margin: 0 0 6mm; break-inside: avoid;
  /* un petit dessin (un trait gris en bas d'une bande de 7 mm) répété de haut en bas */
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='70' preserveAspectRatio='none'%3E%3Crect y='67.5' width='10' height='2.5' fill='%23bdbdbd'/%3E%3C/svg%3E") repeat-y;
  background-size: 100% 7mm;
}
.fiche .reponse { color: var(--bleu-fonce); border-left: 0.8mm solid var(--bleu); padding-left: 3mm; margin-bottom: 5mm; } /* corrigé */

/* ---------- Évaluations ---------- */
.fiche .identite { display: flex; gap: 3mm; margin-bottom: 8mm; }
.fiche .identite .champs { flex: 1; border: 0.4mm solid var(--noir); border-radius: 2mm; padding: 2.5mm 4mm; display: grid; grid-template-columns: 1fr 1fr; gap: 1mm 6mm; font-size: .85em; }
.fiche .identite .champs span::after { content: " : ………………………………………"; color: #999; }
.fiche .identite .note { border: 0.4mm solid var(--noir); border-radius: 2mm; padding: 2mm 4mm; text-align: center; font-weight: 700; font-size: .85em; }
.fiche .partie-eval {
  display: flex; align-items: center; border: 0.5mm solid var(--noir); border-radius: 1.5mm; padding: 1mm 4mm; margin: 8mm 0 4mm;
  font-family: "Londrina Solid", sans-serif; font-weight: 900; font-size: 13pt; text-transform: uppercase; break-after: avoid;
}
.fiche .partie-eval .pts { background: var(--orange); color: var(--noir); border-color: #c96f08; font-family: "Londrina Solid", sans-serif; text-transform: uppercase; }

/* ---------- Saut de page forcé ---------- */
.fiche .saut-page { break-after: page; height: 0; border: 0; margin: 0; }

/* ---------- Impression / PDF ---------- */
@page { size: A4; margin: 13mm 15mm 20mm; }
@media print {
  body { margin: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .fiche h2, .fiche h3 { break-after: avoid; }
  .fiche p { orphans: 3; widows: 3; }
}

/* =====================================================================
   COMPLÉMENTS : corrigés, carte mentale, croquis, conformité au programme
   ===================================================================== */

/* ---------- Corrigés (en vert) ---------- */
.fiche { --vert: #2e8b57; --vert-clair: #dcefe2; }
.fiche .corrige { background: var(--vert-clair); border-radius: 1.5mm; padding: 3mm 4mm; margin: 0 0 6mm; font-size: .93em; break-inside: avoid; }
.fiche .corrige > :last-child { margin-bottom: 0; }
.fiche .corrige.titre { border-left: 1mm solid var(--vert); }
.fiche .corrige.titre::before { content: "Corrigé"; display: block; font-family: "Londrina Solid", sans-serif; text-transform: uppercase; letter-spacing: .05em; color: var(--vert); font-size: 1.05em; margin-bottom: 1mm; }
.fiche .case.coche { background: var(--vert); border-color: #1f6b41; }
.fiche ul.choix li.bon { background: var(--vert-clair); border-radius: 1mm; }
.fiche .vf .corrige { margin: 2mm 0 0; }
.fiche .rep-case { display: inline-block; min-width: 6mm; height: 6mm; line-height: 5.4mm; text-align: center; border: 0.4mm solid var(--bleu); border-radius: 1mm; color: var(--bleu-fonce); font-weight: 700; margin: 0 3mm 0 1mm; }

/* ---------- Petites étiquettes (notions du programme, état « Couvert ») ---------- */
.fiche .notions { display: flex; flex-wrap: wrap; gap: 2mm; margin-bottom: 7mm; }
.fiche .notions span { background: var(--bleu-clair); color: var(--bleu-fonce); font-weight: 600; font-size: .9em; border-radius: 4mm; padding: .4mm 3.5mm; }
.fiche .etat { display: inline-block; background: var(--vert-clair); color: var(--vert); font-weight: 700; font-size: .85em; border-radius: 4mm; padding: .2mm 3mm; white-space: nowrap; }
.fiche .etat.partiel { background: var(--creme); color: #b8690a; }

/* ---------- Chiffres clés sur plusieurs colonnes (dans un document) ---------- */
.fiche .chiffres.grille { display: grid; grid-template-columns: repeat(4, 1fr); }
.fiche .chiffres.grille.trois { grid-template-columns: repeat(3, 1fr); }
.fiche .chiffres.grille .chiffre { width: auto; }
.fiche .doc > :last-child { margin-bottom: 0; }
.fiche .doc { break-inside: auto; }                /* un long document peut continuer page suivante */
.fiche .temoignage p { font-style: normal; }

/* ---------- Format paysage (carte mentale, croquis) : en-tête plus compact ---------- */
.fiche.paysage .entete { padding: 4mm 8mm 5mm; margin-bottom: 5mm; }
.fiche.paysage .entete img.logo { width: 26mm; }
.fiche.paysage h1, .fiche.paysage h1.long { font-size: 20pt; padding-bottom: 2.5mm; }
.fiche .croquis img { width: 100%; }
.fiche .croquis { margin-bottom: 3mm; }

/* ---------- Carte mentale ----------
   Trois colonnes : branches de gauche | sujet au centre | branches de droite.
   Chaque branche a sa couleur (style="--c: #2e9e6b"). */
.fiche .carte-mentale { display: grid; grid-template-columns: 1fr 34mm 1fr; align-items: center; gap: 7mm; }
.fiche .cm-centre { border: 0.7mm solid var(--noir); border-radius: 2.5mm; box-shadow: 1mm 1mm 0 var(--orange); padding: 5mm 2mm; text-align: center; font-family: "Londrina Solid", sans-serif; font-weight: 900; font-size: 13pt; line-height: 1.15; text-transform: uppercase; background: #fff; }
.fiche .cm-cote { display: flex; flex-direction: column; gap: 4mm; }
.fiche .cm-branche { --c: var(--bleu); display: flex; align-items: center; gap: 4mm; }
.fiche .cm-cote.gauche .cm-branche { flex-direction: row-reverse; }
.fiche .cm-titre { flex: none; width: 30mm; background: var(--c); color: #fff; border-radius: 2mm; padding: 2mm; text-align: center; font-family: "Londrina Solid", sans-serif; font-size: 10.5pt; line-height: 1.15; letter-spacing: .04em; text-transform: uppercase; }
.fiche .cm-noeuds { flex: 1; display: flex; flex-direction: column; gap: 1.2mm; padding: 1mm 0 1mm 3mm; border-left: 0.6mm solid var(--c); border-radius: 2mm 0 0 2mm; }
.fiche .cm-cote.gauche .cm-noeuds { padding: 1mm 3mm 1mm 0; border-left: 0; border-right: 0.6mm solid var(--c); border-radius: 0 2mm 2mm 0; }
.fiche .cm-noeud { border: 0.45mm solid var(--c); border-radius: 1.6mm; padding: .8mm 2mm; font-size: 8.5pt; line-height: 1.3; font-weight: 600; background: #fff; }
.fiche .cm-noeud span { display: inline-block; font-weight: 400; background: color-mix(in srgb, var(--c) 14%, #fff); border-radius: 1mm; padding: 0 1.5mm; margin: .4mm 1mm .4mm 0; }

/* ---------- Derniers compléments ---------- */
.fiche td.droite, .fiche th.droite { text-align: right; }
.fiche td { vertical-align: top; }
.fiche .alerte { background: var(--creme); border: 0.3mm solid var(--orange); color: #9a5a06; font-size: .93em; }   /* avertissement */
.fiche .doc-titre, .fiche .doc-nature, .fiche .titre-carte { break-after: avoid; }
.fiche .lien { color: var(--bleu-fonce); }

/* Graphique en barres, dessiné en CSS : chaque barre a sa hauteur en % (style="--h: 60") */
.fiche .barres { display: flex; align-items: flex-end; gap: 3mm; height: 52mm; border-bottom: 0.4mm solid var(--noir); margin: 9mm 0 12mm; padding: 0 2mm; break-inside: avoid; }
.fiche .barre { flex: 1; height: calc(var(--h) * 1%); min-height: .6mm; background: var(--bleu); border-radius: 1mm 1mm 0 0; position: relative; }
.fiche .barre b { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 1mm; text-align: center; font-size: .85em; }
.fiche .barre span { position: absolute; left: -2mm; right: -2mm; top: 100%; margin-top: 1.5mm; text-align: center; font-size: .72em; line-height: 1.2; }
.fiche .barre.fort { background: var(--orange); }
