/* ===================================
   Animations & Effects
   =================================== */

/* --- Page Load Fade In --- */
.page-transition {
  animation: fadeInPage 0.6s ease forwards;
}

@keyframes fadeInPage {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Preloader Om Glow --- */
.preloader-om {
  animation: omGlow 2s ease-in-out infinite;
}

@keyframes omGlow {
  0%, 100% {
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.5), 0 0 40px rgba(212, 175, 55, 0.3);
    transform: scale(1);
  }
  50% {
    text-shadow: 0 0 40px rgba(212, 175, 55, 0.8), 0 0 80px rgba(212, 175, 55, 0.5), 0 0 120px rgba(212, 175, 55, 0.3);
    transform: scale(1.05);
  }
}

/* --- Preloader Dots --- */
.preloader-dots {
  display: flex;
  gap: 8px;
  margin-top: 25px;
}

.preloader-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotPulse 1.4s ease-in-out infinite;
}

.preloader-dots span:nth-child(2) { animation-delay: 0.2s; }
.preloader-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

/* --- Divine Glow (Deity Images) --- */
.divine-glow {
  position: relative;
  transition: all 0.4s ease;
}

.divine-glow::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: inherit;
  background: linear-gradient(45deg, var(--accent), var(--primary), var(--accent));
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: divineRotate 3s linear infinite;
  background-size: 200% 200%;
}

.divine-glow:hover::after {
  opacity: 1;
}

@keyframes divineRotate {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- Diya Flame --- */
.diya-container {
  position: relative;
  display: inline-block;
}

.diya-flame {
  width: 20px;
  height: 30px;
  background: linear-gradient(to top, #ff6600, #ffcc00, transparent);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  position: relative;
  animation: flameFlicker 0.8s ease-in-out infinite alternate;
  filter: blur(1px);
}

.diya-flame::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 18px;
  background: linear-gradient(to top, #ff9900, #ffff00, transparent);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
}

@keyframes flameFlicker {
  0% { transform: scaleX(1) scaleY(1) rotate(-2deg); }
  25% { transform: scaleX(0.95) scaleY(1.05) rotate(1deg); }
  50% { transform: scaleX(1.02) scaleY(0.98) rotate(-1deg); }
  75% { transform: scaleX(0.97) scaleY(1.03) rotate(2deg); }
  100% { transform: scaleX(1) scaleY(1) rotate(0deg); }
}

.diya-base {
  width: 40px;
  height: 12px;
  background: linear-gradient(to bottom, var(--accent), #b8942e);
  border-radius: 0 0 50% 50%;
  margin-top: -2px;
}

.diya-glow {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, rgba(255, 200, 50, 0.4), transparent 70%);
  border-radius: 50%;
  animation: glowPulse 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.6; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.2); }
}

/* --- Shimmer Border --- */
.shimmer-border {
  position: relative;
  overflow: hidden;
}

.shimmer-border::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(212, 175, 55, 0.15),
    transparent
  );
  animation: shimmerSlide 3s ease-in-out infinite;
  z-index: 1;
  pointer-events: none;
}

@keyframes shimmerSlide {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* --- Text Shimmer (Hero Heading) --- */
.text-shimmer {
  background: linear-gradient(
    90deg,
    var(--white) 0%,
    var(--accent) 25%,
    var(--white) 50%,
    var(--accent) 75%,
    var(--white) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: textShimmer 4s linear infinite;
}

@keyframes textShimmer {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* --- Floating Animation --- */
.float {
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* --- Pulse Ring --- */
.pulse-ring {
  position: relative;
}

.pulse-ring::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border: 2px solid var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: pulseRing 2s ease-out infinite;
}

@keyframes pulseRing {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* --- Rotate Slow (for Om, mandala) --- */
.rotate-slow {
  animation: rotateSlow 20s linear infinite;
}

@keyframes rotateSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* --- Scale In --- */
.scale-in {
  animation: scaleIn 0.5s ease forwards;
}

@keyframes scaleIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* --- Slide Up --- */
.slide-up {
  animation: slideUp 0.6s ease forwards;
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* --- Badge Bounce --- */
.badge-bounce {
  animation: badgeBounce 2s ease-in-out infinite;
}

@keyframes badgeBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* --- Card Hover Lift (enhanced) --- */
.card-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

/* --- Nav Link Underline Animation --- */
.nav-underline {
  position: relative;
}

.nav-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s ease;
}

.nav-underline:hover::after {
  width: 100%;
}

/* --- Golden Border Glow (for featured items) --- */
.gold-border-glow {
  border: 2px solid var(--accent);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
  transition: box-shadow 0.3s ease;
}

.gold-border-glow:hover {
  box-shadow: 0 0 25px rgba(212, 175, 55, 0.4), 0 0 50px rgba(212, 175, 55, 0.15);
}

/* --- Gradient Border --- */
.gradient-border {
  position: relative;
  border: none;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

/* --- Stagger children animations --- */
.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 100ms; }
.stagger-children > *:nth-child(3) { animation-delay: 200ms; }
.stagger-children > *:nth-child(4) { animation-delay: 300ms; }
.stagger-children > *:nth-child(5) { animation-delay: 400ms; }
.stagger-children > *:nth-child(6) { animation-delay: 500ms; }
.stagger-children > *:nth-child(7) { animation-delay: 600ms; }
.stagger-children > *:nth-child(8) { animation-delay: 700ms; }
.stagger-children > *:nth-child(9) { animation-delay: 800ms; }

/* --- Accessibility: Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .preloader-om,
  .diya-flame,
  .text-shimmer,
  .shimmer-border::before,
  .float,
  .rotate-slow {
    animation: none !important;
  }

  .text-shimmer {
    -webkit-text-fill-color: var(--white);
  }
}
