/* Navigation loader (see js/nav-loader.js). Colours follow the store theme or admin accent. */
.nav-loader {
  --nl-color: var(--c-secondary, var(--a-accent, #1f6f5c));
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
  visibility: hidden;
}
.nav-loader.is-active { visibility: visible; }

.nav-loader__bar {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  height: 3px;
  width: 0;
  background: var(--nl-color);
  box-shadow: 0 0 8px var(--nl-color);
  border-start-end-radius: 3px;
  border-end-end-radius: 3px;
}
.nav-loader.is-active .nav-loader__bar {
  animation: nav-loader-trickle 8s cubic-bezier(.08, .8, .2, 1) forwards;
}

.nav-loader__veil {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--c-background, var(--a-bg, #fff)) 55%, transparent);
  opacity: 0;
  transition: opacity .2s ease;
}
.nav-loader.is-slow .nav-loader__veil { opacity: 1; pointer-events: auto; cursor: progress; }

.nav-loader__spin {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--nl-color) 22%, transparent);
  border-top-color: var(--nl-color);
  animation: nav-loader-spin .7s linear infinite;
}

@keyframes nav-loader-trickle {
  0% { width: 0; }
  10% { width: 35%; }
  40% { width: 65%; }
  100% { width: 92%; }
}
@keyframes nav-loader-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .nav-loader.is-active .nav-loader__bar { animation: none; width: 100%; opacity: .7; }
  .nav-loader__spin { animation-duration: 1.6s; }
}
