/*
 * ==========================================================
 * 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; }
}

/*
 * ==========================================================
 * DESIGN (Kadence) - Moderne sombre, drawer beige typographique
 * ==========================================================
 */
@media (max-width: 1023px) {
  [class*="-burger"]:not([class*="-bars"]) {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 11px;
    margin: 0;
    background: #1A1A1A;
    border: none;
    border-radius: 6px;
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    transition: background 0.2s ease;
  }
  [class*="-burger"]:not([class*="-bars"]):hover { background: #2C2C2C; }
  [class*="-burger-bars"] {
    gap: 4px;
    width: 22px;
    height: 14px;
  }
  [class*="-burger-bars"] span {
    width: 100%;
    height: 2.5px;
    background: #FFFFFF;
    border-radius: 2px;
  }

  /* Drawer : slide from right, large, fond beige typographique */
  [class*="-nav-mobile"].is-open,
  [id*="-nav-mobile"].is-open {
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: 90%;
    max-width: 420px;
    height: 100vh;
    background: #F5EFE6;
    color: #2C2418;
    padding: 5rem 2rem 2rem;
    box-shadow: -6px 0 28px rgba(0, 0, 0, 0.22);
  }
  [class*="-nav-mobile"].is-open ul { list-style: none; margin: 0; padding: 0; width: 100%; }
  [class*="-nav-mobile"].is-open li {
    border-bottom: 1px solid rgba(44, 36, 24, 0.12);
    padding: 0;
  }
  [class*="-nav-mobile"].is-open a {
    display: block;
    color: #2C2418;
    text-decoration: none;
    padding: 1.15rem 0;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.15rem;
    font-weight: 500;
    letter-spacing: 0.01em;
  }
  [class*="-nav-mobile"].is-open a:hover { color: #6B5742; }
  [class*="-drawer-close"] {
    top: 1.25rem;
    right: 1.25rem;
    width: 38px;
    height: 38px;
    background: transparent;
    border: 1px solid rgba(44, 36, 24, 0.25);
    border-radius: 50%;
    color: #2C2418;
    font-size: 1.7rem;
    line-height: 1;
  }
  [class*="-drawer-close"]:hover { background: rgba(44, 36, 24, 0.06); }
  [class*="-drawer-overlay"].is-open { background: rgba(44, 36, 24, 0.5); }
}
