/*
=========================================================
AP MATHS - V8.0.0 - DIRECTION ARTISTIQUE « CAHIER »
Fichier : css/cahier.css

Rôle :
- Socle visuel commun à TOUTES les pages (public, élève,
  compte, administration) : couleurs, papier quadrillé,
  typographie, boutons, cartes, formulaires, messages.
- Chaque page charge ce fichier EN PREMIER, puis sa propre
  feuille (style.css, accueil.css, admin.css...) qui ne
  contient plus que la mise en page spécifique.

Principe graphique :
- fond = feuille de cahier à petits carreaux ;
- cartes = feuilles blanches posées dessus, trait d'encre
  et légère ombre décalée ;
- couleurs = feutres de trousse (bleu, vert, rouge,
  jaune surligneur) ;
- aucune police externe : polices système arrondies,
  donc rien n'est chargé depuis un autre site (RGPD).
=========================================================
*/


/* =====================================================
   1. VARIABLES
   Changer une couleur ici la change partout.
   ===================================================== */
:root {
    /* Papier et encre */
    --papier: #fbfaf4;
    --carreau: #dfe7f3;
    --marge: #f2a3a3;
    --feuille: #ffffff;
    --encre: #1d2440;
    --crayon: #5d6479;
    --gomme: #eceef3;
    --trait: #c9cfdb;

    /* Feutres */
    --bleu: #2f5bd3;
    --bleu-fonce: #1f3f9e;
    --bleu-clair: #e3eaff;
    --vert: #18925a;
    --vert-clair: #ddf5e8;
    --rouge: #d8432f;
    --rouge-clair: #fde7e3;
    --jaune: #ffe45c;
    --jaune-clair: #fff6c2;
    --orange: #b86200;
    --orange-clair: #ffefd6;
    --violet: #6d4fd1;

    /* Compatibilité : noms utilisés par les anciennes feuilles / JS */
    --blanc: var(--feuille);
    --texte: var(--encre);
    --gris: var(--crayon);
    --gris-clair: var(--gomme);
    --bordure: var(--trait);

    /* Formes */
    --rayon: 14px;
    --rayon-petit: 9px;
    --ombre: 3px 4px 0 rgba(29, 36, 64, 0.10);
    --ombre-forte: 5px 6px 0 rgba(29, 36, 64, 0.14);

    /* Polices système (aucun téléchargement) */
    --police: "Nunito", ui-rounded, "SF Pro Rounded", "Segoe UI Variable Text",
        "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --police-titre: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI Variable Display",
        "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --police-main: "Segoe Print", "Bradley Hand", "Chalkboard SE", "Marker Felt",
        ui-rounded, "Segoe UI", system-ui, sans-serif;
}


/* =====================================================
   2. BASE : la feuille à carreaux
   ===================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--police);
    font-size: 16px;
    line-height: 1.5;
    color: var(--encre);
    background-color: var(--papier);
    background-image:
        linear-gradient(var(--carreau) 1px, transparent 1px),
        linear-gradient(90deg, var(--carreau) 1px, transparent 1px);
    background-size: 22px 22px;
    background-position: -1px -1px;
}

h1,
h2,
h3 {
    font-family: var(--police-titre);
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 8px;
}

h1 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); font-weight: 900; }
h2 { font-size: clamp(1.2rem, 3vw, 1.45rem); font-weight: 850; }
h3 { font-size: 1.05rem; font-weight: 800; }

p { margin: 0 0 10px; }

a { color: var(--bleu); text-underline-offset: 3px; }

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button { cursor: pointer; }

:focus-visible {
    outline: 3px solid var(--jaune);
    outline-offset: 2px;
    border-radius: 6px;
}

.cache { display: none !important; }


/* =====================================================
   3. PETITS ÉLÉMENTS DE STYLE « CAHIER »
   ===================================================== */

/* Coup de surligneur derrière un mot */
.surligne,
mark {
    background: linear-gradient(transparent 55%, var(--jaune) 55%, var(--jaune) 92%, transparent 92%);
    color: inherit;
    padding: 0 3px;
}

/* Sur-titre écrit « à la main » */
.manuscrit {
    font-family: var(--police-main);
    font-weight: 700;
    color: var(--bleu);
    letter-spacing: 0;
    text-transform: none;
}

/* Étiquette / gommette */
.gommette {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1.5px solid currentColor;
    font-size: 0.82rem;
    font-weight: 800;
    background: var(--feuille);
    white-space: nowrap;
}


/* =====================================================
   4. CARTE = feuille posée sur le cahier
   ===================================================== */
.feuille {
    background: var(--feuille);
    border: 2px solid var(--encre);
    border-radius: var(--rayon);
    box-shadow: var(--ombre);
}


/* =====================================================
   5. BOUTONS COMMUNS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border: 2px solid var(--encre);
    border-radius: 12px;
    background: var(--feuille);
    color: var(--encre);
    font-weight: 800;
    text-decoration: none;
    box-shadow: 2px 3px 0 var(--encre);
    transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s;
}

.btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 4px 0 var(--encre); }
.btn:active { transform: translate(2px, 3px); box-shadow: 0 0 0 var(--encre); }
.btn.bleu { background: var(--bleu); color: #fff; }
.btn.jaune { background: var(--jaune); }
.btn.vert { background: var(--vert); color: #fff; }
.btn.rouge { background: var(--rouge); color: #fff; }

.btn:disabled,
.btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }


/* =====================================================
   6. CHAMPS DE FORMULAIRE COMMUNS
   ===================================================== */
.champ,
.compte-form input:not([type=checkbox]):not([type=radio]),
.compte-form select,
.admin-page input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
.admin-page select,
.admin-page textarea,
.admin-modal input:not([type=checkbox]),
.admin-modal select {
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 2px solid var(--trait);
    border-radius: 10px;
    background: var(--feuille);
    transition: border-color 0.15s;
}

.champ:focus,
.compte-form input:not([type=checkbox]):focus,
.compte-form select:focus,
.admin-page input:focus,
.admin-page select:focus,
.admin-page textarea:focus,
.admin-modal input:focus,
.admin-modal select:focus {
    border-color: var(--bleu);
    outline: 3px solid var(--bleu-clair);
    outline-offset: 0;
}


/* =====================================================
   7. ÉCRANS RÉDUITS / ACCESSIBILITÉ
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
    body { background: #fff; }
}
