/* ==========================================================================
   KundaliLens: divine-energy layer for the "My Sky" birth-details panel.
   Purely decorative. Everything here is pointer-events: none and sits
   behind the form controls, except the transient Om bloom.
   ========================================================================== */

:root {
  --dv-gold: #f7cf7a;
  --dv-saffron: #f59a4a;
  --dv-ember: #cd5b13;
}

/* ---------- Mandala layer: fixed, just beneath the glass panel ---------- */

#explorer > .dv-back,
.dv-back {
  position: fixed;
  inset: 0;
  z-index: 17;
  overflow: hidden;
  pointer-events: none !important;
}

.dv-mandala {
  position: absolute;
  left: var(--dv-cx, 50%);
  top: var(--dv-cy, 50%);
  width: var(--dv-size, 420px);
  height: var(--dv-size, 420px);
  margin-left: calc(var(--dv-size, 420px) / -2);
  margin-top: calc(var(--dv-size, 420px) / -2);
  opacity: calc(0.28 + var(--dv-progress, 1) * 0.4);
  transition: opacity 1.2s ease;
  pointer-events: none;
  /* Hollow centre: the yantra rings the Sun instead of drawing over it. */
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent 0, transparent 19%, #000 30%);
  mask-image: radial-gradient(circle at 50% 50%, transparent 0, transparent 19%, #000 30%);
}

.dv-breath {
  position: absolute;
  inset: 0;
  animation: dv-breathe 9s ease-in-out infinite;
  will-change: transform, opacity;
}

/* soft halo behind the geometry */
.dv-breath::before {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 228, 170, 0.34) 0%, rgba(247, 207, 122, 0.16) 14%, rgba(245, 154, 74, 0.08) 34%, rgba(205, 91, 19, 0.035) 52%, transparent 68%);
}

.dv-ring {
  position: absolute;
  inset: 0;
  opacity: 0.2;
  transform: scale(0.94);
  transition: opacity 0.9s ease, transform 1.1s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform, opacity;
}

.dv-ring.is-filled {
  opacity: 0.72;
  transform: scale(1);
}

.dv-ring.is-focus {
  opacity: 1;
  transform: scale(1.035);
}

.dv-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  animation: dv-spin var(--dv-period, 200s) linear infinite;
  animation-direction: var(--dv-dir, normal);
  will-change: transform;
}

/* assembly on first reveal */
.dv-mandala.is-assembling .dv-ring {
  animation: dv-assemble 1.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--dv-delay, 0s);
}

/* surge after submit: mandala flares, then settles */
.dv-mandala.is-surge .dv-breath {
  animation: dv-surge 2.2s cubic-bezier(0.16, 0.84, 0.3, 1) both;
}

.dv-mandala.is-surge .dv-ring {
  opacity: 1;
}

@keyframes dv-breathe {
  0%,
  100% {
    transform: scale(0.975);
    opacity: 0.82;
  }
  50% {
    transform: scale(1.02);
    opacity: 1;
  }
}

@keyframes dv-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes dv-assemble {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
}

@keyframes dv-surge {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  22% {
    transform: scale(1.12);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
}

/* ---------- Field micro-interactions ---------- */

#kundliForm.dv-host .field {
  position: relative;
}

#kundliForm.dv-host .field::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 1px;
  border-radius: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(205, 91, 19, 0.9) 18%, #ffe2a8 50%, rgba(205, 91, 19, 0.9) 82%, transparent 100%);
  background-size: 220% 100%;
  box-shadow: 0 0 8px 1px rgba(245, 154, 74, 0.55), 0 0 18px 2px rgba(247, 207, 122, 0.18);
  opacity: 0;
  transform: scaleX(0.2);
  transition: opacity 0.35s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}

#kundliForm.dv-host .field:focus-within::after {
  opacity: 1;
  transform: scaleX(1);
  animation: dv-flow 2.6s linear infinite;
}

#kundliForm.dv-host .field.dv-valid::after {
  animation: dv-valid 0.9s ease-out;
}

#kundliForm.dv-host .field:focus-within input:not([type="hidden"]),
#kundliForm.dv-host .field:focus-within .kl-seg {
  box-shadow: var(--focus-ring), 0 0 22px -4px rgba(245, 154, 74, 0.45);
}

#kundliForm.dv-host .field:focus-within label {
  color: var(--sand, #e8b98d);
  transition: color 0.3s ease;
}

@keyframes dv-flow {
  from {
    background-position: 110% 0;
  }
  to {
    background-position: -110% 0;
  }
}

@keyframes dv-valid {
  0% {
    opacity: 1;
    transform: scaleX(0.1);
    filter: brightness(2);
  }
  60% {
    opacity: 1;
    transform: scaleX(1);
    filter: brightness(1.4);
  }
  100% {
    transform: scaleX(1);
  }
}

/* ---------- Submit button aura ---------- */

#kundliForm.dv-host #calculateChartBtn {
  position: relative;
  transition: background-color 0.2s ease, box-shadow 0.4s ease;
}

#kundliForm.dv-host #calculateChartBtn:hover,
#kundliForm.dv-host #calculateChartBtn:focus-visible {
  box-shadow: 0 0 0 1px rgba(247, 207, 122, 0.35), 0 0 26px -2px rgba(245, 154, 74, 0.65), 0 0 60px -10px rgba(247, 207, 122, 0.5);
}

/* ---------- Viewport FX layer (particles, shockwave, Om) ---------- */

#explorer > .dv-fx,
.dv-fx {
  position: fixed;
  inset: 0;
  z-index: 19;
  pointer-events: none !important;
  overflow: hidden;
}

.dv-fx canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.dv-om {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.dv-om span {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -54%) scale(0.4);
  font-family: "Noto Sans Devanagari", "Nirmala UI", "Mangal", "Kohinoor Devanagari", "Devanagari Sangam MN", serif;
  font-size: 132px;
  line-height: 1;
  font-weight: 400;
  color: #ffe9b8;
  text-shadow: 0 0 2px #fff6dc, 0 0 14px rgba(247, 207, 122, 0.9), 0 0 38px rgba(245, 154, 74, 0.7), 0 0 90px rgba(205, 91, 19, 0.55);
  opacity: 0;
  white-space: nowrap;
  will-change: transform, opacity;
}

.dv-om.is-play span {
  animation: dv-om 2.4s cubic-bezier(0.16, 0.84, 0.3, 1) both;
}

@keyframes dv-om {
  0% {
    opacity: 0;
    transform: translate(-50%, -54%) scale(0.35);
  }
  18% {
    opacity: 1;
  }
  40% {
    opacity: 1;
    transform: translate(-50%, -96%) scale(1.08);
  }
  70% {
    opacity: 0.9;
    transform: translate(-50%, -104%) scale(1.14);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -112%) scale(1.3);
  }
}

@media (max-width: 760px) {
  .dv-om span {
    font-size: 104px;
  }
}

/* ---------- Reduced motion: static mandala, Om as a fade ---------- */

@media (prefers-reduced-motion: reduce) {
  .dv-breath,
  .dv-ring svg,
  .dv-mandala.is-assembling .dv-ring,
  .dv-mandala.is-surge .dv-breath {
    animation: none !important;
  }
  .dv-ring,
  .dv-ring.is-filled,
  .dv-ring.is-focus {
    transform: none;
  }
  #kundliForm.dv-host .field:focus-within::after,
  #kundliForm.dv-host .field.dv-valid::after {
    animation: none;
    transform: none;
  }
  .dv-om.is-play span {
    animation: dv-om-fade 1.6s ease both;
  }
  @keyframes dv-om-fade {
    0% {
      opacity: 0;
      transform: translate(-50%, -54%) scale(1);
    }
    30% {
      opacity: 0.9;
    }
    100% {
      opacity: 0;
      transform: translate(-50%, -54%) scale(1);
    }
  }
}

/* paused state: no compositor work while My Sky is not on screen */
.dv-paused .dv-breath,
.dv-paused .dv-ring svg {
  animation-play-state: paused;
}
