/* =============================================================================
 * splash.css -- the entry splash
 *
 * WHAT THIS IS FOR
 *
 * A splash exists to cover the gap between "the document has painted" and "the
 * app has decided whether to show the login form or a dashboard". Without a
 * cover, an authenticated user sees the login form flash before the session
 * check resolves. That flash is the bug this screen exists to remove.
 *
 * IT IS NOT A LOADING SCREEN
 *
 * It has no spinner and no fake progress, because both imply work is happening
 * on a timer. What actually happens is a round trip to /api/auth/session. The
 * honest thing to show is the brand, held until an answer arrives.
 *
 * ACCESSIBILITY
 *
 *   - aria-busy on the splash while the check is in flight, removed after.
 *   - The wordmark is a real heading, so a screen reader announces something
 *     meaningful during what is otherwise a silent transition.
 *   - Everything animates through CSS custom properties that the global
 *     prefers-reduced-motion block in base.css collapses, so the reduced-motion
 *     path needs no rule here at all. That is deliberate: an animation that has
 *     to be switched off in two places will eventually be switched off in one.
 *   - Under reduced motion the screen still appears and still waits; only the
 *     movement stops. Hiding it instead would change the sequence for a user who
 *     did not ask for a different sequence.
 * ========================================================================== */

.splash {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  gap: var(--space-6, 24px);
  align-content: center;
  text-align: center;
  padding: var(--space-8, 32px);

  /* The brand navy, matching --surface-nav, so the transition into the app is a
     change of content rather than a change of colour. */
  background: var(--brand-primary, #012F6C);
  color: #FFFFFF;

  /* Removed by removing the attribute, so JS controls the exit and the splash
     can never trap a user behind an overlay whose script failed to run. */
  transition: opacity 280ms ease;
}

.splash[hidden] {
  display: none;
}

.splash.is-leaving {
  opacity: 0;
  /* The element stays in the layout for the duration of the fade and is then
     hidden, rather than being removed immediately, so the fade is visible. */
  pointer-events: none;
}

.splash__mark {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  /* A gold ring rather than a filled disc: the mark itself is the subject and a
     plate behind it would compete with the wordmark. */
  box-shadow: 0 0 0 1px var(--brand-gold-ring, rgba(254, 170, 3, 0.38));
}

.splash__title {
  margin: 0;
  font-size: var(--text-h1, 26px);
  line-height: var(--lh-h1, 32px);
  font-weight: var(--weight-h1, 700);
  letter-spacing: -0.01em;
}

.splash__sub {
  margin: 0;
  font-size: var(--text-body-s, 13px);
  line-height: var(--lh-body-s, 19px);
  /* 70% white on the brand navy. Checked against #012F6C this is about 7:1, so
     it clears WCAG AA for body text rather than only for large text. */
  color: rgba(255, 255, 255, 0.78);
}

.splash__bar {
  width: 168px;
  height: 3px;
  margin: var(--space-2, 8px) auto 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.splash__bar::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-accent, #FEAA03);
  animation: splash-sweep 1100ms ease-in-out infinite;
}

@keyframes splash-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

/* The bar is the only motion on the screen, so it is the only thing that has to
   be suppressed. Kept local rather than global so a future animation on this
   screen is opted in explicitly instead of inheriting an accident. */
@media (prefers-reduced-motion: reduce) {
  .splash__bar::after {
    animation: none;
    width: 100%;
    opacity: 0.5;
  }
}
