/* Header Conextivity -------------------------------------------------------
   Structure posée dans Elementor (template « Main Header ») :
   .cnx-header (fixe)
     > .cnx-header__util  barre utilitaire [cnx_nav variant="utility"]
     > .cnx-header__main  logo, navigation [cnx_nav variant="main"], burger
   Le fond au défilement (.is-scrolled) est géré dans listings.css et script.js.
   Ici : barre utilitaire, navigation principale et méga menu « Brands ». */

.cnx-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Barre utilitaire ------------------------------------------------------- */

.e-con.cnx-header__util {
  max-height: 44px;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease, border-color 0.35s ease;
}

.e-con.cnx-header.is-scrolled .cnx-header__util {
  max-height: 0;
  opacity: 0;
  border-bottom-color: transparent;
}

.cnx-util__list {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 28px;
  margin: 0;
  padding: 10px 0;
  list-style: none;
}

.cnx-util__link {
  font-size: 12.5px;
  line-height: 1.2;
  letter-spacing: 0.2px;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  transition: color 0.2s ease;
}

.cnx-util__link:hover,
.cnx-util__link:focus-visible,
.cnx-util__item.is-current > .cnx-util__link {
  color: #fff;
}

/* Navigation principale --------------------------------------------------- */

.cnx-nav--main {
  display: flex;
  justify-content: flex-end;
}

.cnx-nav__list {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cnx-nav__item {
  display: flex;
  align-items: center;
}

.cnx-nav__link {
  position: relative;
  display: block;
  padding: 10px 12px;
  font-size: 16px;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition: color 0.2s ease;
}

.cnx-nav__link::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 1.5px;
  background-color: #fff;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s ease;
}

.cnx-nav__item:hover > .cnx-nav__link,
.cnx-nav__link:focus-visible,
.cnx-nav__item.is-active > .cnx-nav__link,
.cnx-nav__item.is-open > .cnx-nav__link {
  color: #fff;
}

.cnx-nav__item.is-active > .cnx-nav__link::after {
  transform: scaleX(1);
}

/* « Brands » : lien + bouton chevron (ouverture au clavier et au toucher) */
.cnx-nav__item.has-mega > .cnx-nav__link {
  padding-right: 4px;
}

.cnx-nav__item.has-mega > .cnx-nav__link::after {
  right: 4px;
}

.cnx-nav .cnx-nav__toggle,
.cnx-nav .cnx-nav__toggle:hover,
.cnx-nav .cnx-nav__toggle:focus {
  display: grid;
  place-items: center;
  width: 22px;
  height: 32px;
  margin: 0 6px 0 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  box-shadow: none;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}

.cnx-nav .cnx-nav__item:hover > .cnx-nav__toggle,
.cnx-nav .cnx-nav__item.is-open > .cnx-nav__toggle {
  color: #fff;
}

.cnx-nav__toggle svg {
  width: 10px;
  height: 6px;
  transition: transform 0.25s ease;
}

.cnx-nav__item.is-open > .cnx-nav__toggle svg,
.cnx-nav__item.has-mega:hover > .cnx-nav__toggle svg {
  transform: rotate(180deg);
}

.cnx-nav a:focus-visible,
.cnx-nav .cnx-nav__toggle:focus-visible {
  outline: 2px solid var(--e-global-color-cnxsky, #8cc4e8);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Méga menu --------------------------------------------------------------- */

.cnx-mega {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 20;
  width: min(780px, calc(100vw - 48px));
  padding-top: 16px; /* pont invisible : le survol ne se perd pas entre le lien et le panneau */
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

.cnx-nav__item.has-mega:hover > .cnx-mega,
.cnx-nav__item.has-mega.is-open > .cnx-mega,
.cnx-mega:focus-within {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

/* Fermé après Échap ou après un clic dans le panneau, même si la souris est encore dessus. */
.cnx-nav .cnx-nav__item.has-mega.is-dismissed > .cnx-mega {
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
}

.cnx-mega__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 12px;
  list-style: none;
  background-color: rgba(14, 42, 68, 0.97);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  box-shadow: 0 28px 56px -16px rgba(0, 10, 22, 0.6);
}

.cnx-mega__link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  padding: 20px;
  border-radius: 10px;
  color: #fff;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.cnx-mega__link:hover,
.cnx-mega__link:focus-visible {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.06);
}

.cnx-mega__kicker {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--e-global-color-cnxsky, #8cc4e8);
}

.cnx-mega__name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
}

.cnx-mega__name svg {
  flex: none;
  width: 9px;
  height: 9px;
  opacity: 0.7;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.cnx-mega__link:hover .cnx-mega__name svg,
.cnx-mega__link:focus-visible .cnx-mega__name svg {
  opacity: 1;
  transform: translate(2px, -2px);
}

.cnx-mega__desc {
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.65);
}

.cnx-mega__footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 8px 0;
  padding: 16px 12px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.cnx-mega__tagline {
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.55);
}

.cnx-mega__more {
  flex: none;
  padding-bottom: 3px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  transition: border-color 0.2s ease;
}

.cnx-mega__more:hover,
.cnx-mega__more:focus-visible {
  color: #fff; /* sinon custom-reset.css (a:hover) passe le lien en noir */
  border-bottom-color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .e-con.cnx-header__util,
  .cnx-nav__link::after,
  .cnx-nav__toggle svg,
  .cnx-mega,
  .cnx-mega__name svg {
    transition: none;
  }
}
