/**
 * Nascar Amaxa — Back to top
 * Fixed, accessible control with subtle motion and brand colors.
 */

@media (max-width: 767px) {
    .nascar-back-to-top {
        display: none !important;
    }
}

.nascar-back-to-top {
    position: fixed;
    right: clamp(16px, 2.5vw, 32px);
    bottom: clamp(20px, 3vw, 36px);
    z-index: 90;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 50%;
    background-color: #e44261;
    color: #fff;
    box-shadow: 0 7px 20px rgba(228, 66, 97, 0.23);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(16px) scale(0.92);
    transition:
        opacity 280ms ease,
        visibility 280ms ease,
        transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
        background-color 240ms ease,
        color 240ms ease,
        box-shadow 240ms ease;
}

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

.nascar-back-to-top:hover {
    background-color: #fff;
    color: #e44261;
    box-shadow: 0 11px 28px rgba(228, 66, 97, 0.27);
    transform: translateY(-4px) scale(1.04);
}

.nascar-back-to-top__icon {
    display: block;
    transition: transform 240ms ease;
}

.nascar-back-to-top:hover .nascar-back-to-top__icon {
    transform: translateY(-3px);
}

.nascar-back-to-top:focus-visible {
    outline: 3px solid #072c73;
    outline-offset: 4px;
}

@media (max-width: 767px) {
    .nascar-back-to-top {
        width: 42px;
        height: 42px;
        right: 16px;
        bottom: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nascar-back-to-top,
    .nascar-back-to-top__icon {
        transition: none;
    }
}

/* Keep the fixed button inside the visual viewport, including narrow phones. */
@media (max-width: 767px) {
    .nascar-back-to-top {
        left: auto;
        right: max(12px, env(safe-area-inset-right));
        max-width: calc(100vw - 24px);
        transform-origin: center;
    }
}
