/**
 * Floating back-to-top control.
 */

.atlas-back-to-top {
    position: fixed;
    right: max(var(--atlas-back-to-top-right, 14px), env(safe-area-inset-right));
    bottom: calc(20px + env(safe-area-inset-bottom));
    z-index: 92;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--atlas-back-to-top-size, 68px);
    height: var(--atlas-back-to-top-size, 68px);
    min-width: var(--atlas-back-to-top-size, 68px);
    min-height: var(--atlas-back-to-top-size, 68px);
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.88);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition:
        opacity 0.24s ease,
        transform 0.24s ease,
        visibility 0.24s ease,
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.atlas-back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.atlas-back-to-top:hover,
.atlas-back-to-top:focus-visible {
    background: rgba(34, 197, 94, 0.95);
    border-color: rgba(96, 165, 250, 0.55);
    outline: none;
}

.atlas-back-to-top__label {
    display: block;
}

/* Image mode: no extra frame — the uploaded asset fills the hit area */
.atlas-back-to-top--image {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    overflow: visible;
}

.atlas-back-to-top--image:hover,
.atlas-back-to-top--image:focus-visible {
    background: transparent;
    border-color: transparent;
}

.atlas-back-to-top--image.is-visible:hover,
.atlas-back-to-top--image.is-visible:focus-visible {
    transform: translateY(-2px);
}

.atlas-back-to-top__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 999px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
    pointer-events: none;
}

.atlas-back-to-top--image:hover .atlas-back-to-top__image,
.atlas-back-to-top--image:focus-visible .atlas-back-to-top__image {
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.28);
}

body.light-mode .atlas-back-to-top {
    background: rgba(255, 255, 255, 0.94);
    color: #0f172a;
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

body.light-mode .atlas-back-to-top:hover,
body.light-mode .atlas-back-to-top:focus-visible {
    color: #fff;
}

body.light-mode .atlas-back-to-top--image {
    background: transparent;
    box-shadow: none;
}

body.light-mode .atlas-back-to-top__image {
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
}

body.atlas-mobile-first .atlas-back-to-top {
    bottom: calc(var(--mobile-nav-height) + 16px + env(safe-area-inset-bottom));
}

body.atlas-mobile-first.single-apps .atlas-back-to-top {
    bottom: calc(
        var(--mobile-nav-height) + var(--app-detail-sticky-height, 58px) + 72px + env(safe-area-inset-bottom)
    );
}

@media (min-width: 961px) {
    body.single-apps .atlas-back-to-top {
        bottom: calc(24px + env(safe-area-inset-bottom));
    }
}
