/* ===== Mega-menus desktop : onglets à gauche, cartes à droite (templates/mega-menu.php) ===== */
#arbree-header .mx-dropdown {
  --mx-ink: #24162d;
  --mx-violet: #423666;
  --mx-coral: #ed5f54;
  --mx-muted: rgba(36, 22, 45, 0.62);
  --mx-surface: #f5f3f0;
  --mx-tint: #f1edf7;
  --mx-card: #ffffff;

  position: fixed;
  top: var(--mx-top, 76px);
  left: 50%;
  z-index: 1200;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  align-items: start;
  width: min(1200px, calc(100vw - 32px));
  /* Le panneau entier défile (molette n'importe où dedans) quand l'écran est trop bas */
  max-height: calc(100vh - var(--mx-top, 76px) - 16px);
  border: 0;
  border-radius: 20px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(66, 54, 102, 0.35) transparent;
  background: var(--mx-card);
  box-shadow: 0 28px 70px -20px rgba(36, 22, 45, 0.35), 0 6px 18px rgba(36, 22, 45, 0.08);
  font-family: "Inter", system-ui, sans-serif;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition:
    opacity 0.2s ease,
    transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
    visibility 0s linear 0.2s;
}
#arbree-header .mx-dropdown.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
  transition:
    opacity 0.2s ease,
    transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#arbree-header .mx-dropdown--compact {
  width: min(980px, calc(100vw - 32px));
}

/* Réinitialisations : le site stylise globalement a, p, h3, h4 et a:hover.
   :where() garde ces règles à la priorité la plus basse, pour que les composants ci-dessous l'emportent. */
#arbree-header :where(.mx-dropdown) *,
#arbree-header :where(.mx-dropdown) *::before,
#arbree-header :where(.mx-dropdown) *::after {
  box-sizing: border-box;
}
#arbree-header :where(.mx-dropdown) :where(p, h3, h4) {
  margin: 0;
  padding: 0;
}
#arbree-header :where(.mx-dropdown) :where(a, a:hover, a:focus, p, h3, h4) {
  letter-spacing: normal;
  text-transform: none;
  text-decoration: none !important;
  text-align: left !important;
  hyphens: manual !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
}

/* ----- Colonne de gauche ----- */
#arbree-header .mx-aside {
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* Les onglets restent visibles pendant le défilement du panneau */
  position: sticky;
  top: 0;
  padding: 22px 16px 18px;
  background: var(--mx-card);
}
#arbree-header .mx-aside__label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 0 10px 10px !important;
  font: 600 0.7rem/1.2 "Inter", system-ui, sans-serif !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: var(--mx-muted) !important;
  -webkit-text-fill-color: var(--mx-muted) !important;
}
#arbree-header .mx-tabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#arbree-header .mx-dropdown .mx-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
#arbree-header .mx-dropdown .mx-tab:hover {
  background: #f7f5f2;
}
#arbree-header .mx-dropdown .mx-tab[aria-selected="true"] {
  background: var(--mx-tint);
}
#arbree-header .mx-dropdown .mx-tab:focus-visible {
  outline: 2px solid var(--mx-coral);
  outline-offset: -2px;
}
#arbree-header .mx-tab__title {
  font: 600 0.9rem/1.3 "Inter", system-ui, sans-serif !important;
  color: var(--mx-violet) !important;
  -webkit-text-fill-color: var(--mx-violet) !important;
}
#arbree-header .mx-tab[aria-selected="true"] .mx-tab__title {
  color: var(--mx-coral) !important;
  -webkit-text-fill-color: var(--mx-coral) !important;
}
#arbree-header .mx-tab__sub {
  font: 400 0.74rem/1.3 "Inter", system-ui, sans-serif !important;
  color: var(--mx-muted) !important;
  -webkit-text-fill-color: var(--mx-muted) !important;
}

/* Carte promo en bas de la colonne */
#arbree-header .mx-dropdown .mx-promo {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto !important;
  padding: 14px 16px 16px;
  border-radius: 16px;
  background: var(--mx-violet);
  transition: background-color 0.2s ease;
}
#arbree-header .mx-tabs + .mx-promo {
  margin-top: 16px !important;
}
#arbree-header .mx-dropdown .mx-promo:hover,
#arbree-header .mx-dropdown .mx-promo:focus-visible {
  background: #4c3f74;
  outline: none;
}
#arbree-header .mx-promo__img {
  display: block;
  width: 100%;
  height: 96px;
  margin-bottom: 6px;
  border-radius: 10px;
  object-fit: cover;
}
#arbree-header .mx-promo__kicker {
  font: 700 0.66rem/1.2 "Inter", system-ui, sans-serif !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: #f8b7b1 !important;
  -webkit-text-fill-color: #f8b7b1 !important;
}
#arbree-header .mx-promo__title {
  font: 700 1rem/1.3 "Inter", system-ui, sans-serif !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
#arbree-header .mx-promo__text {
  font: 400 0.78rem/1.45 "Inter", system-ui, sans-serif !important;
  color: rgba(255, 255, 255, 0.78) !important;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.78) !important;
}
#arbree-header .mx-promo__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  padding: 9px 16px;
  border-radius: 12px;
  background: #ffffff;
  font: 600 0.8rem/1.2 "Inter", system-ui, sans-serif !important;
  color: var(--mx-violet) !important;
  -webkit-text-fill-color: var(--mx-violet) !important;
  transition: background-color 0.2s ease, color 0.2s ease;
}
#arbree-header .mx-promo:hover .mx-promo__btn {
  background: var(--mx-coral);
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* ----- Zone de droite ----- */
#arbree-header .mx-main {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  padding: 26px 30px 24px;
  background: var(--mx-surface);
}
#arbree-header .mx-panel[hidden] {
  display: none !important;
}
#arbree-header .mx-panel {
  animation: mx-fade 0.22s ease;
}
@keyframes mx-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
#arbree-header .mx-panel__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
#arbree-header .mx-panel__eyebrow {
  margin-bottom: 4px !important;
  font: 600 0.8rem/1.3 "Inter", system-ui, sans-serif !important;
  color: var(--mx-coral) !important;
  -webkit-text-fill-color: var(--mx-coral) !important;
}
#arbree-header .mx-panel__title {
  font: 700 1.2rem/1.3 "Inter", system-ui, sans-serif !important;
  letter-spacing: -0.01em !important;
  color: var(--mx-ink) !important;
  -webkit-text-fill-color: var(--mx-ink) !important;
}
#arbree-header .mx-panel__intro {
  margin-top: 4px !important;
  font: 400 0.8rem/1.45 "Inter", system-ui, sans-serif !important;
  color: var(--mx-muted) !important;
  -webkit-text-fill-color: var(--mx-muted) !important;
}
#arbree-header .mx-dropdown .mx-panel__cta {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 12px;
  background: #ffffff;
  font: 600 0.78rem/1.2 "Inter", system-ui, sans-serif !important;
  color: var(--mx-violet) !important;
  -webkit-text-fill-color: var(--mx-violet) !important;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}
#arbree-header .mx-dropdown .mx-panel__cta:hover,
#arbree-header .mx-dropdown .mx-panel__cta:focus-visible {
  background: var(--mx-violet);
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* Groupes */
#arbree-header .mx-group + .mx-group {
  margin-top: 22px;
}
#arbree-header .mx-group__title {
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px !important;
  font: 600 0.95rem/1.3 "Inter", system-ui, sans-serif !important;
  color: var(--mx-ink) !important;
  -webkit-text-fill-color: var(--mx-ink) !important;
}
#arbree-header .mx-group__icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #e9e3f2;
  font-size: 0.78rem;
  color: var(--mx-violet);
}
#arbree-header .mx-group__icon i {
  color: var(--mx-violet) !important;
  -webkit-text-fill-color: var(--mx-violet) !important;
}
#arbree-header .mx-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

/* Groupes de 4 cartes : une seule rangée quand la largeur le permet, sinon 2 × 2 */
@media (min-width: 1300px) {
  #arbree-header .mx-grid--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Cartes */
#arbree-header .mx-dropdown .mx-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 132px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--mx-card);
  box-shadow: 0 1px 2px rgba(36, 22, 45, 0.06), 0 4px 14px rgba(36, 22, 45, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#arbree-header .mx-dropdown .mx-card:hover,
#arbree-header .mx-dropdown .mx-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(36, 22, 45, 0.06), 0 14px 30px -8px rgba(36, 22, 45, 0.18);
  outline: none;
}
#arbree-header .mx-dropdown .mx-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(237, 95, 84, 0.45);
}
#arbree-header .mx-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
#arbree-header .mx-card__titles {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
#arbree-header .mx-card__level {
  font: 600 0.66rem/1.2 "Inter", system-ui, sans-serif !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  color: #7b5fb0 !important;
  -webkit-text-fill-color: #7b5fb0 !important;
}
#arbree-header .mx-card__title {
  font: 600 0.88rem/1.3 "Inter", system-ui, sans-serif !important;
  color: var(--mx-ink) !important;
  -webkit-text-fill-color: var(--mx-ink) !important;
}
#arbree-header .mx-card__icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--mx-tint);
  font-size: 0.85rem;
}
#arbree-header .mx-card__icon i {
  color: var(--mx-violet) !important;
  -webkit-text-fill-color: var(--mx-violet) !important;
}
#arbree-header .mx-card__icon img {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  object-fit: contain;
}
#arbree-header .mx-card__desc {
  font: 400 0.78rem/1.45 "Inter", system-ui, sans-serif !important;
  color: var(--mx-muted) !important;
  -webkit-text-fill-color: var(--mx-muted) !important;
}
#arbree-header .mx-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 22px;
  margin-top: auto;
}
#arbree-header .mx-badge {
  padding: 4px 8px;
  border-radius: 6px;
  background: #fde9e7;
  font: 700 0.64rem/1.2 "Inter", system-ui, sans-serif !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  color: #c23b30 !important;
  -webkit-text-fill-color: #c23b30 !important;
  white-space: nowrap;
}
#arbree-header .mx-badge--long {
  background: #fbf0d6;
  color: #8a5a00 !important;
  -webkit-text-fill-color: #8a5a00 !important;
}
#arbree-header .mx-card__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font: 600 0.76rem/1.2 "Inter", system-ui, sans-serif !important;
  color: var(--mx-violet) !important;
  -webkit-text-fill-color: var(--mx-violet) !important;
  white-space: nowrap;
}
#arbree-header .mx-card__more i {
  font-size: 0.7rem;
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
  transition: transform 0.2s ease;
}
#arbree-header .mx-card:hover .mx-card__more {
  color: var(--mx-coral) !important;
  -webkit-text-fill-color: var(--mx-coral) !important;
}
#arbree-header .mx-card:hover .mx-card__more i {
  transform: translateX(3px);
}

/* Tuiles (Espace adhérent) */
#arbree-header .mx-dropdown--compact .mx-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
#arbree-header .mx-dropdown .mx-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--mx-card);
  box-shadow: 0 1px 2px rgba(36, 22, 45, 0.06);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
#arbree-header .mx-dropdown .mx-tile:hover,
#arbree-header .mx-dropdown .mx-tile:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -8px rgba(36, 22, 45, 0.2);
  outline: none;
}
#arbree-header .mx-tile__icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--mx-tint);
  font-size: 0.85rem;
}
#arbree-header .mx-tile__icon i {
  color: var(--mx-violet) !important;
  -webkit-text-fill-color: var(--mx-violet) !important;
}
#arbree-header .mx-tile__title {
  flex: 1;
  font: 500 0.84rem/1.3 "Inter", system-ui, sans-serif !important;
  color: var(--mx-ink) !important;
  -webkit-text-fill-color: var(--mx-ink) !important;
}
#arbree-header .mx-tile__arrow {
  font-size: 0.7rem;
  color: rgba(36, 22, 45, 0.3) !important;
  -webkit-text-fill-color: rgba(36, 22, 45, 0.3) !important;
  transition: transform 0.2s ease, color 0.2s ease;
}
#arbree-header .mx-tile:hover .mx-tile__arrow {
  transform: translateX(3px);
  color: var(--mx-coral) !important;
  -webkit-text-fill-color: var(--mx-coral) !important;
}

/* Lien de bas de zone */
#arbree-header .mx-dropdown .mx-foot {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 10px;
  margin-top: 22px !important;
  font: 600 0.8rem/1.3 "Inter", system-ui, sans-serif !important;
  color: var(--mx-violet) !important;
  -webkit-text-fill-color: var(--mx-violet) !important;
}
#arbree-header .mx-dropdown .mx-foot:hover {
  color: var(--mx-coral) !important;
  -webkit-text-fill-color: var(--mx-coral) !important;
}

/* ----- Ajustement des colonnes selon la largeur ----- */
@media (max-width: 1280px) {
  #arbree-header .mx-dropdown {
    grid-template-columns: 240px minmax(0, 1fr);
  }
  #arbree-header .mx-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #arbree-header .mx-main {
    padding: 22px 22px 20px;
  }
}
/* Écrans peu hauts (PC portables) : tout est resserré pour limiter le défilement */
@media (max-height: 860px) {
  #arbree-header .mx-promo__img,
  #arbree-header .mx-tab__sub {
    display: none;
  }
  #arbree-header .mx-aside {
    padding: 16px 12px 14px;
  }
  #arbree-header .mx-dropdown .mx-tab {
    padding: 8px 12px;
  }
  #arbree-header .mx-main {
    padding: 18px 24px 18px;
  }
  #arbree-header .mx-panel__head {
    margin-bottom: 12px;
  }
  #arbree-header .mx-panel__intro {
    display: none;
  }
  #arbree-header .mx-group + .mx-group {
    margin-top: 14px;
  }
  #arbree-header .mx-group__title {
    margin-bottom: 8px !important;
  }
  #arbree-header .mx-grid {
    gap: 10px;
  }
  #arbree-header .mx-dropdown .mx-card {
    min-height: 0;
    gap: 6px;
    padding: 12px 14px;
  }
  #arbree-header .mx-dropdown .mx-tile {
    padding: 9px 12px;
  }
  #arbree-header .mx-dropdown .mx-foot {
    margin-top: 14px !important;
  }
}
@media (max-height: 700px) {
  #arbree-header .mx-card__desc {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  #arbree-header .mx-promo__text {
    display: none;
  }
}
@media (max-width: 1024px) {
  #arbree-header .mx-dropdown {
    display: none !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  #arbree-header .mx-dropdown,
  #arbree-header .mx-panel,
  #arbree-header .mx-card,
  #arbree-header .mx-tile {
    animation: none !important;
    transition: none !important;
  }
}

/* ----- Voile sombre derrière le menu ouvert, pour le détacher du fond clair du site ----- */
html:not(.high-contrast) body:has(.mx-dropdown.active) #mega-overlay.mega-overlay.active {
  background: rgba(36, 22, 45, 0.55) !important;
}
#arbree-header .mx-dropdown.active {
  box-shadow:
    0 40px 90px -20px rgba(16, 8, 24, 0.55),
    0 10px 28px rgba(16, 8, 24, 0.18);
}

/* ----- Contraste élevé : fond violet, texte jaune (convention du site) ----- */
html.high-contrast #arbree-header .mx-dropdown,
html.high-contrast #arbree-header .mx-aside,
html.high-contrast #arbree-header .mx-main {
  background: #24162d !important;
}
html.high-contrast #arbree-header .mx-dropdown .mx-card,
html.high-contrast #arbree-header .mx-dropdown .mx-tile,
html.high-contrast #arbree-header .mx-dropdown .mx-promo,
html.high-contrast #arbree-header .mx-dropdown .mx-tab[aria-selected="true"],
html.high-contrast #arbree-header .mx-dropdown .mx-panel__cta,
html.high-contrast #arbree-header .mx-promo__btn,
html.high-contrast #arbree-header .mx-card__icon,
html.high-contrast #arbree-header .mx-tile__icon,
html.high-contrast #arbree-header .mx-group__icon,
html.high-contrast #arbree-header .mx-badge {
  background: #423666 !important;
}
html.high-contrast #arbree-header .mx-dropdown *,
html.high-contrast #arbree-header .mx-dropdown *:hover {
  color: #ffff00 !important;
  -webkit-text-fill-color: #ffff00 !important;
}
html.high-contrast #arbree-header .mx-dropdown a:focus-visible,
html.high-contrast #arbree-header .mx-dropdown .mx-tab:focus-visible {
  outline: 3px solid #ffff00 !important;
  outline-offset: 2px;
}
