/* Composants du site. Aucune couleur, police ou taille de thème ici : seulement des variables.
   Un test (apps/charte/tests/test_sans_valeur_en_dur.py) refuse toute couleur écrite en dur. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font-family: var(--police-texte); font-size: 1rem; line-height: 1.6;
}
h1, h2, h3, h4 { font-family: var(--police-titre); color: var(--titre); line-height: 1.25; margin: 1.4em 0 .5em; }
h1 { font-size: 1.9rem; margin-top: .4em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--principal); text-underline-offset: 2px; }
a:hover { color: var(--principal-survol); }
:focus-visible { outline: 3px solid var(--contour-focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--selection); }
code, kbd, .mono { font-family: var(--police-mono); font-size: .92em; }
img, svg { max-width: 100%; height: auto; }
.visuellement-cache {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.lien-evitement { position: absolute; left: -999px; top: .5rem; z-index: 10; }
.lien-evitement:focus { left: .5rem; background: var(--surface); padding: .5rem 1rem; border-radius: var(--rayon-s); }

/* Mise en page */
.entete {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .6rem clamp(1rem, 3vw, 2rem); background: var(--surface); border-bottom: 1px solid var(--bordure);
}
.marque { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--titre);
  font-family: var(--police-titre); font-weight: 700; font-size: 1.15rem; }
.marque img { width: 32px; height: 32px; }
.navigation { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.navigation a { padding: .35rem .7rem; border-radius: var(--rayon-s); text-decoration: none; color: var(--texte-2); }
.navigation a:hover, .navigation a[aria-current="page"] { background: var(--principal-doux); color: var(--principal-doux-texte); }
.outils-entete { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.outils-entete select, .rangee select, .rangee input[type="search"], .rangee input[type="text"] { width: auto; }
.contenu { max-width: 72rem; margin: 0 auto; padding: 1.5rem clamp(1rem, 3vw, 2rem) 4rem; }
.contenu-etroit { max-width: 30rem; }
.pied { padding: 1.5rem clamp(1rem, 3vw, 2rem); color: var(--texte-2); font-size: .9rem; border-top: 1px solid var(--bordure); }
.pied a { color: var(--texte-2); }
.grille { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.pile > * + * { margin-top: 1rem; }
.rangee { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.discret { color: var(--texte-2); font-size: .92rem; }

/* Boutons */
.bouton {
  display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  padding: .55rem 1.1rem; border-radius: var(--rayon-s); border: 1px solid var(--bordure-champ);
  background: var(--surface); color: var(--texte); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; min-height: 2.5rem;
}
.bouton:hover { background: var(--surface-2); color: var(--texte); }
.bouton-principal { background: var(--principal); border-color: var(--principal); color: var(--sur-principal); }
.bouton-principal:hover { background: var(--principal-survol); border-color: var(--principal-survol); color: var(--sur-principal); }
.bouton-danger { background: var(--erreur-plein); border-color: var(--erreur-plein); color: var(--sur-erreur); }
.bouton-lien { background: none; border: none; color: var(--principal); padding: .2rem .3rem; min-height: 0; font-weight: 600; }
.bouton[disabled], .bouton[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

/* Champs */
.champ { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; }
.champ label, .champ legend { font-weight: 600; }
.champ .aide { color: var(--texte-2); font-size: .9rem; }
.champ .erreur-champ { color: var(--erreur); font-size: .92rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"],
input[type="url"], input[type="file"], select, textarea {
  font: inherit; color: var(--texte); background: var(--surface);
  border: 1px solid var(--bordure-champ); border-radius: var(--rayon-s); padding: .5rem .7rem; width: 100%;
}
textarea { min-height: 7rem; }
input[aria-invalid="true"] { border-color: var(--erreur); }

/* Cartes, tableaux */
.carte {
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon);
  padding: 1.1rem 1.25rem; box-shadow: var(--ombre-carte);
}
.carte > :first-child { margin-top: 0; }
.carte > :last-child { margin-bottom: 0; }
.carte-titre { font-family: var(--police-titre); font-weight: 700; color: var(--titre); font-size: 1.1rem; margin: 0 0 .4rem; }
.tableau-defilant { overflow-x: auto; }
table.tableau { border-collapse: collapse; width: 100%; background: var(--surface); }
table.tableau th, table.tableau td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--bordure); vertical-align: top; }
table.tableau th a { color: var(--principal-doux-texte); }
table.tableau th { font-weight: 700; color: var(--texte-2); font-size: .92rem; background: var(--surface-2); }

/* Messages, étiquettes, progression */
.message { border-radius: var(--rayon-s); padding: .7rem 1rem; margin-bottom: 1rem; border: 1px solid transparent; }
.message-info { background: var(--info-fond); color: var(--info); }
.message-succes { background: var(--succes-fond); color: var(--succes); }
.message-alerte { background: var(--alerte-fond); color: var(--alerte); }
.message-erreur { background: var(--erreur-fond); color: var(--erreur); }
.etiquette {
  display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .82rem; font-weight: 700;
  background: var(--surface-2); color: var(--texte-2);
}
.etiquette-succes { background: var(--succes-fond); color: var(--succes); }
.etiquette-alerte { background: var(--alerte-fond); color: var(--alerte); }
.etiquette-info { background: var(--info-fond); color: var(--info); }
.etiquette-erreur { background: var(--erreur-fond); color: var(--erreur); }
.progression { display: block; width: 100%; height: .6rem; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progression > span { display: block; height: 100%; background: var(--principal); }
progress.progression { appearance: none; border: none; }
progress.progression::-webkit-progress-bar { background: var(--surface-2); }
progress.progression::-webkit-progress-value { background: var(--principal); border-radius: 999px; }
progress.progression::-moz-progress-bar { background: var(--principal); border-radius: 999px; }

/* Fenêtre */
dialog.fenetre {
  border: 1px solid var(--bordure); border-radius: var(--rayon-l); background: var(--surface); color: var(--texte);
  box-shadow: var(--ombre-fenetre); padding: 1.5rem; max-width: min(36rem, 92vw);
}
dialog.fenetre::backdrop { background: var(--voile); }

/* Mascotte (thème meumo seulement) */
.mascotte { width: 120px; height: 120px; }
.vide { text-align: center; padding: 2rem 1rem; color: var(--texte-2); }

@media (max-width: 40rem) {
  h1 { font-size: 1.55rem; }
  .entete { gap: .5rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
