/* ============================================================
   À sec, à flot — charte graphique (direction « l'instrument public »)
   Livrée par Claude Design le 23/08/2026, appliquée sur le site eau.
   Chargée APRÈS le <style> de chaque page : ses tokens redéfinissent
   les variables historiques (--crue, --etiage…) — les composants
   existants basculent sur le nouveau nuancier sans réécriture.
   Trois états de thème : clair (défaut), sombre (système), et le
   choix explicite de l'utilisateur via html[data-theme].
   ============================================================ */
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=IBM+Plex+Mono:wght@400;600&display=swap");

:root {
  /* nuancier 1a — thème clair */
  --papier: #F6F4EF;
  --surface: #FFFFFF;
  --surface2: #EDEBE4;
  --encre: #1C1A16;
  --muet: #6B675E;
  --ligne: #DAD5CB;
  --crue: #17405F;
  --crue-vive: #3E7BD6;
  --etiage: #8A5A12;
  --etiage-vif: #C98A1F;
  --ocre: #8A5A12;
  --ocre-vif: #C98A1F;
  --record: #8C1A0F;
  --attente: #9A968D;
  /* alias historiques utilisés par les pages */
  --fond: #F6F4EF;
  --muted: #6B675E;
  --enc: #1C1A16;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --papier: #0E141B;
    --surface: #15161A;
    --surface2: #1C2129;
    --encre: #EAEDF1;
    --muet: #8C9AA8;
    --ligne: #2A313B;
    --crue: #7FB2E5;
    --crue-vive: #7FB2E5;
    --etiage: #E0A94E;
    --etiage-vif: #E0A94E;
    --ocre: #E0A94E;
    --ocre-vif: #E0A94E;
    --record: #E06A55;
    --attente: #6E7680;
    --fond: #0E141B;
    --muted: #8C9AA8;
    --enc: #EAEDF1;
  }
}
:root[data-theme="sombre"] {
  --papier: #0E141B;
  --surface: #15161A;
  --surface2: #1C2129;
  --encre: #EAEDF1;
  --muet: #8C9AA8;
  --ligne: #2A313B;
  --crue: #7FB2E5;
  --crue-vive: #7FB2E5;
  --etiage: #E0A94E;
  --etiage-vif: #E0A94E;
  --ocre: #E0A94E;
  --ocre-vif: #E0A94E;
  --record: #E06A55;
  --attente: #6E7680;
  --fond: #0E141B;
  --muted: #8C9AA8;
  --enc: #EAEDF1;
}

/* ── typographie : le récit en Space Grotesk, l'instrument en Plex Mono ── */
body {
  background: var(--papier);
  color: var(--encre);
}
h1, h2, h3, .marque, .kicker, .pole .kicker, .btn-carte-eau, .btn-carte {
  font-family: "Space Grotesk", system-ui, sans-serif;
}
code, .val, .quand, .chiffre, .pct-badge, .histo-date, .annee-val {
  font-family: "IBM Plex Mono", monospace;
}

/* ── en-tête : papier, filet bicolore, cadran ─────────────────────────── */
header.site.eau-site {
  background: var(--surface);
  border-bottom: 0;
  position: relative;
}
header.site.eau-site::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--ocre) 0 50%, var(--crue) 50% 100%);
}
.eau-site .marque, .eau-site .marque:hover {
  color: var(--encre) !important;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
/* le logo : la ligne de flottaison (piste 1a) — ocre emerge, bleu immerge */
.eau-site .marque::before {
  content: "";
  width: 24px;
  height: 24px;
  flex: none;
  background: url("/eau/logo-asaf.svg?v=p1") center / contain no-repeat;
}
.eau-site .marque em { color: var(--muet) !important; font-weight: 500; }
.eau-site .nav-site a { color: var(--muet); }
.eau-site .nav-site a:hover { color: var(--encre); }
.eau-site .btn-carte.eau-btn {
  background: var(--crue);
  border-color: var(--crue);
  color: #F6F4EF !important;
}

/* ── bouton de thème ──────────────────────────────────────────────────── */
.btn-theme {
  border: 1px solid var(--ligne);
  background: none;
  color: var(--muet);
  border-radius: 999px;
  width: 34px; height: 34px;
  font-size: 15px;
  cursor: pointer;
  flex: none;
}
.btn-theme:hover { color: var(--encre); }

/* ── surfaces génériques des pages eau ───────────────────────────────── */
.eau-carte, .balance-fiche, .recit-eau, .interets {
  background: var(--surface);
  border-color: var(--ligne);
}
.proto-bandeau {
  /* couleurs profondes FIXES : avec les tokens, le sombre inversait le
     gradient (bleu clair sous texte clair — bandeau illisible, audit 23/08) */
  background: linear-gradient(90deg, #8A5A12 0 50%, #17405F 50% 100%);
  color: #F6F4EF;
}
.btn-carte-eau { background: var(--crue); }
.btn-carte-eau:hover { background: var(--crue-vive); }

/* pôles : blocs pleins et PROFONDS dans les deux thèmes, comme le dossier —
   l'inversion par tokens donnait des blocs clairs criards sur fond noir */
.pole.crue { background: #17405F; color: #F6F4EF; }
.pole.etiage { background: #8A5A12; color: #F6F4EF; }

/* état « donnée en attente » : le gris a droit à sa place */
.attente, .etat-attente { color: var(--attente); }

/* l'en-tete tient sur une ligne : le sous-titre s'efface avant le nav */
@media (max-width: 1280px) {
  .eau-site .marque em { display: none; }
}
@media (min-width: 761px) {
  .eau-site .tete { flex-wrap: nowrap; }
  .eau-site .nav-site { flex-wrap: nowrap; white-space: nowrap; }
}

/* ── burger + tiroir de navigation mobile (dossier § 02) ─────────────── */
.burger {
  display: none; border: 1px solid var(--ligne); background: none; color: var(--encre);
  border-radius: 10px; width: 40px; height: 38px; font-size: 17px; cursor: pointer; flex: none;
}
@media (max-width: 760px) {
  .burger { display: inline-flex; align-items: center; justify-content: center; }
  .eau-site .nav-site { display: none !important; }
  /* la carte est la destination n°1 : sur mobile le bouton reste, en compact */
  .eau-site .btn-carte.eau-btn { padding: 7px 12px; font-size: 12px; }
}
.tiroir-nav {
  position: fixed; inset: 0; z-index: 90; background: var(--papier); color: var(--encre);
  display: none; flex-direction: column; padding: 14px 20px 20px; overflow-y: auto;
}
.tiroir-nav.ouvert { display: flex; }
.tiroir-tete { display: flex; align-items: center; justify-content: space-between; }
.tiroir-marque { font: 700 20px "Space Grotesk", sans-serif; }
.tiroir-fermer {
  border: 1px solid var(--ligne); background: none; color: var(--encre);
  border-radius: 50%; width: 38px; height: 38px; font-size: 15px; cursor: pointer;
}
.tiroir-liens { display: flex; flex-direction: column; margin-top: 18px; }
.tiroir-liens a {
  font: 500 19px/1 "Space Grotesk", sans-serif; color: var(--encre); text-decoration: none;
  padding: 13px 0; border-bottom: 1px solid var(--ligne);
}
.tiroir-badge {
  font: 600 10px "IBM Plex Mono", monospace; color: #fff; background: var(--crue-vive);
  border-radius: 999px; padding: 2px 8px; vertical-align: 3px; margin-left: 6px;
}
.tiroir-titre { font: 600 10.5px "IBM Plex Mono", monospace; letter-spacing: .12em; color: var(--muet); margin: 22px 0 8px; }
.tiroir-theme { display: flex; gap: 6px; }
.tiroir-theme button {
  flex: 1; border: 1px solid var(--ligne); background: none; color: var(--muet);
  border-radius: 999px; font: 600 13px "Space Grotesk", sans-serif; padding: 8px 0; cursor: pointer;
}
.tiroir-theme button.on { background: var(--encre); border-color: var(--encre); color: var(--papier); }
.tiroir-pied { margin-top: auto; padding-top: 18px; font-size: 12px; color: var(--muet); }

/* ── pied de page structure (dossier § 02) ───────────────────────────── */
.pied-asaf {
  margin-top: 46px; border-top: 3px solid transparent; background: var(--surface);
  border-image: linear-gradient(90deg, var(--ocre) 0 50%, var(--crue) 50% 100%) 1;
  border-top-style: solid;
}
.pied-grille { display: grid; gap: 26px; padding: 30px 0 36px; }
@media (min-width: 820px) { .pied-grille { grid-template-columns: 1.4fr 1fr 1fr; } }
.pied-marque { font: 700 18px "Space Grotesk", sans-serif; display: flex; align-items: center; gap: 8px; }
.pied-marque::before {
  content: ""; width: 22px; height: 22px; flex: none;
  background: url("/eau/logo-asaf.svg?v=p1") center / contain no-repeat;
}
/* le curseur (piste 1e) : la signature qui va d'un exces a l'autre */
.pied-curseur { display: flex; align-items: center; gap: 8px; margin-top: 10px; max-width: 250px; }
.pied-curseur .mot { font: 600 9.5px "IBM Plex Mono", monospace; letter-spacing: .08em; color: var(--muet); }
.pied-curseur .barre { flex: 1; height: 3px; border-radius: 2px; position: relative;
  font-size: 0; /* le tiret de secours disparait quand le style est la */
  background: linear-gradient(90deg, var(--ocre-vif), var(--ligne) 50%, var(--crue-vive)); }
.pied-curseur .barre::after { content: ""; position: absolute; left: 50%; top: -4px;
  width: 3px; height: 11px; border-radius: 2px; background: var(--encre); }
.pied-by { font: 500 12px "Space Grotesk", sans-serif !important; color: var(--muet) !important; margin-top: 8px !important; }
.pied-by a { display: inline !important; color: var(--encre) !important; font-weight: 700; padding: 0 !important; }
.pied-asaf p { font-size: 12.5px; color: var(--muet); line-height: 1.6; margin: 8px 0 0; max-width: 46ch; }
.pied-titre { font: 600 10.5px "IBM Plex Mono", monospace; letter-spacing: .12em; color: var(--muet); margin-bottom: 8px; }
.pied-asaf a { display: block; color: var(--encre); text-decoration: none; font-size: 13.5px; padding: 3px 0; }
.pied-asaf a:hover { color: var(--crue-vive); }
.pied-secours { font-size: 12.5px; margin-top: 10px; }
@media print { .pied-asaf, .burger, .tiroir-nav { display: none !important; } }

/* la marque ne se coupe jamais ; le slogan s'efface avant de faire plier la ligne */
.eau-site .marque { white-space: nowrap; }
.eau-site .marque em { font-size: 14px; }
@media (max-width: 1420px) {
  .eau-site .marque em { display: none; }
}

/* le pied respire sur telephone : le conteneur de certaines pages n'a pas
   de marge laterale propre */
.pied-asaf .conteneur { padding-left: 20px; padding-right: 20px; }


/* ── le fil de l'eau : les deux exces defilent sous l'en-tete ─────────── */
.fil-eau {
  display: flex; background: var(--surface); border-bottom: 1px solid var(--ligne);
  font-size: 12px; overflow: hidden;
}
.fil-eau .moitie { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 14px; }
.fil-eau .moitie.sec { border-right: 1px solid var(--ligne); }
.fil-eau .fe-etiquette {
  font: 600 9.5px "IBM Plex Mono", monospace; letter-spacing: .1em; flex: none;
}
.fil-eau .sec .fe-etiquette { color: var(--ocre); }
.fil-eau .flot .fe-etiquette { color: var(--crue-vive); }
.fil-eau .defile { overflow: hidden; flex: 1; min-width: 0; }
.fil-eau .piste { display: inline-flex; gap: 30px; white-space: nowrap; padding-right: 30px; animation: fil-defile 36s linear infinite; }
.fil-eau .piste a { color: inherit; text-decoration: none; }
.fil-eau .piste a:hover { color: var(--crue-vive); }
.fil-eau .piste b { font-family: "IBM Plex Mono", monospace; }
@keyframes fil-defile { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .fil-eau .piste { animation: none; } }
@media (max-width: 760px) {
  .fil-eau { flex-direction: column; }
  .fil-eau .moitie.sec { border-right: 0; border-bottom: 1px solid var(--ligne); }
}


/* ── Grand texte : pour les yeux qui ont plus de 50 ans ──────────────── */
html[data-taille="grand"] { font-size: 115%; }
html[data-taille="grand"] body { font-size: 1.05em; }
.tiroir-taille { display: flex; gap: 6px; }
.tiroir-taille button {
  flex: 1; border: 1px solid var(--ligne); background: none; color: var(--muet);
  border-radius: 999px; font: 600 13px "Space Grotesk", sans-serif; padding: 8px 0; cursor: pointer;
}
.tiroir-taille button.on { background: var(--encre); border-color: var(--encre); color: var(--papier); }
/* etiquettes minuscules : 10 -> 11 px */
.pied-curseur .mot { font-size: 11px !important; }
/* le detail du bandeau maquette s'efface sur telephone */
@media (max-width: 760px) {
  .proto-bandeau .pb-detail { display: none; }
}


/* ── pictos maison : grille 24, trait 2 px, encre + un accent max ─────── */
:root { --pic-eau: #17405F; --pic-sec: #C98A1F; --pic-danger: #8C1A0F; --pic-attente: #9A968D; }

/* site.css met .kicker en Braise VigieFeux — l'univers eau parle ocre */
.kicker { color: var(--ocre-vif, #C98A1F); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) { --pic-eau: #7FB2E5; --pic-sec: #E0A94E; --pic-danger: #F08573; }
}
:root[data-theme="sombre"] { --pic-eau: #7FB2E5; --pic-sec: #E0A94E; --pic-danger: #F08573; }
.pic { flex: none; vertical-align: -5px; }
.pic-16 { width: 16px; height: 16px; vertical-align: -3px; }
.pic-20 { width: 20px; height: 20px; vertical-align: -4px; }
.pic-24 { width: 24px; height: 24px; }
.pic-32 { width: 32px; height: 32px; }


/* ── Navigation V2 : quatre groupes a menus (bureau) ──────────────────── */
.nav-groupe { position: relative; display: inline-block; }
.nav-groupe > button {
  border: 0; background: none; cursor: pointer; color: inherit;
  font: 600 13px "Space Grotesk", sans-serif; letter-spacing: .04em;
  padding: 8px 10px; border-radius: 8px;
}
.nav-groupe > button:hover, .nav-groupe > button.actif { color: var(--crue-vive, #3E7BD6); }
.nav-groupe > button.actif { text-decoration: underline; text-underline-offset: 5px; }
.nav-menu {
  display: none; position: absolute; top: 100%; left: 0; min-width: 230px;
  background: var(--surface, #fff); border: 1px solid var(--ligne, #DAD5CB);
  border-radius: 12px; box-shadow: 0 10px 28px rgba(32, 36, 43, .16);
  padding: 8px; z-index: 60;
}
.nav-groupe.ouvert .nav-menu { display: block; }
@media (hover: hover) { .nav-groupe:hover .nav-menu { display: block; } }
.nav-menu a {
  display: block; padding: 8px 10px; border-radius: 8px;
  font: 500 13.5px "Space Grotesk", sans-serif; color: inherit; text-decoration: none;
}
.nav-menu a:hover { background: var(--papier, #F6F4EF); color: var(--crue-vive, #3E7BD6); }

/* ── Barre basse mobile : Chez moi · Carte · Agir · Aide · Plus ────────── */
.barre-basse { display: none; }
@media (max-width: 760px) {
  .barre-basse {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    background: var(--surface, #fff); border-top: 1px solid var(--ligne, #DAD5CB);
    padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
  }
  .barre-basse a, .barre-basse button {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    border: 0; background: none; cursor: pointer; text-decoration: none;
    color: var(--muted, #6B675E); font: 600 10px "Space Grotesk", sans-serif;
    padding: 5px 2px; min-height: 44px; justify-content: center;
  }
  .barre-basse .actif, .barre-basse a:active { color: var(--crue-vive, #3E7BD6); }
  .barre-basse .bb-agir { color: var(--ocre-vif, #C98A1F); }
  body.avec-barre-basse { padding-bottom: 68px; }
  body.avec-barre-basse .tiroir-nav { padding-bottom: 80px; }
  .bb-feuille {
    display: none; position: fixed; left: 8px; right: 8px;
    bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 69;
    background: var(--surface, #fff); border: 1px solid var(--ligne, #DAD5CB);
    border-radius: 14px; box-shadow: 0 -6px 28px rgba(32, 36, 43, .2); padding: 10px;
  }
  .bb-feuille.ouverte { display: block; }
  .bb-feuille-titre {
    font: 700 10.5px "IBM Plex Mono", monospace; letter-spacing: .1em;
    color: var(--muted, #6B675E); padding: 2px 10px 6px;
  }
  .bb-feuille a {
    display: block; padding: 11px 12px; border-radius: 10px;
    font: 600 14px "Space Grotesk", sans-serif; color: inherit; text-decoration: none;
  }
  .bb-feuille a:active { background: var(--papier, #F6F4EF); }
  .bb-feuille .bb-crise {
    background: var(--papier, #F6F4EF); border: 1px solid var(--ligne, #DAD5CB);
    margin-bottom: 6px;
  }
}


/* ── Pied de page V3 : colonnes par besoin, barre officielle en bas ────── */
.pied-grille { display: grid; gap: 26px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .pied-grille { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1080px) { .pied-grille { grid-template-columns: 1.5fr 1fr 1fr 1fr 1.1fr; } }
.pied-grille > div > a { display: block; font-size: 13px; color: inherit; text-decoration: none; padding: 3px 0; }
.pied-grille > div > a:hover { color: var(--crue-vive, #3E7BD6); }
.pied-transparence { font-size: 11.5px !important; opacity: .85; }
.pied-bas { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  border-top: 1px solid var(--ligne, #DAD5CB); margin-top: 26px; padding-top: 16px;
  font-size: 12.5px; }
.pied-bas a { color: inherit; }
.pied-sep { flex: 1; }
@media (max-width: 700px) { .pied-sep { display: none; } }
