/*
 * ==========================================================
 * STRUCTURAL - NE PAS MODIFIER
 * ==========================================================
 * Garantit l'affichage et le comportement du burger + drawer.
 * Toutes les regles ici utilisent !important pour resister
 * aux feuilles de style regenerees par Claude.
 * Selecteurs universels via [class*='-burger'] pour survivre
 * aux renommages de prefixe (rp- -> lpf-, cf7-, etc).
 */

/* === DESKTOP : burger + drawer caches === */
@media (min-width: 1024px) {
  [class*="-burger"]:not([class*="-bars"]) { display: none !important; }
  [class*="-nav-mobile"],
  [id*="-nav-mobile"],
  [class*="-drawer-overlay"] { display: none !important; }
}

/* === MOBILE : burger visible + drawer toggle === */
@media (max-width: 1023px) {
  /* Burger TOUJOURS en position fixed top-right sur mobile, peu importe
     le layout du header (sinon il atterrit sous le logo). */
  #rp-burger,
  [id$="-burger"]:not([id*="bars"]),
  [class*="-burger"]:not([class*="-bars"]):not(.is-hidden) {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    position: fixed !important;
    top: 14px !important;
    right: 14px !important;
    left: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    z-index: 100001 !important;
    cursor: pointer !important;
  }
  [class*="-burger-bars"] {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }
  [class*="-burger-bars"] span {
    display: block !important;
  }
  /* Drawer ferme */
  [class*="-nav-mobile"]:not(.is-open),
  [id*="-nav-mobile"]:not(.is-open),
  [class*="-drawer"]:not(.is-open):not(button) { display: none !important; }
  /* Drawer ouvert : selecteur via ID (#rp-nav-mobile) pour battre les
     injections inline du theme qui utilisent des classes/attrs. */
  #rp-nav-mobile.is-open,
  [id$="-nav-mobile"].is-open,
  [class*="-nav-mobile"].is-open,
  [class*="-drawer"].is-open:not(button) {
    display: flex !important;
    flex-direction: column !important;
    position: fixed !important;
    z-index: 100000 !important;
    overflow-y: auto !important;
    transform: none !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  /* Bouton fermer du drawer */
  [class*="-drawer-close"] {
    position: absolute !important;
    cursor: pointer !important;
    z-index: 1 !important;
  }
  /* Items du drawer : couleur sombre forcee pour eviter blanc-sur-blanc */
  #rp-nav-mobile.is-open ul,
  [id$="-nav-mobile"].is-open ul,
  [class*="-nav-mobile"].is-open ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  #rp-nav-mobile.is-open a,
  [id$="-nav-mobile"].is-open a,
  [class*="-nav-mobile"].is-open a {
    display: block !important;
    color: #1A1A1A !important;
    background: transparent !important;
    padding: 1rem 0.5rem !important;
    text-decoration: none !important;
    font-size: 1.05rem !important;
    font-weight: 500 !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  #rp-nav-mobile.is-open li,
  [id$="-nav-mobile"].is-open li,
  [class*="-nav-mobile"].is-open li {
    display: block !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    list-style: none !important;
  }
  /* Overlay : assombri le fond, plus BAS que le drawer (drawer=100000) */
  #rp-drawer-overlay.is-open,
  [id$="-drawer-overlay"].is-open,
  [class*="-drawer-overlay"].is-open {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 99000 !important;
  }
  [class*="-drawer-overlay"]:not(.is-open) { display: none !important; }
  /* Body lock scroll quand drawer ouvert. Classe `rp-menu-active`
     intentionnellement SANS "drawer" dans le nom pour ne pas matcher
     `[class*="-drawer"]` ci-dessus qui cacherait le body en entier. */
  body.rp-menu-active { overflow: hidden !important; }
}
