/* Important declarations in this layer take precedence over the older
   unlayered visibility rules from the theme and Search. */
@layer kb-mobile-shortcuts {
    /* Mobile browse pages keep both controls inside the visible viewport. */
    body.kb-storefront.kb-floats > :is(#kb-search-fab, #kb-bbux-fab) {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        translate: none !important;
        transform: none !important;
        transition: none !important;
        animation: none !important;
        bottom: calc(16px + max(
            env(safe-area-inset-bottom, 0px),
            var(--kb-ui-viewport-gap, 0px),
            var(--kb-shortcuts-dock-offset, 0px)
        )) !important;
    }

    /* Hide for a visible modal or the on-screen keyboard. Focus alone can
       persist after iOS dismisses the keyboard. */
    body.kb-storefront.kb-floats:is(
        .kb-keyboard-visible,
        :has(
            dialog[open],
            .mfp-wrap.mfp-ready:not(.mfp-removing),
            #kb-bbux-drawer.open,
            .flatsome-cookies--active,
            [data-kb-search-page] .kb-search-filtering
        )
    ) > :is(#kb-search-fab, #kb-bbux-fab) {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}
