/* Splash screen, loaded from index.html (not from src) so it shows before the JS bundle is downloaded.
   Markup: #app-splash in index.html, driven by src/layouts/SplashScreen/SplashScreen.tsx */

/* Same URLs as src/index.css, so each font is downloaded only once.
   "block" here: the splash text waits for the (preloaded) font instead of flashing a fallback font */
@font-face {
  font-family: 'Unbounded';
  src: url('/fonts/Unbounded-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: block;
}

@font-face {
  font-family: 'Poppins';
  src: url('/fonts/Poppins-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: 'Poppins';
  src: url('/fonts/Poppins-Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: block;
}

.app-splash {
  position: fixed;
  inset: 0;
  z-index: 200000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;

  color: #ffffff;
  background-color: #070c22;
  font-family: 'Poppins', system-ui, sans-serif;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.app-splash.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-splash__panel {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
  width: min(340px, 100%);
}

/* ----- Brand: letterhead style ----- */
.app-splash__brand {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

/* White plate follows the oval of the NPE logo itself */
.app-splash__mark {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 104px;
  aspect-ratio: 4 / 3;
  padding: 7px;
  background-color: #ffffff;
  border-radius: 50%;
  animation: app-splash-stamp 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.25) both;
}

.app-splash__mark img {
  display: block;
  width: 100%;
  height: auto;
}

.app-splash__rule {
  flex-shrink: 0;
  width: 3px;
  height: 54px;
  background-color: #FBC848;
  border-radius: 2px;
  transform-origin: top;
  animation: app-splash-rule 0.45s 0.2s ease-out both;
}

.app-splash__name {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  animation: app-splash-in 0.45s 0.3s ease-out both;
}

.app-splash__name strong {
  font-family: 'Unbounded', system-ui, sans-serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
}

.app-splash__name small {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}

/* ----- Progress: one segment per real loading step ----- */
.app-splash__steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
  animation: app-splash-in 0.45s 0.45s ease-out both;
}

.app-splash__step {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  transition: color 0.3s ease;
}

.app-splash__track {
  position: relative;
  height: 3px;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

.app-splash__track::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: #FBC848;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s ease-out;
}

.app-splash__step.is-active {
  color: #ffffff;
}

.app-splash__step.is-active .app-splash__track::after {
  width: 35%;
  transform: none;
  animation: app-splash-scan 1.1s ease-in-out infinite;
}

.app-splash__step.is-done {
  color: #FBC848;
}

.app-splash__step.is-done .app-splash__track::after {
  transform: scaleX(1);
}

.app-splash__status {
  min-height: 1.2em;
  margin: -1.4rem 0 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  animation: app-splash-in 0.45s 0.45s ease-out both;
}

@keyframes app-splash-stamp {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes app-splash-rule {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

@keyframes app-splash-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes app-splash-scan {
  from { left: -35%; }
  to { left: 100%; }
}

/* ----- Installed app (PWA): continue from the OS launch screen -----
   splash.js adds .is-handoff and the offset to the screen center. The logo starts centered at the size of the
   OS / iOS launch image (plate 104px + 2 x 7px padding = 118px, x 1.15 = 136px),
   then slides into place; the rest follows after it lands. */
.app-splash.is-handoff .app-splash__mark {
  animation: app-splash-handoff 0.75s 0.15s cubic-bezier(0.65, 0, 0.35, 1) both;
}

.app-splash.is-handoff .app-splash__rule {
  animation-delay: 0.8s;
}

.app-splash.is-handoff .app-splash__name {
  animation-delay: 0.9s;
}

.app-splash.is-handoff .app-splash__steps,
.app-splash.is-handoff .app-splash__status {
  animation-delay: 1.05s;
}

@keyframes app-splash-handoff {
  from { transform: translate(var(--handoff-x, 0), var(--handoff-y, 0)) scale(1.15); }
  to { transform: none; }
}

@media (max-width: 380px) {
  .app-splash__mark { width: 84px; }
  .app-splash__name strong { font-size: 1.6rem; }
  .app-splash__name small { letter-spacing: 0.22em; }
}

@media (prefers-reduced-motion: reduce) {
  .app-splash__mark,
  .app-splash.is-handoff .app-splash__mark,
  .app-splash__rule,
  .app-splash__name,
  .app-splash__steps,
  .app-splash__status {
    animation: none;
  }

  .app-splash__step.is-active .app-splash__track::after {
    width: 100%;
    opacity: 0.5;
    animation: none;
  }
}
