/* ==================================================================
   BAC — la version A4 d'un cours (page /cours-imprimer/…)
   A l'ecran : une feuille A4 centree et la barre d'outils. A
   l'impression : la feuille seule, sur toute la largeur utile, chaque
   partie sur une nouvelle page, numerotation en pied de page.
   ================================================================== */

@page {
  size: A4;
  margin: 13mm 12mm 15mm;
  @bottom-right { content: counter(page) " / " counter(pages); font: 8pt var(--police); color: var(--texte-3); }
  @bottom-left { content: "Bac · bac.propagatom.com"; font: 8pt var(--police); color: var(--texte-3); }
}

.a4-corps { margin: 0; background: var(--fond); color: var(--encre); font-family: var(--police); }
.a4-outils {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--bord); font-size: .9rem;
}
.a4-outils p { margin: 0; color: var(--texte-3); }
.a4-outils a { color: var(--texte-2); }
.a4-outils button {
  min-height: 40px; padding: 8px 16px; border: 0; border-radius: var(--rayon-petit); background: var(--accent);
  color: var(--accent-encre); font: inherit; font-weight: 600; cursor: pointer;
}

/* La feuille : 210 mm de large a l'ecran, toute la largeur a l'impression. */
.a4-feuille.cours {
  box-sizing: border-box; max-width: 210mm; margin: 24px auto; padding: 14mm 12mm; background: var(--blanc);
  box-shadow: var(--ombre-haute); font-family: var(--police-cours, var(--police)); font-size: 10.5pt; line-height: 1.45;
}
@media (max-width: 800px) { .a4-feuille.cours { margin: 0; padding: 16px; box-shadow: none; } }

.a4-entete { border-bottom: 2px solid var(--c); padding-bottom: 6mm; margin-bottom: 6mm; }
.a4-sur-titre { margin: 0; font-family: var(--police); font-size: 9pt; text-transform: uppercase; letter-spacing: .08em; color: var(--texte-3); }
.a4-entete h1 { margin: 2mm 0; font-size: 22pt; color: var(--c); }
.a4-resume { margin: 0; color: var(--texte-2); }
.a4-titre { font-size: 15pt; }
.a4-consigne { font-family: var(--police); font-size: 9pt; color: var(--texte-3); }
.a4-feuille.cours h2 { margin-top: 7mm; }
.a4-feuille.cours h2:first-child, .a4-cours > h2:first-child { margin-top: 0; }
.a4-feuille.cours table { min-width: 0; font-size: 9.5pt; }
.a4-feuille.cours .table-wrap { overflow: visible; }
.a4-feuille.cours .formula .eq { font-size: 13pt; }

/* Fiches : deux colonnes */
.a4-fiches { grid-template-columns: 1fr 1fr; gap: 5mm; }

/* Cartes a decouper : deux par ligne, pointilles de decoupe et de pliage */
.a4-cartes { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px dashed var(--bord-fort); border-left: 1px dashed var(--bord-fort); }
.a4-carte { display: grid; grid-template-rows: 1fr 1fr; min-height: 52mm; border-right: 1px dashed var(--bord-fort); border-bottom: 1px dashed var(--bord-fort); }
.a4-recto, .a4-verso { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 3mm 4mm; }
.a4-recto { font-weight: 600; }
.a4-recto .carte-k { font-weight: 400; font-size: 8pt; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 1mm; }
.a4-verso { border-top: 1px dotted var(--texte-3); }

/* Quiz a cocher */
.a4-quiz { padding-left: 6mm; }
.a4-quiz > li { margin-bottom: 4mm; }
.a4-question { margin: 0 0 1.5mm; font-weight: 600; }
.a4-options { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1mm 6mm; }
.a4-case { display: inline-block; width: 3.2mm; height: 3.2mm; border: 1px solid var(--encre); border-radius: 1px; margin-right: 1.5mm; vertical-align: -0.4mm; }
.a4-corrige { columns: 2; column-gap: 8mm; }
.a4-corrige li { break-inside: avoid; margin-bottom: 2mm; }

/* Exercices et corrections */
.a4-feuille .exo { box-shadow: none; }
.a4-correction { margin-top: 4mm; padding: 3mm 4mm; border-left: 3px solid var(--vert-cours); background: var(--vert-cours-doux); }
.a4-correction h4 { margin: 0 0 2mm; color: var(--vert-cours); }
.bilan-atelier .carte { box-shadow: none; border: 0; padding: 0; margin: 0 0 6mm; }
.bilan-atelier details { display: block; }

@media print {
  .a4-corps { background: none; }
  .a4-outils { display: none; }
  .a4-feuille.cours { max-width: none; margin: 0; padding: 0; box-shadow: none; }
  .a4-partie { break-before: page; }
  .a4-partie.a4-cours { break-before: auto; }
  h2, h3, h4, .a4-question { break-after: avoid; }
  .def, .ex, .warn, .formula, .res, .tip, .fiche, .a4-carte, .a4-quiz > li, .verdict, .card, tr, .texte .vl { break-inside: avoid; }
  .exo { break-inside: auto; }
  a { color: inherit; text-decoration: none; }
}
