/* ============================================================
   WOW PRELOADER — космическая заставка при загрузке
   ============================================================ */

.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0B132B;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.preloader.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Фоновое свечение */
.preloader::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(32,60,139,0.5), transparent 60%),
    radial-gradient(ellipse at 30% 70%, rgba(198,169,107,0.2), transparent 50%);
  animation: preloaderBgPulse 4s ease-in-out infinite;
}
@keyframes preloaderBgPulse {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}

/* Частицы вокруг — 12 звёздочек, разлетающиеся */
.preloader-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.preloader-particle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  background: #C6A96B;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(198,169,107,0.8);
  animation: particleBurst 3s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
@keyframes particleBurst {
  0%, 15% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
  }
  30% {
    opacity: 1;
    transform: translate(var(--tx), var(--ty)) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--tx) * 2), calc(var(--ty) * 2)) scale(0.3);
  }
}

.preloader-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  z-index: 2;
}

/* Главный элемент — мандала + ОМ внутри */
.preloader-mandala {
  position: relative;
  width: 180px;
  height: 180px;
  animation: mandalaReveal 2.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes mandalaReveal {
  0%   { opacity: 0; transform: scale(0.3) rotate(-60deg); }
  60%  { opacity: 1; transform: scale(1.05) rotate(0deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.preloader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(198,169,107,0.4);
}
.preloader-ring.r1 { animation: ringRotate 8s linear infinite; }
.preloader-ring.r2 {
  inset: 15px;
  border-color: rgba(198,169,107,0.3);
  border-style: dashed;
  animation: ringRotate 12s linear infinite reverse;
}
.preloader-ring.r3 {
  inset: 30px;
  border-color: rgba(32,60,139,0.5);
  animation: ringRotate 15s linear infinite;
}
@keyframes ringRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Треугольники Sri Yantra */
.preloader-yantra {
  position: absolute;
  inset: 40px;
  pointer-events: none;
  animation: yantraBreath 4s ease-in-out infinite;
}
@keyframes yantraBreath {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 0.9; }
}

/* Центральный солнечный диск с ОМ */
.preloader-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFE8A8, #E6CA8A 50%, #C6A96B 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Noto Sans Devanagari', serif;
  font-size: 2.2rem;
  color: #0B132B;
  box-shadow:
    0 0 40px 10px rgba(198,169,107,0.5),
    0 0 80px 25px rgba(230,202,138,0.3);
  animation: centerGlow 3s ease-in-out infinite;
}
@keyframes centerGlow {
  0%, 100% {
    box-shadow: 0 0 40px 10px rgba(198,169,107,0.5), 0 0 80px 25px rgba(230,202,138,0.3);
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    box-shadow: 0 0 60px 15px rgba(198,169,107,0.7), 0 0 120px 40px rgba(230,202,138,0.5);
    transform: translate(-50%, -50%) scale(1.06);
  }
}

/* Орбитальные точки вокруг центра */
.preloader-orbit-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  background: #C6A96B;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(198,169,107,0.8);
  transform-origin: 0 0;
}
.preloader-orbit-dot.d1 { animation: orbitOrbit1 4s linear infinite; }
.preloader-orbit-dot.d2 { animation: orbitOrbit2 6s linear infinite; background: #A8C5FF; box-shadow: 0 0 10px rgba(168,197,255,0.8); }
.preloader-orbit-dot.d3 { animation: orbitOrbit3 8s linear infinite; background: #FFD4C9; box-shadow: 0 0 10px rgba(255,212,201,0.8); }

@keyframes orbitOrbit1 {
  from { transform: rotate(0deg) translateX(55px) rotate(0deg); }
  to   { transform: rotate(360deg) translateX(55px) rotate(-360deg); }
}
@keyframes orbitOrbit2 {
  from { transform: rotate(0deg) translateX(70px) rotate(0deg); }
  to   { transform: rotate(-360deg) translateX(70px) rotate(360deg); }
}
@keyframes orbitOrbit3 {
  from { transform: rotate(0deg) translateX(85px) rotate(0deg); }
  to   { transform: rotate(360deg) translateX(85px) rotate(-360deg); }
}

/* Текст логотипа снизу */
.preloader-brand {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  color: #C6A96B;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  opacity: 0;
  animation: brandFadeIn 1s 1.5s forwards cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes brandFadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to   { opacity: 0.85; transform: translateY(0); }
}

.preloader-mantra {
  font-family: 'Noto Sans Devanagari', serif;
  font-size: 1.4rem;
  color: rgba(245,239,223,0.4);
  letter-spacing: 0.15em;
  opacity: 0;
  animation: brandFadeIn 1s 2s forwards cubic-bezier(0.22, 1, 0.36, 1);
  white-space: nowrap;
}

/* Прогресс-бар */
.preloader-progress {
  width: 220px;
  height: 2px;
  background: rgba(198,169,107,0.15);
  border-radius: 999px;
  overflow: hidden;
  opacity: 0;
  animation: brandFadeIn 0.8s 2.3s forwards;
}
.preloader-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #C6A96B, #E6CA8A, #C6A96B);
  background-size: 200% 100%;
  border-radius: 999px;
  width: 0%;
  animation: progressFill 2.4s 1.8s cubic-bezier(0.65, 0, 0.35, 1) forwards,
             progressShimmer 1.5s infinite linear;
}
@keyframes progressFill {
  from { width: 0%; }
  to   { width: 100%; }
}
@keyframes progressShimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* Лёгкий блик по экрану в финале */
.preloader-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(198,169,107,0.6), transparent 40%);
  opacity: 0;
  pointer-events: none;
}
.preloader.finishing .preloader-flash {
  animation: finalFlash 1s ease-out forwards;
}
@keyframes finalFlash {
  0%   { opacity: 0; transform: scale(0.5); }
  40%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.5); }
}

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .preloader { display: none !important; }
}

/* Мобильная адаптация */
@media (max-width: 480px) {
  .preloader-mandala { width: 140px; height: 140px; }
  .preloader-center { width: 60px; height: 60px; font-size: 1.7rem; }
  .preloader-brand { font-size: 0.95rem; }
  .preloader-mantra { font-size: 1.2rem; }
  .preloader-progress { width: 180px; }
}

/* Плавное появление body после preloader */
body {
  animation: bodyReveal 1.2s 2.2s ease-out both;
}
@keyframes bodyReveal {
  from { opacity: 0.4; filter: blur(8px); }
  to   { opacity: 1; filter: blur(0); }
}

/* Tagline в preloader */
.preloader-tagline {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.1rem;
  color: rgba(245,239,223,0.65);
  letter-spacing: 0.08em;
  margin-top: -0.5rem;
  opacity: 0;
  animation: brandFadeIn 0.9s 2.2s forwards cubic-bezier(0.22, 1, 0.36, 1);
}
