/* Palette taken from the Hestialytics logo: teal and sky blue of the figure, coral of the
   flame, yellow of the triangle, taupe of the lettering. The "-fonce" variants keep a
   contrast ratio of at least 4.5:1 on white for text and buttons. The page stays white so
   the logo (a JPEG on white) sits on it without a box.

   Fonts are system ones on purpose: loading a web font from a third-party CDN would leak
   the user's IP address (RGPD) and is blocked by the Content-Security-Policy anyway. The
   light display weight echoes the thin-line drawing of the logo. */
:root {
  --teal: #02bdc2;
  --teal-fonce: #00777b;
  --encre: #0b3d40;
  --teal-clair: #e6f7f7;
  --bleu: #36b7d6;
  --corail: #f07049;
  --corail-fonce: #b4401c;
  --corail-clair: #fdeee8;
  --jaune: #eae186;
  --jaune-clair: #fbf8df;
  --jaune-fonce: #6b5d0a;
  --taupe: #87907b;
  --texte: #1f2d2e;
  --texte-doux: #566768;
  --fond-doux: #f5fafa;
  --ligne: #d3e7e7;
  --degrade: linear-gradient(90deg, var(--corail), var(--jaune) 35%, var(--bleu) 70%, var(--teal));
  --police: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  --police-titre: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  --rayon: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--police);
  font-size: 1rem;
  color: var(--texte);
  background: #fff;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

.contenu { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
main.contenu { flex: 1; padding-top: 40px; padding-bottom: 64px; }

a { color: var(--teal-fonce); text-underline-offset: 0.18em; }
a:hover { color: var(--encre); }
code { font-size: 0.92em; word-break: break-all; }

h2 {
  margin: 0 0 8px;
  font-family: var(--police-titre);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--encre);
}

.titre {
  margin: 0 0 12px;
  font-family: var(--police-titre);
  font-size: clamp(1.9rem, 4.2vw, 2.75rem);
  font-weight: 300;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--encre);
}

.chapo { max-width: 34em; margin: 0 0 24px; font-size: 1.1rem; color: var(--texte-doux); }
.aide { margin: 6px 0 0; color: var(--texte-doux); font-size: 0.9rem; }

:focus-visible { outline: 3px solid var(--bleu); outline-offset: 2px; }

/* En-tête et pied de page */

.entete { border-bottom: 1px solid var(--ligne); }

.entete .contenu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.marque {
  display: flex;
  align-items: baseline;
  gap: 12px;
  text-decoration: none;
  color: var(--encre);
}

.marque-nom {
  font-family: var(--police-titre);
  font-size: 1.7rem;
  font-weight: 300;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.badge {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--corail-clair);
  color: var(--corail-fonce);
  font-size: 0.75rem;
  font-weight: 600;
}

.entete-droite { display: flex; align-items: center; gap: 20px; }
.accroche { margin: 0; max-width: 17em; color: var(--texte-doux); font-size: 0.85rem; text-align: right; }
.logo { display: block; height: 64px; width: auto; }

/* The one brand flourish: the logo's colour line, reused under the header and as the
   progress bar of a contrôle. */
.ligne-marque { height: 3px; background: var(--degrade); }

footer {
  border-top: 1px solid var(--ligne);
  padding: 20px 0;
  color: var(--texte-doux);
  font-size: 0.85rem;
}

/* Messages */

.alerte {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: var(--rayon);
  border-left: 4px solid;
}

.alerte > span { flex: 1; }
.alerte.success { background: var(--teal-clair); border-color: var(--teal); color: var(--encre); }
.alerte.warning { background: var(--jaune-clair); border-color: var(--jaune); color: var(--jaune-fonce); }
.alerte.error { background: var(--corail-clair); border-color: var(--corail); color: var(--corail-fonce); }

.alerte .fermer {
  flex: none;
  padding: 0 6px;
  border: 0;
  background: none;
  color: inherit;
  font-size: 1.3rem;
  line-height: 1.2;
  cursor: pointer;
  opacity: 0.7;
}

.alerte .fermer:hover { opacity: 1; background: none; }

.registre {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 24px;
  color: var(--texte-doux);
  font-size: 0.95rem;
}

.registre strong { color: var(--encre); }

.pastille {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgb(2 189 194 / 18%);
}

.pastille.perime { background: var(--corail); box-shadow: 0 0 0 4px rgb(240 112 73 / 18%); }

/* Boutons et champs */

button, .bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 20px;
  border: 1.5px solid var(--teal-fonce);
  border-radius: var(--rayon);
  background: var(--teal-fonce);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

button:hover, .bouton:hover { background: var(--encre); border-color: var(--encre); color: #fff; }
button:disabled, button:disabled:hover { background: #b8c4c4; border-color: #b8c4c4; color: #fff; cursor: not-allowed; }
.secondaire { background: #fff; color: var(--teal-fonce); }
.secondaire:hover { background: var(--teal-clair); border-color: var(--teal-fonce); color: var(--encre); }
.danger { background: #fff; border-color: var(--corail-fonce); color: var(--corail-fonce); }
.danger:hover { background: var(--corail-clair); border-color: var(--corail-fonce); color: var(--corail-fonce); }
.lien { padding: 0; border: 0; background: none; color: var(--teal-fonce); font-weight: 400; text-decoration: underline; }
.lien:hover { background: none; color: var(--encre); }

/* Busy state of a submitted form (spinner drawn with borders). */
button.occupe::before {
  content: "";
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: tourner 0.8s linear infinite;
}

@keyframes tourner { to { transform: rotate(360deg); } }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.champ { display: block; margin-bottom: 8px; font-weight: 600; color: var(--encre); }

label.option {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 0;
  cursor: pointer;
}

input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--teal-fonce); }

input[type="number"], input[type="search"] {
  padding: 9px 12px;
  border: 1.5px solid var(--ligne);
  border-radius: var(--rayon);
  font: inherit;
  color: var(--texte);
  background: #fff;
}

input[type="number"]:focus, input[type="search"]:focus { border-color: var(--teal-fonce); }

/* Zone de dépôt : the file input covers the whole zone (transparent), so clicking anywhere
   opens the file picker and dropping a file on it is handled natively by the browser. */

.depot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 132px;
  padding: 24px;
  border: 1.5px dashed var(--bleu);
  border-radius: 14px;
  background: var(--fond-doux);
  transition: background-color 0.15s, border-color 0.15s;
}

.depot-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.depot:hover { background: var(--teal-clair); }
.depot:focus-within { outline: 3px solid var(--bleu); outline-offset: 2px; }

.depot.survol,
.depot.rempli {
  border: 1.5px solid transparent;
  background: linear-gradient(#fff, #fff) padding-box, var(--degrade) border-box;
}

.depot.survol { background: linear-gradient(var(--teal-clair), var(--teal-clair)) padding-box, var(--degrade) border-box; }
.depot.inactif { opacity: 0.45; }
.depot.inactif .depot-input { cursor: not-allowed; }

.depot-icone { flex: none; width: 48px; height: 48px; color: var(--teal-fonce); }
.depot.erreur .depot-icone { color: var(--corail-fonce); }
.depot-texte { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.depot-texte strong { color: var(--encre); font-weight: 600; overflow-wrap: anywhere; }
.depot-texte span { color: var(--texte-doux); font-size: 0.9rem; }
.depot-verif:empty { display: none; }
.depot-verif { font-size: 0.9rem; color: var(--teal-fonce); }
.depot.erreur .depot-verif { color: var(--corail-fonce); }

/* Accueil */

.accueil {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: 64px;
  align-items: start;
}

.formulaire { display: grid; gap: 28px; }

.seuil-reglage { display: flex; align-items: center; gap: 16px; }
.seuil-reglage input[type="number"] { width: 5.5em; text-align: center; font-weight: 600; }

input[type="range"] {
  flex: 1;
  height: 6px;
  margin: 0;
  appearance: none;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal-fonce) var(--remplissage, 91%), var(--ligne) var(--remplissage, 91%));
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 22px;
  height: 22px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--teal-fonce);
  box-shadow: 0 0 0 1.5px var(--teal-fonce);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--teal-fonce);
  box-shadow: 0 0 0 1.5px var(--teal-fonce);
}

.lancer { justify-self: start; padding: 14px 28px; font-size: 1.05rem; }

.apropos {
  padding-left: 32px;
  border-left: 1px solid var(--ligne);
  font-size: 0.95rem;
}

.apropos section + section { margin-top: 36px; }
.apropos p { margin: 0 0 12px; }

.exemple {
  width: 100%;
  margin: 4px 0 16px;
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  font-size: 0.85rem;
}

.exemple th, .exemple td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--ligne); }
.exemple tr:last-child td { border-bottom: 0; }
.exemple th { background: var(--fond-doux); color: var(--encre); font-family: ui-monospace, Consolas, monospace; font-weight: 600; }

/* Contrôle en cours */

.suivi { max-width: 640px; }

.pourcentage {
  margin: 8px 0 16px;
  font-family: var(--police-titre);
  font-size: clamp(3.5rem, 10vw, 5.5rem);
  font-weight: 200;
  line-height: 1;
  color: var(--encre);
}

.pourcentage small { font-size: 0.4em; color: var(--texte-doux); }

.barre {
  height: 8px;
  border-radius: 999px;
  background: var(--teal-clair);
  overflow: hidden;
}

.barre-remplie {
  position: relative;
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--degrade);
  background-size: 640px 100%;
  transition: width 0.6s ease-out;
  overflow: hidden;
}

/* A light sweep along the bar, so the page never looks frozen between two polls. */
.barre-remplie::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 55%), transparent);
  transform: translateX(-100%);
  animation: balayage 1.6s ease-in-out infinite;
}

@keyframes balayage { to { transform: translateX(100%); } }

.suivi .message { margin: 16px 0 4px; font-size: 1.1rem; color: var(--encre); }

/* Résultats */

.verdict {
  margin-bottom: 32px;
  padding: 32px;
  border-radius: 16px;
  background: var(--teal-clair);
}

.verdict.concordances { background: var(--corail-clair); }
.verdict.concordances .titre { color: var(--corail-fonce); }
.verdict.echec { background: var(--corail-clair); }
.verdict .resultat { margin: 0 0 24px; font-size: 1.1rem; }
.verdict .actions:last-child { margin-bottom: 0; }

.chiffres {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 0 0 40px;
  border-top: 1px solid var(--ligne);
  border-bottom: 1px solid var(--ligne);
}

.chiffres > div { padding: 16px 20px 16px 0; }
.chiffres > div + div { padding-left: 20px; border-left: 1px solid var(--ligne); }
.chiffres dt { color: var(--texte-doux); font-size: 0.85rem; }
.chiffres dd { margin: 2px 0 0; font-family: var(--police-titre); font-size: 1.5rem; font-weight: 400; color: var(--encre); }

.tableau-outils {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.tableau-outils input[type="search"] { width: min(100%, 320px); }
.tableau-outils .aide { margin: 0; }

.defilement { overflow-x: auto; border: 1px solid var(--ligne); border-radius: var(--rayon); }
table.concordances { width: 100%; border-collapse: collapse; }
.concordances th, .concordances td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--ligne); }
.concordances tbody tr:last-child td { border-bottom: 0; }
.concordances thead th { background: var(--fond-doux); color: var(--encre); font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.concordances tbody tr:hover { background: var(--fond-doux); }

.trier {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
}

.trier:hover { background: none; color: var(--teal-fonce); }
.trier::after { content: "↕"; margin-left: 4px; opacity: 0.35; }
[aria-sort="ascending"] .trier::after { content: "↑"; opacity: 1; }
[aria-sort="descending"] .trier::after { content: "↓"; opacity: 1; }

.score { display: flex; align-items: center; gap: 10px; min-width: 130px; font-weight: 700; color: var(--corail-fonce); }

.jauge {
  flex: 1;
  height: 6px;
  max-width: 80px;
  border-radius: 999px;
  background: var(--corail-clair);
  overflow: hidden;
}

.jauge > span { display: block; width: var(--score, 0%); height: 100%; background: var(--corail); }

.vide-filtre { padding: 24px 16px; color: var(--texte-doux); text-align: center; }

.pied-controle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--ligne);
}

/* Administration */

.admin { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; margin-top: 8px; }
.admin section + section { margin-top: 40px; }
.admin p { margin: 0 0 16px; }

.fiche { margin: 0; }
.fiche > div { display: grid; grid-template-columns: 13em 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--ligne); }
.fiche dt { color: var(--texte-doux); }
.fiche dd { margin: 0; color: var(--encre); }

/* Mobile */

@media (max-width: 860px) {
  .accueil, .admin { grid-template-columns: 1fr; gap: 48px; }
  .apropos { padding: 32px 0 0; border-left: 0; border-top: 1px solid var(--ligne); }
}

@media (max-width: 600px) {
  .contenu { padding: 0 16px; }
  main.contenu { padding-top: 28px; }
  .accroche { display: none; }
  .logo { height: 48px; }
  .marque-nom { font-size: 1.4rem; letter-spacing: 0.2em; }
  .depot { flex-direction: column; text-align: center; }
  .verdict { padding: 24px 20px; }
  .chiffres > div, .chiffres > div + div { padding: 12px 0; border-left: 0; }
  .chiffres > div + div { border-top: 1px solid var(--ligne); }
  .fiche > div { grid-template-columns: 1fr; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
