/* RDC Gabarits - header mobile, etat ouvert (menu plein ecran, accordeon, recherche). Charge uniquement <= 782 px.
   L'etat ferme (barre de 56 px) est inline dans <head> (includes/header-mobile.php). */
@media (max-width: 782px) {
  .rdc-hdrm-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  html.rdc-hdrm-lock, html.rdc-hdrm-lock body { overflow: hidden; }

  /* Panneau de menu : le meme ul#menu-top, passe en plein ecran sous la barre. */
  html body #page #masthead.rdc-hdrm-menu-open #site-navigation #menu-top {
    display: block !important; position: fixed; top: 56px; left: 0; right: 0; bottom: 0; z-index: 1;
    box-sizing: border-box; width: auto; height: auto; margin: 0; padding: 0 0 24px; float: none;
    overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    background: #fff; border: 0; border-radius: 0; box-shadow: none; text-align: left; font-size: 17px; line-height: 1.3; list-style: none;
  }
  html body #page #masthead #menu-top li {
    display: block !important; position: relative; float: none; width: auto; height: auto; margin: 0; padding: 0;
    background: none; border: 0; border-bottom: 1px solid #eef1f6; list-style: none; line-height: 1.3;
  }
  html body #page #masthead #menu-top li a {
    display: flex; align-items: center; box-sizing: border-box; width: auto; height: auto; min-height: 52px;
    margin: 0; padding: 10px 56px 10px 16px; background: none; border: 0; box-shadow: none; text-shadow: none;
    color: #1b2a5e; font-size: 17px; font-weight: 600; line-height: 1.3; letter-spacing: 0; text-transform: none; text-decoration: none;
  }
  html body #page #masthead #menu-top li a:hover, html body #page #masthead #menu-top li a:active { background: #f5f7fb; color: #1b2a5e; }

  /* Sous-niveaux : accordeon. */
  html body #page #masthead #menu-top ul.sub-menu {
    display: none !important; position: static; float: none; width: auto; min-width: 0; height: auto; margin: 0; padding: 0;
    left: auto; top: auto; visibility: visible; opacity: 1; overflow: visible; background: #f5f7fb; border: 0; box-shadow: none;
  }
  html body #page #masthead #menu-top li.rdc-open > ul.sub-menu { display: block !important; }
  html body #page #masthead #menu-top ul.sub-menu li { border-bottom-color: #e6ebf3; }
  html body #page #masthead #menu-top ul.sub-menu li:last-child { border-bottom: 0; }
  html body #page #masthead #menu-top ul.sub-menu li a { min-height: 46px; padding: 8px 56px 8px 28px; font-size: 15px; font-weight: 400; background: none; }
  html body #page #masthead #menu-top ul.sub-menu ul.sub-menu li a { padding-left: 40px; }

  /* Bouton +/- distinct du lien (le libelle reste cliquable). */
  html body #page #masthead #menu-top .rdc-hdrm-sub {
    display: flex; align-items: center; justify-content: center; position: absolute; top: 0; right: 0; box-sizing: border-box;
    width: 52px; height: 52px; margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none;
    color: #1b2a5e !important; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  html body #page #masthead #menu-top ul.sub-menu .rdc-hdrm-sub { height: 46px; }
  html body #page #masthead #menu-top .rdc-hdrm-sub::before { content: "+"; font-size: 24px; font-weight: 400; line-height: 1; }
  html body #page #masthead #menu-top .rdc-hdrm-sub[aria-expanded="true"]::before { content: "\2212"; }

  /* Panneau de recherche sous la barre. */
  html body #page #masthead.rdc-hdrm-search-open #rdc-hdrm-search {
    display: block; position: fixed; top: 56px; left: 0; right: 0; z-index: 1; box-sizing: border-box;
    padding: 10px 12px 12px; background: #fff; box-shadow: 0 6px 8px -4px rgba(0, 0, 0, .15);
  }
  #rdc-hdrm-search form { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0; }
  #rdc-hdrm-search input[type="search"] {
    flex: 1 1 auto; min-width: 0; box-sizing: border-box; width: auto; height: 44px; margin: 0; padding: 0 18px;
    border: 1px solid #cfd6e4; border-radius: 22px; background: #fff; box-shadow: none; color: #222;
    font-size: 16px; line-height: 44px; -webkit-appearance: none; appearance: none;
  }
  #rdc-hdrm-search input[type="search"]::placeholder { color: #7b8499; opacity: 1; }
  html body #page #masthead #site-navigation #rdc-hdrm-search .rdc-hdrm-ok {
    flex: 0 0 auto; box-sizing: border-box; min-width: 56px; height: 44px; margin: 0 !important; padding: 0 16px !important; border: 0 !important; border-radius: 22px !important;
    background: #1b2a5e !important; color: #fff !important; font-size: 15px; font-weight: 700; line-height: 1; cursor: pointer;
  }

  /* Focus clavier visible. */
  #masthead .rdc-hdrm-btn:focus-visible, #masthead #menu-top a:focus-visible, #masthead .rdc-hdrm-sub:focus-visible,
  #rdc-hdrm-search input:focus-visible, #rdc-hdrm-search .rdc-hdrm-ok:focus-visible { outline: 2px solid #1b2a5e; outline-offset: -2px; }

  /* Les onglets collants de la fiche se calent sous la barre. */
  html body .rdc-scope .rdc-tabs { top: 56px; }
}
