/* EPS Mania : les six couleurs du logo deviennent six couloirs de piste.
   Chaque rubrique court dans son couloir (une couleur = une rubrique). */
:root {
  --paper: #f6f7f9; --surface: #ffffff; --ink: #1b1d22; --muted: #5a606b; --line: #dfe2e8;
  --violet: #6a3fc4; --blue: #2a73d6; --green: #23855a; --yellow: #e9b411; --orange: #d9661a; --red: #d63c45;
  --display: 'Archivo', 'Arial Narrow', Arial, sans-serif;
  --body: 'Atkinson Hyperlegible', Verdana, Geneva, sans-serif;
  --c: var(--ink);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14161a; --surface: #1d2026; --ink: #f1f2f5; --muted: #a9afba; --line: #323742;
    --violet: #a58bf0; --blue: #6ea8f5; --green: #5cc494; --yellow: #f0c545; --orange: #f39a55; --red: #f07a81;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.6; }
img, iframe, video { max-width: 100%; }
img { height: auto; }
a { color: inherit; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); font-stretch: 112%; line-height: 1.12; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); font-weight: 900; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.4rem, 2.8vw, 1.9rem); font-weight: 800; }
h3 { font-size: 1.1rem; font-weight: 700; font-stretch: 105%; }
p { margin: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.evitement { position: absolute; left: -999px; }
.evitement:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* En-tete */
.top { background: var(--surface); position: sticky; top: 0; z-index: 5; }
.top .wrap { display: flex; align-items: center; gap: 10px 26px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { font-family: var(--display); font-weight: 900; font-stretch: 118%; font-size: 1.25rem; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand img { height: 40px; width: auto; display: block; }
.top .brand img + span { position: absolute; left: -999px; }
.nav { display: flex; gap: 2px 4px; flex-wrap: wrap; flex: 1; }
.nav a { text-decoration: none; padding: 7px 11px; font-weight: 700; font-size: 0.97rem; border-bottom: 3px solid transparent; }
.nav a:hover { border-bottom-color: var(--line); }
.nav a[aria-current="page"] { border-bottom-color: var(--c, var(--ink)); }
.track { height: 24px; background: linear-gradient(180deg, var(--violet) 0 4px, var(--blue) 4px 8px, var(--green) 8px 12px, var(--yellow) 12px 16px, var(--orange) 16px 20px, var(--red) 20px 24px); }
.track.fin { height: 4px; background: linear-gradient(90deg, var(--violet), var(--blue), var(--green), var(--yellow), var(--orange), var(--red)); }
.btn { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1rem; line-height: 1.25; padding: 12px 20px; border-radius: 10px; border: 2px solid var(--ink); background: var(--ink); color: var(--paper); cursor: pointer; }
.btn:hover { transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.small { padding: 8px 14px; font-size: 0.92rem; }

/* Accueil */
.hero { background: var(--surface); }
.hero .wrap { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 40px; align-items: center; padding-top: 52px; padding-bottom: 52px; }
.lead { font-size: 1.18rem; color: var(--muted); max-width: 36em; margin-top: 16px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.logo-rond { justify-self: center; width: min(320px, 70vw); aspect-ratio: 1; object-fit: cover; border-radius: 50%; background: #fff; }
section { padding: 52px 0; }
section.serre { padding-top: 0; }
section.fond { background: var(--surface); }
.head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.head p { color: var(--muted); max-width: 40em; margin-top: 8px; }
.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.door { background: var(--surface); border: 1px solid var(--line); border-left: 8px solid var(--c); border-radius: 12px; padding: 24px; text-decoration: none; display: flex; flex-direction: column; gap: 10px; }
.door:hover { border-color: var(--c); }
.door p { color: var(--muted); }
.door span { font-weight: 700; color: var(--ct, var(--c)); margin-top: auto; }
.figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 26px 0; }
.figures b { display: block; font-family: var(--display); font-weight: 900; font-stretch: 115%; font-size: clamp(1.8rem, 4vw, 2.8rem); font-variant-numeric: tabular-nums; line-height: 1.1; }
.figures span { color: var(--muted); }
.theme { display: grid; grid-template-columns: 240px 1fr; gap: 24px; padding: 24px 0; border-top: 1px solid var(--line); }
.theme > div:first-child { border-left: 8px solid var(--c); padding-left: 16px; align-self: start; }
.theme > div:first-child p { color: var(--muted); margin-top: 6px; font-size: 0.97rem; }
.theme h3 a { text-decoration: none; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.quote { font-family: var(--display); font-weight: 700; font-size: 1.35rem; line-height: 1.3; border-left: 8px solid var(--orange); padding-left: 18px; max-width: 30em; }
.prose { max-width: 68ch; display: grid; gap: 1.05em; }

/* Cartes */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.cards.grandes { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: 10px; padding: 16px 18px; text-decoration: none; display: flex; flex-direction: column; gap: 8px; }
.card:hover { border-color: var(--c); }
.card p { color: var(--muted); font-size: 0.95rem; line-height: 1.45; }
.card .vig { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--paper); }
.card[hidden] { display: none; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.chip { font: inherit; font-weight: 700; font-size: 0.95rem; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--c, var(--ink)); background: var(--c, var(--ink)); color: var(--paper); }

/* Pages de contenu */
.page { padding-top: 40px; padding-bottom: 56px; display: grid; gap: 28px; }
.page > * { min-width: 0; }
.entete { border-left: 8px solid var(--c); padding-left: 18px; display: grid; gap: 10px; }
.entete .lead { margin-top: 0; }
.fil { color: var(--muted); font-size: 0.95rem; font-weight: 700; }
.fil a { text-decoration: none; }
.fil a:hover { text-decoration: underline; }
.banniere img { width: 100%; max-height: 420px; object-fit: contain; border-radius: 14px; display: block; background: var(--surface); }
.inter { margin-top: 12px; }
.contenu { display: grid; gap: 24px; }
.contenu > *, .col > * { min-width: 0; }
.contenu h2 { margin-top: 14px; padding-bottom: 10px; border-bottom: 4px solid var(--c); justify-self: start; }
.contenu h2.tc { justify-self: center; text-align: center; }
.para { max-width: 74ch; overflow-wrap: anywhere; }
.para.tc, p.tc { text-align: center; margin-inline: auto; }
.para a, .prose a { color: var(--ct, var(--c)); font-weight: 700; }
.para ul, .para ol { margin: 0.5em 0; padding-left: 1.4em; }
.para li { margin-bottom: 0.4em; }
.para li::marker { color: var(--c); }
.cols { display: flex; gap: 28px; flex-wrap: wrap; }
.col { flex: var(--w, 1) 1 0; min-width: 240px; display: grid; gap: 20px; align-content: start; }
.fig { margin: 0; }
.fig img { border-radius: 10px; display: block; }
.fig.tc img { margin-inline: auto; }
.fig a img:hover { opacity: 0.9; }
figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 6px; }
.contenu hr { border: 0; height: 1px; background: var(--line); width: 100%; margin: 6px 0; }
.video { aspect-ratio: 16 / 9; max-width: 860px; width: 100%; }
.video iframe { width: 100%; height: 100%; border: 0; border-radius: 10px; }
.pdf { display: grid; gap: 10px; }
.pdf iframe { width: 100%; height: 620px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.embed { overflow: hidden; border-radius: 10px; max-width: 100%; }
.embed iframe { max-width: 100%; }
.diapo { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 10px; }
.diapo img { flex: 0 0 auto; height: clamp(180px, 30vw, 320px); width: auto; max-width: none; border-radius: 10px; scroll-snap-align: start; }
.note { background: var(--surface); border: 1px dashed var(--line); border-radius: 10px; padding: 14px 18px; color: var(--muted); font-size: 0.95rem; }
.billet { border-top: 1px solid var(--line); padding-top: 24px; display: grid; gap: 20px; }
.date { color: var(--muted); font-size: 0.95rem; }
.retour { margin-top: 12px; }

footer { background: var(--surface); border-top: 1px solid var(--line); padding: 36px 0 44px; }
footer .wrap { display: flex; gap: 24px 48px; flex-wrap: wrap; justify-content: space-between; }
footer ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
footer small { color: var(--muted); display: block; margin-top: 8px; max-width: 30em; }

@media (max-width: 820px) {
  .hero .wrap, .split, .theme { grid-template-columns: 1fr; }
  .doors, .figures { grid-template-columns: 1fr; }
  .logo-rond { order: -1; width: 200px; }
  section { padding: 38px 0; }
  .top { position: static; }
  .top .wrap { gap: 6px 12px; padding-top: 12px; padding-bottom: 8px; }
  .brand { flex: 1 1 100%; }
  .nav { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin: 0 -24px; padding: 0 24px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: 9px 12px; }
  .top > .wrap > .btn.small { display: none; }
  .pdf iframe { height: 440px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .btn:hover { transform: none; } }
@media print { .top, footer, .retour { display: none; } }

/* Diaporamas interactifs (actives par site.js) */
.diapo.actif { display: block; position: relative; overflow: hidden; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.diapo.actif img { display: block; margin: 0 auto; width: auto; height: auto; max-width: 100%; max-height: min(72vh, 600px); border-radius: 0; cursor: zoom-in; }
.d-prec, .d-suiv, .v-prec, .v-suiv, .v-fermer { position: absolute; width: 46px; height: 46px; border-radius: 50%; border: 2px solid #fff; background: rgba(20, 22, 26, 0.82); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0 0 4px; }
.d-prec, .v-prec { left: 12px; top: 50%; transform: translateY(-50%); }
.d-suiv, .v-suiv { right: 12px; top: 50%; transform: translateY(-50%); }
.d-prec:hover, .d-suiv:hover, .v-prec:hover, .v-suiv:hover, .v-fermer:hover { background: #000; }
.d-compte { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: rgba(20, 22, 26, 0.82); color: #fff; font-size: 0.85rem; font-weight: 700; padding: 2px 12px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.fig img.zoom { cursor: zoom-in; }
.visionneuse { display: none; position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.92); align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.visionneuse.on { display: flex; }
.visionneuse img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.visionneuse.seule .v-prec, .visionneuse.seule .v-suiv { display: none; }
.v-fermer { top: 16px; right: 16px; }

/* Tuile de repli quand une page n'a aucune image */
.card .vig.tuile { display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px; color: #fff; font-family: var(--display); font-weight: 900; font-stretch: 115%; font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.1; background: linear-gradient(180deg, transparent 0 82%, rgba(255, 255, 255, 0.85) 82% 85%, transparent 85% 88%, rgba(255, 255, 255, 0.85) 88% 91%, transparent 91% 94%, rgba(255, 255, 255, 0.85) 94% 97%, transparent 97%), var(--c); }
@media (prefers-color-scheme: dark) { .card .vig.tuile { color: #14161a; } }

/* Le jaune est trop clair pour du texte sur fond blanc : texte plus fonce dans les rubriques jaunes */
[style*="--yellow"] { --ct: #7a5600; }
[style*="--yellow"] .vig.tuile { color: #1b1d22; }
@media (prefers-color-scheme: dark) { [style*="--yellow"] { --ct: var(--yellow); } }

/* Nouveautes, cartes de texte, pages d'information */
.nouv { list-style: none; margin: 0; padding: 0; }
.nouv li { display: grid; grid-template-columns: 180px 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.nouv li:last-child { border-bottom: 1px solid var(--line); }
.nouv .quand { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.nouv a { font-weight: 700; text-decoration: none; }
.nouv a:hover { text-decoration: underline; }
div.card a { color: var(--ct, var(--c)); font-weight: 700; }
.prose h2 { margin-top: 0.6em; }
.retour.actions { margin-top: 12px; }
@media (max-width: 820px) { .nouv li { grid-template-columns: 1fr; gap: 2px; } }

/* Les boutons gardent leur couleur dans les textes */
.prose a.btn, .para a.btn, div.card a.btn { color: var(--paper); }
.prose a.btn.ghost, .para a.btn.ghost, div.card a.btn.ghost { color: var(--ink); }

/* Compteur de visites et messages des pages CRPE */
.vie { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); max-width: 760px; }
.vie[hidden] { display: none; }
.vie-compteur { color: var(--muted); font-weight: 700; margin: 0 0 8px; }
.vie-compteur strong { color: var(--ct, var(--c)); font-variant-numeric: tabular-nums; }
.vie h2 { margin: 0.4em 0 0.6em; }
.vie-form { display: grid; gap: 12px; margin-bottom: 20px; }
.vie-form label { display: grid; gap: 4px; font-weight: 700; }
.vie-form input, .vie-form textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
.vie-form input:focus, .vie-form textarea:focus { outline: 3px solid var(--c); outline-offset: 1px; }
.vie-form .vie-piege { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.vie-form small, .vie-etat { color: var(--muted); }
.vie-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.vie-liste li { padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 8px; }
.vie-liste p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.vie-tete { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.vie-tete time { color: var(--muted); font-size: 0.9em; }
.vie-bloc { padding-top: 0 !important; padding-bottom: 40px; }

/* Diaporamas : image cliquable (lien vers le fichier) et legende */
.diapo .slide { margin: 0; }
.diapo.actif .slide { display: none; padding: 0 0 12px; text-align: center; }
.diapo.actif .slide.on { display: block; }
.diapo.actif .slide a:not(.btn) { display: block; }
.diapo.actif .slide a:not(.btn) img { cursor: pointer; }
.diapo .slide figcaption { margin: 10px auto 0; max-width: 62ch; padding: 0 56px; color: var(--ink); font-size: 0.95rem; line-height: 1.45; text-align: center; }
.diapo .slide figcaption .btn { margin-top: 8px; }
.diapo:not(.actif) .slide { flex: 0 0 auto; max-width: 70vw; }
