/*
 * Splash screen shown while the app loads (#splash in index.html). Plain CSS in
 * its own file: it styles the page before the app's stylesheet arrives and passes
 * a strict Content-Security-Policy. src/lib/splash.ts fades it out once the first
 * page has rendered. Colours mirror the tokens in src/index.css; the theme comes
 * from public/theme-init.js, which runs first.
 */
#splash {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: grid;
  place-items: center;
  padding: 24px;
  background: oklch(0.982 0.003 215);
  color: oklch(0.205 0.008 215);
  font-family: "DM Sans Variable", "DM Sans", ui-sans-serif, system-ui, sans-serif;
  transition:
    opacity 0.2s ease-out,
    visibility 0.2s;
}

#splash[data-hidden] {
  opacity: 0;
  visibility: hidden;
}

.splash-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.splash-mark {
  display: block;
  width: 56px;
  height: 56px;
  color: oklch(0.51 0.1 204);
}

.splash-wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 0 0;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.01em;
}

/* "Inter" is set apart so the name never reads as IntraHealth. */
.splash-inter {
  font-weight: 600;
  color: oklch(0.51 0.1 204);
}

.splash-module {
  padding: 5px 7px;
  border-radius: 6px;
  background: oklch(0.97 0.016 200);
  color: oklch(0.44 0.085 205);
  font-size: 0.6em;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.splash-byline {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 14px 0 0;
  font-size: 14px;
  color: oklch(0.556 0.012 215);
}

/* The IVAS logo; its black letters are white in the dark-mode copy. */
.splash-ivas {
  display: block;
  width: auto;
  height: 22px;
}

.splash-ivas-on-dark {
  display: none;
}

.splash-progress {
  position: relative;
  overflow: hidden;
  width: 120px;
  height: 3px;
  margin-top: 32px;
  border-radius: 3px;
  background: oklch(0.922 0.006 215);
}

.splash-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  border-radius: inherit;
  background: oklch(0.51 0.1 204);
  animation: splash-slide 1.1s ease-in-out infinite;
}

.splash-noscript {
  max-width: 320px;
  margin: 32px 0 0;
  font-size: 14px;
}

.splash-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:root[data-theme="dark"] #splash {
  background: oklch(0.145 0.006 215);
  color: oklch(1 0 0);
}

:root[data-theme="dark"] .splash-inter {
  color: oklch(0.8 0.09 200);
}

:root[data-theme="dark"] .splash-module {
  background: oklch(0.7 0.11 201 / 0.1);
  color: oklch(0.8 0.09 200);
}

:root[data-theme="dark"] .splash-byline {
  color: oklch(0.708 0.011 215);
}

:root[data-theme="dark"] .splash-ivas-on-light {
  display: none;
}

:root[data-theme="dark"] .splash-ivas-on-dark {
  display: block;
}

:root[data-theme="dark"] .splash-progress {
  background: oklch(1 0 0 / 0.08);
}

:root[data-theme="dark"] .splash-progress::after {
  background: oklch(0.7 0.11 201);
}

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

@keyframes splash-pulse {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  #splash {
    transition: none;
  }

  .splash-progress::after {
    width: 100%;
    animation: splash-pulse 1.2s ease-in-out infinite alternate;
  }
}

/* Without JavaScript the app can't start: drop the progress bar, keep the message. */
@media (scripting: none) {
  .splash-progress {
    display: none;
  }
}
