/* =====================================================================
   header.css — top bar, header, menu principale e sottomenu
   ===================================================================== */


/* ---------------------------------------------------------------------
   Variabili del tema per il menu
   #2b6cc4 su bianco ≈ 5,2:1 (AA)
   --------------------------------------------------------------------- */
:root {
  --con_header_nav_menu_link_color_active: #2b6cc4;
  --con_header_nav_menu_link_color_hover: #2b6cc4;
}


/* ---------------------------------------------------------------------
   Top bar
   --------------------------------------------------------------------- */
.top_bar {
  padding-top: 5px;
  padding-bottom: 5px;
}


/* ---------------------------------------------------------------------
   Menu principale (desktop)
   --------------------------------------------------------------------- */
.main_menu_nav > li {
  font-size: 15px !important;
}

.main_menu_nav > li > a {
  padding: 21px 9px !important;
}

@media (min-width: 992px) {
  /* Sfondo semitrasparente dell'header */
  .header_style_2.mobile_grid_tablet .header-box {
    background-color: var(--con_header_nav_background_color, rgba(255, 255, 255, .75));
  }

  /* Voce attiva: sottolineata, non solo colorata (WCAG 1.4.1) */
  .header_style_2 .header-box .main_menu_nav > li.current-menu-item > a,
  .header_style_2 .header-box .main_menu_nav > li.current-menu-ancestor > a,
  .header_style_2 .header-box .main_menu_nav > li.current-menu-parent > a,
  .header_style_2 .header-box .main_menu_nav > li.current_page_item > a,
  .header_style_2 .header-box .main_menu_nav > li.current_page_ancestor > a,
  .header_style_2 .header-box .main_menu_nav > li.current_page_parent > a {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 6px;
  }
}


/* ---------------------------------------------------------------------
   Sottomenu: si apre solo con la classe .is-open (gestita da a11y-menu.js),
   non più in hover.
   NOTA: qui il breakpoint è 1025px, il resto del menu desktop usa 992px.
   Tra 992 e 1024px vale ancora l'apertura in hover del tema: verifica.
   --------------------------------------------------------------------- */
@media (min-width: 1025px) {
  .main_menu_nav > li.menu-item-has-children > .sub-menu {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .main_menu_nav > li.menu-item-has-children.is-open > .sub-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Disattiva l'apertura in hover del tema */
  .main_menu_nav > li.menu-item-has-children:hover > .sub-menu {
    opacity: 0 !important;
    visibility: hidden !important;
  }

  /* Se è aperto resta aperto anche al passaggio del mouse */
  .main_menu_nav > li.menu-item-has-children.is-open:hover > .sub-menu {
    opacity: 1 !important;
    visibility: visible !important;
  }
}


/* ---------------------------------------------------------------------
   Header mobile
   --------------------------------------------------------------------- */
@media only screen and (max-width: 991px) {
  .logo a img {
    max-width: 100% !important;
  }

  #menu_toggle {
    margin: 34px 0 0 !important;
  }

  .mobile_header .top_nav_mobile .main_menu_nav > li > a {
    text-transform: inherit !important;
  }
}


/* ---------------------------------------------------------------------
   DA VERIFICARE — regole per la struttura .header_top / .top_nav
   L'header attuale usa .header-box e .main_menu_nav. Queste regole puntano
   a un'altra struttura (forse un vecchio stile di header). Per verificarle:
   in DevTools cerca ".header_top" nel DOM. Se non c'è, puoi eliminare
   tutto questo blocco.
   --------------------------------------------------------------------- */
body.header_style_2 .header_top .logo a {
  margin-top: -1px !important;
}

body.header_style_2 .header_top .top_nav .top_nav_wrapper > ul > li > a,
body.header_style_2 .header_top .top_nav .main_menu_nav > ul > li > a {
  padding: 10px 12px;
}

body.header_style_2 .header_top .top_nav .top_nav_wrapper > ul > li:hover > a,
body.header_style_2 .header_top .top_nav .main_menu_nav > ul > li:hover > a,
body.header_style_2 .header_top .top_nav .top_nav_wrapper > ul > li.current_page_item > a,
body.header_style_2 .header_top .top_nav .top_nav_wrapper > ul > li.current-menu-ancestor > a,
body.header_style_2 .header_top .top_nav .top_nav_wrapper > ul > li.current-menu-parent > a,
body.header_style_2 .header_top .top_nav .top_nav_wrapper > ul > li.current_page_parent > a,
body.header_style_2 .header_top .top_nav .top_nav_wrapper > ul > li.current_page_ancestor > a,
body.header_style_2 .header_top .top_nav .main_menu_nav > ul > li.current_page_item > a,
body.header_style_2 .header_top .top_nav .main_menu_nav > ul > li.current-menu-ancestor > a,
body.header_style_2 .header_top .top_nav .main_menu_nav > ul > li.current-menu-parent > a,
body.header_style_2 .header_top .top_nav .main_menu_nav > ul > li.current_page_parent > a,
body.header_style_2 .header_top .top_nav .main_menu_nav > ul > li.current_page_ancestor > a,
body.header_style_2 .header_top .top_nav .header_socials a:hover {
  color: var(--inm-blu-tema) !important;
}

@media only screen and (max-width: 1199px) {
  html body .header_top .top_nav .top_nav_wrapper {
    float: right !important;
  }

  body.header_style_2 .header_top .top_nav .header_socials {
    margin: 0 0 0 40px !important;
  }
}