/**
 * Экран загрузки SPA (#app-splash) до монтирования Vue.
 * --splash-load-duration — длина полосы (по умолчанию 4s; на слабом канале index.html ставит 2200ms).
 * Минимальное время до снятия сплэша после mount — getSplashMinMs() в src/main.ts.
 * transition opacity на #app-splash — см. SPLASH_FADE_MS в src/main.ts.
 */

:root {
  --splash-load-duration: 4000ms;
}

html {
  background: #000;
}

body {
  margin: 0;
  background: #000;
}

#app-splash {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: #000;
  font-family: Georgia, 'Times New Roman', serif;
  color: #978979;
  opacity: 1;
  transition: opacity 0.55s ease-out;
  will-change: opacity;
}

#app-splash.app-splash--fade-out {
  opacity: 0;
  pointer-events: none;
}

.app-splash__wrap {
  text-align: center;
  max-width: min(320px, 88vw);
  margin: 0 auto;
}

.app-splash__visual {
  width: min(220px, 72vw);
  height: auto;
  margin: 0 auto 28px;
  position: relative;
  filter: drop-shadow(0 0 28px rgba(108, 94, 79, 0.35));
  animation: grelka-splash-art-breathe 4s ease-in-out infinite;
}

.app-splash__art {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(220px, 50vh);
  object-fit: contain;
  vertical-align: middle;
}

.app-splash__title {
  font-size: 30px;
  letter-spacing: 2px;
}

.app-splash__atlas {
  font-size: 16px;
  margin-top: 6px;
  opacity: 0.7;
  letter-spacing: 4px;
}

.app-splash__tagline {
  font-size: 13px;
  opacity: 0.4;
  margin-top: 6px;
}

/* Блок «Загрузка» + полоса (длительность = --splash-load-duration) */
.app-splash__loading {
  margin-top: 22px;
}

.app-splash__loading-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(151, 137, 121, 0.55);
  margin-bottom: 10px;
}

.app-splash__load-track {
  position: relative;
  height: 2px;
  border-radius: 999px;
  background: rgba(151, 137, 121, 0.12);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(151, 137, 121, 0.06) inset;
}

.app-splash__load-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  border-radius: inherit;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    rgba(108, 94, 79, 0.95) 0%,
    rgba(151, 137, 121, 0.98) 45%,
    rgba(180, 168, 150, 1) 100%
  );
  /* Плавно: сначала медленнее, к концу быстрее (ease-in) */
  animation: app-splash-load-fill var(--splash-load-duration) cubic-bezier(0.42, 0, 0.78, 1) forwards;
}

.app-splash__load-fill::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 42%;
  left: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.22) 45%,
    rgba(255, 255, 255, 0.08) 70%,
    transparent 100%
  );
  animation: app-splash-load-sheen 2.2s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
  pointer-events: none;
}

.app-splash__load-edge {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  margin-right: -1px;
  border-radius: 1px;
  background: linear-gradient(
    180deg,
    rgba(255, 210, 190, 0.35) 0%,
    rgba(255, 230, 210, 0.95) 50%,
    rgba(255, 210, 190, 0.35) 100%
  );
  box-shadow: 0 0 10px rgba(255, 195, 160, 0.5);
  opacity: 0;
  animation: app-splash-load-edge-glow var(--splash-load-duration) cubic-bezier(0.42, 0, 0.78, 1) forwards;
}

@keyframes app-splash-load-fill {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes app-splash-load-sheen {
  0% {
    transform: translateX(-100%);
    opacity: 0.25;
  }
  50% {
    opacity: 0.55;
  }
  100% {
    transform: translateX(220%);
    opacity: 0.3;
  }
}

@keyframes app-splash-load-edge-glow {
  0% {
    opacity: 0;
  }
  12% {
    opacity: 0.85;
  }
  100% {
    opacity: 0.5;
  }
}

@keyframes grelka-splash-art-breathe {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 24px rgba(108, 94, 79, 0.28));
  }
  50% {
    transform: scale(1.04);
    filter: drop-shadow(0 0 40px rgba(151, 137, 121, 0.45));
  }
}
