/* Styles communs à toutes les pages */
body { font-family: 'Nunito', sans-serif; }
html { scroll-behavior: smooth; }

/* Fond décoratif : lignes Seyès (grands carreaux), fixe, par-dessus le dégradé du body */
:root {
    --seyes-u: 8px;                          /* petit interligne */
    --seyes-g: calc(var(--seyes-u) * 4);     /* grand carreau */
    --seyes-fine:  rgb(120 140 220 / .08);
    --seyes-forte: rgb(100  80 200 / .14);
}
body::before {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image:
        repeating-linear-gradient(to bottom, var(--seyes-forte) 0 1px, transparent 1px var(--seyes-g)),
        repeating-linear-gradient(to right,  var(--seyes-forte) 0 1px, transparent 1px var(--seyes-g)),
        repeating-linear-gradient(to bottom, var(--seyes-fine)  0 1px, transparent 1px var(--seyes-u));
}
/* Fond illustré : dessin d'élève, fixe, SOUS la couche Seyès (z-index -2 < -1).
   Ancré en bas à droite, fondu vers le centre par un masque radial,
   légère respiration (désactivée si l'utilisateur réduit les animations). */
:root {
    --fond-eleve-opacite: .16;
    --fond-eleve-taille: min(95vh, 70vw);
}
body::after {
    content: ""; position: fixed; right: 0; bottom: 0; z-index: -2; pointer-events: none;
    width: var(--fond-eleve-taille); aspect-ratio: 1;
    background: url('../assets/img/fond-eleve.webp') right bottom / contain no-repeat;
    opacity: var(--fond-eleve-opacite);
    filter: saturate(.75) contrast(.95);
    mix-blend-mode: multiply;
    -webkit-mask-image: radial-gradient(circle at 70% 65%, #000 35%, transparent 72%);
            mask-image: radial-gradient(circle at 70% 65%, #000 35%, transparent 72%);
    transform-origin: 80% 90%;
    animation: fondRespire 24s ease-in-out infinite alternate, fondApparait 1.2s ease-out both;
}
@keyframes fondRespire {
    from { transform: scale(1) rotate(0deg); }
    to   { transform: scale(1.04) rotate(-.6deg); }
}
@keyframes fondApparait { from { opacity: 0; } to { opacity: var(--fond-eleve-opacite); } }
/* Mobile et petits écrans : en haut à gauche, juste sous le header (≈ 4.25rem), en miroir */
@media (max-width: 640px) {
    :root { --fond-eleve-opacite: .13; --fond-eleve-taille: min(78vw, 45vh); }
    body::after {
        top: 4.25rem; left: 0; right: auto; bottom: auto;
        transform-origin: 50% 0;          /* miroir autour du centre : la boîte ne bouge pas */
        transform: scaleX(-1);            /* le nerdy regarde vers la droite (reste actif sans animation) */
        animation-name: fondRespireMiroir, fondApparait;
    }
}
@keyframes fondRespireMiroir {
    from { transform: scaleX(-1); }
    to   { transform: scale(-1.04, 1.04) rotate(.6deg); }
}
@media (prefers-reduced-motion: reduce) {
    body::after { animation: none; }
}

.font-serif-literary { font-family: 'Playfair Display', serif; }

/* Titres en cursive scolaire (écriture française traditionnelle).
   :is():not() donne une spécificité (0,1,1) qui passe devant les classes Tailwind
   (font-extrabold, tracking-tight, leading-tight...). .no-cursive pour exclure un titre. */
:is(h1, h2):not(.no-cursive) {
    font-family: 'Playwrite FR Trad', cursive;
    font-weight: 400;
    font-style: normal;
    letter-spacing: 0;          /* un interlettrage négatif casse les liaisons */
    line-height: 1.5;           /* hampes et jambages hauts : évite le rognage */
    padding-block: .1em;
}

.fade-up { animation: fadeUp .5s ease-out both; }
.fade-up.d2 { animation-delay: .12s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Curseurs (range) */
input[type="range"] { -webkit-appearance: none; appearance: none; background: #e0f2fe; border-radius: 9999px; }
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: #0284c7; cursor: pointer; border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(2, 132, 199, .35);
}
input[type="range"]::-moz-range-thumb {
    width: 16px; height: 16px; border-radius: 50%;
    background: #0284c7; cursor: pointer; border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(2, 132, 199, .35);
}
section[id] { scroll-margin-top: 1.5rem; }

/* Quiz : retour visuel des réponses */
.correct-anim { animation: pulse-ok .4s ease-in-out; }
.wrong-anim { animation: shake .4s ease-in-out; }
@keyframes pulse-ok { 50% { transform: scale(1.02); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* Impression : seulement le contenu utile */
@media print {
    header, footer, .no-print { display: none !important; }
    body { background: #fff !important; }
    body::before, body::after { display: none; }
}

/* Écoute : cases du texte à trous */
.gap-input {
    display: inline-block; margin: 0 .15em; padding: 0 .35em; line-height: 1.6;
    font-family: 'Nunito', sans-serif; font-size: .95em; font-weight: 700; color: #334155;
    background: #fff1f2; border: 0; border-bottom: 2px solid #fda4af; border-radius: .4em .4em 0 0;
    text-align: center; transition: background .15s, border-color .15s;
}
.gap-input:focus { outline: none; background: #fff; border-bottom-color: #e11d48; box-shadow: 0 0 0 3px #ffe4e6; }
.gap-input.is-ok       { background: #ecfdf5; border-bottom-color: #10b981; color: #047857; }
.gap-input.is-accent   { background: #fffbeb; border-bottom-color: #f59e0b; color: #b45309; }
.gap-input.is-ko       { background: #fef2f2; border-bottom-color: #ef4444; color: #b91c1c; animation: shake .4s ease-in-out; }
.gap-input.is-revealed { background: #f0f9ff; border-bottom-color: #0ea5e9; color: #0369a1; font-style: italic; }
.gap-input[readonly]   { cursor: default; }
button:disabled { opacity: .45; cursor: not-allowed; }
