/* The mobile date sheet is the reference: full width, bottom edge, 20px corners,
   a 280ms upward entrance, and scrolling inside the visible viewport. */
@media (max-width: 767.98px) {
    /* Let the shared observer set the bottom edge before an older center/scale
       animation can run. Hidden states and existing open/close handlers stay intact. */
    body.site-shell :is(dialog[open], .complex-about-dialog.is-open, .all-reviews-sheet:not([hidden])):not([data-public-sheet-panel]) {
        animation: none !important;
    }
    body.site-shell [data-public-sheet-root="backdrop"],
    body.site-shell .modal {
        position: fixed !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        padding: 8px 0 0 !important;
        overflow: hidden !important;
        box-sizing: border-box;
        animation: none !important;
        transform: none !important;
        translate: none !important;
    }

    body.site-shell [data-public-sheet-panel],
    body.site-shell .modal > .modal-dialog {
        flex: 0 1 auto !important;
        min-width: 0 !important;
        min-height: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: calc(100vh - 8px) !important;
        max-height: calc(100dvh - 8px) !important;
        margin: 0 !important;
        border-radius: 20px 20px 0 0 !important;
        box-sizing: border-box;
        overscroll-behavior-y: contain;
        overflow-y: auto;
        translate: none !important;
        transform: none;
        animation: public-mobile-sheet-in 280ms ease both !important;
        scroll-padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    }

    body.site-shell [data-public-sheet-panel]:not(.modal-dialog) {
        padding-bottom: calc(var(--public-sheet-padding-bottom, 0px) + env(safe-area-inset-bottom, 0px));
    }

    body.site-shell [data-public-sheet-root="backdrop"] > [data-public-sheet-panel],
    body.site-shell .modal > .modal-dialog {
        position: absolute !important;
        inset: auto 0 0 !important;
    }

    body.site-shell [data-public-sheet-root="panel"] {
        position: fixed !important;
        inset: auto 0 0 !important;
    }

    body.site-shell .modal [data-public-sheet-panel]::before { display: none !important; }
    body.site-shell [data-public-sheet-panel] > .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 0 !important;
        max-height: inherit;
        border-radius: inherit !important;
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    body.site-shell [data-public-sheet-panel] .modal-body { min-height: 0; overflow-y: auto; }
    body.site-shell [data-public-sheet-panel] :is(.modal-header, .modal-footer) { flex-shrink: 0; }

    /* Bootstrap waits for its dialog's transition before accepting dismissal.
       Prepare its closed position before show(), and use one transition rather
       than combining it with an independently timed entrance animation. */
    body.site-shell .modal.fade > .modal-dialog {
        animation: none !important;
        transform: translateY(105%) !important;
        transition: transform 280ms ease !important;
    }
    body.site-shell .modal.fade.show > .modal-dialog { transform: translateY(0) !important; }

    @keyframes public-mobile-sheet-in {
        from { transform: translateY(105%); }
        to { transform: translateY(0); }
    }
}

@media (max-width: 767.98px) and (prefers-reduced-motion: reduce) {
    body.site-shell [data-public-sheet-panel] { animation: none !important; transition: none !important; }
    body.site-shell .modal.fade > .modal-dialog { transition: none !important; }
}
