/* ============================================================
   style.css — Maths-Sciences LP Saint-Étienne, Cahors
   Charte : tons chauds peu saturés, fond crème, beaucoup d'air.
   Aucune ressource externe (hors-ligne total).
   ============================================================ */

:root {
  --fond:        #faf7f2;   /* crème */
  --fond-carte:  #fffdf9;
  --texte:       #33322e;
  --texte-doux:  #6e675e;
  --terracotta:  #b0562f;
  --terracotta-fonce: #8f4526;
  --brun:        #6b4f3a;
  --olive:       #6f7350;
  --ocre:        #c09a3e;
  --brique:      #a34a3a;
  --bordure:     #e5ddd0;
  --ombre:       0 2px 10px rgba(107, 79, 58, .08), 0 1px 3px rgba(107, 79, 58, .06);
  --ombre-forte: 0 6px 22px rgba(107, 79, 58, .13);
  --rayon:       10px;
  /* couleurs de catégories du planning (pastel, peu saturées) */
  --cat-vacances: #d8a24a;
  --cat-pfmp:     #7d8f5a;
  --cat-conseil:  #b0562f;
  --cat-examen:   #a34a3a;
  --cat-ferie:    #8d7b68;
  --cat-rentree:  #5f7a5f;
  --cat-divers:   #a08c5b;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.02rem;
  line-height: 1.65;
}

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 1.25rem; }

h1, h2, h3, h4 {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--brun);
  line-height: 1.25;
}
h1 { font-size: 2rem; margin: .4em 0 .5em; }
h2 { font-size: 1.5rem; margin: 1.6em 0 .6em; border-bottom: 2px solid var(--bordure); padding-bottom: .3em; }
h3 { font-size: 1.15rem; margin: 1.2em 0 .4em; }

a { color: var(--terracotta); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ---------- En-tête ---------- */
.site-header {
  background: var(--fond-carte);
  border-bottom: 1px solid var(--bordure);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 6px rgba(107, 79, 58, .06);
}
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--texte); }
.brand:hover { text-decoration: none; }
.brand-symbole {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 9px;
  background: var(--terracotta); color: #fff;
  font-family: Georgia, serif; font-size: 1.3rem;
}
.brand-texte { display: flex; flex-direction: column; line-height: 1.15; }
.brand-texte strong { font-family: Georgia, serif; color: var(--brun); }
.brand-texte small { color: var(--texte-doux); font-size: .78rem; }

.site-nav { margin-left: auto; display: flex; gap: .25rem; flex-wrap: wrap; }
.site-nav a {
  color: var(--texte); padding: .45rem .8rem; border-radius: 8px;
  font-size: .96rem;
}
.site-nav a:hover { background: #f2ebe0; text-decoration: none; color: var(--terracotta-fonce); }
.nav-admin { border: 1px solid var(--bordure); }
.nav-toggle, .nav-burger { display: none; }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 3.5rem 1rem 2.8rem;
  position: relative;
  overflow: hidden;
}
/* Fond décoratif discret « maths × sciences » sous le héros */
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url('../img/hero-maths-sciences.svg') center 40% / min(1150px, 130%) no-repeat;
  opacity: .15;
  -webkit-mask-image: radial-gradient(ellipse 90% 95% at 50% 45%, #000 45%, transparent 100%);
          mask-image: radial-gradient(ellipse 90% 95% at 50% 45%, #000 45%, transparent 100%);
  pointer-events: none;
}
/* Voile de papier au centre pour préserver la lisibilité du texte */
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 62% 78% at 50% 46%, rgba(250, 247, 242, .82), rgba(250, 247, 242, 0) 100%);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: 2.5rem; margin-bottom: .2em; }
.hero h1 span { color: var(--terracotta); font-size: .72em; }
.hero-sous-titre { color: var(--texte-doux); font-size: 1.05rem; margin: .3rem 0 1rem; }
.hero-texte { max-width: 640px; margin: 0 auto 1.4rem; color: var(--texte-doux); }
.hero-actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-block;
  background: var(--terracotta); color: #fff;
  padding: .6rem 1.3rem; border-radius: 8px; border: none;
  font-size: .98rem; cursor: pointer; font-family: inherit;
  transition: background .15s ease, transform .1s ease;
}
.btn:hover { background: var(--terracotta-fonce); text-decoration: none; transform: translateY(-1px); }
.btn-secondaire { background: #fff; color: var(--terracotta); border: 1px solid var(--terracotta); }
.btn-secondaire:hover { background: #f7ece4; }
.btn-petit { padding: .3rem .75rem; font-size: .88rem; }
.btn-danger { background: var(--brique); }
.btn-danger:hover { background: #84392d; }

/* ---------- Cartes ---------- */
.grille-cartes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.1rem;
  margin: 1rem 0 2rem;
}
.carte {
  background: var(--fond-carte);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 1.2rem 1.3rem;
  box-shadow: var(--ombre);
  color: var(--texte);
  display: block;
  transition: box-shadow .18s ease, transform .18s ease;
}
a.carte:hover { box-shadow: var(--ombre-forte); transform: translateY(-2px); text-decoration: none; }
.carte h3, .carte h2 { margin: .35em 0 .3em; border: none; }
.carte-niveau {
  display: inline-block; background: #f2e3d6; color: var(--terracotta-fonce);
  font-size: .78rem; font-weight: 600; letter-spacing: .04em;
  padding: .15rem .55rem; border-radius: 20px; text-transform: uppercase;
}
.carte-matiere { color: var(--olive); font-weight: 600; margin: .15rem 0; }
.carte-meta { color: var(--texte-doux); font-size: .9rem; margin: .25rem 0; }
.carte-lien { color: var(--terracotta); font-size: .92rem; font-weight: 600; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; font-size: .78rem; font-weight: 600;
  padding: .12rem .55rem; border-radius: 20px;
  background: #efe7db; color: var(--brun);
}
.badge-vacances { background: #f5e3c4; color: #7a5416; }
.badge-pfmp     { background: #e2e8d2; color: #4f5c33; }
.badge-conseil  { background: #f2d9cd; color: #7c3c22; }
.badge-examen   { background: #f0d3cd; color: #77352a; }
.badge-ferie    { background: #e6dfd4; color: #5c5142; }
.badge-rentree  { background: #d8e2d4; color: #3c523c; }
.badge-divers   { background: #ece3cd; color: #6b5a33; }
.badge-domaine, .badge-theme { background: #e2e8d2; color: #4f5c33; }
.badge-preparation {
  display: inline-block; font-size: .78rem; font-weight: 600; font-style: italic;
  padding: .12rem .55rem; border-radius: 20px;
  background: #f5e3c4; color: #7a5416;
}

/* ---------- Page de connexion (accès élèves) ---------- */
.connexion-carte {
  max-width: 620px; margin: 1.5rem auto; background: var(--fond-carte);
  border: 1px solid var(--bordure); border-radius: var(--rayon);
  padding: 1.6rem 1.8rem; box-shadow: var(--ombre);
}
.connexion-carte h1 { margin-top: 0; }
.connexion-erreur {
  background: #f9ebe7; color: var(--brique); border-left: 4px solid var(--brique);
  padding: .55rem .8rem; border-radius: 6px; font-weight: 600;
}
.connexion-form .form-ligne input[type="password"] {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--bordure);
  border-radius: 7px; font-size: 1rem; background: #fffdf9; color: var(--texte);
}
.connexion-form .form-ligne input[type="password"]:focus {
  outline: 2px solid var(--terracotta); outline-offset: 1px; border-color: var(--terracotta);
}
.connexion-souvenir label { font-weight: 400; display: flex; gap: .45rem; align-items: center; }
.connexion-note { color: var(--texte-doux); font-size: .88rem; margin-bottom: 0; }
.acces-protege p { margin: .35rem 0; }
.edt-deconnexion { font-size: .85rem; }

/* ---------- Icônes contextuelles ---------- */
.icone { vertical-align: -.22em; flex-shrink: 0; }
.site-nav a .icone { vertical-align: -.18em; margin-right: .12rem; opacity: .85; }
.btn .icone { vertical-align: -.2em; margin-right: .15rem; }
h2 .icone { color: var(--terracotta); margin-right: .3rem; }

/* ---------- Cartes niveaux (accueil) ---------- */
.niveaux-grille {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem; margin-top: 1rem;
}
@media (max-width: 760px) { .niveaux-grille { grid-template-columns: 1fr; } }
.carte-niveau-big {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 1.5rem 1.6rem 1.3rem; position: relative;
}
.carte-niveau-big h3 { margin: .35rem 0 .4rem; }
.niveau-icone {
  display: inline-flex; align-items: center; justify-content: center;
  width: 58px; height: 58px; border-radius: 16px;
  background: #f2e3d6; color: var(--terracotta-fonce);
  box-shadow: inset 0 0 0 1px #e8d3c0;
}
.niveau-label {
  position: absolute; top: 1.15rem; right: 1.3rem;
  background: #f2e3d6; color: var(--terracotta-fonce);
  font-size: .78rem; font-weight: 600; letter-spacing: .04em;
  padding: .18rem .6rem; border-radius: 20px; text-transform: uppercase;
}
.niveau-accroche { color: var(--texte-doux); font-size: .94rem; margin: .1rem 0 .6rem; }
.niveau-stats {
  font-size: .85rem; font-weight: 600; color: var(--olive);
  margin: 0 0 .7rem; padding: .3rem .6rem; background: #eef1e4;
  border-radius: 7px; align-self: stretch;
}
.section-intro { color: var(--texte-doux); max-width: 60rem; }

/* ---------- Page niveau ---------- */
.niv-entete {
  display: flex; gap: 1.1rem; align-items: flex-start;
  background: var(--fond-carte); border: 1px solid var(--bordure);
  border-radius: var(--rayon); padding: 1.3rem 1.5rem; margin: 1rem 0 1.6rem;
  box-shadow: var(--ombre);
}
.niv-entete h1 { margin: .1rem 0 .35rem; }
.niv-entete .niveau-stats { display: inline-block; align-self: auto; margin: .3rem 0 0; }
.matiere-bloc { margin: 1.8rem 0; }
.matiere-bloc > h2 {
  border-bottom: 2px solid var(--terracotta); padding-bottom: .35rem;
}
.niv-classe {
  background: var(--fond-carte); border: 1px solid var(--bordure);
  border-radius: var(--rayon); padding: 1.1rem 1.3rem; margin: .9rem 0;
  box-shadow: var(--ombre);
}
.niv-classe-entete {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  align-items: baseline;
}
.niv-classe-entete h3 { margin: 0; }
.niv-classe-entete h3 a { color: var(--brun); }
.niv-specialite { color: var(--texte-doux); font-size: .88rem; margin: .15rem 0 0; }
.niv-classe-meta { color: var(--texte-doux); font-size: .88rem; margin: 0; white-space: nowrap; }
.niv-lecons { margin: .7rem 0 .3rem; padding-left: 1.3rem; }
.niv-lecons li { margin: .28rem 0; }
.niv-lecon-exos { color: var(--olive); font-size: .82rem; font-weight: 600; }
.niv-classe-liens { margin: .6rem 0 0; display: flex; gap: .5rem; flex-wrap: wrap; }
.footer-eco { font-size: .88rem; }
.footer-eco a { color: inherit; text-decoration: underline; }

/* Lien vers le site de l'établissement (héros + pied de page) */
a.lien-etab {
  color: inherit; text-decoration: none;
  border-bottom: 1px dashed currentColor; padding-bottom: 1px;
}
a.lien-etab:hover { color: var(--terracotta); border-bottom-style: solid; }

/* Section « ressources de l'auteur » (page Références) */
.ref-externes { margin-top: 2.2rem; }
.ref-externes > h2 { border-bottom: 2px solid var(--terracotta); padding-bottom: .35rem; }

/* Bouton Exécuter qui pulse quand le code a été modifié sans re-exécution */
@keyframes pulse-terracotta {
  0%   { box-shadow: 0 0 0 0 rgba(176, 86, 47, .55); }
  70%  { box-shadow: 0 0 0 12px rgba(176, 86, 47, 0); }
  100% { box-shadow: 0 0 0 0 rgba(176, 86, 47, 0); }
}
.btn-pulse { animation: pulse-terracotta 1.4s infinite; }

/* ---------- Figures pédagogiques dans les fiches ---------- */
figure.fig {
  margin: 1.1rem auto; max-width: 640px; text-align: center;
  background: #fdfbf7; border: 1px solid var(--bordure); border-radius: 10px;
  padding: .8rem .9rem .55rem; box-shadow: var(--ombre);
  break-inside: avoid;
}
figure.fig img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
figure.fig figcaption {
  margin-top: .45rem; font-size: .85rem; color: var(--texte-doux);
  font-style: italic; line-height: 1.4;
}
figure.fig.fig-large { max-width: 780px; }
@media print { figure.fig { box-shadow: none; } }

/* ---------- Liste de dates (accueil) ---------- */
.liste-dates { list-style: none; padding: 0; margin: 0 0 1.2rem; }
.date-item {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem;
  background: var(--fond-carte); border: 1px solid var(--bordure);
  border-left: 4px solid var(--bordure);
  border-radius: 8px; padding: .65rem .95rem; margin-bottom: .5rem;
  box-shadow: var(--ombre);
}
.date-item.cat-vacances { border-left-color: var(--cat-vacances); }
.date-item.cat-pfmp     { border-left-color: var(--cat-pfmp); }
.date-item.cat-conseil  { border-left-color: var(--cat-conseil); }
.date-item.cat-examen   { border-left-color: var(--cat-examen); }
.date-item.cat-ferie    { border-left-color: var(--cat-ferie); }
.date-item.cat-rentree  { border-left-color: var(--cat-rentree); }
.date-item.cat-divers   { border-left-color: var(--cat-divers); }
.date-quand { font-weight: 700; color: var(--brun); min-width: 150px; }
.date-titre { flex: 1; }
.date-classes { color: var(--texte-doux); font-size: .86rem; }

/* ---------- Page classe ---------- */
.ariane { font-size: .9rem; color: var(--texte-doux); margin: 1.1rem 0 .4rem; }
.ariane a { color: var(--texte-doux); }
.classe-entete { margin-bottom: .6rem; }
.grille-infos {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .9rem; margin: .8rem 0 1.2rem;
}
.info-tuile {
  background: var(--fond-carte); border: 1px solid var(--bordure);
  border-radius: var(--rayon); padding: .9rem 1.1rem; box-shadow: var(--ombre);
}
.info-tuile h3 { margin-top: 0; font-size: 1rem; color: var(--terracotta-fonce); }
.info-tuile p { margin: .2rem 0; }
.puces-champ { margin: .3rem 0; padding-left: 1.3rem; }
.puces-champ li { margin-bottom: .25rem; }
.a-venir { color: var(--texte-doux); font-style: italic; }

.matiere-titre { color: var(--olive); margin-top: 1.4rem; }
.liste-lecons { list-style: none; padding: 0; margin: .4rem 0 1.5rem; counter-reset: lecon; }
.lecon-item {
  background: var(--fond-carte); border: 1px solid var(--bordure); border-radius: 8px;
  padding: .7rem 1rem; margin-bottom: .55rem; box-shadow: var(--ombre);
  counter-increment: lecon;
}
.lecon-lien { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.lecon-lien::before {
  content: counter(lecon) ".";
  font-weight: 700; color: var(--terracotta); font-family: Georgia, serif;
}
.lecon-titre { font-weight: 600; color: var(--texte); }
.lecon-lien:hover .lecon-titre { text-decoration: underline; }
.lecon-domaine { font-size: .82rem; color: var(--olive); }
.lecon-duree {
  float: right; font-size: .85rem; color: var(--texte-doux);
  background: #f2ebe0; border-radius: 14px; padding: .1rem .6rem;
}
.lecon-resume { margin: .3rem 0 0 1.5rem; color: var(--texte-doux); font-size: .94rem; }

/* ---------- Tableaux ---------- */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; margin: .8rem 0 1.4rem; background: var(--fond-carte); }
th, td { border: 1px solid var(--bordure); padding: .5rem .8rem; text-align: left; vertical-align: top; }
th { background: #f2ebe0; color: var(--brun); font-family: Georgia, serif; }
tbody tr:nth-child(even) { background: #f7f2e9; }

/* ---------- Boîtes de cours ---------- */
.boite {
  background: var(--fond-carte);
  border: 1px solid var(--bordure);
  border-left: 5px solid var(--texte-doux);
  border-radius: 8px;
  padding: .9rem 1.2rem;
  margin: 1.1rem 0;
  box-shadow: var(--ombre);
}
.boite > :first-child { margin-top: 0; }
.boite > :last-child { margin-bottom: 0; }
.boite::before {
  display: block; font-size: .78rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; margin-bottom: .3rem;
}
.def  { border-left-color: var(--terracotta); }
.def::before  { content: "Définition"; color: var(--terracotta); }
.prop { border-left-color: var(--brun); background: #fbf6ee; }
.prop::before { content: "Propriété / Formule"; color: var(--brun); }
.ex   { border-left-color: var(--olive); }
.ex::before   { content: "Exemple"; color: var(--olive); }
.meth { border-left-color: var(--ocre); background: #fdf8ec; }
.meth::before { content: "Méthode"; color: #8a6d24; }
.rem  { border-left-color: var(--brique); background: #fbf1ec; }
.rem::before  { content: "Remarque — vigilance"; color: var(--brique); }

/* ---------- Leçon ---------- */
.lecon-entete { margin-bottom: 1rem; }
.lecon-meta { color: var(--texte-doux); }
.lecon-intro { font-size: 1.06rem; color: var(--brun); }
.cours-contenu { margin: 1.2rem 0 2rem; }
.fiche-methode-lecon { margin: 2rem 0; }
.fiche-methode-lecon h2 { border: none; margin-top: 0; }

/* ---------- Quiz ---------- */
.quiz { margin: 2.2rem 0; }
.quiz-score {
  display: flex; align-items: center; gap: 1rem;
  background: var(--fond-carte); border: 1px solid var(--bordure);
  border-radius: 8px; padding: .7rem 1rem; margin-bottom: 1rem;
  box-shadow: var(--ombre); font-size: 1.05rem;
}
.exo {
  background: var(--fond-carte); border: 1px solid var(--bordure);
  border-radius: var(--rayon); padding: 1.1rem 1.3rem; margin-bottom: 1.1rem;
  box-shadow: var(--ombre);
}
.exo-num { font-weight: 700; color: var(--terracotta); font-family: Georgia, serif; }
.exo-question { margin: .3rem 0 .8rem; font-weight: 600; }
.exo-choix { display: flex; flex-direction: column; gap: .45rem; margin-bottom: .8rem; }
.exo-choix label {
  display: flex; align-items: center; gap: .55rem;
  border: 1px solid var(--bordure); border-radius: 8px;
  padding: .5rem .8rem; cursor: pointer; background: #fff;
  transition: border-color .12s ease, background .12s ease;
}
.exo-choix label:hover { border-color: var(--terracotta); }
.exo-choix label.choisi { border-color: var(--terracotta); background: #f9efe7; }
.exo-choix label.correct { border-color: var(--olive); background: #eef2e3; }
.exo-choix label.faux { border-color: var(--brique); background: #f9ebe7; }
.exo-vf { display: flex; gap: .7rem; margin-bottom: .8rem; }
.exo-vf .vf-btn {
  flex: 0 0 auto; border: 1px solid var(--bordure); background: #fff;
  border-radius: 8px; padding: .5rem 1.4rem; cursor: pointer; font-size: .95rem;
}
.exo-vf .vf-btn.choisi { border-color: var(--terracotta); background: #f9efe7; }
.exo-vf .vf-btn.correct { border-color: var(--olive); background: #eef2e3; }
.exo-vf .vf-btn.faux { border-color: var(--brique); background: #f9ebe7; }
.exo-saisie-ligne { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.exo-saisie-ligne input[type="text"] {
  flex: 1 1 220px; padding: .5rem .8rem; border: 1px solid var(--bordure);
  border-radius: 8px; font-size: 1rem; font-family: inherit;
}
.exo-saisie-ligne input.ok { border-color: var(--olive); background: #eef2e3; }
.exo-saisie-ligne input.ko { border-color: var(--brique); background: #f9ebe7; }
.exo-feedback { font-weight: 700; margin: .3rem 0; }
.exo-feedback.ok { color: var(--olive); }
.exo-feedback.ko { color: var(--brique); }
.exo-correction {
  border-top: 1px dashed var(--bordure); margin-top: .6rem; padding-top: .6rem;
  color: var(--texte-doux); font-size: .95rem;
}
.exo-correction strong { color: var(--brun); }

/* ---------- Fiches méthodes ---------- */
.page-intro { color: var(--texte-doux); max-width: 700px; }
.filtres { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin: .7rem 0 1.1rem; }
.filtres-label { font-size: .9rem; color: var(--texte-doux); margin-right: .2rem; }
.filtre-btn {
  border: 1px solid var(--bordure); background: #fff; color: var(--texte);
  border-radius: 20px; padding: .28rem .9rem; font-size: .88rem; cursor: pointer;
}
.filtre-btn:hover { border-color: var(--terracotta); }
.filtre-btn.actif { background: var(--terracotta); color: #fff; border-color: var(--terracotta); }
.carte-methode h2 { font-size: 1.2rem; }
.methode-detail summary { display: inline-block; list-style: none; cursor: pointer; }
.methode-detail summary::-webkit-details-marker { display: none; }
.methode-detail[open] summary { margin-bottom: .8rem; }
.methode-contenu { border-top: 1px dashed var(--bordure); padding-top: .8rem; }

/* ---------- Planning / calendrier ---------- */
.cal-layout {
  display: grid; grid-template-columns: 1fr 300px; gap: 1.4rem;
  align-items: start; margin: 1rem 0 2rem;
}
.cal-controles { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .8rem; }
.cal-mois-titre { border: none; margin: 0; font-size: 1.3rem; text-transform: capitalize; }
.cal-filtres { margin-bottom: .9rem; }
.filtre-cat.actif { opacity: 1; }
.filtre-cat:not(.actif) { opacity: .45; }

.cal-grille-entete {
  display: grid; grid-template-columns: repeat(7, 1fr);
  font-size: .8rem; color: var(--texte-doux); text-align: center;
  padding-bottom: .3rem; font-weight: 600;
}
.cal-grille {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.cal-case {
  min-height: 62px; background: var(--fond-carte);
  border: 1px solid var(--bordure); border-radius: 7px;
  padding: .25rem .35rem; font-size: .85rem; cursor: default;
  position: relative; overflow: hidden;
}
.cal-case.hors-mois { background: transparent; border-color: transparent; }
.cal-case.jour { cursor: pointer; transition: box-shadow .12s ease; }
.cal-case.jour:hover { box-shadow: var(--ombre-forte); }
.cal-case.weekend { background: #f3ede2; }
.cal-case-num { font-weight: 700; color: var(--brun); font-size: .82rem; }
.cal-case-tags { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.cal-tag {
  display: block; font-size: .68rem; line-height: 1.25;
  border-radius: 4px; padding: 1px 4px; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-case.selectionne { outline: 2px solid var(--terracotta); outline-offset: 1px; }
.cal-case.aujourdhui { outline: 2px dashed var(--ocre); outline-offset: -2px; }

/* pastilles de couleur par catégorie */
.chip-vacances { background: var(--cat-vacances) !important; color: #fff !important; }
.chip-pfmp     { background: var(--cat-pfmp) !important; color: #fff !important; }
.chip-conseil  { background: var(--cat-conseil) !important; color: #fff !important; }
.chip-examen   { background: var(--cat-examen) !important; color: #fff !important; }
.chip-ferie    { background: var(--cat-ferie) !important; color: #fff !important; }
.chip-rentree  { background: var(--cat-rentree) !important; color: #fff !important; }
.chip-divers   { background: var(--cat-divers) !important; color: #fff !important; }
.filtre-btn.chip-vacances, .filtre-btn.chip-pfmp, .filtre-btn.chip-conseil,
.filtre-btn.chip-examen, .filtre-btn.chip-ferie, .filtre-btn.chip-rentree,
.filtre-btn.chip-divers { border-color: transparent; }

.cal-legende { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: .9rem; font-size: .85rem; color: var(--texte-doux); }
.legende-item { display: inline-flex; align-items: center; gap: .35rem; }
.legende-pastille { display: inline-block; width: 13px; height: 13px; border-radius: 4px; }

.cal-detail {
  background: var(--fond-carte); border: 1px solid var(--bordure);
  border-radius: var(--rayon); padding: 1rem 1.2rem; box-shadow: var(--ombre);
  position: sticky; top: 84px;
}
.cal-detail h3 { margin-top: 0; border-bottom: 2px solid var(--bordure); padding-bottom: .3rem; }
.detail-ev { border-left: 4px solid var(--bordure); padding: .35rem .7rem; margin-bottom: .7rem; }
.detail-ev h4 { margin: .1rem 0 .25rem; }
.detail-ev .badge { margin-bottom: .2rem; }
.detail-ev-classes { font-size: .85rem; color: var(--texte-doux); }
.detail-ev-desc { font-size: .92rem; color: var(--texte-doux); margin: .25rem 0 0; }

.cal-recap { margin: 2.5rem 0; }
.grille-recap { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.recap-bloc {
  background: var(--fond-carte); border: 1px solid var(--bordure);
  border-radius: var(--rayon); padding: 1rem 1.2rem; box-shadow: var(--ombre);
}
.recap-bloc h3 { margin-top: 0; color: var(--terracotta-fonce); }
.recap-liste { margin: 0; padding-left: 1.2rem; font-size: .93rem; }
.recap-liste li { margin-bottom: .45rem; }
.recap-liste .recap-classes { color: var(--texte-doux); font-size: .85rem; }
.recap-compteur { font-size: 1.05rem; }
.recap-compteur strong { font-size: 1.6rem; color: var(--terracotta); font-family: Georgia, serif; }
.recap-note { font-size: .85rem; color: var(--texte-doux); }

/* ---------- Admin ---------- */
.admin-layout { max-width: 1060px; margin: 0 auto; padding: 0 1.25rem 3rem; }
.admin-nav {
  display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
  background: var(--fond-carte); border: 1px solid var(--bordure);
  border-radius: 8px; padding: .5rem .8rem; margin: 1.2rem 0;
  box-shadow: var(--ombre);
}
.admin-nav a { padding: .35rem .8rem; border-radius: 6px; color: var(--texte); font-size: .93rem; }
.admin-nav a:hover, .admin-nav a.actif { background: #f2e3d6; color: var(--terracotta-fonce); text-decoration: none; }
.admin-nav .admin-nav-droite { margin-left: auto; color: var(--texte-doux); font-size: .88rem; }
.admin-login {
  max-width: 380px; margin: 3rem auto; background: var(--fond-carte);
  border: 1px solid var(--bordure); border-radius: var(--rayon);
  padding: 1.8rem 2rem; box-shadow: var(--ombre-forte);
}
.admin-login h1 { margin-top: 0; font-size: 1.5rem; text-align: center; }
.form-ligne { margin-bottom: .9rem; }
.form-ligne label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .25rem; color: var(--brun); }
.form-ligne input[type="text"], .form-ligne input[type="password"],
.form-ligne input[type="date"], .form-ligne input[type="number"],
.form-ligne select, .form-ligne textarea {
  width: 100%; padding: .5rem .7rem; border: 1px solid var(--bordure);
  border-radius: 7px; font-size: .98rem; font-family: inherit; background: #fff;
}
.form-ligne textarea { min-height: 140px; font-family: Consolas, "Courier New", monospace; font-size: .88rem; line-height: 1.45; }
.form-ligne textarea.grand { min-height: 340px; }
.form-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.flash { border-radius: 8px; padding: .6rem 1rem; margin: .8rem 0; }
.flash-ok { background: #e7efdc; border: 1px solid #c3d3a8; color: #43512c; }
.flash-erreur { background: #f7e2dc; border: 1px solid #e2b8ad; color: #77352a; }
.stats-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .9rem; margin: 1.2rem 0; }
.stat-tuile {
  background: var(--fond-carte); border: 1px solid var(--bordure); border-radius: var(--rayon);
  padding: 1rem 1.2rem; box-shadow: var(--ombre); text-align: center;
}
.stat-tuile .stat-valeur { font-size: 2rem; font-weight: 700; color: var(--terracotta); font-family: Georgia, serif; }
.stat-tuile .stat-label { color: var(--texte-doux); font-size: .9rem; }
.admin-table { font-size: .92rem; }
.admin-table td.actions { white-space: nowrap; }
.admin-table .btn { margin-right: .25rem; }
.json-aide { font-size: .85rem; color: var(--texte-doux); background: #f7f2e9; border-radius: 8px; padding: .6rem .9rem; margin: .6rem 0; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: .85rem; }

/* ---------- Divers sections ---------- */
.site-main { min-height: 55vh; }
.accueil-dates, .accueil-methodes, .classe-section { margin-bottom: 1.5rem; }
.carte-classe { min-height: 150px; }
.classe-spe { color: var(--texte-doux); }
.detail-date { font-weight: 700; color: var(--brun); margin-top: 0; }
.footer-liens a { color: var(--texte-doux); }
.footer-liens a:hover { color: var(--terracotta); }

/* ---------- Pied de page ---------- */
.site-footer {
  border-top: 1px solid var(--bordure); background: var(--fond-carte);
  margin-top: 3.5rem; padding: 1.6rem 0; color: var(--texte-doux); font-size: .92rem;
}
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-detail { position: static; }
}
@media (max-width: 720px) {
  h1 { font-size: 1.6rem; }
  .hero h1 { font-size: 1.9rem; }
  .nav-burger {
    display: block; margin-left: auto; font-size: 1.5rem; cursor: pointer;
    padding: .2rem .6rem; border: 1px solid var(--bordure); border-radius: 7px;
  }
  .site-nav { display: none; width: 100%; flex-direction: column; padding-bottom: .7rem; }
  .nav-toggle:checked ~ .site-nav { display: flex; }
  .header-inner { flex-wrap: wrap; }
  .cal-case { min-height: 46px; }
  .cal-tag { font-size: .6rem; }
  .date-quand { min-width: 0; }
  .footer-inner { flex-direction: column; }
}

/* ============================================================
   Emploi du temps (edt.php)
   ============================================================ */
.edt-legende { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; align-items: center; margin: .8rem 0 1.2rem; font-size: .9rem; color: var(--texte-doux); }
.edt-note-legende { font-style: italic; }

.edt-pastille-maths    { background: #c58a6d; }
.edt-pastille-pc       { background: #8f9a6b; }
.edt-pastille-sciences { background: #c0a05e; }
.edt-pastille-co-ens   { background: #7d94a0; }
.edt-pastille-acho     { background: #a79a8a; }
.edt-pastille-sst      { background: #b09a9a; }
.edt-pastille-vie-classe { background: #b0a893; }
.edt-pastille-svt      { background: #7d9a72; }

.edt-conteneur { overflow-x: auto; padding-bottom: .5rem; }
.edt-grille {
  display: grid;
  grid-template-columns: 52px repeat(5, minmax(168px, 1fr));
  gap: .45rem;
  min-width: 920px;
}
.edt-col-heures { position: relative; height: var(--edt-hauteur); }
.edt-heure {
  position: absolute; right: 6px; transform: translateY(-50%);
  font-size: .72rem; color: var(--texte-doux);
}
.edt-col-heures .edt-heure:first-child { transform: translateY(0); }
.edt-col-heures .edt-heure:last-child { transform: translateY(-100%); }
.edt-jour-titre {
  font-family: Georgia, serif; font-weight: bold; color: var(--brun);
  text-align: center; padding: .3rem 0; border-bottom: 2px solid var(--bordure);
}
.edt-jour-corps {
  position: relative; height: var(--edt-hauteur);
  background: var(--fond-carte); border: 1px solid var(--bordure); border-radius: var(--rayon);
}
.edt-ligne-heure {
  position: absolute; left: 0; right: 0; height: 1px; background: #f1e9dc;
}
.edt-creneau {
  position: absolute; left: 4px; right: 4px; /* left/width affinés en ligne par planning.php */
  display: flex; flex-direction: column; gap: 1px;
  padding: .3rem .45rem; border-radius: 7px; overflow: hidden;
  font-size: .76rem; line-height: 1.3;
  border-left: 4px solid transparent;
  box-shadow: var(--ombre);
}
a.edt-creneau { color: inherit; }
a.edt-creneau:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--ombre-forte); }
.edt-cr-heure   { font-size: .68rem; opacity: .8; }
.edt-cr-matiere { font-size: .8rem; }
.edt-cr-classe  { font-weight: 600; }
.edt-cr-salle   { font-style: italic; opacity: .85; }
.edt-cr-lien    { margin-top: auto; font-size: .7rem; font-weight: 600; text-decoration: underline; }
.edt-type-maths    { background: #f6e4da; border-left-color: #b0562f; }
.edt-type-pc       { background: #e9ecdc; border-left-color: #6f7350; }
.edt-type-sciences { background: #f3ead2; border-left-color: #c09a3e; }
.edt-type-co-ens   { background: #e2eaee; border-left-color: #5f7a85; }
.edt-type-acho     { background: #ece6dd; border-left-color: #8d7b68; }
.edt-type-sst      { background: #efe6e6; border-left-color: #96797c; }
.edt-type-vie-classe { background: #efe9db; border-left-color: #998c66; }
.edt-type-svt      { background: #e6edde; border-left-color: #5f7f56; }
.edt-sans-lien     { opacity: .88; }

.edt-service-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .9rem; margin-top: .8rem; }
.edt-service-carte {
  background: var(--fond-carte); border: 1px solid var(--bordure); border-radius: var(--rayon);
  padding: .9rem 1rem; box-shadow: var(--ombre);
}
.edt-service-carte h3 { margin-top: 0; }
.edt-service-carte p { font-size: .92rem; color: var(--texte-doux); margin: .3rem 0 .7rem; }
.edt-a-venir { font-size: .85rem; font-style: italic; color: var(--texte-doux); }

/* ============================================================
   Phase A : onglets planning, enseignants, références, cours du jour
   ============================================================ */
.planning-onglets { display: flex; gap: .5rem; margin: 1rem 0 1.3rem; flex-wrap: wrap; }
.onglet {
  padding: .45rem 1.1rem; border-radius: 999px; border: 1px solid var(--bordure);
  background: #fff; color: var(--texte-doux); font-size: .95rem; cursor: pointer;
  font-family: inherit;
}
.onglet:hover { border-color: var(--terracotta); }
.onglet.actif { background: var(--terracotta); color: #fff; border-color: var(--terracotta); }
.vue-cachee { display: none !important; }

.carte-prof, .classe-prof { font-size: .85rem; color: var(--texte-doux); font-style: italic; margin: .1rem 0 0; }
.classe-prof { font-style: normal; }

.edt-cr-prof { font-size: .68rem; color: var(--texte-doux); }

/* Références */
.grille-references { margin-top: 1rem; }
.carte-reference { display: flex; flex-direction: column; }
.carte-reference .badge { align-self: flex-start; margin-top: auto; }
.ref-exemple {
  background: #fff; border: 1px dashed var(--bordure); border-radius: 7px;
  padding: .5rem .7rem; font-size: .95rem; color: var(--brun);
}

/* Cours du jour dans le détail du planning */
.detail-cours { margin-top: 1.1rem; border-top: 1px solid var(--bordure); padding-top: .7rem; }
.detail-cours-titre { margin: 0 0 .5rem; font-size: 1rem; }
.detail-cours-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.detail-cours-item {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--fond-carte); border: 1px solid var(--bordure); border-left-width: 4px;
  border-radius: 7px; padding: .4rem .6rem; font-size: .86rem;
}
.detail-cours-heure { font-size: .74rem; color: var(--texte-doux); }
.detail-cours-meta { display: block; font-size: .78rem; color: var(--texte-doux); }
.detail-cours-lien { font-size: .78rem; font-weight: 600; }
.detail-cours-note { font-size: .8rem; color: var(--brique); margin: .5rem 0 0; }
.edt-bord-maths    { border-left-color: #b0562f; }
.edt-bord-pc       { border-left-color: #6f7350; }
.edt-bord-sciences { border-left-color: #c09a3e; }
.edt-bord-co-ens   { border-left-color: #5f7a85; }
.edt-bord-acho     { border-left-color: #8d7b68; }

/* KaTeX : taille et débordement */
.katex { font-size: 1.05em; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: .2rem 0; }

/* Créneaux courts (≤ 60 min) : affichage compact, détails au survol (title) */
.edt-compact { font-size: .7rem; line-height: 1.25; padding: .2rem .4rem; }
.edt-compact .edt-cr-salle,
.edt-compact .edt-cr-prof,
.edt-compact .edt-cr-lien { display: none; }
.edt-creneau .edt-cr-matiere,
.edt-creneau .edt-cr-classe { overflow: hidden; text-overflow: ellipsis; }

/* Les créneaux passent au-dessus des lignes horaires de la grille */
.edt-ligne-heure { z-index: 0; }
.edt-creneau { z-index: 2; }

/* Empêche l'écrasement des lignes dans les créneaux courts : débordement masqué */
.edt-creneau > * { flex-shrink: 0; }

/* ============================================================
   FORMULAIRE MATHS-SCIENCES
   ============================================================ */
.formule-sommaire {
  background: var(--fond-carte); border: 1px solid var(--bordure); border-radius: var(--rayon);
  padding: .8rem 1.1rem; margin: 1.2rem 0 2rem; box-shadow: var(--ombre); font-size: .95rem;
}
.formule-sommaire ul { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin: .4rem 0 0; padding: 0; list-style: none; }
.formule-sommaire li::before { content: '→ '; color: var(--terracotta); }
.formule-section { margin-bottom: 2.6rem; }
.formule-section-entete {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem;
  border-bottom: 2px solid var(--terracotta); margin-bottom: 1.2rem; padding-bottom: .4rem;
}
.formule-section-entete h2 { margin: 0; border: 0; }
.btn-petit { font-size: .85rem; padding: .35rem .8rem; }
.formule-theme {
  background: var(--fond-carte); border: 1px solid var(--bordure); border-radius: var(--rayon);
  padding: 1.1rem 1.3rem; margin-bottom: 1.4rem; box-shadow: var(--ombre);
}
.formule-theme-entete { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .4rem .8rem; }
.formule-theme-entete h3 { margin: 0 0 .3rem; }
.formule-lien-cours { font-size: .88rem; font-weight: 600; white-space: nowrap; }
.formule-intro { color: var(--encre-douce); margin: .2rem 0 .9rem; }
.formule-figure {
  float: right; max-width: 300px; margin: 0 0 .8rem 1.2rem;
  border: 1px solid var(--bordure); border-radius: var(--rayon); overflow: hidden; background: #faf7f2;
}
.formule-figure img { display: block; width: 100%; height: auto; }
.formule-figure figcaption { font-size: .8rem; color: var(--encre-douce); padding: .45rem .7rem; }
.formule-liste { list-style: none; margin: 0; padding: 0; }
.formule-item {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1rem;
  padding: .8rem 0; border-top: 1px dashed var(--bordure); align-items: start;
}
.formule-item:first-child { border-top: 0; }
.formule-math { overflow-x: auto; padding: .35rem .2rem; }
.formule-math .katex-display { margin: 0; }
.formule-info strong { color: var(--terracotta-fonce); }
.formule-info p { margin: .25rem 0 0; font-size: .92rem; color: var(--encre-douce); }
.formule-note { margin-top: 2rem; font-size: .92rem; color: var(--encre-douce); font-style: italic; }
@media (max-width: 760px) {
  .formule-item { grid-template-columns: 1fr; gap: .3rem; }
  .formule-figure { float: none; max-width: 100%; margin: 0 0 1rem; }
}
@media print {
  .site-header, .filtres, .formule-sommaire, .formule-lien-cours, .site-footer { display: none !important; }
  .formule-theme { break-inside: avoid; box-shadow: none; }
}

/* ============================================================
   SIMULATEUR PYTHON
   ============================================================ */
.sim-section h2 { border-bottom: 2px solid var(--terracotta); padding-bottom: .4rem; }
.carte-sim h3 { margin-top: .2rem; }
.sim-badges { display: flex; gap: .4rem; margin: .4rem 0; }
.sim-meta { display: flex; gap: .5rem; margin-top: .5rem; }
.sim-atelier {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 1.4rem; align-items: start; margin-top: 1.2rem;
}
.sim-editeur-bloc {
  background: var(--fond-carte); border: 1px solid var(--bordure);
  border-radius: var(--rayon); box-shadow: var(--ombre); overflow: hidden;
}
.sim-editeur-entete {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  padding: .5rem .9rem; background: #f1e9dc; border-bottom: 1px solid var(--bordure);
  font-size: .85rem; color: var(--encre-douce); flex-wrap: wrap;
}
.sim-fichier { font-weight: 600; }
.sim-aide kbd {
  background: #fff; border: 1px solid var(--bordure); border-bottom-width: 2px;
  border-radius: 4px; padding: 0 .35rem; font-size: .78rem;
}
#sim-editeur {
  display: block; width: 100%; border: 0; resize: vertical;
  padding: .9rem 1rem; background: #2e2a25; color: #f5efe4;
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: .86rem; line-height: 1.55; tab-size: 4;
}
#sim-editeur:focus { outline: 2px solid var(--terracotta); outline-offset: -2px; }
.sim-actions { display: flex; align-items: center; gap: .7rem; padding: .7rem .9rem; flex-wrap: wrap; }
.sim-statut { font-size: .85rem; color: var(--encre-douce); }
.sim-resultats h2 { margin-top: 0; }
.sim-sortie {
  background: #2e2a25; color: #f5efe4; border-radius: var(--rayon);
  padding: .9rem 1rem; font-family: Consolas, monospace; font-size: .85rem;
  line-height: 1.5; white-space: pre-wrap; word-break: break-word;
  min-height: 180px; max-height: 480px; overflow: auto; border-left: 4px solid var(--terracotta);
}
.sim-sortie.sim-erreur { border-left-color: #a33; }
.sim-graphique-bloc {
  margin-top: 1rem; background: var(--fond-carte); border: 1px solid var(--bordure);
  border-radius: var(--rayon); padding: .8rem; box-shadow: var(--ombre);
}
.sim-graphique-bloc canvas { display: block; margin: 0 auto; }
.sim-infos {
  margin-top: 1.6rem; background: var(--fond-carte); border: 1px solid var(--bordure);
  border-radius: var(--rayon); padding: .8rem 1.1rem;
}
.sim-infos summary { cursor: pointer; font-weight: 600; }
.sim-infos code { background: #f1e9dc; padding: 0 .3rem; border-radius: 4px; }
@media (max-width: 900px) {
  .sim-atelier { grid-template-columns: 1fr; }
}
