/* 1. DESIGN TOKENS */
:root, body.theme-midnight {
  --premium-bg: radial-gradient(ellipse at top, #1a1033 0%, #0d0d1a 40%, #050510 100%);
  --premium-surface: rgba(255, 255, 255, 0.04);
  --premium-surface-hover: rgba(255, 255, 255, 0.08);
  --premium-border: rgba(255, 255, 255, 0.08);
  --premium-border-hover: rgba(255, 255, 255, 0.15);
  --premium-glow: rgba(245, 158, 11, 0.15);
  --premium-glow-strong: rgba(245, 158, 11, 0.3);
  --premium-accent: #f59e0b;
  --premium-accent-2: #fb923c;
  --premium-text: #f0f0f5;
  --premium-text-muted: #9ca3af;
  --premium-radius: 16px;
  --premium-radius-sm: 10px;
  --premium-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --premium-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.5);
}

body.theme-sunrise {
  --premium-bg: radial-gradient(ellipse at top, #431407 0%, #1c0602 40%, #0a0200 100%);
  --premium-accent: #fbbf24;
  --premium-accent-2: #f59e0b;
  --premium-text: #fef3c7;
  --premium-text-muted: #d6d3d1;
  --premium-glow: rgba(251, 191, 36, 0.15);
  --premium-glow-strong: rgba(251, 191, 36, 0.3);
}

body.theme-lotus {
  --premium-bg: radial-gradient(ellipse at top, #3b0726 0%, #1a0311 40%, #0a0106 100%);
  --premium-accent: #f472b6;
  --premium-accent-2: #fb7185;
  --premium-text: #fdf2f8;
  --premium-text-muted: #fbcfe8;
  --premium-glow: rgba(244, 114, 182, 0.15);
  --premium-glow-strong: rgba(244, 114, 182, 0.3);
}

body.theme-temple {
  --premium-bg: radial-gradient(ellipse at top, #062b1a 0%, #02120a 40%, #010603 100%);
  --premium-accent: #34d399;
  --premium-accent-2: #10b981;
  --premium-text: #ecfdf5;
  --premium-text-muted: #a7f3d0;
  --premium-glow: rgba(52, 211, 153, 0.15);
  --premium-glow-strong: rgba(52, 211, 153, 0.3);
}

body.theme-classic {
  --premium-bg: radial-gradient(ellipse at top, #2d2417 0%, #141009 40%, #080603 100%);
  --premium-accent: #eab308;
  --premium-accent-2: #ca8a04;
  --premium-text: #fefce8;
  --premium-text-muted: #fef08a;
  --premium-glow: rgba(234, 179, 8, 0.15);
  --premium-glow-strong: rgba(234, 179, 8, 0.3);
}

/* 2. ANIMATED GRADIENT BACKGROUND */
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

body.premium-dark {
  background: var(--premium-bg) !important;
  background-size: 200% 200%;
  animation: gradientShift 20s ease infinite;
  color: var(--premium-text);
}

/* 3. FLOATING PARTICLES (CSS-only, lightweight) */
.particles {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.particle {
  position: absolute;
  width: 3px; height: 3px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.6), transparent);
  border-radius: 50%;
  animation: float linear infinite;
}
/* Generate 12 particles with different positions and timings */
.particle:nth-child(1) { left: 10%; animation-duration: 15s; animation-delay: 0s; top: 100%; }
.particle:nth-child(2) { left: 20%; animation-duration: 18s; animation-delay: 2s; top: 100%; width: 2px; height: 2px; }
.particle:nth-child(3) { left: 35%; animation-duration: 12s; animation-delay: 4s; top: 100%; }
.particle:nth-child(4) { left: 50%; animation-duration: 20s; animation-delay: 1s; top: 100%; width: 4px; height: 4px; }
.particle:nth-child(5) { left: 65%; animation-duration: 16s; animation-delay: 3s; top: 100%; }
.particle:nth-child(6) { left: 80%; animation-duration: 14s; animation-delay: 5s; top: 100%; width: 2px; height: 2px; }
.particle:nth-child(7) { left: 90%; animation-duration: 17s; animation-delay: 2.5s; top: 100%; }
.particle:nth-child(8) { left: 5%; animation-duration: 19s; animation-delay: 6s; top: 100%; width: 3px; height: 3px; }
.particle:nth-child(9) { left: 45%; animation-duration: 13s; animation-delay: 1.5s; top: 100%; }
.particle:nth-child(10) { left: 72%; animation-duration: 21s; animation-delay: 4.5s; top: 100%; width: 2px; height: 2px; }
.particle:nth-child(11) { left: 28%; animation-duration: 16s; animation-delay: 7s; top: 100%; }
.particle:nth-child(12) { left: 58%; animation-duration: 15s; animation-delay: 3.5s; top: 100%; width: 4px; height: 4px; }

@keyframes float {
  0% { transform: translateY(0) translateX(0) scale(0); opacity: 0; }
  10% { opacity: 1; transform: translateY(-10vh) translateX(5px) scale(1); }
  90% { opacity: 0.6; }
  100% { transform: translateY(-110vh) translateX(-10px) scale(0.5); opacity: 0; }
}

/* 4. ANIMATED GRADIENT TEXT */
.gradient-text {
  background: linear-gradient(135deg, var(--premium-accent), var(--premium-accent-2), var(--premium-accent));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 3s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 200% center; }
}

/* 5. GLASSMORPHISM DEITY CARDS */
.deity-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px;
  transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  text-decoration: none;
  color: var(--premium-text);
  border: none !important;
}

.deity-card:hover {
  transform: translateY(-6px) scale(1.03);
}

.deity-card:active {
  transform: translateY(-2px) scale(0.98);
  transition-duration: 0.1s;
}

.deity-card img {
  border-radius: 50%;
  object-fit: cover;
  transition: transform 0.35s ease, filter 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border: 2px solid var(--premium-border);
}

.deity-card:hover img {
  transform: scale(1.08);
  filter: brightness(1.1);
  box-shadow: 0 16px 40px var(--premium-glow), 0 0 0 3px var(--premium-glow-strong);
  border-color: transparent;
}

.deity-name {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--premium-text);
  opacity: 0.9;
  letter-spacing: 0.01em;
}

.deity-name-en {
  display: block;
  font-size: 0.68rem;
  font-weight: 400;
  opacity: 0.6;
  margin-top: 2px;
  letter-spacing: 0.03em;
}

/* 6. STAGGERED GRID ENTRY ANIMATION */
@keyframes cardEntry {
  0% { opacity: 0; transform: translateY(30px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.chalisa-grid .deity-card {
  opacity: 0;
  animation: cardEntry 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.chalisa-grid .deity-card:nth-child(1) { animation-delay: 0.05s; }
.chalisa-grid .deity-card:nth-child(2) { animation-delay: 0.1s; }
.chalisa-grid .deity-card:nth-child(3) { animation-delay: 0.15s; }
.chalisa-grid .deity-card:nth-child(4) { animation-delay: 0.2s; }
.chalisa-grid .deity-card:nth-child(5) { animation-delay: 0.25s; }
.chalisa-grid .deity-card:nth-child(6) { animation-delay: 0.3s; }
.chalisa-grid .deity-card:nth-child(7) { animation-delay: 0.35s; }
.chalisa-grid .deity-card:nth-child(8) { animation-delay: 0.4s; }
.chalisa-grid .deity-card:nth-child(9) { animation-delay: 0.45s; }
.chalisa-grid .deity-card:nth-child(10) { animation-delay: 0.5s; }

/* 7. PAGE ENTRY ANIMATION */
@keyframes pageEntry {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

.premium-dark #wrapper {
  animation: pageEntry 0.8s ease-out forwards;
}

/* 8. PREMIUM HEADER STYLING */
.premium-dark #header {
  position: relative;
}

.premium-dark #header h1 {
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.premium-dark #header .logo img {
  filter: drop-shadow(0 0 20px var(--premium-glow-strong));
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 20px var(--premium-glow-strong)); transform: scale(1); }
  50% { filter: drop-shadow(0 0 30px var(--premium-glow-strong)); transform: scale(1.03); }
}

/* 9. OM DIVIDER */
.om-divider {
  text-align: center;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  padding: 8px 0 4px;
  opacity: 0.5;
  color: var(--premium-accent);
  text-shadow: 0 0 20px var(--premium-glow-strong);
  user-select: none;
  letter-spacing: 16px;
}

/* 10. PREMIUM SECTION TITLE */
.section-title {
  text-align: center;
  margin-bottom: 20px;
}
.section-title h2 {
  font-size: clamp(1.4rem, 3vw, 2rem) !important;
  font-weight: 700;
  margin-bottom: 4px;
}

/* 11. SUBPAGE PREMIUM STYLES */
.premium-dark .header {
  background: rgba(10, 10, 26, 0.85) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--premium-glow);
  position: relative;
}

.premium-dark .header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--premium-accent), transparent);
  animation: headerGlow 3s ease-in-out infinite;
}

@keyframes headerGlow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.premium-dark .hero img {
  border: 1px solid var(--premium-glow);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 60px var(--premium-glow);
  transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.premium-dark .hero img:hover {
  transform: scale(1.02);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.6), 0 0 80px var(--premium-glow-strong);
}

.premium-dark .content,
.premium-dark .subpage-content {
  background: rgba(15, 15, 30, 0.7) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--premium-glow);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 var(--premium-surface);
}

.premium-dark .content h2 {
  color: var(--premium-accent) !important;
}

.premium-dark .footer,
.premium-dark .subpage-footer {
  color: var(--premium-text-muted);
  font-size: 0.95rem;
  padding: 24px 16px 32px;
  text-align: center;
  width: 100%;
}

/* Subpage entry animation */
.premium-dark .hero {
  animation: pageEntry 0.6s ease-out 0.1s both;
}
.premium-dark .content,
.premium-dark .subpage-content {
  animation: pageEntry 0.6s ease-out 0.2s both;
}

/* 12. SCROLL TO TOP BUTTON */
.scroll-top-btn {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--premium-glow);
  border: 1px solid var(--premium-glow-strong);
  backdrop-filter: blur(8px);
  color: var(--premium-accent);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 100;
}
.scroll-top-btn.visible {
  opacity: 1; visibility: visible;
  transform: translateY(0);
}
.scroll-top-btn:hover {
  background: var(--premium-glow-strong);
  transform: translateY(-3px);
}

/* 13. PREMIUM PANCHANG CARDS */
.premium-dark #panchang .panchang-meta-item,
.premium-dark #panchang .panchang-card {
  background: rgba(15, 15, 30, 0.6) !important;
  backdrop-filter: blur(12px);
  border: 1px solid var(--premium-glow) !important;
  color: var(--premium-text) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
  transition: all 0.3s ease;
}

.premium-dark #panchang .panchang-meta-item:hover,
.premium-dark #panchang .panchang-card:hover {
  border-color: var(--premium-glow-strong) !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--premium-glow) !important;
  transform: translateY(-2px);
}

.premium-dark #panchang .panchang-meta-item .label,
.premium-dark #panchang .panchang-card h4 {
  color: var(--premium-accent) !important;
}

.premium-dark #panchang .panchang-meta-item span:not(.label),
.premium-dark #panchang .panchang-card p {
  color: var(--premium-text) !important;
}

/* 14. PREMIUM FOOTER */
.premium-footer {
  text-align: center;
  padding: 32px 16px 24px;
  color: var(--premium-text-muted);
  font-size: 0.88rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 32px;
}

.premium-footer .footer-divider {
  color: var(--premium-accent);
  font-size: 1.2rem;
  opacity: 0.5;
  margin-bottom: 12px;
  letter-spacing: 8px;
}

.premium-footer .footer-credit {
  opacity: 0.7;
  margin-top: 8px;
}

.premium-footer a {
  color: var(--premium-accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--premium-glow-strong);
  transition: border-color 0.2s ease;
}

.premium-footer a:hover {
  border-bottom-color: var(--premium-accent);
}

/* 15. RESPONSIVE ADJUSTMENTS */
@media (max-width: 480px) {
  .deity-card { padding: 8px; gap: 6px; }
  .deity-name { font-size: 0.75rem; }
  .deity-name-en { font-size: 0.62rem; }
  .om-divider { font-size: 1.2rem; letter-spacing: 10px; }
  .scroll-top-btn { bottom: 16px; right: 16px; width: 38px; height: 38px; }
}

@media (max-width: 360px) {
  .deity-card { padding: 6px; gap: 4px; }
  .deity-name { font-size: 0.7rem; }
  .deity-name-en { font-size: 0.58rem; }
}

/* 16. REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .particles { display: none; }
}

/* 8. REMOVE SQUARE BOX ON HOME PAGE */
#main > .main {
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 20px 0 !important;
  margin: 0 !important;
}

.swiper-slide .content {
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}


/* 9. REMOVE HORIZONTAL LINE UNDER HEADER */
header.major h2:after {
  display: none !important;
}


/* 10. FIX BLURRY TEXT ON PANCHANG CARDS */
.premium-dark #panchang .panchang-meta-item,
.premium-dark #panchang .panchang-card,
.premium-dark #panchang .panchang-card h4,
.premium-dark #panchang .panchang-card p {
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  transform: translateZ(0);
  backface-visibility: hidden;
  text-shadow: none !important;
}

/* 17. NATIVE PAGE TRANSITIONS */
body {
  animation: pageFadeIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
body.page-transition-out {
  animation: pageFadeOut 0.25s cubic-bezier(0.55, 0, 0.1, 1) forwards !important;
  pointer-events: none;
}
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pageFadeOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-8px) scale(0.99); }
}


/* Modern Scrolling Mantra (replaces deprecated marquee) */
.scrolling-mantra-container {
  overflow: hidden;
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px;
  margin-top: 20px;
  margin-bottom: 20px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
  position: relative;
  display: flex;
  align-items: center;
}

.scrolling-mantra {
  display: inline-block;
  color: var(--accent);
  font-weight: 600;
  font-size: 1.1rem;
  padding-left: 100%;
  animation: scroll-mantra 15s linear infinite;
}

@keyframes scroll-mantra {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}
