/* ═══════════════════════════════════════════════════════════════════════
   Mentorix — socle visuel « univers »
   Couleurs, polices, boutons, progression, médailles, dialogue.
   Partagé par l'espace élève (eleve.css) et, plus tard, enseignants/parents.
   Polices hébergées sur le site : la CSP n'autorise que font-src 'self'.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Polices ─────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'DM Sans'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('../fonts/dmsans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'DM Sans'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('../fonts/dmsans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Nunito'; font-style: normal; font-weight: 700 1000; font-display: swap;
  src: url('../fonts/nunito-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito'; font-style: normal; font-weight: 700 1000; font-display: swap;
  src: url('../fonts/nunito-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'OpenDyslexic'; font-weight: 400; font-display: swap;
  src: url('../fonts/OpenDyslexic-Regular.otf') format('opentype');
}
@font-face {
  font-family: 'OpenDyslexic'; font-weight: 700; font-display: swap;
  src: url('../fonts/OpenDyslexic-Bold.otf') format('opentype');
}

/* ── Couleurs ────────────────────────────────────────────────────────── */
:root {
  --ink:    #192e32;   /* texte */
  --green:  #133d38;   /* vert forêt : actions, sélection */
  --green-2:#2d5b4d;   /* survol */
  --lime:   #e9f299;   /* accent */
  --cream:  #faf7ef;   /* fond de page */
  --white:  #fffef9;   /* cartes */
  --muted:  #617168;   /* texte secondaire */
  --line:   #dfe3d6;   /* bordures */
  --moss:   #668650;   /* progression */
  --ok-bg:  #e8f1d8;  --ok-line:  #749359;   /* bonne réponse */
  --try-bg: #fcf0e8;  --try-line: #b77a55;   /* réponse à revoir (jamais rouge vif) */
  --focus:  #bd7828;
  --font-text:  'DM Sans', Arial, sans-serif;
  --font-title: 'Nunito', Arial, sans-serif;
}

/* ── Base ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 105px; }
body {
  margin: 0;
  font: 16px/1.55 var(--font-text);
  background: var(--cream);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; color: inherit; }
button:disabled { cursor: default; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font-title); }
svg { width: 22px; height: 22px; flex: none; }
button, a { touch-action: manipulation; }
a:focus-visible, button:focus-visible, summary:focus-visible, select:focus-visible, input:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 4px;
}
[hidden] { display: none !important; }

.skip { position: absolute; top: -100px; left: 8px; }
.skip:focus { top: 8px; background: #fff; padding: 12px; z-index: 100; border-radius: 8px; }

.eyebrow {
  display: block; margin-bottom: 13px;
  font-size: 11px; font-weight: 800; letter-spacing: 1.8px; text-transform: uppercase;
  color: #45624b;
}

/* ── Boutons ─────────────────────────────────────────────────────────── */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 16px;
  min-height: 46px; padding: 12px 18px;
  background: var(--green); color: #fff;
  border: 0; border-radius: 9px;
  font-size: 14px; font-weight: 700;
}
.button:hover { background: var(--green-2); }
.button:disabled { background: #e4e7db; color: #6b7666; }
.button svg { width: 18px; height: 18px; }
.button.secondary { background: transparent; color: var(--green); border: 1px solid var(--line); }
.button.secondary:hover { background: #f0f3e8; }
.button.pale { background: var(--lime); color: var(--green); }
.small-link {
  font-size: 13px; color: #416844;
  text-decoration: underline; text-underline-offset: 4px;
  border: 0; background: none; padding: 5px; white-space: nowrap;
}

/* ── Progression ─────────────────────────────────────────────────────── */
progress {
  appearance: none; -webkit-appearance: none;
  display: block; width: 100%; height: 7px;
  border: 0; border-radius: 20px; background: #e8eddf;
}
progress::-webkit-progress-bar   { background: #e8eddf; border-radius: 20px; }
progress::-webkit-progress-value { background: var(--moss); border-radius: 20px; }
progress::-moz-progress-bar      { background: var(--moss); border-radius: 20px; }

/* ── Médailles et récompenses ────────────────────────────────────────── */
.reward-img { display: block; width: 45px; height: 45px; object-fit: contain; mix-blend-mode: multiply; flex: none; }
.reward-img.locked { filter: saturate(.3); opacity: .55; }

/* ── Dialogue ────────────────────────────────────────────────────────── */
dialog {
  width: min(500px, calc(100% - 35px));
  padding: 30px;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--cream); color: var(--ink);
  box-shadow: 0 30px 100px #0005;
}
dialog::backdrop { background: #123c37b8; backdrop-filter: blur(4px); }
dialog h2 { font-size: 26px; margin: 10px 0 15px; }
dialog p  { color: var(--muted); margin-bottom: 23px; }
.dialog-close {
  position: absolute; right: 14px; top: 12px;
  min-width: 44px; min-height: 44px;
  border: 0; background: none; font-size: 25px;
}

/* ── Lecture adaptée (OpenDyslexic) ──────────────────────────────────── */
.dyslexic,
.dyslexic h1, .dyslexic h2, .dyslexic h3, .dyslexic h4,
.dyslexic button, .dyslexic input, .dyslexic select {
  font-family: 'OpenDyslexic', Arial, sans-serif;
  letter-spacing: 0;
}
.dyslexic h1, .dyslexic h2, .dyslexic h3 { line-height: 1.5; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Texte réservé aux lecteurs d’écran */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Teintes par matière (tuiles, pastilles) — usage : data-subject="mathematiques" */
[data-subject="francais_lecture"]   { --tint: #e6eef2; --tone: #2f5d73; }
[data-subject="francais_ecriture"]  { --tint: #efe9f4; --tone: #5d4a78; }
[data-subject="mathematiques"]      { --tint: #f4e4c9; --tone: #865d27; }
[data-subject="sciences"]           { --tint: #e3eed8; --tone: #46693a; }
[data-subject="univers_social"]     { --tint: #f3ead2; --tone: #7a6420; }
[data-subject="anglais"]            { --tint: #f6e3df; --tone: #8a4336; }
[data-subject="arts"]               { --tint: #f7e4ec; --tone: #86406a; }
[data-subject="education_physique"] { --tint: #dcefe9; --tone: #2e6b5c; }
.subject-chip { display: inline-block; padding: 3px 10px; border-radius: 30px; background: var(--tint, #eef1df); color: var(--tone, var(--green)); font-size: 12px; font-weight: 700; white-space: nowrap; }
