/* Back to top — CSS-only reveal via scroll-driven animations (public pages) */

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

.back-to-top {
    position: fixed;
    z-index: 1040;
    inset-block-end: 1.25rem;
    inset-inline-end: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 2.75rem;
    block-size: 2.75rem;
    border-radius: 999px;
    border: 1px solid #dd4814;
    background: #dd4814;
    color: #fff;
    box-shadow: 0 0.35rem 1rem rgba(0, 0, 0, 0.25);
    text-decoration: none;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.back-to-top:hover,
.back-to-top:focus,
.back-to-top:focus-visible {
    background: #dd4814;
    border-color: #dd4814;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 0.45rem 1.15rem rgba(0, 0, 0, 0.35);
    filter: brightness(1.08);
}

.back-to-top:focus-visible {
    outline: 2px solid #dd4814;
    outline-offset: 3px;
}

.back-to-top i {
    font-size: 1rem;
    line-height: 1;
}

@supports (animation-timeline: scroll()) {
    @keyframes back-to-top-reveal {
        from {
            opacity: 0;
            transform: translateY(0.6rem);
            pointer-events: none;
        }

        to {
            opacity: 1;
            transform: translateY(0);
            pointer-events: auto;
        }
    }

    .back-to-top {
        opacity: 0;
        transform: translateY(0.6rem);
        pointer-events: none;
        /* animation shorthand must come before animation-timeline */
        animation: back-to-top-reveal linear both;
        animation-timeline: scroll(root block);
        animation-range: 320px 480px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .back-to-top {
        animation: none;
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }
}
