/*
==========================================
STAYWILD
Back to Top
==========================================
*/


/* ======================================
   BUTTON
====================================== */

.sw-back-to-top {
    position: fixed;

    right: calc(28px + env(safe-area-inset-right, 0px));

    bottom: calc(28px + env(safe-area-inset-bottom, 0px));

    z-index: 80;

    display: flex;
    align-items: center;
    justify-content: center;

    box-sizing: border-box;

    width: 44px;
    height: 44px;

    margin: 0;
    padding: 0;

    border: 1px solid #CDB483;
    border-radius: 2px;

    background-color: #333334;
    color: #CDB483;

    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.14);

    cursor: pointer;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(10px);

    transition:
        opacity 200ms ease,
        visibility 200ms ease,
        transform 200ms ease,
        background-color 180ms ease,
        border-color 180ms ease,
        color 180ms ease;
}


/* ======================================
   DARK MODE
====================================== */

html[data-theme="dark"] .sw-back-to-top {
    background-color: #232421;
}


/* ======================================
   VISIBLE STATE
====================================== */

.sw-back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transform: translateY(0);
}


/* ======================================
   EXISTING SVG ARROW
====================================== */

.sw-back-to-top__icon {
    display: block;
    flex-shrink: 0;

    width: 16px;
    height: 16px;

    background-color: currentColor;

    -webkit-mask:
        url("/assets/icons/arrow.svg") center / contain no-repeat;

    mask:
        url("/assets/icons/arrow.svg") center / contain no-repeat;

}


/* ======================================
   HOVER
====================================== */

.sw-back-to-top:hover {
    background-color: #CDB483;
    border-color: #CDB483;
    color: #232421;
}

html[data-theme="dark"] .sw-back-to-top:hover {
    background-color: #CDB483;
    border-color: #CDB483;
    color: #232421;
}


/* ======================================
   KEYBOARD FOCUS
====================================== */

.sw-back-to-top:focus-visible {
    outline: 2px solid #CDB483;
    outline-offset: 4px;
}


/* ======================================
   COOKIE CONSENT
====================================== */

/*
 * The button remains inaccessible
 * while the consent dialog is active.
 */

body.cookie-consent-open .sw-back-to-top {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}


/* ======================================
   MOBILE
====================================== */

@media (max-width: 720px) {

    .sw-back-to-top {
        right: calc(20px + env(safe-area-inset-right, 0px));

        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }

}


/* ======================================
   REDUCED MOTION
====================================== */

@media (prefers-reduced-motion: reduce) {

    .sw-back-to-top {
        transition: none;
    }

}