/* =====================================================
   iOS Safari fix — BricksExtras offcanvas mobile menu
   ===================================================== */

@media (max-width: 991px) {

  /*
   * Bricks inline CSS sets z-index: -1 !important to create a
   * "slide from behind the header" effect. On Chrome this works
   * because fixed + negative z-index still paints above normal-flow
   * content. iOS Safari paints it BEHIND page content, making the
   * menu invisible / untouchable.
   *
   * Fix: positive z-index below header (9999) but above everything else.
   */
  #brxe-cyyfrs .x-offcanvas_inner {
    z-index: 9998 !important;
  }

  /*
   * 100vh on iOS Safari = maximum viewport (URL-bar collapsed).
   * When the URL-bar is visible the panel overflows the screen.
   * Switch to auto height + dvh cap.
   */
  .x-offcanvas_inner.x-offcanvas_top {
    height: auto !important;
    max-height: 100vh;
    max-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /*
   * When the offcanvas is open, prevent body scroll.
   * iOS ignores overflow:hidden on <body> alone.
   */
  html[class*="x-offcanvas_prevent-scroll"],
  html[class*="x-offcanvas_prevent-scroll"] > body {
    overflow: hidden !important;
    touch-action: none;
  }

  /*
   * The backdrop must sit above normal content but below the panel.
   */
  #brxe-cyyfrs > .x-offcanvas_backdrop {
    z-index: 9997 !important;
  }

}
