/*
  BOOT SPLASH (residence only)

  Markup lives in index.html; this file styles it. It paints before the JS bundle and the theme CSS
  load, so colors are literal values here rather than theme tokens. src/app/app-splash.ts fades it
  out once the session restore resolves. Served from public/ (not bundled) and precached by the
  service worker as part of the static shell.
*/

#app-splash {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  overflow: hidden;
  background: linear-gradient(#b7c5d4, #887f76 60%, #272422);
  transition: opacity 400ms ease;
  /* Failsafe without JS: if the app never starts, hide the splash after 15s. */
  animation: app-splash-failsafe 0s linear 15s forwards;
}

#app-splash.is-leaving {
  opacity: 0;
  pointer-events: none;
}

/* Wide screens: a blurred copy fills the sides around the portrait frame. */
.app-splash__backdrop {
  position: absolute;
  inset: -40px;
  background: url("/splash/splash-building.webp") center / cover no-repeat;
  filter: blur(28px) brightness(0.7);
}

.app-splash__frame {
  position: absolute;
  inset: 0;
  width: min(100vw, calc(100dvh * 768 / 1376));
  margin-inline: auto;
  overflow: hidden;
}

.app-splash__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  animation: app-splash-zoom 9s ease-out forwards;
}

.app-splash__content {
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  padding: 96px 24px calc(56px + env(safe-area-inset-bottom));
  text-align: center;
  color: #ffffff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(to top, rgba(12, 14, 18, 0.88), rgba(12, 14, 18, 0.55) 55%, transparent);
}

.app-splash__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding-block: 8px;
  padding-inline: 8px 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(11, 23, 38, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.app-splash__logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.app-splash__tagline {
  margin: 16px 0 0;
  font-size: 17px;
  line-height: 1.5;
  opacity: 0.9;
}

.app-splash__progress {
  position: relative;
  width: 160px;
  height: 4px;
  margin: 28px auto 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.app-splash__progress span {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2dd4bf, #4ade80, #38bdf8);
  animation: app-splash-progress 1.4s ease-in-out infinite;
}

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

/* The screen-reader label follows the language bootstrapped in index.html. */
html:not([lang="en"]) .app-splash__sr[lang="en"],
html[lang="en"] .app-splash__sr[lang="he"] {
  display: none;
}

@keyframes app-splash-zoom {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.06);
  }
}

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

@keyframes app-splash-failsafe {
  to {
    visibility: hidden;
    pointer-events: none;
  }
}

@media (max-height: 700px) {
  .app-splash__content {
    padding: 72px 16px calc(36px + env(safe-area-inset-bottom));
  }
  .app-splash__brand {
    font-size: 22px;
  }
  .app-splash__logo {
    width: 40px;
    height: 40px;
  }
  .app-splash__tagline {
    margin-top: 12px;
    font-size: 15px;
  }
  .app-splash__progress {
    margin-top: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-splash__image,
  .app-splash__progress span {
    animation: none;
  }
  .app-splash__progress span {
    width: 100%;
    opacity: 0.6;
  }
  #app-splash {
    transition: none;
  }
}
