/* ═══════════════════════════════════════════════════════
   Digital Darshan — style.css
   Temple palette: deep ochre #1a0a00, gold #D4A574, warm amber
   All animations slow + reverent (≥600ms, cubic-bezier easing)
═══════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --ochre-deep:   #1a0a00;
  --ochre:        #8B4513;
  --ochre-mid:    #5c2a07;
  --gold:         #D4A574;
  --gold-bright:  #f0c070;
  --gold-dim:     #8a6840;
  --cream:        #f5e8d0;
  --shadow:       rgba(26, 10, 0, 0.85);
  --ease:         cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:     cubic-bezier(0, 0, 0.2, 1);
  --ease-in:      cubic-bezier(0.4, 0, 1, 1);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ochre-deep);
  color: var(--gold);
  font-family: Georgia, 'Times New Roman', serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Loader ────────────────────────────────────────── */
.loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--ochre-deep);
  transition: opacity 1s var(--ease), visibility 1s;
}

.loader.loader--gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Universe wrapper */
.om-universe {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Om glyph — perfectly still */
.om-glyph {
  width: 120px;
  height: 120px;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 0 16px rgba(212, 165, 116, 0.55));
}

/* Orbiting rings */
.om-ring {
  position: absolute;
  border-radius: 50%;
}

.om-ring--1 {
  inset: -18px;
  border: 1.5px solid rgba(212,165,116,0.38);
  animation: universe-spin 5s linear infinite;
}

/* Bright gold dot on inner ring */
.om-ring--1::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 7px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(212,165,116,0.9);
}

.om-ring--2 {
  inset: -36px;
  border: 1px solid rgba(212,165,116,0.16);
  animation: universe-spin 9s linear infinite reverse;
}

/* Dim dot on outer ring */
.om-ring--2::before {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: rgba(212,165,116,0.5);
  border-radius: 50%;
}

@keyframes universe-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.loader-text {
  margin-top: 1.5rem;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: var(--gold-dim);
  font-style: italic;
  animation: pulse-text 2s var(--ease) infinite alternate;
}


@keyframes pulse-text {
  from { opacity: 0.4; }
  to   { opacity: 0.9; }
}

/* ── Audio Controls (top-right pill) ──────────────── */
.audio-controls {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(26,10,0,0.65);
  border: 1px solid rgba(212,165,116,0.28);
  border-radius: 20px;
  padding: 0.28rem 0.75rem 0.28rem 0.28rem;
  backdrop-filter: blur(4px);
}

.mute-btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-dim);
  transition: color 0.4s var(--ease);
  flex-shrink: 0;
}

.mute-btn:hover { color: var(--gold); }

.mute-btn svg {
  width: 16px;
  height: 16px;
}

/* Volume range slider */
.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 3px;
  background: rgba(212,165,116,0.28);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
}

.volume-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--gold);
  border: none;
  cursor: pointer;
}

/* ── Phase Base ────────────────────────────────────── */
.phase {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.phase--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.phase--fade-in {
  animation: phase-fade-in 1.2s var(--ease) forwards;
}

@keyframes phase-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Background layer (static image) */
.phase__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 1s var(--ease);
}

.phase__bg--hidden {
  opacity: 0;
  pointer-events: none;
}

/* Video layer */
.phase__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s var(--ease);
}

.phase__video--visible {
  opacity: 1;
}

/* Content overlay */
.phase__content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 1.5rem;
}

.phase__content--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.8rem;
}

/* ── Phase 1 ───────────────────────────────────────── */
.phase--1 .phase__bg {
  filter: brightness(0.75);
}

.invite-text {
  font-size: clamp(1.4rem, 4vw, 2rem);
  letter-spacing: 0.12em;
  color: var(--gold);
  text-shadow: 0 2px 16px rgba(212,165,116,0.5);
  animation: pulse-text 3s var(--ease) infinite alternate;
}

/* ── Bell Image Overlay ────────────────────────────── */
/* Pixel analysis: bell at x=576/1024 (56.2%), y=515/1536 (33.5%).
   Mobile cover-scale (844/1536=0.549, 562px wide, 86px crop each side):
   screen-x = 59%, screen-y = 33.5%.
   Img top offset: bell center is at 54.5% of cutout height,
   so top = 33.5% – (54.5% × img_rendered_height / screen_height). */
.bell-wrap {
  position: absolute;
  /* Center of img at 59% from left */
  left: 59%;
  transform: translateX(-50%);
  /* Top: 23% places bell body center at ~33.5% on 844px screen */
  top: 23%;
  width: 110px;
  cursor: pointer;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.bell-wrap--hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s var(--ease);
}

/* Bell image — gentle idle sway, pivots from chain top */
.bell-img {
  width: 100%;
  display: block;
  transform-origin: 50% 3%;
  animation: bell-idle-sway 3.5s ease-in-out infinite alternate;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.7));
  user-select: none;
  pointer-events: none; /* click handled by wrapper */
}

@keyframes bell-idle-sway {
  from { transform: rotate(-4deg); }
  to   { transform: rotate(4deg);  }
}

/* Hard ring on tap */
.bell-img--ringing {
  animation: bell-hard-ring 0.9s ease !important;
}

@keyframes bell-hard-ring {
  0%   { transform: rotate(0deg);  }
  12%  { transform: rotate(22deg); }
  28%  { transform: rotate(-18deg);}
  44%  { transform: rotate(13deg); }
  60%  { transform: rotate(-8deg); }
  76%  { transform: rotate(4deg);  }
  88%  { transform: rotate(-2deg); }
  100% { transform: rotate(0deg);  }
}

/* Prompt text — just below the bell body */
.bell-prompt {
  position: absolute;
  left: 59%;
  top: 49%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 1rem;
  color: var(--gold-dim);
  letter-spacing: 0.1em;
  font-style: italic;
  text-shadow: 0 1px 8px rgba(26,10,0,0.95);
  animation: pulse-text 2.5s var(--ease) infinite alternate;
  transition: opacity 0.8s var(--ease);
  z-index: 10;
}

.bell-prompt--fade   { opacity: 0; }
.bell-prompt--hidden { opacity: 0; pointer-events: none; }

/* ── CTA Button ────────────────────────────────────── */
.cta-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.8rem 2.4rem;
  background: rgba(26,10,0,0.65);
  border: 1px solid rgba(212,165,116,0.5);
  border-radius: 2px;
  color: var(--cream);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.6s var(--ease), border-color 0.6s var(--ease),
              color 0.6s var(--ease), transform 0.6s var(--ease);
  animation: cta-pulse 3.5s var(--ease) infinite alternate;
}

.cta-btn:hover {
  background: rgba(92,42,7,0.75);
  border-color: rgba(212,165,116,0.9);
  color: var(--gold-bright);
  transform: scale(1.03);
}


@keyframes cta-pulse {
  from { box-shadow: 0 0 0   rgba(212,165,116,0); }
  to   { box-shadow: 0 0 20px rgba(212,165,116,0.25); }
}

.cta-btn--threshold {
  margin-top: 1rem;
  transition: opacity 0.8s var(--ease), background 0.6s var(--ease),
              border-color 0.6s var(--ease);
}

/* ── Phase 2 — Threshold ───────────────────────────── */
.phase--2 .phase__bg {
  filter: brightness(0.65);
}

.threshold-text {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  color: var(--cream);
  text-shadow: 0 2px 24px rgba(26,10,0,0.8);
  letter-spacing: 0.06em;
  animation: threshold-fade-in 1s var(--ease) both;
}

.threshold-subtext {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: var(--gold-dim);
  font-style: italic;
  animation: threshold-fade-in 1s 0.4s var(--ease) both;
}

@keyframes threshold-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Phase 3 — Puja Scene ──────────────────────────── */
.phase--3 .phase__bg--lingam {
  filter: brightness(0.8);
  transition: opacity 1s var(--ease), filter 2s var(--ease);
}

/* Flickering candlelight overlay */
.flicker-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(ellipse at 50% 65%,
    rgba(220, 110, 20, 0.28) 0%,
    rgba(170, 60, 10, 0.14) 45%,
    transparent 72%);
  opacity: 0;
}

.flicker-overlay--active {
  animation: candleflicker 0.13s linear infinite alternate;
}

@keyframes candleflicker {
  0%   { opacity: 0.45; }
  20%  { opacity: 0.68; }
  40%  { opacity: 0.38; }
  60%  { opacity: 0.62; }
  80%  { opacity: 0.42; }
  100% { opacity: 0.58; }
}

/* Vignette */
.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center,
    transparent 40%,
    rgba(26,10,0,0.6) 80%,
    rgba(26,10,0,0.92) 100%);
  pointer-events: none;
  z-index: 5;
}

/* ── Incense Smoke ─────────────────────────────────── */
.incense-smoke {
  position: absolute;
  bottom: 20%;
  left: 52%;
  width: 60px;
  height: 200px;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  transition: opacity 2s var(--ease);
}

.incense-smoke--visible {
  opacity: 1;
}

.smoke-svg {
  width: 100%;
  height: 100%;
}

.smoke-path {
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
}

.smoke-path--1 {
  animation: smoke-rise 6s 1s var(--ease-out) infinite;
}

.smoke-path--2 {
  animation: smoke-rise 7s 2.5s var(--ease-out) infinite;
}

@keyframes smoke-rise {
  0%   { stroke-dashoffset: 300; opacity: 0; }
  20%  { opacity: 0.8; }
  80%  { opacity: 0.3; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

/* ── Puja Scene container ──────────────────────────── */
.puja-scene {
  position: absolute;
  inset: 0;
  z-index: 10;
  transition: opacity 1s var(--ease);
}

.puja-scene--hidden {
  opacity: 0;
  pointer-events: none;
}

/* ── Bottom Puja Bar ───────────────────────────────── */
.puja-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-end;
  gap: 0.45rem;
  padding: 0.8rem 0.5rem 1.1rem;
  background: linear-gradient(to top, rgba(26,10,0,0.92) 55%, transparent);
  z-index: 15;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.puja-bar::-webkit-scrollbar { display: none; }

.puja-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
  background: rgba(26,10,0,0.6);
  border: 1px solid rgba(212,165,116,0.35);
  border-radius: 4px;
  padding: 0.55rem 0.5rem 0.35rem;
  cursor: pointer;
  color: var(--gold);
  min-width: 50px;
  flex-shrink: 0;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease),
              transform 0.4s var(--ease);
  animation: hotspot-glow 4s var(--ease) infinite alternate;
}

.puja-item:hover:not(:disabled) {
  background: rgba(92,42,7,0.72);
  border-color: rgba(212,165,116,0.8);
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(212,165,116,0.18);
}

.puja-item:disabled {
  opacity: 0.45;
  cursor: default;
  animation: none;
}

.puja-item__icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.puja-item__label {
  font-size: 0.6rem;
  color: var(--gold-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Emoji puja items */
.item-emoji {
  font-size: 32px;
  line-height: 1;
  display: block;
  filter: drop-shadow(0 2px 5px rgba(26,10,0,0.5));
}

@keyframes hotspot-glow {
  from { box-shadow: 0 0 0   rgba(212,165,116,0); }
  to   { box-shadow: 0 0 12px rgba(212,165,116,0.18); }
}

/* ── Bell swing animation ──────────────────────────── */
@keyframes bell-swing {
  0%   { transform: rotate(0deg); }
  15%  { transform: rotate(18deg); }
  35%  { transform: rotate(-14deg); }
  55%  { transform: rotate(10deg); }
  75%  { transform: rotate(-6deg); }
  90%  { transform: rotate(3deg); }
  100% { transform: rotate(0deg); }
}

.bell-ringing {
  animation: bell-swing 0.8s var(--ease);
  transform-origin: top center;
}

/* ── Conch glow pulse ──────────────────────────────── */
@keyframes conch-pulse {
  0%   { filter: drop-shadow(0 0 0 rgba(212,165,116,0)); }
  50%  { filter: drop-shadow(0 0 12px rgba(212,165,116,0.7)); }
  100% { filter: drop-shadow(0 0 0 rgba(212,165,116,0)); }
}

.conch-blown {
  animation: conch-pulse 1.5s var(--ease);
}

/* ── Bilva leaf fall ───────────────────────────────── */
.bilva-leaf {
  position: absolute;
  width: 36px;
  height: 36px;
  pointer-events: none;
  animation: leaf-fall 2s var(--ease-in) forwards;
}

@keyframes leaf-fall {
  0%   { transform: translateY(-60px) rotate(0deg); opacity: 1; }
  60%  { transform: translateY(40px) rotate(120deg); opacity: 1; }
  100% { transform: translateY(80px) rotate(180deg) scale(0.9); opacity: 0.9; }
}

/* ── Water stream (kalash) ─────────────────────────── */
.water-stream {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}

.water-stream--visible {
  opacity: 1;
  animation: water-glistening 10s var(--ease) forwards;
}

@keyframes water-glistening {
  0%   { opacity: 1; }
  70%  { opacity: 0.8; }
  100% { opacity: 0; }
}

/* ── Flame (diya) ──────────────────────────────────── */
.diya-flame {
  animation: flame-flicker 0.8s var(--ease) infinite alternate;
}

@keyframes flame-flicker {
  0%   { transform: scaleY(1) scaleX(1)    translateY(0); opacity: 0.9; }
  30%  { transform: scaleY(1.05) scaleX(0.97) translateY(-1px); opacity: 1; }
  60%  { transform: scaleY(0.95) scaleX(1.03) translateY(1px); opacity: 0.85; }
  100% { transform: scaleY(1.08) scaleX(0.96) translateY(-2px); opacity: 0.95; }
}

/* ── Vibhuti lines (stroke-dashoffset draw) ────────── */
/* Scoped to the hotspot icon only — the lingam overlay uses JS-driven
   inline transitions so it must not pick up this CSS animation. */
#icon-vibhuti .vibhuti-line {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: draw-vibhuti 1s var(--ease) forwards;
}

#icon-vibhuti .vibhuti-line:nth-child(2) { animation-delay: 0.3s; }
#icon-vibhuti .vibhuti-line:nth-child(3) { animation-delay: 0.6s; }

@keyframes draw-vibhuti {
  to { stroke-dashoffset: 0; }
}

/* ── Lingam effects overlay ────────────────────────── */
.lingam-effects {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
}

/* Garland drape */
.garland-drape {
  position: absolute;
  bottom: 28%;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  opacity: 0;
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}

.garland-drape--placed {
  opacity: 1;
  transform: translateX(-50%) scale(1) translateY(4px);
  animation: garland-bounce 0.8s var(--ease);
}

@keyframes garland-bounce {
  0%   { transform: translateX(-50%) scale(1) translateY(-10px); }
  60%  { transform: translateX(-50%) scale(1) translateY(6px); }
  80%  { transform: translateX(-50%) scale(1) translateY(-2px); }
  100% { transform: translateX(-50%) scale(1) translateY(4px); }
}

/* ── Aarti button ──────────────────────────────────── */
.aarti-btn {
  position: absolute;
  bottom: calc(4% + 100px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.7rem 2rem;
  background: rgba(92,42,7,0.8);
  border: 1px solid rgba(212,165,116,0.6);
  border-radius: 2px;
  color: var(--cream);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: opacity 0.8s var(--ease), background 0.5s var(--ease),
              border-color 0.5s var(--ease);
  animation: cta-pulse 3s var(--ease) infinite alternate;
  z-index: 20;
}

.aarti-btn--hidden {
  opacity: 0;
  pointer-events: none;
}


.aarti-btn:hover {
  background: rgba(139,69,19,0.9);
  border-color: var(--gold);
}

/* ── Finale overlay ────────────────────────────────── */
.finale {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26,10,0,0.82);
  transition: opacity 1.5s var(--ease), visibility 1.5s;
}

.finale--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.finale__content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  padding: 2rem;
}

.finale__main {
  font-size: clamp(2rem, 6vw, 3.5rem);
  color: var(--cream);
  text-shadow: 0 0 30px rgba(212,165,116,0.6);
  animation: finale-glow 2s var(--ease) infinite alternate;
}

@keyframes finale-glow {
  from { text-shadow: 0 0 20px rgba(212,165,116,0.4); }
  to   { text-shadow: 0 0 40px rgba(212,165,116,0.8); }
}

.finale__sub {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: var(--gold-dim);
  font-style: italic;
}

.finale__mantra {
  font-size: clamp(1.4rem, 4vw, 2rem);
  color: var(--gold);
  letter-spacing: 0.12em;
  margin-top: 0.5rem;
}

.restart-btn {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  background: transparent;
  border: none;
  color: var(--gold-dim);
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.5s var(--ease);
}

.restart-btn:hover {
  color: var(--gold);
}


/* ── Finale flame brightness burst ────────────────── */
@keyframes flame-burst {
  0%   { filter: brightness(1); }
  40%  { filter: brightness(2.5) drop-shadow(0 0 8px rgba(255,200,80,0.9)); }
  100% { filter: brightness(1); }
}

.flame-burst {
  animation: flame-burst 3s var(--ease);
}

/* ── Mobile adjustments ────────────────────────────── */
@media (max-width: 480px) {
  .audio-controls {
    top: 10px;
    right: 10px;
  }
  .puja-item {
    min-width: 44px;
    padding: 0.45rem 0.4rem 0.3rem;
  }
  .puja-item__icon {
    width: 30px;
    height: 30px;
  }
  .item-emoji {
    font-size: 26px;
  }
  .puja-item__label {
    font-size: 0.55rem;
  }
  .aarti-btn {
    bottom: calc(3% + 100px);
  }
}

/* ── 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;
  }
}
