/* Scroll to top button — see catalog/view/javascript/scroll_to_top.js
 *
 * Sits right above the chat button (#carrotquest-fake-chat-button in common.js:
 * right 25px, bottom 50px, 60x60) and is centered on the same vertical axis.
 */

.scroll-to-top {
    --scroll-to-top-size: 44px;
    --chat-button-right: 25px;
    --chat-button-bottom: 50px;
    --chat-button-size: 60px;
    --gap-above-chat: 12px;

    position: fixed;
    right: calc(var(--chat-button-right) + (var(--chat-button-size) - var(--scroll-to-top-size)) / 2);
    bottom: calc(var(--chat-button-bottom) + var(--chat-button-size) + var(--gap-above-chat));
    z-index: 9998; /* chat button is 9999 */
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: var(--scroll-to-top-size);
    height: var(--scroll-to-top-size);
    margin: 0;
    padding: 0;
    color: var(--text-color-yellow);
    background: var(--bg-quaternary);
    border: var(--table-border-width, 1px) solid var(--border-color, rgba(255, 255, 255, .12));
    border-radius: 50%;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
    cursor: pointer;
    -webkit-appearance: none;
            appearance: none;
    -webkit-tap-highlight-color: transparent;

    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition:
        opacity .25s ease,
        transform .25s ease,
        background-color .3s ease,
        visibility 0s linear .25s;
}

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

.scroll-to-top__icon {
    width: 20px;
    height: 20px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 7.4l-6.3 6.3 1.4 1.4 4.9-4.9 4.9 4.9 1.4-1.4z'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 7.4l-6.3 6.3 1.4 1.4 4.9-4.9 4.9 4.9 1.4-1.4z'/%3E%3C/svg%3E") center / contain no-repeat;
    pointer-events: none;
}

.scroll-to-top:focus {
    outline: none;
}

.scroll-to-top:focus-visible {
    outline: 2px solid var(--text-color-yellow);
    outline-offset: 2px;
}

@media (hover: hover) {
    .scroll-to-top:hover {
        background: var(--bg-senary);
    }
}

@media (prefers-reduced-motion: reduce) {
    .scroll-to-top,
    .scroll-to-top.is-visible {
        transition-duration: 0s;
        transition-delay: 0s;
    }
}
