/*
 * Mobile layout guard
 *
 * Keep the bottom navigation anchored to the visual viewport without forcing
 * html/body to a viewport-based height. Page-specific styles must not set
 * 100vh/100svh/100dvh or flex stretching on html/body.
 */
:root {
    --mobile-menu-height: 56px;
}

@media (max-width: 991.98px) {
    html,
    body {
        height: auto !important;
        min-height: 0 !important;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    body {
        display: block !important;
    }

    /* hidden on only the X axis computes overflow-y:auto, creating a second
       scrolling area on body. Keep the document as the only page scroller;
       clip still prevents sideways overflow without creating a scroll box.
       Do not use !important here: modal/sidebar inline overflow:hidden must
       continue to lock the page while an overlay is open. */
    @supports (overflow: clip) {
        html,
        body {
            overflow-x: clip;
            overflow-y: visible;
        }
    }

    html {
        overscroll-behavior-y: none;
    }

    .mobile-menu {
        position: fixed !important;
        inset: auto 0 0 0 !important;
        width: 100% !important;
        min-height: var(--mobile-menu-height);
        margin: 0 !important;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-sizing: border-box;
        transform: none !important;
    }

    .footer-part {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    /* Reserve only the real menu height so the footer text is not covered. */
    .footer-bottom {
        margin-bottom: 0 !important;
        padding-bottom: calc(var(--mobile-menu-height) + 20px + env(safe-area-inset-bottom, 0px)) !important;
    }
}
