/**
 * "Нагору" button created by assets/js/scroll-top.js.
 * A separate file, versioned by its modification time, so a cached style.css
 * never leaves the button unstyled.
 */
.scroll-top {
    position: fixed;
    right: 24px;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
    /* The white ring keeps the button visible over the green footer and handheld bar. */
    border: 2px solid #fff;
    border-radius: 50%;
    background-color: #128108;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s, background-color .2s ease;
}

.scroll-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity .2s ease, transform .2s ease, visibility 0s, background-color .2s ease;
}

.scroll-top:hover,
.scroll-top:focus-visible {
    background-color: #0d5f06;
    color: #fff;
}

.scroll-top:focus-visible {
    outline: 2px solid #000;
    outline-offset: 3px;
}

.scroll-top svg {
    display: block;
}

/* Phones: in the bottom-right corner, level with the floating search button
   (storefckarpaty_floating_bar()); above the floating buttons while that corner is
   taken: the cart button has something in it, or a product page's "Додати в
   кошик". The cart button is replaced on every cart change (a WooCommerce
   fragment), and :has() follows it without any script. */
@media (max-width: 767px) {
    .scroll-top {
        right: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        width: 44px;
        height: 44px;
    }

    body:has(.floating-bar--product) .scroll-top,
    body:has(.floating-bar__cart:not(.is-empty)) .scroll-top {
        bottom: calc(12px + 52px + 12px + env(safe-area-inset-bottom, 0px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .scroll-top,
    .scroll-top.is-visible {
        transform: none;
        transition: none;
    }
}

/* The page wrapper takes focus after "Нагору" so the next Tab starts at the top; no outline around the whole page. */
#page[tabindex="-1"]:focus {
    outline: none;
}
