/* The pre-React loading indicator, shared by index.html (first paint, before any script has
   run) and src/app/bootstrap/PendingScreen.tsx. It is a plain same-origin stylesheet, served
   from public/assets/ because the deployed gateway only routes /assets/* (plus _session.html
   and env.json) to static storage (Charts/cdn/templates/virtualservice.yml) — index.css is
   bundled and arrives with the scripts instead, and a strict CSP blocks inline styles. Keep it
   dependency free. The colours are the UXT theme's page backgrounds (light and dark) so the
   hand-off to the themed app does not flash. */

:root {
  color-scheme: light dark;
  --boot-bg: #ffffff;
  --boot-bar: #5a6473;
}

@media (prefers-color-scheme: dark) {
  :root {
    --boot-bg: #1a1a1f;
    --boot-bar: #a3acbb;
  }
}

body {
  background: var(--boot-bg);
}

/* Invisible for the first 400 ms so a fast load shows nothing, then fades in. The
   PendingScreen variant waits less: the page has already been up for a while by then. */
.boot-pending {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  overflow: hidden;
  opacity: 0;
  animation: boot-pending-fade 200ms ease-out 400ms forwards;
}

.boot-pending--resumed {
  animation-delay: 150ms;
}

.boot-pending__bar {
  width: 40%;
  height: 100%;
  background: var(--boot-bar);
  animation: boot-pending-slide 1.4s ease-in-out infinite;
}

@keyframes boot-pending-fade {
  to {
    opacity: 1;
  }
}

@keyframes boot-pending-slide {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(250%);
  }
}

/* Forced colours (Windows contrast themes) replaces background colours with the system
   palette, which would turn the bar into the page's own Canvas colour. Opt the bar alone out
   of that and paint it in the user's text colour. */
@media (forced-colors: active) {
  .boot-pending__bar {
    forced-color-adjust: none;
    background: CanvasText;
  }
}

@media (prefers-reduced-motion: reduce) {
  .boot-pending__bar {
    /* Full width and fully opaque: at 50% opacity this fell below the 3:1 contrast
       minimum for a graphical indicator (WCAG 1.4.11) in both themes. */
    width: 100%;
    animation: none;
  }
}
