/* The shared navigation can sit above the Envo content without styling that content. */
#ea-navigation {
  position: sticky;
  top: var(--ea-admin-offset, 0px);
  z-index: 10020;
  isolation: isolate;
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  text-align: left;
  color: var(--ink);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  --ea-admin-offset: 0px;
}
body.admin-bar #ea-navigation { --ea-admin-offset: 32px; }
@media (max-width: 782px) { body.admin-bar #ea-navigation { --ea-admin-offset: 46px; } }
@media (max-width: 600px) { body.admin-bar #ea-navigation { --ea-admin-offset: 0px; } }
#ea-navigation .ea-home-header { position: relative; top: 0; min-height: 0; overflow: visible; }
#ea-navigation .mega-panel { max-height: calc(100dvh - var(--header-height) - var(--ea-admin-offset)); overflow: auto; }
#ea-navigation .menu-scrim { top: calc(var(--header-height) + var(--ea-admin-offset)); }
@media (min-width: 1200px) {
  #ea-navigation .ea-home-header.is-compact .utility-rail { top: calc(var(--header-height) + var(--ea-admin-offset) + 16px); }
}
@media (max-width: 1199px) {
  #ea-navigation #mobile-nav { max-height: calc(100dvh - var(--header-height) - var(--ea-admin-offset)); }
}
#ea-navigation ~ .page-wrap > .main-menu,
#ea-navigation ~ .page-wrap > .top-bar-section { display: none !important; }
body.ea-navigation-menu-open { overflow: hidden; }

/* Envo's child theme sets !important button colours, backgrounds and type sizes.
   Keep these overrides inside the shared header, including its own dialogs. */
#ea-navigation :where(button, a.button) {
  margin: 0;
  text-transform: none;
  letter-spacing: normal;
  background: transparent !important;
  color: inherit !important;
  font-size: inherit !important;
}
#ea-navigation .icon-button:hover { color: var(--gold) !important; }
#ea-navigation .ea-seal { color: #4d352c !important; }
#ea-navigation .ea-menu-link { color: #493b29 !important; }
#ea-navigation .ea-menu-action { color: #ffe2a4 !important; font-size: clamp(16px, 1.23vw, 18px) !important; }
#ea-navigation .utility-link { color: #775727 !important; }
#ea-navigation .utility-link:hover { color: #352819 !important; }
#ea-navigation .utility-rail .patient-toggle { color: #3d5b4a !important; }
#ea-navigation .ea-home-header:not(.is-compact) .utility-link:hover { background: #faf6ee !important; }
@media (min-width: 1200px) {
  #ea-navigation .is-compact .utility-link { background: #fff !important; }
  #ea-navigation .is-compact .lunar-toggle.is-full { background: radial-gradient(circle at 50% 35%, #fff1c5, #fff 65%) !important; }
}
#ea-navigation .button { font-size: 13px !important; }
#ea-navigation .primary { background: #8b6933 !important; color: #fff !important; }
#ea-navigation .primary:hover { background: #6f5228 !important; }
#ea-navigation .almanac-tabs button { color: #746850 !important; font-size: 11px !important; }
#ea-navigation .almanac-tabs button[aria-selected="true"] { background: #29433a !important; color: #fff9e7 !important; }
#ea-navigation .almanac-tabs button:hover:not([aria-selected="true"]) { background: #fffdf6 !important; color: #574323 !important; }
#ea-navigation .almanac-spaces button { color: #756241 !important; font-size: 15px !important; }
#ea-navigation .almanac-spaces button[aria-pressed="true"] { background: #294239 !important; color: #fff4d7 !important; }
#ea-navigation .almanac-spaces button:hover:not([aria-pressed="true"]) { background: #fffaf0 !important; }
#ea-navigation .almanac-reading-nav button { color: #657452 !important; font-size: 12px !important; }
#ea-navigation .almanac-reading-nav button:hover { color: #85662e !important; }
@media (max-width: 600px) {
  #ea-navigation .almanac-tabs button { font-size: 9px !important; }
  #ea-navigation .almanac-reading-nav button, #ea-navigation .almanac-spaces button { font-size: 11px !important; }
}

/* Links from the mega menu land on Elementor headings or whole course sections. */
:is(.ea-professionnels-page, .ea-formations-page) :is(
  [id^="pro-"], #structures-professionnelles, #formations-sur-mesure,
  #formation-pro-title, #stages-ressources, #interventions-partenaires
) { scroll-margin-top: var(--ea-anchor-inset, 130px); }

/* Shared header: the open mobile panel stays below the visible header even
   after opening the menu partway through a long Elementor page. */
@media (max-width: 1199px) {
  #ea-navigation #mobile-nav:not([hidden]) {
    position: fixed;
    top: calc(var(--header-height) + var(--ea-admin-offset));
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 90;
  }
  /* Body overflow toggling can disturb sticky headers in some mobile WebViews.
     The page remains protected against pointer interaction by the scrim. */
  body.ea-navigation-menu-open { overflow: visible; }
  #ea-navigation .menu-scrim:not([hidden]) { touch-action: none; }
}
