/* ============================================================
   KAALTRIKAAL — Rashi Chakra + Vastu Purusha Mandala
   Animated cosmic artworks. Matches the gold-on-purple system.
   ============================================================ */

:root {
  --fire:  oklch(0.80 0.085 52);
  --earth: oklch(0.80 0.075 115);
  --air:   oklch(0.80 0.070 250);
  --water: oklch(0.80 0.075 215);
  --ether: oklch(0.80 0.070 320);
}

@keyframes chakraSpin    { to { transform: rotate(360deg); } }
@keyframes chakraSpinRev { to { transform: rotate(-360deg); } }
@keyframes haloPulse {
  0%, 100% { opacity: 0.35; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 0.9;  transform: translate(-50%, -50%) scale(1.08); }
}
@keyframes dimGlow {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

/* ============================================================
   SHARED — two-column cosmic layout
   ============================================================ */
.cosmic-layout {
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: 72px;
  align-items: center;
  position: relative;
  z-index: 2;
}
.cosmic-copy .eyebrow { margin-bottom: 18px; }
.cosmic-copy h2 { font-size: clamp(2.1rem, 4.2vw, 3.2rem); margin-bottom: 22px; }
.cosmic-copy > p {
  color: var(--text-soft); font-size: 1.1rem; max-width: 30em; margin-bottom: 34px;
}

/* live readout card (shared shell) */
.cosmic-readout {
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 30px;
  position: relative;
  overflow: hidden;
  min-height: 188px;
}
.cosmic-readout::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 100% 0%, rgba(230,195,100,0.10), transparent 60%);
  pointer-events: none;
}
.ro-top { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.ro-emblem {
  width: 60px; height: 60px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: #2c1404;
  background: var(--grad-gold);
  box-shadow: 0 8px 26px -8px rgba(230,195,100,0.6);
}
.ro-titles { display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }
.ro-name {
  font-family: 'Playfair Display', serif; font-weight: 700;
  font-size: 1.7rem; color: var(--white);
}
.ro-sub { font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.ro-dev { font-family: 'Playfair Display', serif; color: var(--gold-deep); font-size: 1.15rem; }
.ro-rows { display: grid; gap: 11px; }
.ro-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  font-size: 0.96rem; padding-bottom: 11px; border-bottom: 1px solid var(--line-soft);
}
.ro-row:last-child { border-bottom: none; padding-bottom: 0; }
.ro-row .k { color: var(--text-dim); letter-spacing: 0.04em; }
.ro-row .v { color: var(--text); font-weight: 600; text-align: right; }
.ro-row .v .pl { color: var(--gold); margin-right: 8px; font-size: 1.05rem; }

/* element chips */
.tattwa-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.tattwa {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 0.82rem; letter-spacing: 0.04em; font-weight: 600;
  padding: 9px 16px 9px 13px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text);
  background: rgba(255,255,255,0.015);
}
.tattwa .swatch { width: 11px; height: 11px; border-radius: 50%; }
.tattwa[data-el="Fire"]  .swatch { background: var(--fire);  box-shadow: 0 0 10px var(--fire); }
.tattwa[data-el="Earth"] .swatch { background: var(--earth); box-shadow: 0 0 10px var(--earth); }
.tattwa[data-el="Air"]   .swatch { background: var(--air);   box-shadow: 0 0 10px var(--air); }
.tattwa[data-el="Water"] .swatch { background: var(--water); box-shadow: 0 0 10px var(--water); }
.tattwa[data-el="Ether"] .swatch { background: var(--ether); box-shadow: 0 0 10px var(--ether); }
.tattwa small { color: var(--text-dim); font-weight: 500; }

/* ============================================================
   RASHI CHAKRA — rotating zodiac wheel
   ============================================================ */
.chakra-stage { position: relative; display: flex; justify-content: center; }
.chakra {
  position: relative; width: min(560px, 88vw); aspect-ratio: 1;
  filter: drop-shadow(0 30px 70px rgba(0,0,0,0.45));
}
/* rotor: rings + spokes + sign nodes — spins very slowly */
.chakra-rotor {
  position: absolute; inset: 0; border-radius: 50%;
  animation: chakraSpin 200s linear infinite;
}
.chakra-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chakra-svg .ring        { fill: none; stroke: rgba(230,195,100,0.30); }
.chakra-svg .ring-faint  { fill: none; stroke: rgba(216,201,232,0.10); }
.chakra-svg .spoke       { stroke: rgba(230,195,100,0.13); stroke-width: 1; }
.chakra-svg .tick        { fill: var(--gold-deep); opacity: 0.55; }
.chakra-svg .band        { fill: rgba(230,195,100,0.022); }
.chakra-svg .wedge {
  fill: rgba(230,195,100,0.12);
  stroke: rgba(230,195,100,0.5); stroke-width: 1;
  opacity: 0; transition: opacity .45s var(--ease);
}
.chakra-svg .wedge.on { opacity: 1; }

/* sign nodes (HTML, overlaid, kept upright via counter-spin) */
.rashi-node { position: absolute; top: 50%; left: 50%; width: 0; height: 0; }
.rashi-counter { position: absolute; transform: translate(-50%, -50%); }
.rashi-up { animation: chakraSpinRev 200s linear infinite; }
.rashi-glyph {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  cursor: pointer; user-select: none;
  transition: transform .4s var(--ease);
}
.rashi-glyph .sym {
  font-size: 2.05rem; line-height: 1; color: var(--gold);
  transition: color .35s, text-shadow .35s, transform .4s var(--ease);
}
.rashi-glyph .nm {
  font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 700;
}
.rashi-glyph:hover .sym { color: var(--gold-bright); transform: scale(1.12); }
.rashi-node.active .rashi-glyph .sym {
  color: var(--gold-bright); transform: scale(1.18);
  text-shadow: 0 0 22px rgba(236,210,119,0.85);
}
.rashi-node.active .rashi-glyph .nm { color: var(--gold); }

/* central hub — non-rotating, shows active sign */
.chakra-hub {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 41%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, var(--panel-2), var(--bg) 78%);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 4px; z-index: 4;
  box-shadow: inset 0 0 50px rgba(0,0,0,0.55);
}
.chakra-hub .halo {
  position: absolute; top: 50%; left: 50%; width: 116%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgba(230,195,100,0.18), transparent 68%);
  animation: haloPulse 4.5s var(--ease) infinite; z-index: -1;
}
.chakra-hub .hub-sym { font-size: 3.1rem; line-height: 1; color: var(--gold-bright);
  text-shadow: 0 0 26px rgba(236,210,119,0.5); }
.chakra-hub .hub-name { font-family: 'Playfair Display', serif; font-size: 1.35rem; color: var(--white); line-height: 1.1; }
.chakra-hub .hub-dev  { font-family: 'Playfair Display', serif; color: var(--gold); font-size: 1rem; }
.chakra-hub .hub-meta { font-size: 0.62rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-dim); margin-top: 4px; }
.chakra.paused .chakra-rotor,
.chakra.paused .rashi-up { animation-play-state: paused; }

/* ============================================================
   VASTU PURUSHA MANDALA — directional energy grid
   ============================================================ */
.mandala-stage { position: relative; display: flex; justify-content: center; }
.mandala {
  position: relative; width: min(540px, 88vw); aspect-ratio: 1;
}
/* rotating compass ring behind the grid */
.mandala-ring {
  position: absolute; inset: -7%; border-radius: 50%;
  border: 1px dashed rgba(230,195,100,0.22);
  animation: chakraSpin 150s linear infinite;
}
.mandala-ring::before, .mandala-ring::after {
  content: '✦'; position: absolute; color: var(--gold-deep); font-size: 0.9rem;
  left: 50%; transform: translateX(-50%);
}
.mandala-ring::before { top: -0.65rem; }
.mandala-ring::after  { bottom: -0.65rem; }
.mandala-ring2 {
  position: absolute; inset: -1.5%; border-radius: 50%;
  border: 1px solid rgba(216,201,232,0.08);
  animation: chakraSpinRev 110s linear infinite;
}

/* compass letters — fixed, upright */
.compass { position: absolute; inset: -7%; pointer-events: none; z-index: 5; }
.compass span {
  position: absolute; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em;
  color: var(--gold); text-shadow: 0 0 8px rgba(29,4,50,0.9);
}
.compass .c-n { top: -0.2rem; left: 50%; transform: translateX(-50%); }
.compass .c-s { bottom: -0.2rem; left: 50%; transform: translateX(-50%); }
.compass .c-e { right: -0.2rem; top: 50%; transform: translateY(-50%); }
.compass .c-w { left: -0.2rem; top: 50%; transform: translateY(-50%); }

/* the 3x3 grid */
.mandala-grid {
  position: absolute; inset: 0; border-radius: 8px; overflow: hidden;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  gap: 2px; background: var(--line);
  border: 1px solid rgba(230,195,100,0.30);
  box-shadow: 0 30px 70px rgba(0,0,0,0.45);
}
.pada {
  position: relative; background: var(--panel);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 4px; padding: 8px; cursor: pointer;
  transition: background .4s var(--ease), box-shadow .4s var(--ease);
}
.pada .dir { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.14em; color: var(--gold); }
.pada .sa  { font-family: 'Playfair Display', serif; font-size: 1.04rem; color: var(--white); line-height: 1.05; }
.pada .dv  { font-size: 0.8rem; color: var(--gold-deep); }
.pada .gv  { font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.pada:hover { background: var(--panel-2); }
.pada.active { background: linear-gradient(160deg, var(--panel-2), var(--panel)); box-shadow: inset 0 0 0 1px rgba(230,195,100,0.55), inset 0 0 34px rgba(230,195,100,0.12); }
.pada.active .dir { color: var(--gold-bright); }
.pada.active .gv { color: var(--gold); }

/* Brahmasthan (center) */
.pada.brahma { background: radial-gradient(circle at 50% 45%, var(--panel-2), var(--panel-3)); }
.pada.brahma .sa { color: var(--gold-bright); text-shadow: 0 0 18px rgba(236,210,119,0.5); }
.pada.brahma::after {
  content: 'ॐ'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif; font-size: 3.6rem; color: rgba(230,195,100,0.07);
  animation: dimGlow 5s var(--ease) infinite; pointer-events: none;
}
.pada.brahma > * { position: relative; z-index: 1; }

/* Vastu Purusha diagonal axis: head NE -> feet SW */
.purusha-axis {
  position: absolute; inset: 0; pointer-events: none; z-index: 3; overflow: visible;
}
.purusha-axis line { stroke: rgba(236,210,119,0.45); stroke-width: 1.5; stroke-dasharray: 5 6; }
.purusha-axis .node { fill: var(--gold-bright); }
.purusha-axis .pulse { fill: none; stroke: var(--gold); stroke-width: 1.2; opacity: 0; }
.axis-tag {
  position: absolute; z-index: 6; font-size: 0.56rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-deep);
  background: rgba(29,4,50,0.82); padding: 3px 7px; border-radius: 999px; border: 1px solid var(--line);
  white-space: nowrap;
}
.axis-tag.head { top: 7%; right: 7%; }
.axis-tag.feet { bottom: 7%; left: 7%; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
  .cosmic-layout { grid-template-columns: 1fr; gap: 54px; justify-items: center; text-align: center; }
  .cosmic-copy { order: 2; max-width: 560px; }
  .cosmic-copy > p { margin-left: auto; margin-right: auto; }
  .tattwa-legend { justify-content: center; }
  .cosmic-readout { text-align: left; width: 100%; max-width: 460px; }
  .chakra-stage, .mandala-stage { order: 1; }
}
@media (max-width: 600px) {
  .chakra { width: min(420px, 90vw); }
  .mandala { width: min(400px, 86vw); }
  .rashi-glyph .sym { font-size: 1.7rem; }
  .rashi-glyph .nm { display: none; }
  .pada .sa { font-size: 0.9rem; }
  .pada .dv { font-size: 0.72rem; }
  .pada .gv { display: none; }
  .pada.brahma .gv { display: block; }
  .cosmic-readout { padding: 24px; }
}
@media (max-width: 380px) {
  .rashi-glyph .sym { font-size: 1.45rem; }
  .pada .sa { font-size: 0.78rem; }
}

@media (prefers-reduced-motion: reduce) {
  .chakra-rotor, .rashi-up, .mandala-ring, .mandala-ring2,
  .chakra-hub .halo, .pada.brahma::after { animation: none; }
}
