@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../fonts/source-sans-3-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../fonts/source-sans-3-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* manifsendirect.fr : carte en direct. Mobile d'abord. */

:root {
  --font: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;

  --l0: #3BA55C;
  --l1: #FFE600;
  --l2: #FF8C00;
  --l3: #E3000F;
  --on-l0: #1E1E1E;
  --on-l1: #1E1E1E;
  --on-l2: #1E1E1E;
  --on-l3: #FFFFFF;
  /* À venir : bleu dédié, distinct des couleurs d'intensité (jaune, orange, rouge) */
  --up: #2F6FDB;
  --on-up: #FFFFFF;

  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F3F5F8;
  --line: #DCE1E8;
  --ink: #1E1E1E;
  --muted: #55606E;
  --link: #0B5CAD;
  --focus: #0B5CAD;
  --danger: #B3000C;
  --mk-stroke: #1E1E1E;
  --ring: #1E1E1E;
  --scroll: #B9C1CC;
  --sel-bg: #FFE600;
  --sel-fg: #1E1E1E;

  --fs-xs: 0.8rem;
  --fs-s: 0.9375rem;
  --fs-m: 1rem;
  --fs-l: 1.25rem;
  --fs-xl: 1.5625rem;
  --fs-brand: 1.375rem;

  --top-pad: max(12px, env(safe-area-inset-left, 0px));
  --pad: 12px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
  --logo-light: block;
  --logo-dark: none;
  --map-water: #BFD3E6;
  --city-label: #3A4250;
  --water-text: #4F6F94;
  --halo: #F8F9FB;
  --top-bg: #FFFFFF;
  --chip-bg: #FFFFFF;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --dark: 1; }
}
:root[data-theme="dark"] { --dark: 1; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #001D3B; --surface: #062849; --surface-2: #0B3157; --line: #1A4470;
    --ink: #E8EEF6; --muted: #A9BCD3; --link: #8CC4FF; --focus: #FFE600;
    --danger: #FF8F98; --mk-stroke: #00142A; --ring: #FFFFFF; --scroll: #2F5E8E;
    --top-bg: #001D3B; --chip-bg: #0B3157;
    color-scheme: dark; --logo-light: none; --logo-dark: block; --map-water: #00142A; --city-label: #A9BCD3; --water-text: #6E8FB5; --halo: #04223F;
  }
}
:root[data-theme="dark"] {
  --bg: #001D3B; --surface: #062849; --surface-2: #0B3157; --line: #1A4470;
    --ink: #E8EEF6; --muted: #A9BCD3; --link: #8CC4FF; --focus: #FFE600;
    --danger: #FF8F98; --mk-stroke: #00142A; --ring: #FFFFFF; --scroll: #2F5E8E;
    --top-bg: #001D3B; --chip-bg: #0B3157;
  color-scheme: dark; --logo-light: none; --logo-dark: block; --map-water: #00142A; --city-label: #A9BCD3; --water-text: #6E8FB5; --halo: #04223F;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }
body {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs-m)/1.4 var(--font);
  -webkit-text-size-adjust: 100%;
  caret-color: var(--focus);
  padding-top: env(safe-area-inset-top, 0px);
}

::selection { background: var(--sel-bg); color: var(--sel-fg); }

* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 2px; }
::-webkit-scrollbar-track { background: transparent; }

a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--ink); color: var(--bg);
  padding: 8px 12px; border-radius: 2px;
}
.skip:focus { top: 8px; }

/* Niveaux */
.sq { display: inline-block; width: 12px; height: 12px; border-radius: 2px; border: 1px solid var(--mk-stroke); flex: none; }
[data-level="0"] > .sq, .sq[data-level="0"] { background: var(--l0); }
.sq[data-level="1"] { background: var(--l1); }
.sq[data-level="2"] { background: var(--l2); }
.sq[data-level="3"] { background: var(--l3); }
.sq[data-up="1"] { background: var(--up); }

/* ---------- En-tête ---------- */
.top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 12px;
  padding: 8px max(12px, env(safe-area-inset-right, 0px)) 8px var(--top-pad);
  background: var(--top-bg);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.brandmark { margin: 0; line-height: 0; }
.logo-link { display: block; }
.logo { flex: none; }
.logo-light { display: var(--logo-light); }
.logo-dark { display: var(--logo-dark); }
.logo img { display: block; height: 36px; width: auto; }
@media (min-width: 900px) {
  .brand { flex-direction: row; align-items: center; gap: 14px; }
  .logo img { height: 48px; }
}
.edition { font-weight: 600; font-size: var(--fs-s); line-height: 1.2; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tools { display: flex; gap: 4px; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: 2px; color: var(--ink);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); }

.level { grid-column: 1; grid-row: 2; display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--muted); }
.status { grid-column: 2; grid-row: 2; font-size: var(--fs-xs); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; display: flex; gap: 8px; align-items: baseline; justify-content: flex-end; }
.status[data-state="error"] .status-text, .status[data-state="offline"] .status-text { color: var(--danger); font-weight: 600; }
.stats { grid-column: 1 / -1; grid-row: 3; display: flex; flex-wrap: wrap; gap: 0 14px; font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.stats b { color: var(--ink); font-weight: 700; }

.pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 3px 10px 3px 8px;
  border-radius: 2px; border: 1px solid var(--mk-stroke); font-weight: 700; font-size: var(--fs-s); line-height: 1.1;
  background: var(--surface-2); color: var(--ink);
}
.pill[data-level="1"] { background: var(--l1); color: var(--on-l1); }
.pill[data-level="2"] { background: var(--l2); color: var(--on-l2); }
.pill[data-level="3"] { background: var(--l3); color: var(--on-l3); }
.meter { display: inline-flex; gap: 2px; }
.meter i { width: 6px; height: 12px; border: 1px solid currentColor; border-radius: 1px; }
.meter i.on { background: currentColor; }

.link-btn { background: none; border: 0; padding: 4px 0; color: var(--link); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
.link-btn:hover { text-decoration-thickness: 2px; }

.demo {
  margin: 0; padding: 5px var(--top-pad); background: var(--l1); color: #1E1E1E;
  font-size: var(--fs-xs); font-weight: 600; text-align: center; border-bottom: 1px solid #1E1E1E33;
}

/* ---------- Mise en page ---------- */
.layout { flex: 1; min-height: 0; position: relative; display: grid; grid-template-columns: 400px minmax(0, 1fr); }
.map-wrap { position: relative; min-height: 0; background: var(--map-water); overflow: hidden; order: 2; isolation: isolate; }
#map { position: absolute; inset: 0; }

.panel {
  order: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface);
  padding: 12px var(--pad) env(safe-area-inset-bottom, 0px); border-right: 1px solid var(--line);
}
.handle {
  display: none; flex: none; height: 28px; width: 100%; background: transparent; border: 0; place-items: center; touch-action: none; cursor: grab;
}
.handle span { width: 40px; height: 4px; border-radius: 2px; background: var(--scroll); }
.handle:hover span { background: var(--muted); }

.controls { flex: none; padding: 0 0 12px; display: grid; gap: 8px; }
.search { position: relative; display: block; }
.search svg { position: absolute; left: 10px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 40px; padding: 0 10px 0 34px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--muted); border-radius: 2px; caret-color: var(--focus);
}
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 9px;
  font-size: var(--fs-s); font-weight: 600; background: var(--chip-bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 2px;
}
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip .n { font-weight: 400; font-variant-numeric: tabular-nums; opacity: 0.85; }
.chip:disabled { opacity: 0.55; cursor: default; }

.filterbar { display: flex; }
.city-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 8px 0 10px;
  background: var(--surface-2); border: 1px solid var(--ink); border-radius: 2px; font-weight: 700; font-size: var(--fs-s);
}
.city-chip svg { flex: none; }

.scroll { flex: 1; min-height: 0; margin-inline: calc(var(--pad) * -1); padding-inline: var(--pad); overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--line); }
.view { padding-bottom: 12px; }

.list-title { padding: 12px 0 4px; font-size: var(--fs-l); line-height: 1.2; font-weight: 700; font-variant-numeric: tabular-nums; }
.list-title:focus { outline: none; }
.list-sub { font-weight: 400; color: var(--muted); font-size: var(--fs-xs); }

/* Lignes de la liste (reprise de la maquette vigilance) */
.row { position: relative; display: grid; grid-template-columns: 12px 1fr; gap: 10px; margin-inline: calc(var(--pad) * -1); padding: 10px var(--pad); border-bottom: 1px solid var(--line); }
.row:hover { background: var(--surface-2); }
.row[aria-current="true"] { background: var(--surface-2); }
.row > .sq { margin-top: 5px; }
.row-main { min-width: 0; }
.row-open { all: unset; display: block; cursor: pointer; font-size: var(--fs-m); line-height: 1.3; }
.row-open::after { content: ""; position: absolute; inset: 0; }
.row-open:focus-visible { outline: none; }
.row:has(.row-open:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.row-open b { font-weight: 700; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: 2px; font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.meta a { position: relative; z-index: 1; }
.tag { display: inline-flex; align-items: center; gap: 3px; color: var(--ink); font-weight: 600; }
.row[data-fresh="recent"] > .sq { opacity: 0.85; }
.row[data-fresh="stale"] > .sq { opacity: 0.6; filter: saturate(0.8); }
.row[data-fresh="fading"] > .sq { opacity: 0.35; filter: saturate(0.3); }
.row[data-fresh="stale"] .row-open, .row[data-fresh="fading"] .row-open { color: var(--muted); }
.row[data-fresh="fading"] .tag { color: var(--muted); }
.tag svg { width: 14px; height: 14px; color: var(--ink); --mk-stroke: currentColor; }

.empty { padding: 18px 0; color: var(--muted); display: grid; gap: 8px; justify-items: start; max-width: 46ch; }
.empty b { color: var(--ink); }

.foot { padding: 12px 0 4px; font-size: var(--fs-xs); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; }
.foot .copy { color: var(--muted); }
.foot .copy a { color: inherit; }

/* Publicité */
.bx { padding: 12px 0; text-align: center; }
.bx-off .bx { display: none !important; }
.bx-row { margin-inline: calc(var(--pad) * -1); padding-inline: var(--pad); border-bottom: 1px solid var(--line); }
.bx-row { display: block; }
.bx-label { display: block; font-size: 0.75rem; color: var(--muted); margin-bottom: 2px; }
.bx-slot { margin: 0 auto; width: 100%; max-width: 320px; min-height: 50px; background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.bx-desk { display: none; border-bottom: 0; }
.bx-none { display: none !important; }
.bx-row.bx-detail { margin: 18px 0 4px; padding-inline: 0; border-bottom: 0; }
.bx-desk.bx-detail { margin: 18px 0 4px; padding: 0; }
.bx-slot { position: relative; overflow: hidden; }
.bx-frame { position: relative; }
.bx-frame iframe { display: block; border: 0; width: 100%; height: 100%; background: transparent; }
.bx-desk .bx-slot { max-width: 300px; min-height: 250px; }

/* Fiche événement */
.detail { padding: 12px 0 16px; display: grid; gap: 12px; }
.back {
  display: inline-flex; align-items: center; gap: 4px; justify-self: start; min-height: 40px; padding: 0 10px 0 4px;
  background: none; border: 0; color: var(--link); font-weight: 600;
}
.back:hover { text-decoration: underline; }
.detail h2, .about h2 { font-size: var(--fs-xl); line-height: 1.15; font-weight: 700; text-wrap: balance; }
.detail h2:focus, .about h2:focus { outline: none; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 9px; font-size: var(--fs-s); font-weight: 600;
  border: 1px solid var(--ink); border-radius: 2px; background: var(--surface);
}
.badge.lvl[data-level="1"] { background: var(--l1); color: var(--on-l1); }
.badge.lvl[data-level="2"] { background: var(--l2); color: var(--on-l2); }
.badge.lvl[data-level="3"] { background: var(--l3); color: var(--on-l3); }
.badge.lvl[data-level="0"] { background: var(--l0); color: var(--on-l0); }
.badge.lvl { border-color: var(--mk-stroke); }
.detail dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-variant-numeric: tabular-nums; }
.detail dt { color: var(--muted); font-size: var(--fs-s); }
.detail dd { min-width: 0; }
.detail .summary { max-width: 65ch; font-size: var(--fs-m); }
.sources h3 { font-size: var(--fs-s); margin-bottom: 4px; }
.sources li { padding: 8px 0; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.sources .src-meta { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.militante { display: inline-block; font-size: var(--fs-xs); font-weight: 600; color: var(--ink); border: 1px solid var(--ink); border-radius: 2px; padding: 0 5px; margin-left: 6px; }
.btn {
  justify-self: start; min-height: 40px; padding: 0 14px; border: 1px solid var(--ink); border-radius: 2px;
  background: var(--ink); color: var(--surface); font-weight: 600;
}
.btn:hover { background: var(--surface); color: var(--ink); }
.btn.ghost { background: var(--surface); color: var(--ink); }
.btn.ghost:hover { background: var(--surface-2); }

/* À propos et légende */
.about { padding: 12px 0 24px; display: grid; gap: 10px; align-content: start; }
.about h3 { font-size: var(--fs-l); margin-top: 10px; }
.about p, .about li { max-width: 65ch; }
.about ul.plain { list-style: disc; padding-left: 18px; display: grid; gap: 4px; }
.legend-list { display: grid; gap: 6px; margin: 4px 0 8px; }
.legend-list li { display: grid; grid-template-columns: 12px 1fr; gap: 10px; align-items: start; }
.legend-list .sq { margin-top: 5px; }
.legend-shapes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 4px 12px; margin: 4px 0 8px; }
.legend-shapes li { display: flex; align-items: center; gap: 6px; }
.how .sub, .about .sub { font-size: var(--fs-s); margin: 10px 0 4px; }
.how p, .about #aboutHow p { margin: 4px 0; max-width: 62ch; }

/* ---------- Carte ---------- */
.map-btn {
  position: absolute; z-index: 3; top: 8px; left: 8px; min-height: 36px; padding: 0 12px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--ink); border-radius: 2px; font-weight: 600; font-size: var(--fs-s);
}
.map-btn:hover { background: var(--surface-2); }

.how {
  position: absolute; z-index: 3; left: 8px; bottom: 26px; width: min(360px, calc(100% - 16px));
  background: var(--surface); border: 1px solid var(--ink); border-radius: 2px; font-size: var(--fs-s);
}
.how summary { list-style: none; cursor: pointer; padding: 0 12px; min-height: 36px; display: flex; align-items: center; font-weight: 600; }
.how summary::-webkit-details-marker { display: none; }
.how summary::after { content: ""; margin-left: 8px; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; rotate: 45deg; translate: 0 -2px; }
.how[open] summary::after { rotate: -135deg; translate: 0 2px; }
.how[open] summary { border-bottom: 1px solid var(--line); }
.how-body { padding: 4px 12px 10px; max-height: min(52vh, 420px); overflow-y: auto; }
.how:not([open]) { width: auto; }

.map-msg {
  position: absolute; z-index: 4; inset: 50% 16px auto; translate: 0 -50%; text-align: center; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--ink); border-radius: 2px; max-width: 420px; margin-inline: auto;
}

/* Aide du bouton trafic : en haut de la carte, hors de portée de la feuille du bas sur mobile */
.tr-hint {
  position: absolute; z-index: 5; top: 8px; left: 50%; translate: -50% 0; width: max-content; max-width: calc(100% - 140px); margin: 0;
  padding: 8px 14px; background: var(--ink); color: var(--surface); border-radius: 2px; font-size: var(--fs-s); font-weight: 600; text-align: center;
}
.tr-hint[hidden] { display: none; }

.maplibregl-map { font-family: var(--font); background: var(--map-water); }
.maplibregl-ctrl-attrib {
  font-size: 0.7rem; background: color-mix(in srgb, var(--surface) 82%, transparent) !important; color: var(--muted);
}
.maplibregl-ctrl-attrib a { color: var(--muted) !important; }
.maplibregl-ctrl-group { border-radius: 2px !important; box-shadow: none !important; border: 1px solid var(--ink); background: var(--surface); }
.maplibregl-ctrl-group button { width: 36px; height: 36px; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line); }
:root[data-theme="dark"] .maplibregl-ctrl-icon { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .maplibregl-ctrl-icon { filter: invert(1); } }

/* Marqueurs */
.mk {
  position: absolute; display: grid; place-items: center; min-width: 36px; height: 36px; padding: 0;
  background: none; border: 0; border-radius: 4px;
}
.mk-body { display: grid; place-items: center; transition: transform 0.15s var(--ease); }
.mk:hover .mk-body { transform: scale(1.1); }
.mk:focus-visible { outline: none; }
.mk:focus-visible .mk-body, .mk[aria-current="true"] .mk-body { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.mk-city .mk-body {
  min-width: 26px; height: 26px; padding: 0 6px; border-radius: 2px; border: 1px solid var(--mk-stroke);
  font-weight: 700; font-size: var(--fs-s); line-height: 1; font-variant-numeric: tabular-nums;
}
.mk-city[data-level="0"] .mk-body { background: var(--l0); color: var(--on-l0); }
.mk-city[data-level="1"] .mk-body { background: var(--l1); color: var(--on-l1); }
.mk-city[data-level="2"] .mk-body { background: var(--l2); color: var(--on-l2); }
.mk-city[data-level="3"] .mk-body { background: var(--l3); color: var(--on-l3); }
.mk-city[data-up="1"] .mk-body { background: var(--up); color: var(--on-up); border-style: dashed; border-color: var(--on-up); }
.mk-ev .mk-body { width: 26px; height: 26px; }
.mk-ev svg { width: 24px; height: 24px; }
.mk-body { opacity: calc(var(--fo, 1) * var(--dim, 1)); }
.mk[data-fresh="recent"] { --fo: 0.85; }
.mk[data-fresh="stale"] { --fo: 0.6; }
.mk[data-fresh="fading"] { --fo: 0.35; }
.mk[data-fresh="stale"] .mk-body { filter: saturate(0.8); }
.mk[data-fresh="fading"] .mk-body { filter: saturate(0.3); }
.mk[data-dim] { --dim: 0.6; }

/* L'anneau pulse une seule fois à l'arrivée */
.mk.pulse::after {
  content: ""; position: absolute; inset: 5px; border: 2px solid var(--ring); border-radius: 4px; pointer-events: none;
  animation: ring 1.6s var(--ease) 1 both;
}
@keyframes ring {
  from { transform: scale(0.95); opacity: 0.9; }
  to { transform: scale(2); opacity: 0; }
}

/* ---------- Ordinateur ---------- */
@media (min-width: 900px) {
  .top {
    grid-template-columns: auto auto 1fr auto auto;
    grid-template-areas: "brand level stats status tools";
    gap: 8px 20px; padding-block: 8px;
  }
  .brand { grid-area: brand; }
  .level { grid-area: level; }
  .stats { grid-area: stats; grid-column: auto; font-size: var(--fs-s); gap: 0 18px; }
  .status { grid-area: status; grid-column: auto; grid-row: auto; font-size: var(--fs-s); }
  .tools { grid-area: tools; }
  .edition { max-width: none; }
  .bx-desk { display: block; }
  .bx-row { display: none; }
  .how { bottom: 26px; }
}

@media (max-width: 899px) {
  .top { padding-bottom: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .mk.pulse::after { animation: none; transform: scale(1.5); opacity: 0.55; }
}


.pill { white-space: nowrap; }

.om { position: absolute; z-index: 3; top: 52px; left: 8px; }
.om select {
  min-height: 36px; padding: 0 28px 0 10px; font: inherit; font-size: var(--fs-s); font-weight: 600; color: var(--ink);
  background: var(--surface); border: 1px solid var(--ink); border-radius: 2px;
}
.om select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (min-width: 900px) { .panel { padding-top: 12px; } }

@media (max-width: 599px) {
  .mk { min-width: 30px; height: 30px; }
  .mk-city .mk-body { min-width: 22px; height: 22px; padding: 0 4px; font-size: 0.75rem; }
  .mk-ev .mk-body { width: 22px; height: 22px; }
  .mk-ev svg { width: 20px; height: 20px; }
}

/* Volet : rangée d'outils, intertitres */
.tools-row { display: flex; gap: 6px; align-items: center; min-width: 0; }
.tools-row .chips { flex: 1; min-width: 0; }
.chip.icon { padding: 0; width: 36px; justify-content: center; }
.chips { scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.sep { list-style: none; padding: 14px 0 4px; }
.sep h3 { font-size: var(--fs-s); font-weight: 700; color: var(--muted); }


/* Fiabilité */
.conf { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); }
.conf svg { flex: none; color: var(--ink); }
.conf[data-conf-level="confirme"], .conf[data-conf-level="officielle"] { color: var(--ink); font-weight: 600; }
.reliab h3 { font-size: var(--fs-s); margin-bottom: 4px; }
.reliab p { max-width: 65ch; }

/* Phases */
.row[data-fresh="ghost"] > .sq { opacity: 0.45; filter: saturate(0.4); }
.row[data-fresh="ghost"] .row-open, .row[data-fresh="ghost"] .tag { color: var(--muted); }
.mk[data-fresh="ghost"] { --fo: 0.45; }
.dur { color: var(--muted); font-variant-numeric: tabular-nums; }
.dur[data-ph="termine"], .dur[data-ph="probablement_termine"] { color: var(--ink); font-weight: 600; }
.row[data-fresh="ghost"] .dur { color: var(--muted); }
.hours h3 { font-size: var(--fs-s); margin-bottom: 4px; }

/* Mode permanent : jour calme, à venir par jour, bandeau */
.dateline { font-weight: 400; margin-left: 6px; }
.special { margin: 0; padding: 5px var(--top-pad); background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: var(--fs-xs); font-weight: 600; text-align: center; }
.calm { list-style: none; padding: 14px 0 6px; max-width: 46ch; color: var(--muted); }
.calm b { color: var(--ink); }
.day { list-style: none; border-bottom: 1px solid var(--line); margin-inline: calc(var(--pad) * -1); padding-inline: var(--pad); }
.day-sum { display: grid; gap: 1px; padding: 9px 0; }
summary.day-sum { cursor: pointer; list-style: none; position: relative; padding-right: 24px; }
summary.day-sum::-webkit-details-marker { display: none; }
summary.day-sum::after { content: ""; position: absolute; right: 6px; top: 16px; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; rotate: 45deg; }
details[open] > summary.day-sum::after { rotate: -135deg; top: 19px; }
summary.day-sum:hover b { text-decoration: underline; }
.day-sum span { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.day-sum .day-cities { color: var(--ink); }
.day .rows.sub .row:last-child { border-bottom: 0; }
@media (max-width: 599px) { .dateline { display: none; } }

.sep-n { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 4px; }

/* Libellés de la vue nationale */
.nat-label { pointer-events: none; white-space: nowrap; font-weight: 600; font-size: 0.8rem; line-height: 1; transition: opacity 0.35s; text-shadow: 0 0 3px var(--halo), 0 0 3px var(--halo); }
.nat-label.country { color: var(--muted); font-size: 0.9rem; }
.nat-label.country.fr { color: var(--ink); font-size: 1.1rem; opacity: 0.7; }
.nat-label.water { color: var(--water-text); font-style: italic; font-weight: 400; }
.nat-label.city { color: var(--city-label, var(--ink)); }
.nat-label.off, .nat-label.hit { opacity: 0 !important; }
.more { list-style: none; padding: 12px 0; }
@media (max-width: 599px) { .nat-label.city { display: none; } }


/* Sombre : boutons de zoom */
:root[data-theme="dark"] .maplibregl-ctrl-group { background: var(--surface-2); border-color: var(--line); }
:root[data-theme="dark"] .maplibregl-ctrl-icon { filter: invert(1) brightness(1.14); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .maplibregl-ctrl-group { background: var(--surface-2); border-color: var(--line); }
  :root:not([data-theme="light"]) .maplibregl-ctrl-icon { filter: invert(1) brightness(1.14); }
}
@media (max-width: 599px) { .status-text .lag, .sum-upd .lag { display: none; } }
.status-text .freq, .sum-upd .freq { color: var(--muted); font-weight: 400; }

#ssr-list .row-open { cursor: default; }
#ssr-list .row-open::after { content: none; }
.city-chip { text-decoration: none; color: var(--ink); }
/* Liens vers les pages ville : repliés par défaut (utiles surtout aux moteurs de recherche) */
.seo-cities { padding: 4px 0; }
.seo-cities summary { display: flex; align-items: center; gap: 6px; min-height: 36px; cursor: pointer; list-style: none; color: var(--muted); }
.seo-cities summary::-webkit-details-marker { display: none; }
.seo-cities summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); margin-left: 2px; transition: transform 150ms ease-out; }
.seo-cities details[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.seo-cities summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.seo-cities h2 { display: inline; font-size: var(--fs-xs); font-weight: 600; margin: 0; color: inherit; }
.seo-cities-list { margin: 4px 0 0; font-size: var(--fs-xs); line-height: 1.7; }
.seo-cities-list a { margin-right: 12px; white-space: nowrap; color: var(--muted); }
@media (pointer: coarse) { .seo-cities summary { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { .seo-cities summary::after { transition: none; } }

/* Pastille regroupée : un peu plus grande */
.mk-city.mk-cluster .mk-body { min-width: 32px; height: 32px; font-size: 1.05rem; }
@media (max-width: 599px) { .mk-city.mk-cluster .mk-body { min-width: 28px; height: 28px; font-size: 0.9rem; } }


/* =====================================================================
   Adaptation par contexte : en-tête compact, feuille du bas, filtres
   ===================================================================== */

.level-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (min-width: 900px) { .level-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; } }
.lv-short { display: none; }
.fr-btn svg, .leg-btn { display: none; }
.fr-btn .lbl { display: inline; }

/* Ligne de résumé du volet (petit écran) */
.sumline {
  display: none; flex: none; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; padding: 0 0 8px;
  font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums;
}
.sumline b { color: var(--ink); font-weight: 700; }
.sum-upd[data-state="error"], .sum-upd[data-state="offline"] { color: var(--danger); font-weight: 600; }

/* Recherche, bouton Filtres, puces actives */
.ctl-row { display: flex; gap: 8px; align-items: stretch; }
.ctl-row .search { flex: 1; min-width: 0; }
.filters-btn {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
  font-size: var(--fs-s); font-weight: 600; background: var(--chip-bg); color: var(--ink); border: 1px solid var(--ink); border-radius: 2px;
}
.filters-btn:hover { background: var(--surface-2); }
.filters-btn[aria-expanded="true"] { background: var(--ink); color: var(--surface); }
.fbadge {
  min-width: 20px; height: 20px; padding: 0 5px; display: inline-grid; place-items: center; background: var(--ink); color: var(--surface);
  border-radius: 2px; font-size: 0.75rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.filters-btn[aria-expanded="true"] .fbadge { background: var(--surface); color: var(--ink); }
.active-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.active-dyn { display: contents; }
.chip svg:last-child:not(:first-child) { flex: none; }

/* Menu de filtres : feuille sur petit écran, menu déroulant sur ordinateur */
.scrim { position: fixed; inset: 0; z-index: 39; background: rgb(0 0 0 / 0.45); }
.filters-menu {
  position: fixed; z-index: 40; background: var(--surface); color: var(--ink); display: grid; gap: 12px;
  left: 0; right: 0; bottom: 0; max-height: 86dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 8px var(--pad) calc(16px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--ink);
}
@media (min-width: 900px) {
  .filters-menu { right: auto; bottom: auto; max-height: min(82dvh, 640px); padding: 8px 12px 14px; border: 1px solid var(--ink); }
  .fm-check { min-height: 34px; }
  .fm-switch { min-height: 38px; }
  .scrim { display: none; }
}
.fm-head { display: flex; align-items: center; justify-content: space-between; }
.fm-head h2 { font-size: var(--fs-l); line-height: 1.2; }
.fm-group { margin: 0; padding: 0; border: 0; min-width: 0; }
.fm-group legend { padding: 0; font-weight: 700; font-size: var(--fs-s); }
.fm-hint { color: var(--muted); font-size: var(--fs-xs); margin: 2px 0 4px; }
.fm-check { display: grid; grid-template-columns: 22px 20px 1fr auto; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.fm-check .n, .fm-switch .n { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.fm-check input, .fm-switch input { appearance: none; margin: 0; flex: none; cursor: pointer; }
.fm-check input { width: 22px; height: 22px; border: 1.5px solid var(--ink); border-radius: 2px; background: var(--surface); display: grid; place-content: center; }
.fm-check input:checked { background: var(--ink); }
.fm-check input:checked::after { content: ""; width: 13px; height: 10px; background: var(--surface); clip-path: polygon(14% 44%, 0 62%, 40% 100%, 100% 16%, 82% 0, 40% 62%); }
.fm-check svg { color: var(--ink); }
.fm-switches { display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 6px; }
.fm-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; cursor: pointer; }
.fm-switch input { width: 44px; height: 26px; border: 1.5px solid var(--ink); border-radius: 2px; background: var(--surface-2); position: relative; }
.fm-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; background: var(--ink); transition: translate 0.15s var(--ease); }
.fm-switch input:checked { background: var(--ink); }
.fm-switch input:checked::after { translate: 18px 0; background: var(--surface); }
.fm-check input:focus-visible, .fm-switch input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.fm-actions { display: flex; gap: 8px; justify-content: space-between; }
.fm-actions .btn { flex: 1 1 auto; justify-self: auto; white-space: nowrap; }
.fm-actions .btn.ghost { flex: 0 0 auto; }

/* Bloc de présentation : premier élément de la liste */
.seo { position: relative; padding: 8px 0 2px; }
.seo-h1 { margin: 0; padding: 0 36px 0 0; font-size: var(--fs-l); line-height: 1.2; font-weight: 700; text-wrap: balance; }
.seo-intro {
  margin: 4px 0 0; padding-right: 36px; font-size: var(--fs-s); line-height: 1.4; color: var(--muted); max-width: 65ch;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.seo-intro.open { display: block; overflow: visible; }
.seo-more { position: absolute; right: -6px; bottom: -4px; width: 36px; height: 36px; display: grid; place-items: center; background: none; border: 0; color: var(--link); }
.seo-more svg { transition: rotate 0.15s var(--ease); }
.seo-more[aria-expanded="true"] svg { rotate: 180deg; }

/* ----- Petit écran (< 900 px) : en-tête sur une ligne ----- */
@media (max-width: 899px) {
  .top {
    grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "brand level tools";
    gap: 0 8px; align-items: center; min-height: 52px;
    padding: 4px max(8px, env(safe-area-inset-right, 0px)) 4px max(12px, env(safe-area-inset-left, 0px));
  }
  .brand { grid-area: brand; }
  .level { grid-area: level; }
  .tools { grid-area: tools; gap: 0; }
  .edition, .stats, .status, .meter, .special { display: none; }
  .logo img { height: 28px; }
  .pill { min-height: 32px; padding: 3px 10px; }
  .lv-full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lv-short { display: inline; }
  .sumline { display: flex; }
  .seo-h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .seo-intro { -webkit-line-clamp: 1; }

  /* boutons ronds de la carte, légende dans À propos */
  .fr-btn, .leg-btn {
    display: grid; place-items: center; top: 8px; right: 8px; left: auto; width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 50%;
  }
  .leg-btn { top: 60px; }
  .fr-btn svg { display: block; }
  .fr-btn .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .how { display: none; }
}
@media (max-width: 899px) and (pointer: fine) {
  .fr-btn { top: 88px; }
  .leg-btn { top: 140px; }
}

/* ----- Feuille du bas : téléphone en portrait (et tablette étroite) ----- */
@media (max-width: 899px) and (min-height: 501px), (max-width: 899px) and (orientation: portrait) {
  .layout { display: block; overflow: hidden; --sheet-y: 45%; }
  .map-wrap { position: absolute; inset: 0; }
  .panel {
    position: absolute; left: 0; right: 0; top: 0; height: 100%; z-index: 5; padding-top: 0; border-right: 0; border-top: 1px solid var(--ink);
    transform: translateY(var(--sheet-y)); transition: transform 0.2s ease-out;
  }
  .layout.dragging .panel { transition: none; will-change: transform; }
  .layout:not(.ready) .panel { transition: none; }
  .handle { display: grid; }
  .sumline { touch-action: none; }
  .layout[data-sheet="low"] .scroll, .layout[data-sheet="mid"] .scroll { overflow-y: hidden; touch-action: none; }
}

/* ----- Téléphone en paysage : côte à côte comme sur ordinateur ----- */
@media (max-width: 899px) and (orientation: landscape) and (max-height: 500px) {
  .layout { grid-template-columns: 45% minmax(0, 1fr); }
  .panel { padding-top: 6px; }
}

/* ----- Pointeur grossier : cibles de 44 px, pincer pour zoomer ----- */
@media (pointer: coarse) {
  .maplibregl-ctrl-top-right { display: none; }
  .fm-check { min-height: 48px; }
  .fm-switch { min-height: 48px; }
  .icon-btn { width: 44px; height: 44px; }
  .btn, .back, .filters-btn, .city-chip, .chip { min-height: 44px; }
  .search input { height: 44px; }
  .link-btn { min-height: 44px; display: inline-flex; align-items: center; }
  .fm-check { min-height: 48px; }
  .mk { min-width: 44px; height: 44px; }
  .seo-more { width: 44px; height: 44px; right: -10px; bottom: -8px; }
  .om select { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .panel { transition: none !important; }
}
@media (min-width: 900px) and (pointer: fine) { .fm-check { min-height: 34px; } .fm-switch { min-height: 38px; } }

/* Variante texte du bouton (anciens gabarits générés) */
.seo-more.link-btn { position: static; display: block; width: auto; height: auto; margin: 0; padding: 4px 0; text-align: left; }

/* Outre-mer : bouton rond sous « France entière », menu ancré, puce de retour */
.map-stack { position: absolute; z-index: 3; top: 8px; left: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.map-stack .map-btn { position: static; top: auto; right: auto; left: auto; }
.om-btn { display: grid; place-items: center; width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 50%; position: relative; }
.om-n {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center;
  background: var(--ink); color: var(--surface); border-radius: 9px; font-size: 0.75rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.om-btn[hidden] { display: none; }
.tr-btn { display: grid; place-items: center; width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 50%; position: relative; }
.tr-btn[hidden] { display: none; }
.tr-btn[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.tr-btn[aria-pressed="true"]:hover { background: var(--ink); }
.tr-btn[aria-pressed="true"] .car-hub { fill: var(--ink); }
.om-back {
  position: absolute; z-index: 3; top: 8px; left: 50%; translate: -50% 0; width: max-content; max-width: calc(100% - 140px); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 8px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--ink); border-radius: 2px; font-size: var(--fs-s);
}
.om-back:hover { background: var(--surface-2); }
.om-where { font-weight: 700; }
.om-act { color: var(--link); font-weight: 600; text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
.om-menu {
  position: fixed; z-index: 40; width: 240px; max-width: calc(100vw - 16px); padding: 4px; display: grid;
  background: var(--surface); color: var(--ink); border: 1px solid var(--ink);
}
.om-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 40px; padding: 0 10px; background: none; border: 0; text-align: left; font-weight: 600; }
.om-item:hover, .om-item:focus-visible { background: var(--surface-2); }
.om-item .n { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
@media (pointer: coarse) { .om-item { min-height: 48px; } }
@media (max-width: 899px) {
  .map-stack { left: auto; right: 8px; align-items: flex-end; }
}
@media (max-width: 899px) and (pointer: fine) { .map-stack { top: 88px; } }

.map-stack .om-btn { position: relative; }

/* Retard de la collecte */
.status[data-stale], .sum-upd[data-stale] { color: var(--danger); font-weight: 600; }
.clock-i { flex: none; vertical-align: -2px; margin-right: 4px; }
.stale-banner {
  display: flex; align-items: flex-start; gap: 8px; margin: 8px 0 0; padding: 8px 10px; font-size: var(--fs-s); line-height: 1.35;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 2px;
}
.stale-banner .clock-i { margin: 2px 0 0; color: var(--danger); }

/* Pages ville : dernières mobilisations des 7 jours (contenu propre à chaque ville) */
.seo-history { padding: 8px 0 4px; }
.seo-history h2 { font-size: var(--fs-s); font-weight: 700; margin: 0 0 6px; }
.seo-history .hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: var(--fs-s); }
.seo-history .hist time { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 4px; }
.seo-history .hist a { color: var(--muted); white-space: nowrap; }
.seo-history .hist-sum { margin: 0 0 8px; font-size: var(--fs-s); color: var(--muted); }
.seo-days { padding: 4px 0; }
.seo-days h2 { font-size: var(--fs-xs); font-weight: 600; margin: 0; color: var(--muted); }
