/*
 * AZ Marketing — Mobile Menu Layer & Scroll Fix V1
 * Scoped to the Bootstrap mobile offcanvas. Hero, footer, desktop navigation
 * and content layout are intentionally not modified.
 */
@media (max-width: 991.98px) {
    /* Bootstrap defaults to 1045 for offcanvas, below the AZ sticky navbar
       (1050). Floating contact/chat widgets are also higher (9999). */
    .offcanvas-backdrop {
        z-index: 12000 !important;
    }

    #mobileMenu.offcanvas {
        --bs-offcanvas-width: min(380px, 100vw);
        width: var(--bs-offcanvas-width) !important;
        z-index: 12010 !important;
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
    }

    /* Keep the close button/title above the first navigation link. */
    #mobileMenu .offcanvas-header {
        position: relative;
        flex: 0 0 auto;
        min-height: 76px;
        padding: calc(1rem + env(safe-area-inset-top, 0px)) 1.25rem 1rem;
        align-items: center;
        z-index: 1;
    }

    #mobileMenu .offcanvas-title {
        margin: 0;
        font-size: 1.05rem;
        line-height: 1.45;
    }

    #mobileMenu .offcanvas-body {
        min-height: 0;
        padding: 1.125rem 1.25rem max(1rem, env(safe-area-inset-bottom, 0px));
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        gap: 1rem;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }

    #mobileMenu .navbar-nav {
        flex: 0 0 auto;
    }

    #mobileMenu .navbar-nav .nav-link {
        display: block;
        padding: 0.6rem 0.2rem;
        line-height: 1.55;
        font-size: 1.06rem;
    }

    /* The language/consultation actions stay reachable on short screens. */
    #mobileMenu .offcanvas-body > div:last-child {
        flex: 0 0 auto;
        margin-top: auto !important;
        padding-top: 0.75rem;
    }

    #mobileMenu .offcanvas-body > div:last-child .btn {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        white-space: normal;
        line-height: 1.35;
    }
}
