/*
   The navigation progress bar (#271): a thin line along the top of the window while the next page is on its way.
   js/nav-progress.js shows it once an enhanced navigation, an enhanced form post or a full page load has taken
   longer than 150 ms, and finishes it when the page arrives. It is a child of <body>, outside every header, so the
   Android app (which hides the site's header) still shows it, and it draws in the brand's own --aq-primary, so the
   band site and the Realm each show theirs. Purely visual: it is hidden from screen readers.
*/
.nav-progress {
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    right: 0;
    left: 0;
    z-index: 2100;
    height: 3px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 200ms ease;
}

.nav-progress__bar {
    display: block;
    height: 100%;
    background: var(--aq-primary);
    box-shadow: var(--aq-accent-glow);
    transform: scaleX(0);
    transform-origin: 0 50%;
}

.nav-progress.is-active {
    opacity: 1;
}

/* Quick at first, then ever slower: it never reaches the end until the page is there. */
.nav-progress.is-active .nav-progress__bar {
    animation: nav-progress-grow 10s cubic-bezier(0.08, 0.7, 0.2, 1) forwards;
}

/* The page arrived: the line fills and fades away. */
.nav-progress.is-done {
    opacity: 0;
    transition-delay: 120ms;
}

.nav-progress.is-done .nav-progress__bar {
    transform: scaleX(1);
}

@keyframes nav-progress-grow {
    from {
        transform: scaleX(0.04);
    }

    to {
        transform: scaleX(0.92);
    }
}

/* Without motion: a still, full line while waiting, gone at once when the page is there. */
@media (prefers-reduced-motion: reduce) {
    .nav-progress,
    .nav-progress.is-done {
        transition: none;
    }

    .nav-progress.is-active .nav-progress__bar {
        animation: none;
        transform: scaleX(1);
    }
}
