/* Alerte : charte graphique (voir docs/charte-graphique.md).
   Encre profonde + orange « signal » + vert « tout est surveillé ». Titres lourds et serrés, coins arrondis,
   un radar comme motif. Clair par défaut, sombre selon les préférences du système. */
:root {
  --encre: #0e1a2b;
  --encre-2: #16273f;
  --fond: #f6f7fb;
  --carte: #ffffff;
  --texte: #14202f;
  --discret: #5a687b;
  --trait: #e2e7ef;
  --signal: #ff5a36;
  --signal-fonce: #e8421d;
  --signal-doux: #ffece6;
  --ok: #1fb37c;
  --sur-encre: #e9eef7;
  --rayon: 18px;
  --ombre: 0 1px 2px rgba(14, 26, 43, .06), 0 8px 24px rgba(14, 26, 43, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0a1220;
    --carte: #121f33;
    --texte: #e7edf6;
    --discret: #9aa8bb;
    --trait: #223350;
    --signal-doux: #3a2019;
    --ombre: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--signal-fonce); }
@media (prefers-color-scheme: dark) { a { color: #ff8a6e; } }

/* --- En-tête --- */
header.haut { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--fond) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--trait); }
header.haut .contenu {
  max-width: 62rem; margin: 0 auto; padding: 10px 18px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px;
}
header.haut a { color: var(--texte); text-decoration: none; font-weight: 600; font-size: .95rem; }
header.haut a:hover { color: var(--signal-fonce); }
header.haut .marque {
  display: inline-flex; align-items: center; gap: 8px; margin-right: auto;
  font-size: 1.35rem; font-weight: 800; letter-spacing: -.03em;
}
.logo { width: 30px; height: 30px; flex: none; }
.logo .arc { stroke: var(--signal); fill: none; stroke-width: 3; stroke-linecap: round; }
.logo .pt { fill: var(--signal); }

main { max-width: 62rem; margin: 0 auto; padding: 18px; }
h1 { font-size: clamp(2rem, 7vw, 3.3rem); line-height: 1.05; letter-spacing: -.035em; font-weight: 800; margin: 10px 0 16px; }
h2 { font-size: 1.5rem; letter-spacing: -.02em; font-weight: 800; margin: 44px 0 14px; color: var(--texte); }
h3 { font-size: 1rem; margin: 16px 0 2px; }

/* --- Cartes et textes --- */
.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 16px 18px; margin: 10px 0; box-shadow: var(--ombre); }
.discret { color: var(--discret); font-size: .92rem; }

/* --- Bouton --- */
button, .bouton {
  display: inline-block; margin-top: 14px; padding: 12px 20px; font: inherit; font-weight: 700;
  background: var(--signal); color: #fff; border: 0; border-radius: 999px; text-decoration: none; cursor: pointer;
}
button:hover, .bouton:hover { background: var(--signal-fonce); }
button.secondaire, .bouton.secondaire { background: transparent; color: var(--texte); border: 1px solid var(--trait); }

/* --- Pastilles d'état --- */
.etat {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 5px 14px 5px 12px;
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 999px; background: rgba(255, 255, 255, .08);
  color: var(--sur-encre); font-size: .8rem; font-weight: 600; letter-spacing: .04em;
}
.etat::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(31, 179, 124, .7); animation: pouls 2s infinite; }
@keyframes pouls { 70% { box-shadow: 0 0 0 9px rgba(31, 179, 124, 0); } 100% { box-shadow: 0 0 0 0 rgba(31, 179, 124, 0); } }

/* --- Héros avec radar --- */
.heros {
  position: relative; overflow: hidden; margin: 6px 0 0; padding: 40px 24px 36px;
  background: radial-gradient(120% 140% at 100% 0%, var(--encre-2) 0%, var(--encre) 60%);
  border-radius: 26px; color: var(--sur-encre);
}
.heros h1 { color: #fff; max-width: 14ch; }
.heros h1 em { font-style: normal; color: var(--signal); }
.heros .chapeau { font-size: 1.12rem; max-width: 34rem; color: var(--sur-encre); margin: 0 0 10px; }
.heros .discret { color: #9db0c9; }
.radar { position: absolute; right: -90px; top: 50%; width: 360px; height: 360px; margin-top: -180px; opacity: .55; pointer-events: none; }
.radar circle { fill: none; stroke: #6f8fb8; stroke-width: 1; opacity: .5; }
.radar .balayage { transform-origin: 180px 180px; animation: tour 6s linear infinite; }
.radar .faisceau { fill: rgba(255, 90, 54, .30); stroke: none; opacity: 1; }
.radar .cible { fill: var(--signal); stroke: none; opacity: 1; animation: clignote 3s ease-in-out infinite; }
@keyframes tour { to { transform: rotate(360deg); } }
@keyframes clignote { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }


/* --- Appel final --- */
.appel { text-align: center; margin-top: 44px; padding: 28px 18px; background: var(--encre); color: var(--sur-encre); border: 0; }
.appel h2 { margin: 0 0 6px; color: #fff; }
.appel p { margin: 0; color: #b6c4d8; }

footer.bas { max-width: 62rem; margin: 28px auto; padding: 0 18px; color: var(--discret); font-size: .82rem; }

@media (max-width: 640px) {
  .heros { padding: 30px 18px 28px; border-radius: 22px; }
  .radar { right: -150px; opacity: .35; }
  header.haut .contenu { gap: 4px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .etat::before, .radar .balayage, .radar .cible { animation: none; }
}

/* --- Inscription, formulaires, pages utilisateur --- */
.formulaire { display: flex; flex-direction: column; gap: 8px; max-width: 34rem; margin: 18px auto 0; text-align: left; }
.formulaire label { font-weight: 600; font-size: .92rem; }
.formulaire input[type=text], .formulaire input[type=email], .formulaire input[type=search], .formulaire select {
  font: inherit; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--trait); background: var(--carte); color: var(--texte); width: 100%;
}
.formulaire input:focus-visible { outline: 3px solid var(--signal); outline-offset: 1px; }
.formulaire .case { font-weight: 400; font-size: .85rem; display: flex; gap: 10px; align-items: flex-start; }
.formulaire .case input { margin-top: 3px; flex: none; }
.appel .formulaire label { color: #dbe5f3; }
.appel .formulaire .case, .appel .formulaire .case a { color: #b6c4d8; }
.appel a { color: #ffd0c4; }
.piege { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.erreur { background: #fde8e6; color: #8a1c14; border: 1px solid #f3b4ad; border-radius: 10px; padding: 10px 14px; margin: 12px auto 0; max-width: 34rem; text-align: left; }
.carte.ok { border-color: var(--ok); }
.ligne { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ligne form { margin: 0; }
.ligne button { margin: 0; padding: 6px 12px; }
.legal h2 { font-size: 1.15rem; margin: 26px 0 8px; }
.legal p, .legal li { max-width: 46rem; }
.tableau { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 10px 0; }
.tableau th, .tableau td { border: 1px solid var(--trait); padding: 8px 10px; text-align: left; vertical-align: top; }
.tableau th { background: var(--signal-doux); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { text-align: center; margin: 0; }
.stat strong { display: block; font-size: 1.8rem; }
@media (prefers-color-scheme: dark) { .erreur { background: #3a1a17; color: #ffc9c2; border-color: #7a3029; } }
select { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--trait); background: var(--carte); color: var(--texte); }

/* Connexion par lien */
header.haut .lien-compte { margin-left: auto; padding: 6px 12px; border: 1px solid var(--trait); border-radius: 999px; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.barre-admin { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; padding: .5rem 1rem; background: #f58a1f22; border-bottom: 2px solid #f58a1f; font-size: .95rem; }
.barre-admin a { font-weight: 600; }
.barre-admin form { margin-left: auto; }
.barre-admin button { padding: .25rem .7rem; font-size: .85rem; }

/* Filtres par thème : repliés par défaut sous « Affiner la recherche » ; une pastille par ligne, tout visible sans défilement latéral. */
.affiner { margin: 1rem 0 1.25rem; }
.affiner summary { cursor: pointer; padding: .7rem 1rem; border: 1.5px solid var(--signal); border-radius: 999px; background: var(--carte);
  font-weight: 500; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.affiner summary::-webkit-details-marker { display: none; }
.affiner summary::after { content: "▾"; color: var(--signal-fonce); }
.affiner[open] summary::after { content: "▴"; }
.affiner summary .n { font-size: .8rem; color: var(--discret); font-weight: 400; margin-left: auto; }
.themes { display: flex; flex-direction: column; gap: .5rem; margin: .75rem 0 0; }
.themes a.puce { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .6rem 1rem;
  border: 1.5px solid var(--signal); border-radius: 999px; background: var(--carte); color: var(--texte);
  font-size: .95rem; font-weight: 500; line-height: 1.2; text-decoration: none; }
.themes a.puce .n { font-size: .8rem; color: var(--discret); }
.themes a.puce:hover { background: var(--signal-doux); }
.themes a.puce.actif { background: var(--signal); border-color: var(--signal); color: #fff; font-weight: 600; }
.themes a.puce.actif .n { color: #fff; opacity: .85; }
.theme { font-weight: 600; }

.alerter { margin-top: -.5rem; }
.alerter .appel { margin-top: .75rem; }
.barre-admin .etiquette { font-size: .8rem; color: var(--discret); }
.checklist-page h2 { margin-top: 1.5rem; font-size: 1.15rem; }
.checklist-page h3 { font-size: 1rem; }
.checklist-page ul.checklist { list-style: none; padding-left: 0; margin: .5rem 0; }
.checklist-page li { padding: .3rem 0; border-bottom: 1px solid var(--ligne, #0001); }
.checklist-page li.fait { color: var(--discret); }
.checklist-page .case-ck { margin-right: .3rem; color: var(--signal-fonce); }
.checklist-page code { font-size: .85em; }
.nuage { line-height: 1.9; text-align: center; }
.nuage a { display: inline-block; margin: 0 .35em; text-decoration: none; }
.nuage a:hover { text-decoration: underline; }
.heros.compact { padding: 24px 26px; margin-bottom: 1rem; }
.heros.compact h1 { max-width: none; font-size: clamp(1.55rem, 4.2vw, 2.1rem); margin: .3rem 0 .5rem; }
.heros.compact .chapeau { margin: 0; }
.recherche { display: grid; grid-template-columns: 1fr; gap: 10px; }
.formulaire.recherche { max-width: none; margin: 18px 0 0; }
.recherche input[type=search] { font-size: 1.08rem; padding: 14px 16px; }
.recherche button { margin: 0; }
@media (min-width: 720px) {
  .recherche { grid-template-columns: 1.4fr 1fr 1fr auto; align-items: center; }
  .recherche input[type=search] { grid-column: 1 / -1; }
}
.aide { margin-top: 2rem; }
.aide details summary { cursor: pointer; font-weight: 600; }
.aide details p { margin: .6rem 0 0; }
