/* Luciole (avec Éclaireur, l'assistant).
   Mobile d'abord. Polices Young Serif et Atkinson Hyperlegible auto-hébergées (vendor/fonts, licence OFL) : marche sans internet. */

@font-face { font-family: "Young Serif"; src: url("../vendor/fonts/young-serif-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("../vendor/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("../vendor/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

/* Palette olive et terracotta.
   olive #4f5f26 · olive foncé #2f3a15 · encre #1d230d · terracotta #a9441b · terracotta foncé #7e3012
   safran #d29a3c · laine crème #eee5cf et #e0d4b4 · texte clair #f7f0df · encre du texte #232714
   Les contrastes sont MESURÉS par tests/contrastes.py (texte >= 4.5:1, badges et boutons compris).

   Thème : clair par défaut ; sombre si le système le demande ; le bouton soleil/lune pose
   data-theme="light" ou "dark" sur <html> (choix mémorisé), ce qui l'emporte sur le système.
   Les deux blocs du mode sombre ci-dessous doivent rester IDENTIQUES (vérifié par tests/contrastes.py). */

/* Clair : fond blanc, cartes blanc cassé, texte encre, boutons terracotta, liens olive, détails safran */
:root {
  --fond: #ffffff;
  --fond-halo: #fbf1de;
  --surface: #f7f5ee;
  --surface-2: #eeeadc;
  --texte: #232714;
  --doux: #4f5f26;
  --trait: #e0dccb;
  --action: #a9441b;          /* boutons principaux */
  --action-texte: #fbf8f0;
  --action-survol: #7e3012;
  --accent: #d29a3c;          /* safran : halo, lueur, sélection (jamais du texte sur blanc) */
  --accent-texte: #232714;
  --lien: #4f5f26;
  --lien-survol: #2f3a15;
  --focus: #4f5f26;
  --icone: #a9441b;           /* cadenas de la promesse de confidentialité */
  --jeune: #f5e6c6;
  --oui: #2f3a15;  --oui-fond: #e4e8cf;
  --comment: #5e4210; --comment-fond: #f5e6c6;
  --non: #7e3012;  --non-fond: #f6dfd2;
  --inconnu: #3d4224; --inconnu-fond: #eeeadc;
  --nuit-haut: #131a2a;       /* accueil : nuit bleue en haut... */
  --nuit-bas: #2f3a15;        /* ...olive profond en bas (dans les deux modes) */
  --pastille-fond: #263021;
  --lien-nuit: #e2b462;
  --etage-bas: #2f3a15;       /* la montée : étage 1, le plus clair... */
  --etage-haut: #111727;      /* ...étage 5, la nuit la plus profonde */
  --luciole-fond: #3b4523;    /* fond d'une luciole (pastille) sur l'étage le plus clair */
  --ciel-fond: #232b10;       /* ciel de nuit, dans les deux modes */
  --ciel-anneau: #56652b;
  --ciel-texte: #f7f0df;
  --ciel-doux: #e0d4b4;
  --luciole: #e2b462;
  --luciole-eteinte: #a3a58f;
  --voile: rgba(29, 35, 13, .55);
  --ombre: 0 1px 2px rgba(29, 35, 13, .06), 0 8px 24px -14px rgba(29, 35, 13, .18);
  --rayon: 18px;
  --titre: "Young Serif", Georgia, serif;
  --corps: "Atkinson Hyperlegible", system-ui, sans-serif;
  color-scheme: light;
}

/* Sombre (réglage du système), sauf si la personne a choisi le clair avec le bouton */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #1d230d;
    --fond-halo: #3b3b12;
    --surface: #2f3a15;
    --surface-2: #3a4719;
    --texte: #f7f0df;
    --doux: #e0d4b4;
    --trait: #4c5a27;
    --action: #a9441b;
    --action-texte: #f7f0df;
    --action-survol: #7e3012;
    --accent: #d29a3c;
    --accent-texte: #1d230d;
    --lien: #e2b462;
    --lien-survol: #f7f0df;
    --focus: #d29a3c;
    --icone: #d29a3c;         /* cadenas en safran */
    --jeune: #4d3f14;
    --oui: #dfe6b0;  --oui-fond: #45541d;
    --comment: #f1cf8b; --comment-fond: #4d3f14;
    --non: #f3c3ab;  --non-fond: #5a2a12;
    --inconnu: #e0d4b4; --inconnu-fond: #3a4719;
    --ciel-fond: #12160a;
    --ciel-anneau: #4c5a27;
    --ciel-texte: #f7f0df;
    --ciel-doux: #e0d4b4;
    --luciole: #e2b462;
    --luciole-eteinte: #a3a58f;
    --voile: rgba(0, 0, 0, .6);
    --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

/* Sombre choisi avec le bouton soleil/lune (même valeurs que ci-dessus) */
:root[data-theme="dark"] {
  --fond: #1d230d;
  --fond-halo: #3b3b12;
  --surface: #2f3a15;
  --surface-2: #3a4719;
  --texte: #f7f0df;
  --doux: #e0d4b4;
  --trait: #4c5a27;
  --action: #a9441b;
  --action-texte: #f7f0df;
  --action-survol: #7e3012;
  --accent: #d29a3c;
  --accent-texte: #1d230d;
  --lien: #e2b462;
  --lien-survol: #f7f0df;
  --focus: #d29a3c;
  --icone: #d29a3c;         /* cadenas en safran */
  --jeune: #4d3f14;
  --oui: #dfe6b0;  --oui-fond: #45541d;
  --comment: #f1cf8b; --comment-fond: #4d3f14;
  --non: #f3c3ab;  --non-fond: #5a2a12;
  --inconnu: #e0d4b4; --inconnu-fond: #3a4719;
  --ciel-fond: #12160a;
  --ciel-anneau: #4c5a27;
  --ciel-texte: #f7f0df;
  --ciel-doux: #e0d4b4;
  --luciole: #e2b462;
  --luciole-eteinte: #a3a58f;
  --voile: rgba(0, 0, 0, .6);
  --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--texte);
  font: 18px/1.6 var(--corps);
  background-color: var(--fond);
  /* La lueur de la luciole : un halo safran en haut de page, qui s'estompe */
  background-image: radial-gradient(120% 60% at 50% -10%, var(--fond-halo) 0%, transparent 60%);
  background-repeat: no-repeat;
  caret-color: var(--action);
}
::selection { background: var(--accent); color: var(--accent-texte); }

main { max-width: 720px; margin: 0 auto; padding: 20px 16px 96px; }

/* ---------- En-tête ---------- */
.entete { display: flex; gap: 14px; align-items: center; margin: 12px 0 6px; }
.logo { width: 56px; height: 56px; flex: none; }

/* Variantes du logo : la claire par défaut, la sombre (cernée de crème) en mode sombre */
.logo-sombre { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-clair { display: none; }
  :root:not([data-theme="light"]) .logo-sombre { display: block; }
}
:root[data-theme="dark"] .logo-clair { display: none; }
:root[data-theme="dark"] .logo-sombre { display: block; }

/* Bouton soleil / lune, en haut à droite (48 px : taille d'un doigt) */
header { position: relative; }
.bouton-theme {
  position: absolute; top: 4px; right: 0;
  width: 48px; height: 48px; min-height: 48px; padding: 0; border-radius: 50%;
}
.bouton-theme svg { width: 22px; height: 22px; stroke: var(--texte); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bouton-theme .icone-lune { fill: var(--texte); stroke: none; }
.icone-soleil { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icone-soleil { display: block; }
  :root:not([data-theme="light"]) .icone-lune { display: none; }
}
:root[data-theme="dark"] .icone-soleil { display: block; }
:root[data-theme="dark"] .icone-lune { display: none; }
.entete { padding-right: 56px; } /* le titre ne passe jamais sous le bouton */
.signature { margin: 4px 0 0; font: 400 1.05rem/1.2 var(--titre); color: var(--lien); }
.pied-nom { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--texte); }
h1 {
  font: 400 2.1rem/1.05 var(--titre);
  letter-spacing: -0.02em;
  margin: 0;
}
.accroche { color: var(--doux); margin: 12px 0 18px; max-width: 46ch; font-size: 1.05rem; }
.accroche strong { color: var(--texte); }

h2 { font: 400 1.35rem/1.2 var(--titre); letter-spacing: -0.01em; margin: 0 0 10px; text-wrap: balance; }
h3 { font-size: 1rem; margin: 14px 0 4px; }
a { color: var(--lien); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { color: var(--lien-survol); }
.doux { color: var(--doux); font-size: .95rem; }

/* ---------- Blocs ---------- */
.carte {
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 18px 16px;
  margin: 16px 0;
  box-shadow: var(--ombre);
  scroll-margin-top: 72px; /* place pour le bandeau du hackathon fixé en haut */
}

/* La promesse de confidentialité : toujours visible, posée comme une étiquette */
.promesse {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 14px;
  font-weight: 700;
  font-size: .98rem;
}
.promesse svg { flex: none; width: 22px; height: 22px; margin-top: 1px; stroke: var(--icone); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Boutons (48 px de haut minimum : taille d'un doigt) ---------- */
button, .bouton {
  font: 700 1rem/1.2 var(--corps);
  color: var(--texte);
  background: var(--surface);
  border: 1.5px solid var(--trait);
  border-radius: 999px;
  padding: 12px 18px;
  min-height: 48px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color .2s ease, border-color .2s ease, transform .15s ease;
}
button:hover, .bouton:hover { border-color: var(--accent); background: var(--surface-2); }
button:active, .bouton:active { transform: translateY(1px); }
button:disabled { opacity: .6; cursor: progress; }
button.principal, .bouton.principal {
  background: var(--action);
  border-color: var(--action);
  color: var(--action-texte);
  box-shadow: 0 2px 4px rgba(43, 26, 18, .18), 0 6px 14px -8px rgba(43, 26, 18, .35);
}
button.principal:hover, .bouton.principal:hover { background: var(--action-survol); border-color: var(--action-survol); color: var(--action-texte); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 12px; }
button svg, .bouton svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linejoin: round; }
button.garde svg { fill: var(--accent); stroke: var(--texte); }

.rangee { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rangee > .bouton, .rangee > button { flex: 1 1 auto; }

input[type="text"], input[type="search"], textarea {
  font: 1rem/1.4 var(--corps);
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1.5px solid var(--trait);
  border-radius: 14px;
  background: var(--fond);
  color: var(--texte);
}
input::placeholder, textarea::placeholder { color: var(--doux); opacity: 1; }
input:focus, textarea:focus { border-color: var(--accent); }

/* ---------- Badges « sans bac » ---------- */
.badge {
  display: inline-block;
  font: 700 .8rem/1.2 var(--corps);
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.oui { color: var(--oui); background: var(--oui-fond); }
.badge.comment { color: var(--comment); background: var(--comment-fond); }
.badge.non { color: var(--non); background: var(--non-fond); }
.badge.inconnu { color: var(--inconnu); background: var(--inconnu-fond); }

/* ---------- Zones et métiers du rapport ---------- */
details.zone { border-top: 1px solid var(--trait); padding: 12px 0 6px; }
details.zone:first-of-type { border-top: 0; }
details.zone summary {
  cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font: 400 1.08rem/1.3 var(--titre);
  min-height: 44px; padding-top: 6px;
}
details.zone summary::-webkit-details-marker { display: none; }
details.zone summary .doux {
  font: 700 .85rem/1 var(--corps);
  background: var(--surface-2); color: var(--doux);
  border-radius: 999px; padding: 6px 10px;
}
.metiers { list-style: none; padding: 0; margin: 4px 0 0; }
.metiers li + li { border-top: 1px dashed var(--trait); }
.metiers button {
  width: 100%;
  border: 0; border-radius: 12px;
  background: transparent;
  padding: 12px 6px;
  text-align: left;
  justify-content: space-between;
  font-weight: 700;
}
.metiers button:hover { background: var(--surface-2); }
.metiers .confiance { display: block; font-weight: 400; font-size: .85rem; color: var(--doux); margin-top: 2px; }

/* ---------- Fiche ---------- */
#fiche[hidden] { display: none; }
#fiche { border-color: var(--accent); }
.fiche-entete { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.fiche-entete h2 { font-size: 1.6rem; margin-bottom: 6px; }
#fiche > p { max-width: 65ch; }
#fiche details summary { cursor: pointer; font-weight: 700; color: var(--lien); min-height: 44px; display: flex; align-items: center; }
.infos { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 14px 0; padding: 12px; background: var(--surface-2); border-radius: 14px; }
.infos dt { color: var(--doux); font-size: .92rem; }
.infos dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Recherche ---------- */
#resultats { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
#resultats button { width: 100%; justify-content: flex-start; text-align: left; border-radius: 14px; font-weight: 700; }

/* ---------- Chat ---------- */
#fil { display: grid; gap: 12px; margin-bottom: 12px; }
.message { padding: 12px 14px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
.message.jeune { background: var(--jeune); justify-self: end; max-width: 85%; border-bottom-right-radius: 6px; font-weight: 700; }
.message.assistant { background: var(--fond); border: 1px solid var(--trait); border-bottom-left-radius: 6px; }
.message .sources { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--trait); font-size: .9rem; white-space: normal; }
.message .sources a { display: block; padding: 4px 0; }
.message .mode { margin-top: 6px; font-size: .8rem; color: var(--doux); white-space: normal; }
/* 3 questions suggérées, toujours visibles, l'une sous l'autre (pas de rangée qui défile) */
.suggestions { display: grid; gap: 8px; margin-bottom: 14px; }
.suggestions button { justify-content: flex-start; text-align: left; font-weight: 400; background: var(--fond); border-radius: 16px; }
form.question { display: flex; gap: 8px; margin-top: 6px; }
form.question input { flex: 1; }
#mode-ia { margin-top: 12px; }

table.comparaison { width: 100%; border-collapse: collapse; font-size: .92rem; margin-top: 10px; white-space: normal; font-variant-numeric: tabular-nums; }
table.comparaison th, table.comparaison td { border-top: 1px solid var(--trait); padding: 8px 6px; text-align: left; vertical-align: top; }
table.comparaison tr:first-child th { font-family: var(--titre); font-weight: 400; color: var(--texte); }
table.comparaison th { color: var(--doux); font-weight: 400; width: 30%; }

/* ---------- Récap ---------- */
#recap-texte { min-height: 200px; font-size: .95rem; background: var(--surface-2); }

footer { font-size: .9rem; color: var(--doux); margin-top: 32px; max-width: 65ch; }
.cache { display: none !important; }

@media (min-width: 720px) {
  main { padding-top: 40px; }
  h1 { font-size: 2.8rem; }
  .logo { width: 68px; height: 68px; }
  .carte { padding: 24px; }
  .rangee > .bouton, .rangee > button { flex: 0 0 auto; }
}

/* ================= Interface simplifiée (branche ciel) ================= */
.carte { padding: 22px 18px; margin: 20px 0; }
.petite { font-size: .9rem; }
.accroche { font-size: 1.1rem; }

/* Accueil : deux gros boutons, rien d'autre */
.accueil h2 { font-size: 1.6rem; }
.gros-boutons { display: grid; gap: 14px; margin-top: 6px; }
.gros { min-height: 64px; font-size: 1.15rem; border-radius: 20px; width: 100%; }

/* Ciel / liste et filtres : boutons à bascule de 48 px */
.bascule-vue, .filtres { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.bascule-vue button, .filtres button { min-height: 48px; font-weight: 700; }
.bascule-vue button[aria-pressed="true"], .filtres button[aria-pressed="true"] {
  background: var(--texte); color: var(--fond); border-color: var(--texte);
}
#filtre-info:empty { display: none; }

/* Le ciel de lucioles (ciel de nuit dans les deux modes) */
.ciel {
  position: relative;
  margin: 12px -18px 0;   /* le ciel prend toute la largeur de la carte */
  background: radial-gradient(70% 55% at 50% 50%, #2f3a15 0%, var(--ciel-fond) 70%);
  background-color: var(--ciel-fond);
  overflow: hidden;
}
.ciel-dessin { position: absolute; inset: 0; }
.ciel-anneau { fill: none; stroke: var(--ciel-anneau); stroke-width: 1.2; stroke-dasharray: 3 5; }
.ciel-zone { fill: var(--ciel-doux); font: 700 12px/1 var(--corps); letter-spacing: .02em; }
.ciel-centre { fill: #3a4719; stroke: var(--luciole); stroke-width: 1.5; }
.ciel-toi { fill: var(--ciel-texte); font: 400 17px/1 var(--titre); }
.ciel-chemin { stroke: var(--luciole); stroke-width: 3; stroke-linecap: round; filter: drop-shadow(0 0 4px var(--luciole)); }
.luciole {
  position: absolute; width: 48px; height: 48px; min-height: 48px; padding: 0;
  transform: translate(-50%, -50%);
  border: 0; border-radius: 50%; background: transparent;
  display: grid; place-items: center;
}
.luciole:hover { background: rgba(247, 240, 223, .08); border: 0; }
.luciole:active { transform: translate(-50%, -50%); }
/* La lueur est un dégradé (pas une ombre colorée) : coeur doré, halo qui s'estompe */
.luciole .point {
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle, var(--luciole) 0 26%, rgba(226, 180, 98, .42) 34%, rgba(226, 180, 98, 0) 70%);
  transition: transform .2s ease;
}
.luciole.incertaine .point { width: 16px; height: 16px; background: transparent; border: 2px dashed var(--luciole-eteinte); }
.luciole.hors-filtre { opacity: .3; }
.luciole.allumee .point { transform: scale(1.6); }
.luciole:focus-visible { outline: 3px solid var(--ciel-texte); outline-offset: 0; border-radius: 50%; }
.ciel-legende {
  margin: 0 -18px; padding: 12px 18px; min-height: 48px;
  background: var(--ciel-fond); color: var(--ciel-texte); font-weight: 700;
}
#bloc-ciel .doux.petite { margin-top: 10px; }
.metiers button.hors-filtre { opacity: .45; }
.changer { margin: 16px 0 0; }
.lien-bouton { color: var(--lien); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; display: inline-flex; min-height: 48px; align-items: center; }

/* La fiche : panneau qui monte du bas de l'écran */
.voile { position: fixed; inset: 0; background: var(--voile); z-index: 40; }
.feuille {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); color: var(--texte);
  border-radius: 24px 24px 0 0; border: 1px solid var(--trait); border-bottom: 0;
  box-shadow: 0 -12px 40px -12px rgba(0, 0, 0, .35);
  padding: 0 18px 28px;
}
.feuille[hidden], .voile[hidden] { display: none; }
.feuille-haut {
  position: sticky; top: 0; z-index: 1; background: var(--surface);
  display: flex; justify-content: space-between; align-items: center; padding: 10px 0;
}
.poignee { width: 44px; height: 5px; border-radius: 3px; background: var(--trait); margin-left: calc(50% - 22px); }
.fermer { min-height: 48px; font-weight: 700; }
.fermer svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.5; stroke-linecap: round; }
body.panneau-ouvert { overflow: hidden; }
#fiche-titre { font-size: 1.7rem; outline: none; }
.resume { font-size: 1.08rem; }
.je-ne-sais-pas { font-weight: 700; font-size: 1.1rem; }
.actions-fiche { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 8px; }
.actions-fiche .principal { grid-column: 1 / -1; }
.actions-fiche button { width: 100%; }
button svg.plein { fill: var(--accent); }
.source-fiche { margin-top: 14px; }
@media (min-width: 720px) {
  .feuille { left: 50%; right: auto; width: 640px; transform: translateX(-50%); padding: 0 28px 32px; }
}

/* Duel : deux métiers côte à côte */
.choix-duel { list-style: none; padding: 0; margin: 10px 0 16px; display: grid; gap: 8px; }
.choix-duel button { width: 100%; justify-content: space-between; text-align: left; border-radius: 16px; }
table.duel { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 6px 0 10px; }
table.duel thead th { font: 400 1.05rem/1.25 var(--titre); text-align: left; padding: 6px 8px 10px; vertical-align: bottom; }
table.duel .duel-critere { text-align: left; font-size: .85rem; color: var(--doux); padding: 12px 8px 2px; border-top: 1px solid var(--trait); }
table.duel td { padding: 2px 8px 10px; vertical-align: top; font-weight: 700; font-variant-numeric: tabular-nums; }
table.duel td.jnsp { color: var(--doux); font-weight: 400; font-style: italic; }

/* Chat : réponse courte, puis « En savoir plus » */
.reponse-courte { margin: 0; }
.reponse-plus { margin-top: 8px; white-space: pre-wrap; }
.en-savoir-plus { margin-top: 10px; min-height: 48px; }
.titre-sources { font-size: 1.1rem; margin-top: 8px; }

/* ================= Chantier 2 : accueil plein écran de nuit ================= */
[hidden] { display: none !important; }
.ecran { position: relative; }
.ecran-int { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 20px 16px 0; }
main { padding-top: 0; }
.lucioles-fond { display: none; }
body.etat-accueil .ecran {
  min-height: 100svh;
  background: linear-gradient(165deg, var(--nuit-haut) 0%, #1a2318 48%, var(--nuit-bas) 100%);
  color: var(--ciel-texte);
  overflow: hidden;
}
body.etat-accueil .lucioles-fond {
  display: block; position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}
body.etat-accueil .ecran-int {
  max-width: 1160px; min-height: 100svh;
  padding: 64px 20px 40px; display: flex; flex-direction: column;
}
body.etat-accueil .accroche { display: none; }
body.etat-accueil h1 { color: var(--ciel-texte); }
body.etat-accueil .signature { color: var(--lien-nuit); }
body.etat-accueil .logo { width: 72px; height: 72px; }
body.etat-accueil .logo-clair { display: none; }
body.etat-accueil .logo-sombre { display: block; }
body.etat-accueil .bouton-theme { background: rgba(247, 240, 223, .08); border-color: rgba(247, 240, 223, .3); }
body.etat-accueil .bouton-theme svg { stroke: var(--ciel-texte); }
body.etat-accueil .bouton-theme .icone-lune { fill: var(--ciel-texte); stroke: none; }
body.etat-accueil :focus-visible { outline-color: var(--lien-nuit); }

/* Le contenu : texte + une action, et l'aperçu du ciel */
.accueil { display: grid; gap: 36px; flex: 1; align-content: center; padding: 28px 0 8px; }
.accueil .hero-titre {
  font: 400 clamp(2.4rem, 9vw, 4.4rem)/1.04 var(--titre); letter-spacing: -0.02em;
  color: var(--ciel-texte); margin: 0 0 18px; max-width: 13ch; text-wrap: balance;
}
.hero-sous { font-size: clamp(1.12rem, 2.6vw, 1.35rem); line-height: 1.5; color: var(--ciel-doux); max-width: 30ch; margin: 0 0 30px; }
.hero-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.hero-actions .gros { min-height: 60px; font-size: 1.15rem; border-radius: 999px; padding: 0 34px; }
.lien-secondaire {
  background: none; border: 0; border-radius: 12px; padding: 0 6px; min-height: 48px;
  color: var(--lien-nuit); font-weight: 700; text-decoration: underline; text-underline-offset: 5px;
  white-space: nowrap;
}
.lien-secondaire:hover { background: none; color: var(--ciel-texte); }
.pastille {
  display: inline-flex; align-items: center; gap: 8px; margin: 26px 0 0;
  padding: 6px 14px 6px 10px; border-radius: 999px;
  background: var(--pastille-fond); border: 1px solid rgba(247, 240, 223, .18);
  font-size: .88rem; font-weight: 700; color: var(--ciel-texte);
}
.pastille svg { width: 16px; height: 16px; fill: none; stroke: var(--lien-nuit); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.etat { color: var(--ciel-doux); margin: 14px 0 0; min-height: 1.5em; }
.etat:empty { display: none; }

/* Le mini ciel animé */
.hero-apercu { margin: 0; justify-self: center; width: min(100%, 380px); }
.hero-apercu svg { width: 100%; height: auto; display: block; }
.hero-apercu figcaption { text-align: center; font-size: .92rem; color: var(--ciel-doux); margin-top: 6px; }
.ap-anneau { fill: none; stroke: #56652b; stroke-width: 1.1; stroke-dasharray: 3 5; }
.ap-point { fill: #e2b462; opacity: .45; }
.ap-halo { fill: rgba(226, 180, 98, 0); transition: fill .5s ease; }
.ap-coeur { fill: #e2b462; transition: r .4s ease; }
.ap-metier.allume .ap-halo { fill: rgba(226, 180, 98, .3); }
.ap-metier.allume .ap-coeur { r: 8px; }
.ap-metier.gris .ap-coeur { fill: none; stroke: #a3a58f; stroke-width: 2; stroke-dasharray: 3 3; }
.ap-metier.gris.allume .ap-halo { fill: rgba(163, 165, 143, .18); }
.ap-etiquette { opacity: 0; transition: opacity .45s ease; }
.ap-metier.allume .ap-etiquette { opacity: 1; }
.ap-etiquette rect { fill: #12160a; stroke: #56652b; }
.ap-nom { fill: #f7f0df; font: 700 13px var(--corps); }
.ap-info { fill: #e2b462; font: 700 12px var(--corps); }
.ap-metier.gris .ap-info { fill: #e0d4b4; }
.ap-chemin { stroke: #e2b462; stroke-width: 2.5; stroke-linecap: round; }
.ap-chemin.gris { stroke: #a3a58f; stroke-dasharray: 4 5; }
.ap-chemin.trace:not(.gris) { stroke-dasharray: 320; animation: tracer .9s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes tracer { from { stroke-dashoffset: 320; } to { stroke-dashoffset: 0; } }
.hero-apercu svg { border-radius: 20px; overflow: hidden; }
.ap-toi-cercle { fill: #3a4719; stroke: #e2b462; stroke-width: 1.5; }
.ap-toi { fill: #f7f0df; font: 400 15px var(--titre); }
@media (prefers-reduced-motion: reduce) {
  .ap-chemin.trace:not(.gris) { animation: none; stroke-dasharray: none; }
  .ap-halo, .ap-coeur, .ap-etiquette { transition: none; }
}

/* Ordinateur : deux colonnes, le texte à gauche, le ciel à droite */
@media (min-width: 900px) {
  body.etat-accueil .ecran-int { padding: 72px 40px 48px; }
  body.etat-accueil .logo { width: 88px; height: 88px; }
  .accueil { grid-template-columns: 1.1fr .9fr; align-items: center; gap: 56px; }
  .hero-actions { flex-direction: row; align-items: center; gap: 22px; }
  .hero-apercu { width: min(100%, 440px); }
}

/* Sources et pied de page, plus discrets */
footer { font-size: .8rem; }
footer p { margin: 8px 0; }
.titre-sources { font-size: .95rem; }

/* ================= Changer de rapport ================= */
.barre-rapport {
  position: sticky; top: var(--haut-bandeau, 0px); z-index: 7;
  margin: 0 -16px; padding: 8px 16px;
  background: var(--fond); border-bottom: 1px solid var(--trait);
}
.changer-rapport { min-height: 48px; font-weight: 700; }
.changer-rapport svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.changer-rapport.discret { border-color: transparent; background: transparent; text-decoration: underline; text-underline-offset: 4px; color: var(--lien); padding: 0 8px; }
.feuille-haut .poignee { margin-left: 0; }
.logo-bouton { min-height: 48px; padding: 0; border: 0; background: none; border-radius: 50%; display: inline-flex; flex: none; }
.logo-bouton:hover { background: none; border: 0; }
body.etat-accueil .logo-bouton { cursor: default; }
.confirmer {
  max-width: min(92vw, 420px); border: 1px solid var(--trait); border-radius: 20px;
  background: var(--surface); color: var(--texte); padding: 22px 20px 18px;
  box-shadow: var(--ombre);
}
.confirmer::backdrop { background: var(--voile, rgba(29, 35, 13, .55)); }
.confirmer h2 { font-size: 1.3rem; margin: 0 0 8px; }
.confirmer p { margin: 0 0 18px; }
.confirmer-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
/* ================= Chantier 3 : « la montée » ================= */
/* Barre collée en haut pendant qu'on monte (sous le bandeau du hackathon) */
.barre-ciel {
  position: sticky; top: calc(var(--haut-bandeau, 0px) + var(--haut-barre-rapport, 0px)); z-index: 6;
  background: var(--surface); margin: 0 -18px; padding: 8px 18px 4px;
  border-bottom: 1px solid var(--trait);
}
.barre-ciel .bascule-vue, .barre-ciel .filtres { margin: 6px 0; }

.montee {
  position: relative; margin: 0 -18px; height: auto !important;
  background: none; overflow: hidden;
}
.montee-pile { display: flex; flex-direction: column-reverse; } /* Toi (premier dans le DOM) en bas */
.montee-calque { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.montee .ciel-chemin { fill: none; stroke: var(--luciole); stroke-width: 3; stroke-linecap: round; filter: drop-shadow(0 0 5px rgba(226, 180, 98, .8)); }

/* Les étages : de plus en plus de nuit en montant */
.etage { position: relative; min-height: 34svh; padding: 26px 18px 30px; border-top: 1px dashed rgba(247, 240, 223, .14); }
.etage-1 { background: linear-gradient(to top, var(--etage-bas), #29331a); }
.etage-2 { background: linear-gradient(to top, #29331a, #222c1d); }
.etage-3 { background: linear-gradient(to top, #222c1d, #1b2420); }
.etage-4 { background: linear-gradient(to top, #1b2420, #161d25); }
.etage-5 { background: linear-gradient(to top, #161d25, var(--etage-haut)); }
.etage-titre { font: 400 1.4rem/1.2 var(--titre); color: var(--ciel-texte); margin: 0; text-wrap: balance; }
.etage-sous { color: var(--ciel-doux); font-size: .92rem; margin: 6px 0 18px; }
.etage-vide { color: var(--ciel-doux); font-style: italic; }
.etage-lucioles { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 16px 12px; justify-content: center; }

/* Une luciole : lueur + nom toujours visible ; 52 px de haut */
.montee .luciole {
  position: static; transform: translateY(var(--decalage, 0px));
  width: auto; height: auto; min-height: 52px; padding: 6px 16px 6px 8px;
  display: inline-flex; align-items: center; gap: 10px;
  border-radius: 999px; background: var(--luciole-fond); border: 1px solid rgba(247, 240, 223, .16);
  color: var(--ciel-texte); font-weight: 700; text-align: left;
}
.montee .luciole:hover { background: #46512a; border-color: rgba(247, 240, 223, .3); }
.montee .luciole:active { transform: translateY(var(--decalage, 0px)); }
.montee .luciole .point {
  width: 34px; height: 34px; flex: none;
  animation: respire 3.4s ease-in-out var(--retard, 0s) infinite alternate;
}
@keyframes respire { from { opacity: .72; transform: scale(.88); } to { opacity: 1; transform: scale(1.06); } }
.montee .luciole.allumee { border-color: var(--luciole); background: #4a4a22; }
.montee .luciole.allumee .point { animation: none; transform: scale(1.25); }
.montee .luciole.incertaine .point { width: 18px; height: 18px; margin: 8px; animation: none; }
.luciole-jnsp { font-weight: 400; font-style: italic; font-size: .82rem; color: var(--ciel-doux); }
/* Hors filtre : la lueur s'éteint, le nom reste lisible (contraste conservé) */
.montee .luciole.hors-filtre { opacity: 1; background: transparent; border-style: dashed; }
.montee .luciole.hors-filtre .point { opacity: .18; animation: none; }
.montee .luciole.hors-filtre .luciole-nom { color: var(--ciel-doux); font-weight: 400; }
.montee .luciole:focus-visible { outline: 3px solid var(--ciel-texte); outline-offset: 2px; border-radius: 999px; }

/* Toi, tout en bas */
.montee-toi {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 22px 18px 26px; background: var(--etage-bas); color: var(--ciel-texte);
}
.toi-cercle {
  width: 64px; height: 64px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: #3a4719; border: 2px solid var(--luciole); font: 400 1.25rem/1 var(--titre); color: var(--ciel-texte);
}
.toi-texte { font-weight: 700; max-width: 22ch; }
.ciel-legende { margin: 0 -18px; }

@media (prefers-reduced-motion: reduce) {
  .montee .luciole .point { animation: none; }
}
@media (min-width: 900px) {
  .etage { min-height: 30vh; padding: 30px 40px 36px; }
  .etage-titre { font-size: 1.7rem; }
  .etage-lucioles { gap: 18px 16px; }
}

/* Le nom SOUS chaque luciole, toujours visible (pastille verticale) */
.montee .luciole {
  flex-direction: column; justify-content: flex-start; align-items: center;
  width: 104px; min-height: 84px; padding: 8px 6px 10px; gap: 6px;
  border-radius: 18px; text-align: center;
}
.montee .luciole .luciole-nom { font-size: .84rem; line-height: 1.2; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
.montee .luciole:focus-visible { border-radius: 18px; }
.montee .luciole.incertaine .point { margin: 8px 0; }
@media (min-width: 900px) { .montee .luciole { width: 124px; } }

/* Après le chargement : en-tête compact et intro réduite, le ciel commence dans le premier écran */
body:not(.etat-accueil) .ecran-int { padding-top: 8px; }
body:not(.etat-accueil) .entete { margin: 0; gap: 10px; }
body:not(.etat-accueil) .logo { width: 40px; height: 40px; }
body:not(.etat-accueil) h1 { font-size: 1.35rem; }
body:not(.etat-accueil) .signature { font-size: .85rem; margin-top: 0; }
body:not(.etat-accueil) .accroche { display: none; }
#vue-rapport { padding-top: 14px; }
#vue-rapport > h2 { font-size: 1.25rem; margin-bottom: 2px; }
#vue-rapport > #resume-rapport { margin: 0 0 6px; font-size: .9rem; }
#vue-rapport > .promesse.petite { padding: 6px 10px; margin-bottom: 8px; font-size: .85rem; }

/* Téléphone : 3 lucioles par ligne dans chaque étage */
.etage { padding-left: 10px; padding-right: 10px; }
.etage-titre, .etage-sous { padding: 0 8px; }
.etage-lucioles { gap: 14px 8px; }
/* Ordinateur : l'écran du rapport s'élargit, la montée aussi */
@media (min-width: 900px) {
  body:not(.etat-accueil) main, body:not(.etat-accueil) .ecran-int { max-width: 1080px; }
  .etage { padding-left: 40px; padding-right: 40px; }
  .montee .luciole { width: 132px; }
  .montee .luciole .luciole-nom { font-size: .9rem; }
}

/* Le chemin lumineux passe ENTRE le fond des étages et le contenu : jamais par-dessus un nom */
.montee .etage-titre, .montee .etage-sous, .montee .luciole, .montee .toi-cercle, .montee .toi-texte { position: relative; z-index: 3; }

/* ================= Passe finale : barre fine, lucioles libres, étages pleine largeur ================= */
.lecteur-seul {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Écran du rapport : plus de grande en-tête (la barre fine la remplace), le ciel prend toute la largeur */
body:not(.etat-accueil) .ecran { display: none; }
body:not(.etat-accueil) main { max-width: none; padding: 0 0 96px; }
body:not(.etat-accueil) main > .carte:not(#vue-rapport) { margin: 20px 16px; }
body:not(.etat-accueil) footer { padding: 0 16px; }
@media (min-width: 900px) {
  body:not(.etat-accueil) main > .carte:not(#vue-rapport), body:not(.etat-accueil) footer { max-width: 1048px; margin-left: auto; margin-right: auto; }
}
body:not(.etat-accueil) #vue-rapport {
  background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0; margin: 0;
}
.filtre-info { margin: 8px 16px; }

/* La barre fine collée : logo, Changer de rapport, thème, puis Ciel/Liste + filtres */
.barre-rapport {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  margin: 0; padding: 6px 12px;
  background: var(--fond); border-bottom: 1px solid var(--trait);
}
.logo-bouton.petit img { width: 32px; height: 32px; }
.logo-bouton.petit { min-height: 48px; min-width: 48px; justify-content: center; align-items: center; }
.barre-rapport .changer-rapport { padding: 0 14px; }
.place-theme { margin-left: auto; display: flex; }
.place-theme .bouton-theme { position: static; }
.barre-defile {
  flex: 1 1 100%; display: flex; gap: 8px; align-items: center;
  overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
}
.barre-defile::-webkit-scrollbar { display: none; }
.barre-defile .bascule-vue, .barre-defile .filtres { flex-wrap: nowrap; margin: 0; flex: none; }
.barre-defile button { white-space: nowrap; min-height: 48px; padding: 0 14px; }
.barre-defile .filtres { padding-left: 8px; border-left: 1px solid var(--trait); }
@media (min-width: 900px) {
  .barre-rapport { flex-wrap: nowrap; padding: 6px 24px; }
  .barre-defile { flex: 1 1 auto; order: 3; }
  .place-theme { order: 4; }
}

/* Les étages : bandes pleine largeur, contenu centré sur ordinateur */
.montee { margin: 0; }
.etage { padding: 24px max(12px, calc((100% - 1048px) / 2)) 32px; }
.etage-titre, .etage-sous { padding: 0 8px; }
.etage-lucioles { justify-content: space-around; gap: 30px 4px; }

/* Les lucioles flottent : plus de carte, juste la lueur qui respire et le nom dessous */
.montee .luciole {
  background: transparent; border: 0; border-radius: 16px;
  width: 96px; min-height: 48px; padding: 4px 2px 6px; gap: 4px;
  margin: 0 var(--ecart-x, 0px);
}
.montee .luciole:hover { background: rgba(247, 240, 223, .07); border: 0; }
.montee .luciole.allumee { background: transparent; border: 0; }
.montee .luciole.allumee .luciole-nom { text-decoration: underline; text-decoration-color: var(--luciole); text-underline-offset: 4px; }
.montee .luciole.hors-filtre { background: transparent; border: 0; }
.montee .luciole .point { width: 38px; height: 38px; }
.montee .luciole .luciole-nom { color: var(--ciel-texte); text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
@media (min-width: 900px) { .montee .luciole { width: 128px; } }

/* Toi, et le cadenas en pastille discrète au pied de l'écran */
.montee-toi { flex-direction: column; gap: 10px; padding: 18px 16px 20px; }
.toi-ligne { display: flex; align-items: center; gap: 14px; }
.pastille-toi {
  display: inline-flex; align-items: center; gap: 6px; margin: 0;
  padding: 4px 12px; border-radius: 999px; font-size: .82rem; font-weight: 700;
  background: var(--pastille-fond); color: var(--ciel-texte); border: 1px solid rgba(247, 240, 223, .16);
}
.pastille-toi svg { width: 14px; height: 14px; fill: none; stroke: var(--lien-nuit); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Survol seulement avec une souris (sur écran tactile, il resterait « collé » après le toucher) */
.montee .luciole:hover { background: transparent; }
@media (hover: hover) { .montee .luciole:hover { background: rgba(247, 240, 223, .07); } }
/* Ordinateur : un peu plus de désordre vertical (reste sous l'espace entre les lignes : pas de chevauchement) */
@media (min-width: 900px) {
  .montee .luciole { transform: translateY(calc(var(--decalage, 0px) * 1.5)); }
  .montee .luciole:active { transform: translateY(calc(var(--decalage, 0px) * 1.5)); }
}

/* ================= Thème : bascule propre ================= */
/* Pendant la bascule clair / sombre, aucune transition : sinon les fonds glissent pendant 0,2 s
   alors que le texte a déjà changé (texte illisible, effet de flash) */
html.sans-transition *, html.sans-transition *::before, html.sans-transition *::after { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
/* Le logo de nuit seulement sur l'écran de nuit de l'accueil (pas dans le pied de page) */
body.etat-accueil footer .logo-clair { display: inline; }
body.etat-accueil footer .logo-sombre { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.etat-accueil footer .logo-clair { display: none; }
  :root:not([data-theme="light"]) body.etat-accueil footer .logo-sombre { display: inline; }
}
:root[data-theme="dark"] body.etat-accueil footer .logo-clair { display: none; }
:root[data-theme="dark"] body.etat-accueil footer .logo-sombre { display: inline; }
body.etat-accueil .ecran .logo-clair { display: none; }
body.etat-accueil .ecran .logo-sombre { display: block; }
