/* Kit des fiches de programmation en récit (octobre 2026). À charger après prog-cours.css et css/recit.css.
   Moteur : js/recit.js + css/recit.css, js/scrolly.js ; exercices et quiz : prog-cours.js (inchangés).
   Polices : Fira Code pour les titres, les accroches et le code ; Atkinson Hyperlegible Next pour le texte.
   <link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&family=Atkinson+Hyperlegible+Next:wght@400;600;700&family=Nunito:wght@600;700;800&display=swap" rel="stylesheet">

   Code couleur des schémas (le même dans toute la série, voir prog-cours.css) : data-famille sur un écran ou un chapitre.
     valeur, donnée, vrai, résultat ......... menthe      variable, nom, ce qui s'exécute ... ciel
     objet, référence, classe ............... lilas       faux, erreur, exception ........... rose
     calcul en cours, résultat qui attend ... citron
   Classes : .fc .fm .ff (remplissage clair, moyen, foncé), .sm .sf (trait), .tf (texte foncé), .tn (neutre),
   .tc (code, Fira Code), .tl (légende). Écran « dans la vraie vie » : <p class="pc-vraie-vie">Dans la vraie vie</p>. */

:root {
    --mk-recit-titre: 'Fira Code', ui-monospace, 'SFMono-Regular', Menlo, monospace;
    --pc-texte-police: 'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --pc-r-encre: #1D2433;
    --pc-r-doux: #4F5867;
    --pc-r-surface: #FFFDF8;
}
body.pc-recit {
    margin: 0;
    padding-bottom: 0;
    font-family: var(--pc-texte-police);
    background: var(--mk-creme, #FFF8EE);
    color: var(--pc-r-encre);
    -webkit-font-smoothing: antialiased;
}
body.pc-recit main { display: block; }

[data-famille="rose"]   { --fam-c: var(--mk-rose);   --fam-m: var(--mk-rose-m);   --fam-f: var(--mk-rose-f); }
[data-famille="lilas"]  { --fam-c: var(--mk-lilas);  --fam-m: var(--mk-lilas-m);  --fam-f: var(--mk-lilas-f); }
[data-famille="peche"]  { --fam-c: var(--mk-peche);  --fam-m: var(--mk-peche-m);  --fam-f: var(--mk-peche-f); }
[data-famille="menthe"] { --fam-c: var(--mk-menthe); --fam-m: var(--mk-menthe-m); --fam-f: var(--mk-menthe-f); }
[data-famille="ciel"]   { --fam-c: var(--mk-ciel);   --fam-m: var(--mk-ciel-m);   --fam-f: var(--mk-ciel-f); }
[data-famille="citron"] { --fam-c: var(--mk-citron); --fam-m: var(--mk-citron-m); --fam-f: var(--mk-citron-f); }
.pc-recit .fc { fill: var(--fam-c, #E2F5EA); }
.pc-recit .fm { fill: var(--fam-m, #B6E5C8); }
.pc-recit .ff { fill: var(--fam-f, #166534); }
.pc-recit .sm { stroke: var(--fam-m, #B6E5C8); }
.pc-recit .sf { stroke: var(--fam-f, #166534); }
.pc-recit .tf { fill: var(--fam-f, #166534); }
.pc-recit .tn { fill: var(--pc-r-encre); }
.pc-recit svg text { font-family: var(--pc-texte-police); }
.pc-recit svg .tc { font-family: 'Fira Code', ui-monospace, monospace; }
.pc-recit svg .tl { font-family: var(--pc-texte-police); font-weight: 700; }

/* ── Ouverture ─────────────────────────────────────────────────────────────── */
.pc-ouverture {
    box-sizing: border-box;
    min-height: 78vh;
    min-height: 78svh;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 14px;
    padding: 64px 22px 28px;
    text-align: center;
}
.pc-surtitre { margin: 0; font-size: 1rem; font-weight: 700; color: var(--mk-fond-a, #166534); }
.pc-ouverture h1 {
    margin: 0;
    font-family: var(--mk-recit-titre);
    font-size: clamp(2.3rem, 1rem + 7.4vw, 4.8rem);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.03em;
    text-wrap: balance;
}
.pc-chapo { margin: 0; max-width: 30rem; font-size: clamp(1.15rem, 1rem + 1vw, 1.4rem); line-height: 1.45; color: var(--pc-r-doux); text-wrap: balance; }
.pc-ouverture .mkn-tete { margin: 8px auto 0; }
.pc-recit .pc-saut { justify-self: center; }

/* ── Écrans ───────────────────────────────────────────────────────────────── */
.pc-recit .mk-ecran h2 { letter-spacing: -0.02em; }
.pc-recit .mk-ecran .pc-grand { font-family: var(--mk-recit-titre); font-size: 1.3em; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 0.4em; }
.pc-recit .mk-ecran[data-style="accroche"], .pc-recit .mk-accroche { font-size: clamp(1.8rem, 1rem + 5.4vw, 3.5rem); letter-spacing: -0.03em; }
.pc-recit .mk-ecran code, .pc-recit .mk-carte code { font-family: 'Fira Code', ui-monospace, monospace; font-size: 0.86em; background: color-mix(in srgb, var(--fam-c, #E2F5EA) 70%, #fff); border-radius: 6px; padding: 0.05em 0.35em; }
.pc-vraie-vie {
    display: inline-block;
    margin: 0 0 10px !important;
    padding: 5px 14px;
    border-radius: 999px;
    background: var(--mk-fond-a, #166534);
    color: #fff;
    font-size: 0.78em;
    font-weight: 700;
}
.pc-fig { text-align: left; }
.pc-fig-nom {
    display: inline-block;
    margin: 0 0 10px !important;
    padding: 5px 14px;
    border-radius: 999px;
    background: var(--fam-f, #166534);
    color: #fff;
    font-family: 'Fira Code', ui-monospace, monospace;
    font-size: 0.78em;
    font-weight: 600;
}
.pc-fig svg, .pc-schema {
    display: block;
    width: 100%;
    max-width: 30rem;
    height: auto;
    margin: 0 0 12px;
    background: var(--pc-r-surface);
    border: 1.5px solid var(--fam-m, rgba(29, 36, 51, 0.14));
    border-radius: 18px;
}
.pc-fig-def { margin: 0 0 8px !important; font-size: 0.92em; line-height: 1.45; }
.pc-fig-def strong { color: var(--fam-f, inherit); }
.pc-recit .pc-exemple { margin: 0; font-size: 0.88em; color: var(--pc-r-doux); }
/* Code dans un écran : le bloc de prog-cours, plus compact */
.pc-recit .mk-ecran .pc-code { margin: 8px 0 10px; text-align: left; }
.pc-recit .mk-ecran .pc-code pre { font-size: 0.72em; line-height: 1.55; padding: 0.7rem 0.85rem 0.8rem; }

/* Petite intro au-dessus d'une scène collée ou d'un bloc à explorer */
.pc-intro-scene { box-sizing: border-box; max-width: 40rem; margin: 0 auto; padding: 56px 22px 4px; }
.pc-intro-scene h3 { margin: 0 0 8px; font-family: var(--mk-recit-titre); font-size: clamp(1.35rem, 1rem + 2.2vw, 1.9rem); line-height: 1.2; letter-spacing: -0.02em; color: var(--pc-r-encre); }
.pc-intro-scene p { margin: 0; color: var(--pc-r-doux); font-size: 1.05rem; line-height: 1.55; }

/* Séquence de lecture de code : les lignes de l'étape s'allument */
.pc-lecture-code { margin: 0 auto; max-width: 34rem; background: var(--pc-editeur, #172a2f); color: #e6edf0; border-radius: 18px; overflow: hidden; }
.pc-lecture-code .pc-code-tete { color: #9db3b8; }
.pc-lecture-code pre { margin: 0; padding: 0.8rem 0; font: 500 0.78rem/1.7 'Fira Code', ui-monospace, monospace; white-space: pre; overflow-x: auto; }
.pc-lecture-code .ln { display: block; padding: 0 0.9rem; border-left: 3px solid transparent; transition: background-color 0.3s ease, opacity 0.3s ease, border-color 0.3s ease; }
.pc-lecture-code .ln.est-eteinte { opacity: 0.4; }
.pc-lecture-code .ln.est-allumee { background: rgba(166, 227, 161, 0.14); border-left-color: #a6e3a1; opacity: 1; }
.pc-lecture-code .pc-sortie { border-top: 1px dashed rgba(255, 255, 255, 0.14); padding: 0.6rem 0.95rem 0.75rem; font: 500 0.8rem/1.5 'Fira Code', monospace; color: #a6e3a1; white-space: pre-wrap; transition: opacity 0.3s; }

/* Exercices, quiz et blocs à explorer dans les chapitres */
.pc-recit .pc-col { padding: 0 22px; }
.pc-recit .pc-exo { margin: 2.2rem 0 1.2rem; }
.pc-recit .pc-quiz-chapitre { padding: 56px 0 64px; }
.pc-recit .pc-quiz-chapitre .pc-h2 { font-family: var(--mk-recit-titre); letter-spacing: -0.02em; }
.pc-plus { box-sizing: border-box; max-width: 40rem; margin: 0 auto; padding: 48px 22px 8px; }
.pc-plus .mk-carte a { color: var(--mk-fond-a, #166534); font-weight: 700; }
.pc-recit .mk-sources { max-width: 40rem; margin: 32px auto 0; padding: 0 22px 56px; box-sizing: border-box; }
.pc-recit .mk-sources-liste { list-style: decimal; }
.pc-pied { padding: 28px 22px 40px; text-align: center; color: var(--pc-r-doux); font-size: 0.95rem; }
.pc-pied p { margin: 0 0 6px; }

/* Correctifs du 2 octobre 2026 (relevés par la refonte de Prog 3 et Prog 4) */
.pc-recit .mk-ecran .pc-code pre { font-size: 0.6em; overflow-x: auto; }
.pc-recit .mk-ecran .pc-code pre code { background: none; padding: 0; border-radius: 0; color: inherit; font-size: 1em; }
/* les schémas construits en JavaScript par les anciennes scènes gardent leur Fira Code */
.pc-recit svg text[font-family*="Fira"] { font-family: 'Fira Code', ui-monospace, monospace; }
/* chapitre sur fond nuit (data-fond="encre") */
.pc-recit [data-fond="encre"] .pc-vraie-vie { background: #FBE38E; color: #1E2A45; }
.pc-recit [data-fond="encre"] .pc-exemple { color: #D9D3C7; }
.pc-recit [data-fond="encre"] .pc-intro-scene h3 { color: #F6F1E7; }
.pc-recit [data-fond="encre"] .pc-intro-scene p { color: #D9D3C7; }
/* code en ligne : il revient à la ligne au lieu de faire déborder un écran ou une carte */
.pc-recit .mk-ecran code, .pc-recit .mk-carte code { white-space: normal; overflow-wrap: anywhere; }
.pc-recit .mk-ecran pre code { white-space: pre; overflow-wrap: normal; }
/* tuiles de code des exercices « remets dans l'ordre » : lisibles sur iPhone */
.pc-recit .pc-ligne { font-size: 0.78rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.pc-recit .pc-ligne .pc-num:empty { display: none; }


/* ── Plus de mouvement et de couleur (10 octobre 2026) ───────────────────────
   Déclencheurs posés par prog-cours.js (animerRecit) sur chaque écran, joués au défilement par js/recit.js :
   l'étiquette saute, le code s'écrit ligne à ligne (curseur sur la ligne en cours), sa sortie s'imprime,
   un feutre de la couleur du chapitre passe sous le premier mot en gras. Sans JavaScript ou avec le mouvement
   réduit, tout est affiché d'emblée. */
html.mk-recit-on .pc-saute[data-mk-des] { transform-origin: 0 50%; transition: opacity 0.3s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
html.mk-recit-on .pc-saute[data-mk-des]:not(.est-la) { opacity: 0; transform: scale(0.55) translate3d(0, 6px, 0); }

.pc-recit .pc-ln { display: inline-block; min-width: 1ch; padding-right: 2px; border-radius: 3px; }
html.mk-recit-on .pc-ln[data-mk-des] { transition: opacity 0.28s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.25s ease, box-shadow 0.25s ease; }
html.mk-recit-on .pc-ln[data-mk-des]:not(.est-la) { opacity: 0; transform: translate3d(-12px, 0, 0); }
html.mk-recit-on .pc-ln.est-la:has(+ .pc-ln:not(.est-la)) { background: rgba(255, 255, 255, 0.1); box-shadow: inset -2px 0 0 var(--pc-lang, #a6e3a1); }

.pc-recit .pc-execute { clip-path: inset(0 0 0 0); }
html.mk-recit-on .pc-execute[data-mk-des] { transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), clip-path 0.7s cubic-bezier(0.2, 0.8, 0.2, 1); }
html.mk-recit-on .pc-execute[data-mk-des]:not(.est-la) { opacity: 0; transform: translate3d(0, -6px, 0); clip-path: inset(0 0 100% 0); }

.pc-recit .pc-feutre {
    background-image: linear-gradient(var(--fam-m, #FBE38E), var(--fam-m, #FBE38E));
    background-repeat: no-repeat;
    background-position: 0 90%;
    background-size: 100% 0.42em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}
html.mk-recit-on .pc-feutre[data-mk-des] { transition: background-size 0.75s cubic-bezier(0.2, 0.8, 0.2, 1); }
html.mk-recit-on .pc-feutre[data-mk-des]:not(.est-la) { opacity: 1; transform: none; background-size: 0% 0.42em; }

/* Éditeurs de code : la couleur du langage (en-tête teinté, curseur), lisible sur le fond sombre ; classe posée par
   prog-cours.js d'après data-code, l'extension du fichier ou le nom du langage dans l'en-tête */
.pc-recit .pc-lang-python { --pc-lang: #7DB9F5; }
.pc-recit .pc-lang-java { --pc-lang: #F89820; }
.pc-recit .pc-lang-js { --pc-lang: #F7DF1E; }
.pc-recit .pc-lang-ts { --pc-lang: #A5B4FC; }
.pc-recit .pc-lang-cs { --pc-lang: #C99BE8; }
.pc-recit .pc-lang-cpp { --pc-lang: #93C5D8; }
.pc-recit .pc-lang-go { --pc-lang: #4FD1E8; }
.pc-recit .pc-lang-r { --pc-lang: #9FD3A8; }
.pc-recit .pc-code[class*="pc-lang-"] .pc-code-tete {
    color: var(--pc-lang);
    background: color-mix(in srgb, var(--pc-lang) 13%, transparent);
    border-bottom-color: color-mix(in srgb, var(--pc-lang) 38%, transparent);
}

/* Cartes, bulles et titres de scène à la couleur du chapitre */
.pc-recit [data-famille] .mk-carte {
    background: color-mix(in srgb, var(--fam-c) 60%, #FFFDF8);
    border-color: var(--fam-m);
}
.pc-recit [data-famille] .mk-carte h3 { color: var(--fam-f); }
.pc-recit [data-famille] .mk-fil { --mk-fil-toi: color-mix(in srgb, var(--fam-m) 55%, #FFFDF8); }
.pc-recit [data-famille]:not([data-fond="encre"]) .pc-intro-scene h3 { color: var(--fam-f); }
.pc-recit [data-famille] .pc-schema, .pc-recit [data-famille] .pc-fig svg { border-width: 2px; border-color: var(--fam-m); }
/* Boîtes blanches des schémas d'écran : une teinte légère du chapitre (les couleurs qui ont un sens restent) */
.pc-recit [data-famille]:not([data-fond="encre"]) .pc-schema [fill="#FFFDF8" i] { fill: color-mix(in srgb, var(--fam-c) 80%, #FFFDF8); }
