/* Températures de l'école : pensé pour un écran de classe (TNI, vidéoprojecteur),
   donc gros caractères, gros traits et fond clair. */

:root {
  --page: #f4f3ef;
  --surface: #fcfcfb;
  --encre: #0b0b0b;
  --encre-2: #52514e;
  --discret: #898781;
  --grille: #e1e0d9;
  --axe: #c3c2b7;
  --bordure: rgba(11, 11, 11, 0.12);
  --bleu: #2a78d6;
  --bleu-pale: #eaf2fc;
  --autres: #aeaca4;          /* courbes des autres classes (Comparer) */
  --froid: #d03b3b;           /* < 18 °C */
  --frais: #fab219;           /* 18 à 19 °C */
  --bon: #0ca30c;             /* >= 19 °C */
  --bon-texte: #006300;
  font-size: clamp(16px, 1.1vw + 8px, 22px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--encre);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
}

a { color: var(--bleu); }

/* --- Bandeau ---------------------------------------------------------------- */

.haut {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.4rem;
  padding: 0.7rem 1.4rem;
  background: var(--surface);
  border-bottom: 1px solid var(--bordure);
}
.marque {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: auto;
  color: var(--encre);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}
.haut nav { display: flex; gap: 1.2rem; }
.haut nav a {
  color: var(--encre-2);
  text-decoration: none;
  font-size: 1.05rem;
  padding: 0.2rem 0;
  border-bottom: 3px solid transparent;
}
.haut nav a.on { color: var(--encre); font-weight: 700; border-bottom-color: var(--bleu); }
.haut form { margin: 0; }
.lien { background: none; border: none; color: var(--encre-2); font: inherit; font-size: 0.85rem; cursor: pointer; text-decoration: underline; }

/* En plein écran, seule la page compte. */
html:fullscreen .haut nav, html:fullscreen .haut form, html:fullscreen .marque { display: none; }
html:fullscreen .haut { justify-content: flex-end; border: none; background: none; padding-bottom: 0; }

main { padding: 1rem 1.4rem 2rem; max-width: 1600px; margin: 0 auto; }

h1 { font-size: 2.2rem; margin: 0.4rem 0 0.8rem; line-height: 1.1; }
h2 { font-size: 1.4rem; margin: 1.6rem 0 0.6rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 0.4rem; color: var(--encre-2); }
.aide { color: var(--encre-2); max-width: 50em; }

/* --- Boutons ---------------------------------------------------------------- */

.bouton {
  display: inline-block;
  border: 2px solid var(--axe);
  border-radius: 10px;
  padding: 0.4rem 0.9rem;
  background: #fff;
  color: var(--encre);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.bouton:hover { border-color: var(--bleu); }
.bouton.on { border-color: var(--bleu); background: var(--bleu-pale); font-weight: 700; }
.bouton.principal { background: var(--bleu); border-color: var(--bleu); color: #fff; font-weight: 700; padding: 0.5rem 1.4rem; }
:focus-visible { outline: 3px solid var(--bleu); outline-offset: 2px; }

/* --- États (pastille de couleur + mots, jamais la couleur seule) ------------- */

.etat { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 600; margin: 0; }
.pastille { width: 0.9em; height: 0.9em; border-radius: 50%; display: inline-block; flex: none; }
.froid .pastille { background: var(--froid); }
.frais .pastille { background: var(--frais); }
.bon .pastille { background: var(--bon); }
.silence { color: var(--encre-2); font-style: italic; margin: 0; }

/* --- Accueil : une tuile par classe ------------------------------------------ */

.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
.tuile {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-left: 10px solid var(--axe);
  border-radius: 12px;
  color: var(--encre);
  text-decoration: none;
}
.tuile:hover { border-color: var(--bleu); }
.tuile.froid { border-left-color: var(--froid); }
.tuile.frais { border-left-color: var(--frais); }
.tuile.bon { border-left-color: var(--bon); }
.tuile .salle { font-size: 1.5rem; font-weight: 700; }
.tuile .temp { font-size: 2.6rem; font-weight: 700; line-height: 1.1; }

/* --- Page d'une classe ------------------------------------------------------- */

.tete { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem 2rem; margin-bottom: 0.6rem; }
.tete h1 { font-size: 2.8rem; margin: 0; }
.maintenant { margin: 0; color: var(--encre-2); font-size: 1.05rem; }
.maintenant strong { display: block; color: var(--encre); font-size: 3.2rem; line-height: 1.05; }
.tete .etat { font-size: 1.3rem; }
.choix { margin-left: auto; display: flex; gap: 0.5rem; }

.graphe { margin: 0; background: var(--surface); border: 1px solid var(--bordure); border-radius: 12px; padding: 0.6rem 0.8rem 0.4rem; }
.dessin { position: relative; height: clamp(280px, 52vh, 720px); touch-action: pan-y; }
html:fullscreen .dessin { height: 62vh; }
.dessin svg { display: block; overflow: visible; }
.dessin text { font-family: inherit; fill: var(--encre-2); }
.dessin .grille { stroke: var(--grille); }
.dessin .seuil { stroke-width: 3; stroke-dasharray: 10 7; }
.dessin .seuil.froid { stroke: var(--froid); }
.dessin .seuil.bon { stroke: var(--bon); }
.dessin .courbe { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.dessin .courbe.en-avant { stroke: var(--bleu); stroke-width: 4; }
.dessin .courbe.autre { stroke: var(--autres); stroke-width: 2; }
.dessin .nom-courbe { fill: var(--encre); font-weight: 700; }
.dessin .curseur { stroke: var(--encre-2); stroke-width: 1.5; pointer-events: none; }
.dessin .point { fill: var(--bleu); stroke: #fff; stroke-width: 3; pointer-events: none; }
.dessin .vide { fill: var(--encre-2); font-style: italic; }
.bulle {
  position: absolute;
  pointer-events: none;
  background: #fff;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  padding: 0.35rem 0.6rem;
  font-size: 0.95rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.bulle ol { list-style: none; margin: 0.2rem 0 0; padding: 0; }
.bulle li { display: flex; justify-content: space-between; gap: 1rem; color: var(--encre-2); }
.bulle li.en-avant { color: var(--encre); font-weight: 700; }

.legende { display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; padding: 0.5rem 0.2rem 0.2rem; color: var(--encre-2); }
.legende > span { display: inline-flex; align-items: center; gap: 0.5rem; }
.trait { display: inline-block; width: 2.2em; border-top: 4px dashed; }
.trait.bon { border-color: var(--bon); }
.trait.froid { border-color: var(--froid); }
.trait.autre { border-top: 3px solid var(--autres); }
.legende b { color: var(--encre); white-space: nowrap; }

.extremes { display: flex; flex-wrap: wrap; gap: 0.4rem 2rem; font-size: 1.15rem; margin: 1rem 0; }

.releve h3 { text-transform: none; }
.heures { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(5.4rem, 1fr)); gap: 0.4rem; }
.heures li {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.35rem 0.2rem;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-bottom: 5px solid var(--axe);
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
.heures li span { color: var(--encre-2); font-size: 0.9rem; }
.heures li b { font-size: 1.15rem; }
.heures li.froid { border-bottom-color: var(--froid); }
.heures li.frais { border-bottom-color: var(--frais); }
.heures li.bon { border-bottom-color: var(--bon); }

/* --- Comparer ---------------------------------------------------------------- */

.noms { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.4rem 0 0.9rem; }
.nom {
  border: 2px solid var(--axe);
  border-radius: 999px;
  padding: 0.25rem 0.9rem;
  background: #fff;
  color: var(--encre);
  text-decoration: none;
  font-weight: 600;
}
.nom small { font-weight: 400; color: var(--encre-2); }
.nom.on { background: var(--bleu); border-color: var(--bleu); color: #fff; }
.nom.on small { color: #fff; }

/* --- Réglages ---------------------------------------------------------------- */

.cartes { border-collapse: collapse; margin: 1rem 0; background: var(--surface); border: 1px solid var(--bordure); }
.cartes th, .cartes td { padding: 0.45rem 0.8rem; border-bottom: 1px solid var(--grille); text-align: left; }
.cartes th { color: var(--encre-2); font-weight: 600; }
.cartes input { font: inherit; width: 12em; padding: 0.25rem 0.5rem; border: 2px solid var(--axe); border-radius: 8px; }
.alerte { color: var(--froid); font-weight: 600; }
.message { border-radius: 10px; padding: 0.6rem 1rem; max-width: 50em; }
.message p { margin: 0; }
.message ul { margin: 0.3rem 0 0; }
.message.ok { background: #e7f6e7; color: var(--bon-texte); font-weight: 600; }
.message.erreur { background: #fbeaea; color: #8f1f1f; }

/* --- Connexion --------------------------------------------------------------- */

.connexion {
  max-width: 24rem;
  margin: 3rem auto;
  padding: 1.6rem;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.connexion h1 { margin: 0; }
.connexion p { margin: 0; color: var(--encre-2); }
.connexion label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; }
.connexion input { font: inherit; padding: 0.45rem 0.6rem; border: 2px solid var(--axe); border-radius: 8px; }
.connexion .message.erreur { color: #8f1f1f; }

@media (max-width: 640px) {
  .haut, main { padding-left: 1rem; padding-right: 1rem; }
  .choix { margin-left: 0; }
  .cartes input { width: 8em; }
  .cartes th:nth-child(3), .cartes td:nth-child(3) { display: none; }
}
