/* =============================================================================
   BOOTHACK COMPONENT — BACK TO TOP
============================================================================= */

#back-to-top.back-to-top {
    position: fixed !important;
    bottom: 25px;
    right: 25px;
    left: auto;
    margin: 0 !important;
    float: none !important;
    clear: none !important;

    /* Hidden State */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px);

    /* Smooth Animation */
    transition: 
        opacity .3s ease, 
        transform .3s ease, 
        visibility .3s ease,
        background-color .2s ease, 
        border-color .2s ease, 
        color .2s ease;

    z-index: 1050; /* Safely clears fixed navbars and offcanvas backdrops */

    /* Shape formatting (Overrides Bootstrap's default rectangular btn-lg) */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    padding: 0;
}

/* =============================================================================
   JAVASCRIPT TOGGLE STATE
============================================================================= */

#back-to-top.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

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

@media (max-width: 767.98px) {
    #back-to-top.back-to-top {
        bottom: 15px;
        right: 15px;
        width: 3rem;
        height: 3rem;
    }
}

/* Defensive lock for singular mobile where third-party styles can alter flow. */
@media (max-width: 767.98px) {
    body.single #back-to-top.back-to-top {
        position: fixed !important;
        margin: 0 !important;
    }
}

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

@media (prefers-reduced-motion: reduce) {
    #back-to-top.back-to-top {
        transition: opacity 0.2s ease, visibility 0.2s ease !important;
        transform: none !important;
    }
}