/*
 * Spinner shown over a link or button right after it is tapped, until the next page
 * replaces it. Toggled by static/js/fm_nav_loading.js (class .fm-nav-loading).
 */
@keyframes fm-nav-spin {
    to {
        transform: rotate(360deg);
    }
}

.fm-nav-loading {
    position: relative;
    pointer-events: none;
    cursor: progress;
}

.fm-nav-loading::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: inherit;
    background: rgba(2, 6, 23, 0.55);
}

.fm-nav-loading::after {
    content: "";
    position: absolute;
    z-index: 3;
    top: 50%;
    left: 50%;
    width: 1.25rem;
    height: 1.25rem;
    margin: -0.625rem 0 0 -0.625rem;
    box-sizing: border-box;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #f97316;
    border-radius: 9999px;
    animation: fm-nav-spin 0.7s linear infinite;
}

/* Bottom tab bar: the spinner takes the icon's place instead of dimming the whole tab.
 * Item padding-top is 0.25rem and the icon is 1.5rem, so the icon center is at 1rem;
 * a 1.25rem spinner centered there starts at 0.375rem. */
.fm-bottom-nav__item.fm-nav-loading::before {
    display: none;
}

.fm-bottom-nav__item.fm-nav-loading::after {
    top: 0.375rem;
    left: 50%;
    margin: 0 0 0 -0.625rem;
    /* Keep the spin animation from fighting the centering transform. */
    transform-origin: center;
}

.fm-bottom-nav__item.fm-nav-loading .fm-bottom-nav__icon {
    opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
    .fm-nav-loading::after {
        animation-duration: 2s;
    }
}
