/*
 * Page de statut de Commune en ligne (status.communeenligne.fr).
 * Couleurs des maquettes P-Statut-Public et P-Statut-Public-Sombre, définies une seule fois
 * ci-dessous, avec deux corrections de contraste (LISEZMOI.md, « La page ») :
 *  - --perturbations en clair : #9E5F09 au lieu de #B26A0B (4,7:1 sur son fond de pastille) ;
 *  - --aucun (« Pas de mesure ») : #7A899D / #66768B au lieu de #DCE3EC / #2A3646, pour 3:1 ;
 *    la barre est alors dessinée vide, cerclée de cette couleur.
 */

/* Police Manrope, servie par le domaine lui-même (@communeenligne/design 2.3.0, licence
   SIL Open Font License 1.1 : fonts/OFL.txt). Le texte courant (400) s'affiche en 500. */
@font-face { font-family: Manrope; src: url("/fonts/manrope-latin-500-normal.woff2?v=2.3.0") format("woff2"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: Manrope; src: url("/fonts/manrope-latin-600-normal.woff2?v=2.3.0") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: Manrope; src: url("/fonts/manrope-latin-700-normal.woff2?v=2.3.0") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: Manrope; src: url("/fonts/manrope-latin-800-normal.woff2?v=2.3.0") format("woff2"); font-weight: 800; font-display: swap; }
/* Repli aux mesures de Manrope (valeurs du paquet design) : le texte ne bouge presque pas. */
@font-face {
  font-family: "Manrope Fallback";
  src: local("Arial"), local("ArialMT"), local("Arimo"), local("Liberation Sans");
  font-weight: 400 600;
  size-adjust: 105.6%; ascent-override: 100.94%; descent-override: 28.41%; line-gap-override: 0%;
}
@font-face {
  font-family: "Manrope Fallback";
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Arimo Bold"), local("Liberation Sans Bold");
  font-weight: 700 900;
  size-adjust: 103.04%; ascent-override: 103.46%; descent-override: 29.12%; line-gap-override: 0%;
}

/* --- Couleurs --------------------------------------------------------------------------- */

:root {
  color-scheme: light dark;
  --texte: #18202B;
  --discret: #4A5A6E;
  --fond: #F5F7FA;
  --surface: #FFFFFF;
  --filet: #DCE3EC;
  --lien: #1F3A5F;
  --bulle: #18202B;
  --bulle-texte: #FFFFFF;
  --operationnel: #1E7A4A;
  --operationnel-fond: #E6F4EC;
  --perturbations: #9E5F09;
  --perturbations-fond: #FDF3E4;
  --indisponible: #B42318;
  --indisponible-fond: #FCEBEA;
  --maintenance: #4A6A8F;
  --maintenance-fond: #EAF0F7;
  --aucun: #7A899D;
  --aucun-fond: #EEF2F6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --texte: #E8EDF3;
    --discret: #A9B6C6;
    --fond: #0F1722;
    --surface: #18202B;
    --filet: #2A3646;
    --lien: #A9C2E0;
    --bulle: #E8EDF3;
    --bulle-texte: #18202B;
    --operationnel: #4CC38A;
    --operationnel-fond: rgba(76, 195, 138, 0.14);
    --perturbations: #E7A55A;
    --perturbations-fond: rgba(231, 165, 90, 0.14);
    --indisponible: #F2726B;
    --indisponible-fond: rgba(242, 114, 107, 0.14);
    --maintenance: #9DB3CF;
    --maintenance-fond: rgba(157, 179, 207, 0.14);
    --aucun: #66768B;
    --aucun-fond: rgba(169, 182, 198, 0.1);
  }
}

/* Une classe d'état pose sa couleur ; chaque élément s'en sert à sa façon. */
.e-operationnel, .e-resolu { --couleur: var(--operationnel); --couleur-fond: var(--operationnel-fond); }
.e-perturbations, .e-en_cours { --couleur: var(--perturbations); --couleur-fond: var(--perturbations-fond); }
.e-indisponible { --couleur: var(--indisponible); --couleur-fond: var(--indisponible-fond); }
.e-maintenance { --couleur: var(--maintenance); --couleur-fond: var(--maintenance-fond); }
.e-aucun { --couleur: var(--aucun); --couleur-fond: var(--aucun-fond); }

/* --- Page ------------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: Manrope, "Manrope Fallback", "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--lien); font-weight: 600; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--lien); outline-offset: 2px; }

.lecteur {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.symbole { font-weight: 500; color: var(--texte); }
.symbole b { font-weight: 800; }

.evitement {
  position: absolute; left: -9999px; top: 8px; z-index: 10;
  padding: 12px 18px; border-radius: 10px;
  background: var(--texte); color: var(--fond); text-decoration: none;
}
.evitement:focus { left: 8px; }

.page {
  max-width: 1000px; margin: 0 auto; padding: 40px 24px 40px;
  display: flex; flex-direction: column; gap: 28px;
}
main { display: flex; flex-direction: column; gap: 28px; }
main:focus { outline: none; }

.entete { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.entete .logo { display: block; width: 210px; height: auto; }
.lien-externe, .pied a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 16px; }

h1 { margin: 40px 0 0; font-size: 40px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }
h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.introduction { margin: -16px 0 0; max-width: 64ch; color: var(--discret); font-size: 18px; }

.carte { background: var(--surface); border: 1px solid var(--filet); border-radius: 16px; }

/* --- Bandeau d'état général ------------------------------------------------------------- */

.bandeau {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 26px; border-left: 6px solid var(--couleur);
}
.bandeau p { margin: 0; }
.bandeau-phrase { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 800; line-height: 1.3; }
.bandeau-phrase .point {
  flex: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--couleur); box-shadow: 0 0 0 5px var(--couleur-fond);
}
.bandeau-heure { font-size: 16px; color: var(--discret); text-align: right; }

/* --- Maintenances ----------------------------------------------------------------------- */

#maintenances { display: flex; flex-direction: column; gap: 16px; }
#maintenances:empty { display: none; }
.maintenance {
  display: flex; gap: 14px; padding: 18px 22px;
  background: var(--maintenance-fond); border: 1px solid var(--filet);
  border-left: 6px solid var(--maintenance); border-radius: 16px;
}
.maintenance .icone { flex: none; margin-top: 2px; color: var(--maintenance); }
.maintenance p { margin: 2px 0 0; font-size: 16px; }
.maintenance .maintenance-titre { margin: 0; font-size: 17px; }
.maintenance strong { font-weight: 700; }

/* --- Services --------------------------------------------------------------------------- */

.titre-services { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.legende {
  display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 0; list-style: none;
  font-size: 14px; color: var(--discret);
}
.legende li { display: inline-flex; align-items: center; gap: 7px; }
.legende i { display: inline-block; width: 10px; height: 18px; border-radius: 4px; background: var(--couleur); }
.legende i.e-aucun, .jour.e-aucun { background: var(--aucun-fond); box-shadow: inset 0 0 0 1.5px var(--aucun); }

.service { padding: 20px 24px; border-top: 1px solid var(--filet); display: flex; flex-direction: column; gap: 12px; }
.service:first-child { border-top: 0; }
.service-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.service-nom { margin: 0; font-size: 18px; font-weight: 700; }
.service-description { margin: 0; font-size: 14px; color: var(--discret); }

.pastille, .etiquette {
  display: inline-flex; align-items: center; gap: 7px; border-radius: 999px;
  background: var(--couleur-fond); color: var(--couleur); font-size: 14px; font-weight: 700; white-space: nowrap;
}
.pastille { padding: 4px 12px; }
.pastille .point { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pastille.e-aucun { color: var(--discret); }

/* Barre de 90 jours (30 sous 640 px) */
.barre { display: grid; grid-template-columns: repeat(90, 1fr); gap: 2px; height: 34px; }
.jour { position: relative; border-radius: 2px; background: var(--couleur); cursor: default; }
.jour:hover, .jour:focus-visible { outline: 2px solid var(--texte); outline-offset: 1px; }

/* Bulle d'un jour : au survol et au focus, même sans script. */
.bulle {
  display: none; position: absolute; top: calc(100% + 10px); z-index: 2;
  width: 230px; padding: 10px 12px; border-radius: 10px;
  background: var(--bulle); color: var(--bulle-texte);
  font-size: 14px; font-weight: 500; line-height: 1.4; text-align: left;
  box-shadow: 0 8px 24px rgba(24, 32, 43, 0.22);
  pointer-events: none;
}
.bulle b { display: block; font-weight: 700; }
.bulle .symbole { color: inherit; }
.jour::after {
  content: ""; display: none; position: absolute; top: calc(100% + 5px); left: 50%; z-index: 2;
  width: 12px; height: 12px; margin-left: -6px; background: var(--bulle); transform: rotate(45deg);
}
.jour:hover .bulle, .jour:focus .bulle, .jour:hover::after, .jour:focus::after { display: block; }
/* Un seul jour à la fois : le survol l'emporte sur le focus ; Échap ferme la bulle. */
.barre:hover .jour:focus:not(:hover) .bulle, .barre:hover .jour:focus:not(:hover)::after,
.barre.sans-bulle .bulle, .barre.sans-bulle .jour::after { display: none; }
.b-g .bulle { left: -4px; }
.b-c .bulle { left: 50%; transform: translateX(-50%); }
.b-d .bulle { right: -4px; }

.axe { display: flex; justify-content: space-between; gap: 4px 12px; margin: 0; font-size: 14px; color: var(--discret); }
.axe b { color: var(--texte); font-weight: 700; }
.etroit { display: none; }

/* --- Incidents -------------------------------------------------------------------------- */

.incident { display: flex; gap: 16px; padding: 18px 24px; border-top: 1px solid var(--filet); }
.incident:first-child { border-top: 0; }
.incident time { flex: none; width: 96px; font-size: 14px; font-weight: 700; color: var(--discret); }
.incident h3 { margin: 0; font-size: 17px; font-weight: 700; }
.incident p { margin: 2px 0 0; font-size: 16px; color: var(--discret); }
.etiquette { margin-left: 8px; padding: 1px 9px; vertical-align: 2px; }
.vide { margin: 0; padding: 18px 24px; color: var(--discret); }

/* --- Pied de page ----------------------------------------------------------------------- */

.pied {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 16px; padding-top: 28px; border-top: 1px solid var(--filet);
}
.pied .logo { display: block; width: 150px; height: auto; }
.pied ul { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0; padding: 0; list-style: none; }
.pied a { color: var(--discret); gap: 5px; }

/* --- Téléphone -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .page { padding: 24px 16px 32px; gap: 22px; }
  main { gap: 22px; }
  .entete .logo { width: 170px; }
  h1 { font-size: 30px; }
  .introduction { font-size: 16px; }
  .bandeau { flex-direction: column; align-items: flex-start; padding: 18px; }
  .bandeau-phrase { font-size: 19px; }
  .bandeau-heure { text-align: left; }
  .service { padding: 16px; }
  .service-tete { align-items: flex-start; }
  .service-nom { font-size: 17px; }

  .barre { grid-template-columns: repeat(30, 1fr); }
  .jour.ancien { display: none; }
  .b-g .bulle, .b-c .bulle, .b-d .bulle { left: auto; right: auto; transform: none; }
  .bc-g .bulle { left: -4px; }
  .bc-c .bulle { left: 50%; transform: translateX(-50%); }
  .bc-d .bulle { right: -4px; }
  .large { display: none; }
  .etroit { display: inline; }
  /* Axe sur deux lignes : les bornes, puis la période et la mesure. */
  .axe { display: grid; grid-template-columns: 1fr auto; }
  .axe-bord { grid-row: 1; }
  .axe-fin { text-align: right; }
  .axe-periode { grid-row: 2; }
  .axe-mesure { grid-row: 2; text-align: right; }

  .incident { flex-direction: column; gap: 4px; padding: 16px; }
  .pied { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .jour, .legende i, .point { forced-color-adjust: none; }
}
