.floating-nav {
  position: fixed;
  z-index: 9999999 !important;
  top: 10rem;
  left: auto;
  padding-inline: 2rem;
  margin-top: 2rem;
}
/* @media (max-width: 42em) {
  .floating-nav-stack {
    visibility: hidden;
    transform: translateX(150%);
  }
} */
@media (min-width: 51em) {
  .floating-nav {
    position: fixed;
    top: 40% !important;
    right: 70px !important;
    left: auto !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    z-index: 2147483647 !important; /* au-dessus de tout */
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
  /* .nav-mobile {
    padding: 0;
  } */
  .logo-petit {
    display: none;
  }
}
.floating-nav-stack a,
.floating-nav button,
.floating-nav .floating-nav__burger {
  background: var(--wp--preset--color--primary);
  color: var(--wp--preset--color--base);
  flex-direction: column;
  gap: 8px;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  border: 2px solid var(--wp--preset--color--base);
  text-decoration: none;
}
.floating-nav-stack a:hover,
.floating-nav-stack button:hover {
  background-color: var(--wp--preset--color--base);
  color: var(--wp--preset--color--primary);
  border: 2px solid var(--wp--preset--color--primary);
}
.nav-toggle__open:hover span {
  border: 2px solid var(--wp--preset--color--primary);
}
.floating-nav-stack .nav-toggle__open span:hover {
  background: var(--wp--preset--color--base);
  color: var(--wp--preset--color--primary);
  border: 2px solid var(--wp--preset--color--primary);
}
.nav-toggle__open {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: 4px;
}
.nav-toggle__open span {
  display: block;
  width: 24px;
  height: 0px;
  border: 1px solid var(--wp--preset--color--base);
  border-radius: 8px;
}
.nav-toggle__open span:hover {
  display: block;
  width: 24px;
  height: 0px;
  border: 1px solid var(--wp--preset--color--primary);
  border-radius: 8px;
}
.nav-toggle__close-icon span:nth-child(1) {
  display: block;
  width: 24px;
  height: 0px;
  border: 1.5px solid var(--wp--preset--color--base);
  border-radius: 8px;
  transform: rotate(45deg);
  position: relative;
}
.nav-toggle__close-icon span:nth-child(2) {
  display: block;
  width: 24px;
  height: 0px;
  border: 1.5px solid var(--wp--preset--color--base);
  border-radius: 8px;
  transform: rotate(-45deg);
  position: relative;
}
.floating-search[hidden] {
  display: none !important;
}
.nav-toggle__close {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.25rem; /* espace entre le mot et la croix */
  font-weight: 600; /* optionnel */
}

.nav-toggle__close-label {
  font-size: 1rem;
}
.nav-toggle__close-icon {
  font-size: 1.2rem;
  line-height: 1;
}
.floating-nav_stack,
.floating-nav__langs {
  gap: 4px;
  display: flex;
  flex-direction: column;
}

/* version mobile */
:root {
  --nav-gap: 0.6rem;
  --nav-size: 44px; /* diamètre des boutons ronds */
  --nav-font: 14px;
  --nav-z: 50; /* au-dessus du contenu, sous le mega-menu si besoin */
}
.nav-mobile {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  border-radius: 8px;
  max-width: 480px;
  margin: 0 auto;
}
/* conteneur principal fixé en haut-droite */
.floating-nav {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: var(--nav-z);
  pointer-events: none; /* évite des clics fantômes ; on redonne aux enfants */
}
.floating-nav-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--nav-gap);
  pointer-events: auto;
}

/* boutons ronds */
.floating-nav__btn,
.floating-nav__langs .lang-chip {
  display: inline-grid;
  place-items: center;
  width: var(--nav-size);
  height: var(--nav-size);
  border-radius: 999px;
  font: 600 var(--nav-font);
  text-transform: lowercase;
  background: var(--wp--preset--color--primary);
  color: var(--wp--preset--color--base);
  border: 2px solid var(--wp--preset--color--base);
}
.floating-nav__btn:hover,
.floating-nav__langs .lang-chip:hover {
  filter: brightness(1.05);
}

/* langue active (tu l’as déjà côté PHP) */
.lang-chip.is-active {
  background: #fff;
  color: #0c2e47;
  border-color: #0c2e47;
}

/* groupe langues (pile verticale compact) */
.floating-nav__langs {
  display: grid;
  gap: var(--nav-gap);
}

/* icônes textuelles (si pas de SVG) */
.floating-nav__burger .nav-toggle__open,
.floating-nav__burger .nav-toggle__close {
  font-weight: 700;
}

/* swap burger/fermer quand le méga-menu est ouvert */
.nav-toggle__close {
  display: none;
}
.mega-open .nav-toggle__open {
  display: none;
}
.mega-open .nav-toggle__close {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}

/* recherche inline (cachée par défaut) */
.floating-search[hidden] {
  display: none !important;
}
.floating-search {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  background: #fff;
  color: #222;
  border-radius: 999px;
  padding: 0.35rem 0.5rem 0.35rem 0.75rem;
  border: 2px solid #cfe0ef;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  width: min(80vw, 320px);
}
.floating-search input[type="search"] {
  flex: 1 1 auto;
  min-width: 120px;
  border: 0;
  outline: 0;
  font: 500 14px/1.2 inherit;
}
.floating-search button {
  border: 0;
  background: #0c2e47;
  color: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
}

/* ============= BREAKPOINTS ============= */
@media (min-width: 47.999999em) {
  .nav-mobile-logo {
    display: none;
  }
  .nav-mobile {
    padding-inline: 0;
  }
}

/* Mobile d’abord : on cache tout SAUF le burger quand le menu est fermé */
@media (max-width: 51em) {
  /* .nav-toggle {
    position: fixed;
    top: -16rem;
  } */
  .nav-mobile {
    display: flex;
    flex-direction: row;
    align-items: space-between;
    padding-inline: 1.5rem;
  }
  @media (max-width: 51em) {
    /* on cache tout SAUF le burger */
    .floating-nav__langs,
    .floating-nav__search,
    .floating-search,
    .contact-button {
      display: none !important;
    }

    /* ne PAS masquer le burger ! */
    .floating-nav__btn:not(.floating-nav__burger) {
      display: none !important;
    }

    /* quand le méga-menu est ouvert → on réaffiche */
    .mega-open .floating-nav__langs {
      display: grid !important;
    }
    .mega-open .floating-nav__search {
      display: inline-grid !important;
    }
  }

  /* quand le mega-menu est ouvert -> on montre la pile utilitaire (fr/en/loupe/mail) */
  .mega-open .floating-nav__langs,
  .mega-open .floating-nav__search {
    display: grid; /* pour langs */
  }
  .mega-open .floating-nav__search {
    display: inline-grid;
  } /* le bouton loupe */

  /* place la pile sous le burger avec un petit décalage */
  .floating-nav-stack {
    align-items: flex-end;
  }
}

/* Tablette & Desktop : la colonne reste visible en permanence */
@media (min-width: 51em) {
  .floating-nav__langs,
  .floating-nav__search {
    display: grid; /* visibles */
  }
}

/* Accessibilité - "sr-only" */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
/* ===== Top bar mobile ===== */
@media (max-width: 48em) {
  .mega-open .floating-nav .floating-nav-stack {
    display: grid !important;
    /* grid-auto-flow: column; */ /* ajout du 14/09 à voir si pas génant sur desktop */
    gap: 8px;
    position: fixed;
    top: var(--nav-h);
    right: 12px;
    z-index: 10000;
  }
}
@media (max-width: 51em) {
  :root {
    --nav-h: 56px;
  }

  /* Conteneur principal nav flottante */
  .floating-nav {
    position: fixed;
    inset: 0 auto auto 0; /* top/left */
    top: 0;
    right: 0;
    left: 0;
    padding: 0;
    margin: 0;
    z-index: 9999;
    pointer-events: none; /* on évite les clics fantômes autour */
  }

  /* Barre horizontale (logo + burger) */
  .floating-nav .nav-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-h);
    /* padding: 0 14px; */
    background: transparent;
    pointer-events: auto; /* réactive les clics sur la barre */
  }

  .floating-nav .logo-petit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 0;
  }

  .floating-nav .logo-petit img {
    height: 46px;
    width: auto;
  }

  /* Burger à droite */
  .floating-nav .floating-nav__burger {
    display: inline-flex;
    /* align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid var(--wp--preset--color--contrast-3, #eaeaea);
    background: var(--wp--preset--color--base); */
    cursor: pointer;
    pointer-events: auto;
  }

  /* .floating-nav .nav-toggle__open span {
    display: block;
    width: 22px;
    height: 0;
    border: 1.5px solid var(--wp--preset--color--primary);
    border-radius: 8px;
  } */

  .floating-nav .nav-toggle__close {
    display: none;
  } /* on garde une seule icône simple sur mobile */

  /* Cache la pile latérale (langues, loupe, mail) quand le menu est fermé */
  .floating-nav .floating-nav-stack {
    display: none !important;
  }

  /* Quand le mega-menu est ouvert, on peut ré-afficher les utilitaires si tu veux */
  .mega-open .floating-nav .floating-nav-stack {
    display: grid !important;
    /* grid-auto-flow: column; */ /* ajout du 14/09 à voir si pas génant sur desktop */
    gap: 8px;
    position: fixed;
    top: 110px;
    right: 24px;
    z-index: 10000;
  }
}

/* ===== Desktop : barre mobile masquée, pile latérale visible ===== */
@media (min-width: 50.999999em) {
  /* .floating-nav .nav-mobile {
    display: none;
  } */
  .floating-nav .floating-nav-stack {
    display: flex;
  }
}
/* Desktop : on garde la pile latérale ET le burger */
@media (min-width: 50.999999em) {
  .floating-nav .floating-nav-stack {
    display: flex;
  }
}

/* Ajout du 19/09 - search toggle */
.floating-search[hidden] {
  display: none !important;
}

.floating-search {
  position: absolute; /* ou fixed si tu préfères */
  inset-inline-end: 0;
  top: 0; /* ajuste selon ta nav flottante */
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: var(--wp--preset--color--base, #fff);
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  z-index: 10000000;
}

.floating-search input[type="search"] {
  min-width: 18rem; /* ajuste sur mobile via @media */
  border: 1px solid var(--wp--preset--color--contrast-2, #ddd);
  padding: 0.5rem 0.6rem;
  border-radius: 0.375rem;
}

@media (max-width: 42em) {
  .floating-search {
    top: auto;
    bottom: 1rem;
    inset-inline: 1rem;
  }
  .floating-search input[type="search"] {
    min-width: 0;
    width: 100%;
  }
}
.floating-search {
  position: fixed;
  left: 1rem;
  right: 1rem;
  top: 1rem;
  z-index: 999999;
}

.floating-search input[type="search"] {
  font-size: 16px; /* anti-zoom iOS */
  min-height: 44px; /* cible tactile confortable */
}

@supports (padding: env(safe-area-inset-top)) {
  .floating-search {
    top: calc(1rem + env(safe-area-inset-top));
  }
}

/* Gros bouton pour le déclencheur */
.search-toggle {
  min-width: 44px;
  min-height: 44px;
}
/* Ajout du 20/09 */
/* Recherche mobile au-dessus du méga-menu */
.floating-search {
  position: fixed;
  left: 1rem;
  right: 1rem;
  top: 1rem;
  z-index: 10001; /* > .mega-menu (10000/9998) */
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: var(--wp--preset--color--base, #fff);
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}
.floating-search[hidden] {
  display: none !important;
}
.floating-search input[type="search"] {
  font-size: 16px; /* anti-zoom iOS */
  min-height: 44px;
  flex: 1 1 auto;
}
@supports (padding: env(safe-area-inset-top)) {
  .floating-search {
    top: calc(1rem + env(safe-area-inset-top));
  }
}

/* Le méga-menu ne doit pas bloquer la recherche (même ouvert) */
.mega-menu.is-open + .floating-search,
.floating-search {
  pointer-events: auto;
}

/* Accessibilité : bouton invisible mais présent pour iOS */
.floating-search button[type="submit"].sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 51em) {
  .nav-mobile {
    display: flex;
    flex-direction: row;
    padding-block: 0.8rem;
    padding-inline: 1.5rem;
    max-width: 800px;
  }
}

/* Pictos nav : passer en noir au hover/focus */
.floating-nav__btn img,
.contact-btn img {
  transition: filter 0.2s ease;
}

/* survol + focus clavier */
.floating-nav__btn:hover img,
.floating-nav__btn:focus-visible img,
.contact-btn:hover img,
.contact-btn:focus-visible img {
  /* force le pictogramme en noir */
  filter: brightness(0) saturate(100%);
}
