/* ============================================================
   sosnav.css — menu principal (variante « 1a » : barre flottante).
   Source unique du style ; le balisage vit dans partials/menu.html,
   recopié dans chaque page par `npm run build` (scripts/build-menu.js).
   Comportement (burger, Échap) : js/sosnav.js.
   Thème : clair par défaut, sombre via [data-theme="dark"] posé sur
   <html> par l'anti-flash (suit prefers-color-scheme).
   ============================================================ */

.sosnav {
  --sn-bar: #fff;
  --sn-ink: #0f1a30;
  --sn-link: #33405c;
  --sn-soft: #4a5872;
  --sn-blue: #1e57d2;
  /* Corail d'action : assez foncé pour le texte blanc (contraste AA),
     comme --action sur le reste du site. */
  --sn-coral: #d6361a;
  --sn-coral-hover: #b92d13;
  --sn-tint: #eaf0fb;
  --sn-chevron: #9aa6c2;
  --sn-line: rgba(15, 26, 48, 0.08);
  --sn-shadow: 0 1px 2px rgba(11, 21, 51, 0.06), 0 8px 24px rgba(11, 21, 51, 0.06);

  /* Ne suit plus le défilement (2026-10-10) : en sticky, le contenu
     passait dans la bande transparente autour de la barre flottante.
     `relative` reste nécessaire pour que le z-index s'applique. */
  position: relative;
  /* Au-dessus des volets Leaflet (≤ 1000), sous la barre basse (9000)
     et les modales. */
  z-index: 1200;
  padding: 16px clamp(12px, 3vw, 32px);
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[data-theme="dark"] .sosnav {
  --sn-bar: #141d33;
  --sn-ink: #e9eefb;
  --sn-link: rgba(233, 238, 251, 0.80);
  --sn-soft: rgba(233, 238, 251, 0.60);
  --sn-blue: #6ea8ff;
  --sn-tint: rgba(110, 168, 255, 0.14);
  --sn-chevron: rgba(233, 238, 251, 0.40);
  --sn-line: rgba(255, 255, 255, 0.10);
  --sn-shadow: 0 1px 2px rgba(0, 0, 0, 0.30), 0 10px 28px rgba(0, 0, 0, 0.38);
}
.sosnav * { box-sizing: border-box; }
.sosnav a { text-decoration: none; }
.sosnav ul { margin: 0; padding: 0; list-style: none; }

/* Lien d'évitement : hors champ, il n'apparaît qu'au focus clavier.
   La cible #contenu suit le menu dans le partiel (vide, focusable). */
.sosnav__skip {
  position: absolute;
  top: 8px;
  left: 12px;
  z-index: 2;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--sn-ink);
  color: var(--sn-bar);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}
/* Masquage visuel (pas display:none : il doit rester atteignable au Tab).
   Un simple décalage vers le haut ne suffit pas : le bandeau du haut
   pousse le menu vers le bas et le lien réapparaissait par-dessus. */
.sosnav__skip:not(:focus) {
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
}
.sosnav__skip:focus { outline: 3px solid var(--sn-blue); outline-offset: 2px; }
.sosnav__cible { outline: none; scroll-margin-top: 96px; }

.sosnav__bar {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--sn-bar);
  border-radius: 20px;
  padding: 10px 10px 10px 18px;
  box-shadow: var(--sn-shadow);
}

.sosnav__brand { display: flex; align-items: center; gap: 10px; flex: none; color: var(--sn-ink); }
/* !important : responsive.css force `height: auto !important` sur les
   images sous 900px, ce qui rendait le logo à sa taille d'origine. */
.sosnav .sosnav__brand img { height: 48px !important; width: auto !important; max-width: none !important; display: block; }
[data-theme="dark"] .sosnav__brand img { filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, 0.55)); }
.sosnav__name { display: flex; flex-direction: column; gap: 2px; line-height: 1.1; }
.sosnav__name b { font-size: 16px; font-weight: 800; letter-spacing: 0.01em; text-transform: uppercase; }
.sosnav__name small { font-size: 12px; font-weight: 500; color: var(--sn-soft); }

.sosnav__links { flex: 1; display: flex; justify-content: center; gap: 2px; }
.sosnav__links a {
  position: relative;
  display: block;
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--sn-link);
  white-space: nowrap;
  transition: color 0.2s;
}
.sosnav__links a::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--sn-blue);
  opacity: 0;
  transition: opacity 0.2s;
}
.sosnav__links a:hover,
.sosnav__links a[aria-current="page"] { color: var(--sn-blue); }
.sosnav__links a[aria-current="page"]::after { opacity: 1; }

/* Bouton Urgences : ouvre la modale des numéros (emergency.js écoute
   [data-urgences]). */
.sosnav__sos {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  background: var(--sn-coral);
  color: #fff;
  font: 700 15px/1 'Hanken Grotesk', system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.2s;
}
.sosnav__sos:hover { background: var(--sn-coral-hover); }
.sosnav__sos i {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3);
  animation: sosnavPulse 2.4s ease-out infinite;
}
@keyframes sosnavPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.sosnav__burger {
  display: none;
  flex: none;
  width: 44px; height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--sn-tint);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  -webkit-tap-highlight-color: transparent;
}
.sosnav__burger span { display: block; width: 18px; height: 2px; background: var(--sn-ink); border-radius: 2px; transition: transform 0.25s; }
.sosnav.is-open .sosnav__burger span:first-child { transform: translateY(3.5px) rotate(45deg); }
.sosnav.is-open .sosnav__burger span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

.sosnav__panel { display: none; }

.sosnav a:focus-visible,
.sosnav button:focus-visible { outline: 2px solid var(--sn-blue); outline-offset: 2px; border-radius: 10px; }

/* Entre 1101 et 1280px la barre est juste : on retire le sous-titre
   et on resserre plutôt que de laisser déborder. */
@media (max-width: 1280px) {
  .sosnav__bar { gap: 16px; }
  .sosnav__name small { display: none; }
  .sosnav__links a { padding: 10px 9px; }
  .sosnav__links a::after { left: 9px; right: 9px; }
  .sosnav__sos { padding: 0 16px; }
}

@media (max-width: 1100px) {
  .sosnav { padding: 12px; }
  .sosnav__bar { gap: 10px; padding: 8px 8px 8px 14px; border-radius: 18px; }
  .sosnav__links { display: none; }
  .sosnav__brand { flex: 1; min-width: 0; }
  .sosnav .sosnav__brand img { height: 38px !important; }
  .sosnav__name b { font-size: 15px; }
  .sosnav__sos { height: 44px; padding: 0 14px; border-radius: 12px; font-size: 14px; gap: 6px; }
  .sosnav__sos i { width: 6px; height: 6px; box-shadow: none; animation: none; }
  .sosnav__burger { display: flex; }

  .sosnav.is-open .sosnav__panel { display: block; }
  .sosnav__panel {
    max-width: 1280px;
    margin: 8px auto 0;
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--sn-bar);
    border-radius: 18px;
    padding: 8px;
    box-shadow: 0 8px 24px rgba(11, 21, 51, 0.08);
  }
  [data-theme="dark"] .sosnav__panel { box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38); }
  .sosnav__panel ul { display: flex; flex-direction: column; }
  .sosnav__panel a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
    color: var(--sn-link);
  }
  .sosnav__panel a::after {
    content: "";
    width: 7px; height: 7px;
    border-top: 2px solid var(--sn-chevron);
    border-right: 2px solid var(--sn-chevron);
    transform: rotate(45deg);
  }
  .sosnav__panel a[aria-current="page"] { color: var(--sn-blue); background: var(--sn-tint); }
  /* Pages de service : second groupe, volontairement en retrait. */
  .sosnav__panel .sosnav__sec { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--sn-line); }
  .sosnav__panel .sosnav__sec a { min-height: 46px; font-size: 15px; color: var(--sn-soft); }
}

@media (max-width: 380px) {
  .sosnav__name b { font-size: 13px; }
  .sosnav__sos { padding: 0 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .sosnav__sos i { animation: none; }
  .sosnav__burger span, .sosnav__links a, .sosnav__links a::after { transition: none; }
}
