/* Kit des fiches de maths en récit (octobre 2026). À charger après css/recit.css et css/fr-recit.css, qui apporte
   l'ouverture, les écrans « figure », les exercices choix / tri / ordre (js/fr-recit.js), le quiz et les sources.
   <body class="fr-recit mth-recit">

   Polices (dans le <head> de la fiche) :
   <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@500;700;800;900&family=Atkinson+Hyperlegible+Next:wght@400;600;700&family=Fira+Code:wght@500;700&display=swap" rel="stylesheet">
   Outfit pour les titres, les accroches et les grands nombres ; Atkinson Hyperlegible Next pour le texte ;
   Fira Code pour les calculs posés dans les schémas (classe .tc).

   Formules : MathJax 3, \( … \) dans le texte. Jamais de formule dans un écran data-entree="mots" (le découpage en mots
   casserait la formule avant que MathJax la lise). Après la mise en forme, appeler MkRecit.refresh() (voir le <head>
   des fiches) : la hauteur des écrans change.

   Code couleur des schémas : data-famille="citron|peche|rose|lilas|ciel|menthe" sur un écran ou un chapitre.
     .fv  remplissage vif : la part prise, ce qu'on compte       .fc .fm .ff  clair, moyen, foncé (fr-recit.css)
     .sf  trait foncé de la famille ; .si trait d'encre (découpes) ; .tc calcul (Fira Code) ; .tl légende ; .tn neutre
     .mth-part.mk-marque  part qui se colorie quand le défilement l'atteint (data-mk-des)
   Écran « dans la vraie vie » : <p class="mth-vraie-vie">Dans la vraie vie</p> en tête d'écran. */

:root {
    --mk-recit-titre: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mth-encre: #2A2333;
    --mth-doux: #5B5466;
    --mth-surface: #FFFDF8;
    --mth-vide: #FFFFFF;
}
[data-famille="citron"] { --fam-v: #F2B705; }
[data-famille="peche"]  { --fam-v: #F28C4B; }
[data-famille="rose"]   { --fam-v: #E9739B; }
[data-famille="lilas"]  { --fam-v: #9B7FE6; }
[data-famille="ciel"]   { --fam-v: #5B9DEB; }
[data-famille="menthe"] { --fam-v: #45B97C; }

body.mth-recit { font-feature-settings: "tnum" 0; }
.mth-recit .fv { fill: var(--fam-v, #F2B705); }
.mth-recit .si { stroke: var(--mth-encre); }
.mth-recit svg .tc { font-family: 'Fira Code', ui-monospace, monospace; font-weight: 700; }
.mth-recit svg .tg { font-family: var(--mk-recit-titre); font-weight: 800; }
.mth-recit .mth-part { fill: var(--mth-vide); transition: fill 0.35s ease; }
.mth-recit .mth-part.est-la { fill: var(--fam-v, #F2B705); }
.mth-recit .mth-part.mth-part-2.est-la { fill: var(--mth-v2, #E9739B); }
.mth-recit .f2 { fill: var(--mth-v2, #E9739B); }
.mth-recit .mth-vu { transition: fill 0.35s ease, stroke 0.35s ease; }
/* .mth-teinte : transparent, puis la couleur vive ; .mth-halo : un cadre clair qui s'allume derrière un groupe */
.mth-recit .mth-teinte { fill: transparent; transition: fill 0.35s ease; }
.mth-recit .mth-teinte.est-la { fill: var(--fam-v, #F2B705); }
.mth-recit .mth-halo { fill: transparent; stroke: transparent; stroke-width: 2; transition: fill 0.35s ease, stroke 0.35s ease; }
.mth-recit .mth-halo.est-la { fill: var(--fam-c, #FFF4CC); stroke: var(--fam-f, #854D0E); }

/* ── Ouverture ─────────────────────────────────────────────────────────────── */
.mth-recit .fr-ouverture h1 { font-weight: 900; letter-spacing: -0.03em; line-height: 0.95; }
.mth-ouverture-fig { display: block; width: min(72vw, 15rem); height: auto; margin: 4px auto 0; }
.mth-saut {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px;
    border: 1.5px solid color-mix(in srgb, var(--mk-fond-a, #854D0E) 30%, transparent); background: var(--mth-surface);
    color: var(--mk-fond-a, #854D0E); font-weight: 700; text-decoration: none;
}
.mth-saut:focus-visible { outline: 3px solid var(--mk-fond-a, #854D0E); outline-offset: 2px; }
.mth-programme { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.mth-programme li { display: flex; gap: 10px; align-items: baseline; font-size: 0.95em; }
.mth-programme li span { flex: none; font-family: var(--mk-recit-titre); font-weight: 800; color: var(--mk-fond-a, #854D0E); }

/* ── Écrans ───────────────────────────────────────────────────────────────── */
.mth-recit .mk-ecran h2 { font-weight: 800; letter-spacing: -0.02em; }
.mth-recit .mk-ecran[data-style="accroche"], .mth-recit .mk-accroche { font-weight: 800; letter-spacing: -0.025em; }
.mth-recit .mk-ecran .mth-grand { font-family: var(--mk-recit-titre); font-size: 1.32em; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 0.4em; }
.mth-vraie-vie {
    display: inline-block;
    margin: 0 0 10px !important;
    padding: 5px 14px;
    border-radius: 999px;
    background: var(--mk-fond-a, #854D0E);
    color: #fff;
    font-size: 0.74em;
    font-weight: 700;
}
.mth-ecran-fig { text-align: left; }
.mth-schema, .mth-recit .mk-ecran .mth-schema {
    display: block;
    width: 100%;
    max-width: 30rem;
    height: auto;
    margin: 0 0 12px;
    background: var(--mth-surface);
    border: 1.5px solid var(--fam-m, rgba(42, 35, 51, 0.14));
    border-radius: 18px;
}
.mth-recit .mth-def { margin: 0 0 8px !important; font-size: 0.92em; line-height: 1.45; }
.mth-recit .mth-def strong { color: var(--fam-f, inherit); }
.mth-recit .mth-pied-fig { margin: 0; font-size: 0.88em; color: var(--mth-doux); }
/* Formule mise en avant dans un écran ou une carte */
.mth-f { margin: 0.2em 0 0.6em !important; text-align: center; font-size: 1.08em; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.mth-f.mth-f-cadre { background: var(--fam-c, var(--mk-citron)); border: 1.5px solid var(--fam-m, var(--mk-citron-m)); border-radius: 14px; padding: 6px 10px; }
.mth-recit mjx-container[jax="CHTML"] { line-height: 0; }
.mth-recit mjx-container[jax="CHTML"][display="true"] { margin: 0.3em 0; }
.mth-recit .mk-carte .mth-f { font-size: 1.12em; margin: 0.35em 0 0.2em !important; }

/* Petite intro au-dessus d'une scène collée ou d'une activité (même rôle que .fr-intro-scene) */
.mth-recit .fr-intro-scene h3 { font-weight: 800; letter-spacing: -0.02em; }

/* ── Scènes collées héritées du kit « mth » ────────────────────────────────── */
.mth-recit .mk-pin.mth-pin { --mk-pin-couleur: var(--mk-fond-a, #854D0E); margin: 18px 0 8px; color: var(--mth-doux); }
.mth-recit .mth-scene {
    box-sizing: border-box;
    background: var(--mth-surface);
    border: 1.5px solid color-mix(in srgb, var(--mk-fond-a, #854D0E) 26%, transparent);
    border-radius: 22px;
    padding: 14px 14px 12px;
    max-width: 35rem;
    margin: 0 auto;
    color: var(--mth-encre);
    box-shadow: none;
}
@media (max-width: 480px) { .mth-recit .mth-scene { padding: 12px 10px 10px; border-radius: 18px; } }
.mth-recit .mth-kicker { display: block; font-size: 0.86rem; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--mk-fond-a, #854D0E); }
.mth-recit .mth-scene-titre { font-family: var(--mk-recit-titre); font-size: 1.18rem; font-weight: 800; line-height: 1.2; color: var(--mth-encre); margin: 0.1rem 0 0.4rem; }
.mth-recit .mth-fig { display: block; width: 100%; height: auto; max-height: 40vh; margin: 0 auto; }
.mth-recit .mth-fig text { font-family: 'Atkinson Hyperlegible Next', system-ui, sans-serif; }
.mth-recit .mth-formule { text-align: center; font-family: 'Fira Code', ui-monospace, monospace; font-size: 1.02rem; font-weight: 500; color: var(--mth-encre); margin: 0.3rem 0 0; line-height: 1.45; min-height: 2.6em; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0 0.3em; background: var(--mk-fond-c, var(--mk-citron)); border-radius: 0.9rem; padding: 0.25rem 0.7rem; }
.mth-recit .mth-formule b { font-weight: 700; }
.mth-recit .mth-phrase { text-align: center; font-size: 0.98rem; line-height: 1.45; color: var(--mth-doux); margin: 0.3rem 0 0; min-height: 2.9em; }
.mth-recit .mth-frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.05; margin: 0 0.1em; font-weight: 700; }
.mth-recit .mth-frac > span:last-child { border-top: 2px solid currentColor; padding-top: 0.06em; min-width: 1.15em; text-align: center; }
.mth-recit .mth-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; margin: 0.45rem 0 0.1rem; }
.mth-recit .mth-pill, .mth-recit .fro-pill {
    min-height: 40px; padding: 0.3rem 0.8rem; border-radius: 999px;
    border: 1.5px solid var(--mk-citron-m); background: var(--mk-citron); color: #854D0E;
    font: 700 0.86rem/1.2 'Fira Code', ui-monospace, monospace; cursor: pointer;
}
.mth-recit .mth-pill[aria-pressed="true"], .mth-recit .fro-pill.fro-on { background: var(--mk-fond-a, #854D0E); border-color: var(--mk-fond-a, #854D0E); color: #fff; }
.mth-recit .mth-pill:focus-visible, .mth-recit .fro-pill:focus-visible { outline: 3px solid var(--mth-encre); outline-offset: 2px; }
@media (min-width: 900px) {
    .mth-recit .mth-scene--large { max-width: 58rem; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 0 1.8rem; align-items: center; padding: 1.2rem 1.4rem; }
    .mth-recit .mth-scene--large > .mth-scene-tete { grid-column: 1 / -1; }
    .mth-recit .mth-fig { max-height: 58vh; }
}

/* Séquences (js/scrolly.js) dans une fiche de maths */
.mth-recit .mk-scrolly { --mk-card-border: color-mix(in srgb, var(--mk-fond-a, #854D0E) 26%, transparent); --mk-card-bg: var(--mth-surface); }
.mth-recit .mk-scrolly .mk-step-card { border-radius: 16px; font-size: 1.05rem; box-shadow: none; color: var(--mth-encre); }
.mth-recit .mk-scrolly .mk-step-card b, .mth-recit .mk-scrolly .mk-step-card strong { color: var(--mk-fond-a, #854D0E); }
.mth-recit .mk-scrolly .mk-scrolly-graphic > svg { background: var(--mth-surface); border: 1.5px solid color-mix(in srgb, var(--mk-fond-a, #854D0E) 22%, transparent); border-radius: 18px; }
.mth-etape { display: block; font-size: 0.86rem; font-weight: 700; color: var(--mk-fond-a, #854D0E); margin-bottom: 0.3rem; }

/* ── Exercices du kit « mth » (moteur propre à chaque fiche) ───────────────── */
.mth-recit .mth-exo {
    box-sizing: border-box;
    background: var(--mth-surface);
    border: 1.5px solid color-mix(in srgb, var(--mk-fond-a, #854D0E) 30%, transparent);
    border-radius: 18px;
    padding: 18px;
    max-width: 40rem;
    margin: 36px auto;
}
.mth-recit .mth-exo-titre { font-family: var(--mk-recit-titre); font-size: 1.3rem; font-weight: 800; line-height: 1.25; color: var(--mth-encre); margin: 0.15rem 0 0.35rem; }
.mth-recit .mth-exo-consigne { color: var(--mth-doux); line-height: 1.5; margin: 0 0 0.5rem; font-size: 1rem; }
.mth-recit .mth-exo-compte { display: block; text-align: center; font-size: 0.86rem; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--mk-fond-a, #854D0E); margin-top: 0.3rem; }
.mth-recit .mth-exo-enonce { display: table; margin: 0.5rem auto 0.2rem; padding: 0.35rem 0.9rem; border-radius: 1rem; background: var(--mk-fond-c, var(--mk-citron)); text-align: center; font-family: 'Fira Code', ui-monospace, monospace; font-size: 1.35rem; font-weight: 700; color: var(--mth-encre); line-height: 1.5; }
.mth-recit .mth-choix { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin: 0.6rem 0 0.3rem; }
.mth-recit .mth-choix button {
    min-height: 46px; min-width: 4.5rem; padding: 0.45rem 1rem; border-radius: 12px;
    border: 1.5px solid rgba(42, 35, 51, 0.14); background: #fff; color: var(--mth-encre);
    font: 700 1rem/1.2 'Fira Code', ui-monospace, monospace; cursor: pointer;
}
.mth-recit .mth-choix button:hover:not(:disabled) { border-color: var(--mk-fond-a, #854D0E); }
.mth-recit .mth-choix button:focus-visible { outline: 3px solid var(--mk-fond-a, #854D0E); outline-offset: 2px; }
.mth-recit .mth-choix button:disabled { cursor: default; }
.mth-recit .mth-choix button.is-juste { background: var(--mk-menthe); border-color: var(--mk-menthe-f); color: #166534; }
.mth-recit .mth-choix button.is-faux { background: var(--mk-rose); border-color: var(--mk-rose-f); color: #9D174D; }
.mth-recit .mth-detail { text-align: center; font-family: 'Fira Code', ui-monospace, monospace; font-size: 0.95rem; color: var(--mth-doux); min-height: 1.5em; margin: 0.2rem 0 0; }
.mth-recit .mth-actions { display: flex; justify-content: center; margin-top: 0.4rem; gap: 0.6rem; flex-wrap: wrap; }
.mth-recit .mth-bouton { min-height: 46px; padding: 0.5rem 1.3rem; border-radius: 999px; border: 0; background: var(--mk-fond-a, #854D0E); color: #fff; font: 700 1rem/1 'Atkinson Hyperlegible Next', system-ui, sans-serif; cursor: pointer; }
.mth-recit .mth-bouton:focus-visible { outline: 3px solid var(--mth-encre); outline-offset: 2px; }
.mth-recit .mth-bouton[hidden] { display: none; }
.mth-recit .mth-chat-zone .mk-chat { margin: 0.6rem 0 0; }

/* Exercices corrigés : on cherche, puis on ouvre le corrigé (activité, jamais lue à voix haute) */
.mth-corriges { box-sizing: border-box; max-width: 40rem; margin: 36px auto; padding: 0 22px; }
.mth-corriges h3 { margin: 0 0 6px; font-family: var(--mk-recit-titre); font-size: 1.3rem; font-weight: 800; }
.mth-corriges > p { margin: 0 0 14px; color: var(--mth-doux); line-height: 1.5; }
.mth-corrige { background: var(--mth-surface); border: 1.5px solid color-mix(in srgb, var(--mk-fond-a, #854D0E) 28%, transparent); border-radius: 16px; margin-bottom: 10px; overflow: hidden; }
.mth-corrige summary { cursor: pointer; list-style: none; padding: 14px 16px; font-weight: 700; line-height: 1.5; }
.mth-corrige summary::-webkit-details-marker { display: none; }
.mth-corrige summary:focus-visible { outline: 3px solid var(--mk-fond-a, #854D0E); outline-offset: -3px; border-radius: 16px; }
.mth-corrige-n { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; margin-right: 0.5rem; border-radius: 8px; background: var(--mk-fond-a, #854D0E); color: #fff; font-size: 0.9rem; }
.mth-corrige-ouvrir { display: block; margin-top: 4px; font-size: 0.88rem; font-weight: 600; color: var(--mk-fond-a, #854D0E); }
.mth-corrige[open] .mth-corrige-ouvrir { display: none; }
.mth-corrige-corps { padding: 12px 16px 14px; border-top: 1.5px dashed color-mix(in srgb, var(--mk-fond-a, #854D0E) 28%, transparent); line-height: 1.65; }
.mth-corrige-corps strong { color: var(--mk-fond-a, #854D0E); }

/* Quiz des fiches de maths : la question peut contenir une formule */
.mth-recit .fr-quiz-q { font-family: 'Atkinson Hyperlegible Next', system-ui, sans-serif; font-style: normal; font-weight: 700; font-size: 1.25rem; }
.mth-recit .fr-quiz .answer-btn mjx-container { font-size: 112%; }
.mth-recit .fr-quiz-expl { background: var(--mk-citron); color: #3F2A06; }
.mth-recit .fr-quiz-expl.est-juste { background: var(--mk-menthe); color: #14532D; }

@media (prefers-reduced-motion: reduce) {
    .mth-recit .mth-part, .mth-recit .mth-vu { transition: none; }
}

/* Renvois aux sources entre crochets : un petit « 2 » collé à un mot se lirait comme un exposant */
.mth-recit sup.mk-ref a::before { content: '['; }
.mth-recit sup.mk-ref a::after { content: ']'; }
.mth-recit .fr-quiz h2 { font-weight: 800; letter-spacing: -0.02em; }
/* Formule collée à sa ponctuation (pas de « : » ou de « . » seul en début de ligne) : <span class="mth-nw">\( … \).</span> */
.mth-nw { white-space: nowrap; }
