/* ==========================================================================================
   LeLabGeolPack.com – LMC_EF : feuille de style commune des exercices pédagogiques
   Utilisée par toutes les pages exXX_.../index.html (lien ../commun/exercice.css).
   Le PDF est produit par outils/generer_pdf_exercice.py à partir de ces mêmes pages.
   ========================================================================================== */
:root {
    --bleu: #667eea;          /* bleu des notes de calcul LMC_EF */
    --bleu-f: #3949ab;        /* bleu foncé (titres) */
    --bleu-c: #f3f5ff;        /* fond bleu très clair */
    --bord: #dfe3f6;
    --site: #0071c1;          /* bleu du logo */
    --jaune: #d4d600;         /* jaune du logo */
    --encre: #222;
    --gris: #6b7280;
    --vert: #2f855a;
    --orange: #c05621;
    --rouge: #c53030;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0; background: #eef0f6; color: var(--encre);
    font-family: "Century Gothic", "TeX Gyre Adventor", "Segoe UI", Arial, sans-serif;
    font-size: 15px; line-height: 1.6;
}
.page {
    max-width: 920px; margin: 24px auto; background: #fff; padding: 22px 34px 30px;
    border-radius: 10px; box-shadow: 0 2px 14px rgba(40, 50, 90, .08);
}
a { color: var(--bleu-f); }

/* ── En-tête : cadre bleu à coins arrondis ───────────────────────────────────────────────── */
.bandeau {
    display: flex; align-items: center; gap: 16px; background: var(--bleu); color: #fff;
    border-radius: 10px; padding: 12px 20px; margin-bottom: 22px;
}
.bandeau .logo { flex: 0 0 auto; width: 54px; height: 54px; background: #fff; border-radius: 8px; padding: 4px;
                 display: flex; align-items: center; justify-content: center; }
.bandeau .logo img { max-width: 100%; max-height: 100%; }
.bandeau .site { flex: 1 1 auto; font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.bandeau .site small { display: block; font-size: 11.5px; font-weight: 400; opacity: .85; letter-spacing: 0; }
.bandeau .ex { flex: 0 0 auto; text-align: right; font-size: 16px; font-weight: 700; }
.bandeau .ex small { display: block; font-size: 11.5px; font-weight: 400; opacity: .85; }

/* ── Titre de l'exercice et fiche signalétique ───────────────────────────────────────────── */
h1 { font-size: 27px; line-height: 1.25; color: var(--bleu-f); margin: 4px 0 6px; }
.sous-titre { font-size: 16px; color: #4a5568; margin: 0 0 14px; }
.fiche { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 18px;
         background: var(--bleu-c); border: 1px solid var(--bord); border-radius: 8px; padding: 12px 16px; margin: 0 0 14px;
         font-size: 13.5px; }
.fiche b { display: block; font-size: 11px; color: var(--bleu); text-transform: uppercase; letter-spacing: .5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.chips span { font-size: 12px; background: #e8eaf6; color: var(--bleu-f); border-radius: 12px; padding: 2px 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; font-size: 13.5px;
       font-weight: 600; text-decoration: none; border: 1px solid var(--bleu); color: var(--bleu-f); background: #fff; }
.btn:hover { background: var(--bleu-c); }
.btn.principal { background: var(--bleu); color: #fff; }
.btn.principal:hover { filter: brightness(1.08); }
.resume { font-size: 15.5px; border-left: 4px solid var(--jaune); padding: 2px 0 2px 14px; margin: 0 0 18px; }

/* Sommaire (page web seulement ; le PDF a des signets) */
.sommaire { background: #fafbff; border: 1px solid var(--bord); border-radius: 8px; padding: 10px 16px; margin: 0 0 8px; font-size: 13.5px; }
.sommaire b { color: var(--bleu-f); }
.sommaire ol { margin: 6px 0 0; padding-left: 0; list-style: none; columns: 2; column-gap: 28px; }
.sommaire li { break-inside: avoid; }
.sommaire li.n3 { padding-left: 22px; font-size: 12.5px; }
.sommaire a { text-decoration: none; }
.sommaire a:hover { text-decoration: underline; }

/* ── Titres numérotés automatiquement ────────────────────────────────────────────────────── */
body { counter-reset: chap fig tab eq; }
main > section { counter-reset: sec; }
h2 { counter-increment: chap; counter-reset: sec; font-size: 19px; color: #fff; background: var(--bleu);
     border-radius: 6px; padding: 7px 14px; margin: 30px 0 14px; }
h2::before { content: counter(chap) ".\00a0\00a0"; }
h3 { counter-increment: sec; font-size: 16.5px; color: var(--bleu-f); border-left: 4px solid var(--bleu);
     padding-left: 10px; margin: 24px 0 10px; }
h3::before { content: counter(chap) "." counter(sec) "\00a0\00a0"; }
h4 { font-size: 15px; color: #333; margin: 18px 0 6px; }
h4::before { content: "▸ "; color: var(--bleu); }
h2.sans-num::before, h3.sans-num::before { content: none; }
h2.sans-num { counter-increment: none; }
h3.sans-num { counter-increment: none; }
p { margin: 0 0 10px; }
ul, ol { margin: 0 0 10px; padding-left: 24px; }
li { margin: 2px 0; }

/* Texte provisoire à remplacer (visible en gris italique ; supprimez la classe une fois rédigé) */
.a-rediger { color: #8a8fa3; font-style: italic; }

/* ── Figures, images, schémas ────────────────────────────────────────────────────────────── */
figure { margin: 16px 0; text-align: center; break-inside: avoid; }
figure img, figure svg { max-width: 100%; height: auto; border: 1px solid #e5e7f0; border-radius: 6px; }
figure svg.sans-cadre, figure img.sans-cadre { border: none; }
figure.etroite img, figure.etroite svg, figure.etroite .emplacement { max-width: 62%; }
figcaption { counter-increment: fig; font-size: 13px; color: var(--gris); margin-top: 6px; }
figcaption::before { content: "Figure " counter(fig) " – "; font-weight: 700; color: #444; }
figure.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
figure.duo > figcaption { grid-column: 1 / -1; }
figure.duo .legende { display: block; font-size: 12px; color: var(--gris); margin-top: 3px; }
/* emplacement réservé à une image pas encore fournie */
.emplacement { display: flex; align-items: center; justify-content: center; flex-direction: column; margin: 0 auto;
               min-height: 220px; border: 2px dashed #b9c0e4; border-radius: 8px; background: #f7f8fd;
               color: #8a8fa3; font-size: 13px; padding: 14px; }
.emplacement::before { content: "🖼"; font-size: 30px; margin-bottom: 4px; }
/* styles réutilisables dans les schémas SVG */
svg .sol1 { fill: #e9d8a6; } svg .sol2 { fill: #b5c99a; } svg .sol3 { fill: #d6b48a; }
svg .eau { fill: #a8d4f5; opacity: .55; } svg .ligne-eau { stroke: #1f78c8; stroke-width: 1.5; fill: none; }
svg .structure { stroke: #222; stroke-width: 4; fill: none; }
svg .tirant { stroke: #c05621; stroke-width: 1.6; fill: none; } svg .scellement { stroke: #c05621; stroke-width: 5; fill: none; }
svg .cote { stroke: #555; stroke-width: 1; fill: none; } svg .trait { stroke: #555; stroke-width: 1; fill: none; }
svg .tirete { stroke: #555; stroke-width: 1; stroke-dasharray: 5 4; fill: none; }
svg text { font-family: inherit; font-size: 12px; fill: #333; } svg text.petit { font-size: 10.5px; fill: #555; }

/* ── Tableaux ────────────────────────────────────────────────────────────────────────────── */
.tableau { overflow-x: auto; margin: 14px 0; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
caption { counter-increment: tab; caption-side: top; text-align: left; font-size: 13px; color: var(--gris); padding-bottom: 5px; }
caption::before { content: "Tableau " counter(tab) " – "; font-weight: 700; color: #444; }
th { background: var(--bleu); color: #fff; font-weight: 600; text-align: left; padding: 6px 9px; }
td { border-bottom: 1px solid #e5e7f0; padding: 5px 9px; vertical-align: top; }
tbody tr:nth-child(even) td { background: #fafbff; }
td.n, th.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.c, th.c { text-align: center; }
tr.fort td { font-weight: 700; background: var(--bleu-c) !important; }
.ok { color: var(--vert); font-weight: 600; } .ecart { color: var(--orange); font-weight: 600; } .ko { color: var(--rouge); font-weight: 600; }

/* ── Formules (KaTeX : \( … \) dans le texte, \[ … \] ou $$ … $$ en bloc) ─────────────────── */
.formule { background: var(--bleu-c); border-radius: 8px; padding: 6px 14px; margin: 12px 0; display: flex; align-items: center;
           gap: 12px; break-inside: avoid; overflow-x: auto; }
.formule > .f { flex: 1 1 auto; text-align: center; }
.formule > .no { flex: 0 0 auto; color: var(--gris); font-size: 13px; counter-increment: eq; }
.formule > .no::before { content: "(" counter(eq) ")"; }
.katex { font-size: 1.08em; }

/* ── Étapes numérotées ───────────────────────────────────────────────────────────────────── */
.etapes { counter-reset: etape; }
.etape { display: flex; gap: 14px; margin: 16px 0; break-inside: avoid; }
.etape::before { counter-increment: etape; content: counter(etape); flex: 0 0 30px; height: 30px; border-radius: 50%;
                 background: var(--bleu); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.etape > .c { flex: 1; min-width: 0; }
.etape > .c > h4:first-child { margin-top: 4px; }
.etape > .c > h4:first-child::before { content: none; }
.ui { display: inline-block; background: #eef0fb; border: 1px solid #c9cff0; border-radius: 4px; padding: 0 6px;
      font-size: .9em; font-weight: 600; color: var(--bleu-f); white-space: nowrap; }
.chemin { font-weight: 600; color: var(--bleu-f); }
code { font-family: Consolas, 'Courier New', monospace; font-size: .88em; background: #f4f4f6; border-radius: 3px; padding: 0 4px; }
kbd { font-family: inherit; font-size: .88em; background: #f4f4f6; border: 1px solid #ccc; border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; }

/* ── Encadrés ────────────────────────────────────────────────────────────────────────────── */
.encadre { position: relative; border-radius: 8px; padding: 10px 14px 10px 48px; margin: 14px 0; font-size: 14.5px; break-inside: avoid; }
.encadre::before { position: absolute; left: 13px; top: 8px; font-size: 20px; }
.encadre > .t { display: block; font-weight: 700; margin-bottom: 3px; }
.encadre > :last-child { margin-bottom: 0; }
.encadre.theorie { background: #f3f5ff; border: 1px solid #cdd3f5; } .encadre.theorie::before { content: "📐"; }
.encadre.note { background: #f0f7ff; border: 1px solid #bcdcf7; } .encadre.note::before { content: "ℹ️"; }
.encadre.attention { background: #fff8e6; border: 1px solid #f5d27a; } .encadre.attention::before { content: "⚠️"; }
.encadre.retenir { background: #effaf3; border: 1px solid #a7dcb9; } .encadre.retenir::before { content: "✅"; }
.encadre.question { background: #fdf2fa; border: 1px solid #f0bfe0; } .encadre.question::before { content: "❓"; }

/* Solution repliable (dépliée automatiquement dans le PDF) */
details.solution { border: 1px solid var(--bord); border-radius: 8px; margin: 8px 0 14px; padding: 0 14px; background: #fff; }
details.solution > summary { cursor: pointer; font-weight: 600; color: var(--bleu-f); padding: 8px 0; }
details.solution[open] { padding-bottom: 10px; }

/* ── Références, pied de page ────────────────────────────────────────────────────────────── */
.references { font-size: 13.5px; padding-left: 20px; }
.references li { margin: 4px 0; }
.pied { margin-top: 30px; border-top: 1px solid #e0e3ee; padding-top: 10px; font-size: 12px; color: var(--gris);
        display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.pied a { color: var(--gris); }

/* ── Mise en page PDF et impression ──────────────────────────────────────────────────────── */
.saut-page { break-before: page; }           /* à poser sur un titre ou une figure pour forcer une nouvelle page */
@media print {
    body { background: #fff; font-size: 10pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .page { max-width: none; margin: 0; padding: 0; border-radius: 0; box-shadow: none; }
    .ecran-seul { display: none !important; }
    h1 { font-size: 20pt; } h2 { font-size: 14pt; } h3 { font-size: 12pt; } h4 { font-size: 10.5pt; }
    h2, h3, h4 { break-after: avoid; }
    .sous-titre, .resume { font-size: 11pt; }
    .fiche, table, figcaption, caption, .encadre { font-size: 9pt; }
    .bandeau .site { font-size: 15pt; } .bandeau .ex { font-size: 12pt; }
    .emplacement { min-height: 150px; }
    a { color: inherit; text-decoration: none; }
}

/* ── Petits écrans ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    body { font-size: 14px; }
    .page { margin: 0; padding: 14px 16px 22px; border-radius: 0; }
    .bandeau { padding: 10px 12px; gap: 10px; }
    .bandeau .logo { width: 42px; height: 42px; }
    .bandeau { flex-wrap: wrap; }
    .bandeau .site { flex: 1 1 0; min-width: 0; font-size: 15px; }
    .bandeau .ex { flex: 1 0 100%; text-align: left; font-size: 13px; border-top: 1px solid rgba(255,255,255,.35); padding-top: 6px; }
    .bandeau .ex small { display: inline; margin-left: 6px; }
    h1 { font-size: 22px; }
    .sommaire ol { columns: 1; }
    figure.duo { grid-template-columns: 1fr; }
    figure.etroite img, figure.etroite svg, figure.etroite .emplacement { max-width: 100%; }
    .etape { gap: 8px; } .etape::before { flex-basis: 24px; height: 24px; font-size: 12px; }
}
