/**
 * RedMinds Campaign Studio — AI Campaign Experience Styles
 *
 * Safe, GPU-accelerated decorative visual system for campaign landings.
 * Invariants:
 * - pointer-events: none (zero interaction interception).
 * - z-index: 1 (content is always z-index: 2+).
 * - Strict Theme Isolation: Base theme backgrounds, tokens and typography are untouched.
 * - prefers-reduced-motion: reduce turns off all motion and hides entrance stages.
 * - Zero layout shift: Absolute inset-0 paint layer container with grid-column: 1 / -1.
 */

:root {
  --rwm-decor-accent: #c5a059;
  --rwm-decor-accent-glow: rgba(197, 160, 89, 0.12);
  --rwm-decor-accent-soft: rgba(197, 160, 89, 0.04);
}

/* Palette mapping by accent */
.rwm-accent--gold,
[data-campaign-accent="gold"] {
  --rwm-decor-accent: #d4af37;
  --rwm-decor-accent-glow: rgba(212, 175, 55, 0.14);
  --rwm-decor-accent-soft: rgba(212, 175, 55, 0.04);
}

.rwm-accent--amber,
[data-campaign-accent="amber"] {
  --rwm-decor-accent: #f59e0b;
  --rwm-decor-accent-glow: rgba(245, 158, 11, 0.15);
  --rwm-decor-accent-soft: rgba(245, 158, 11, 0.05);
}

.rwm-accent--emerald,
[data-campaign-accent="emerald"] {
  --rwm-decor-accent: #10b981;
  --rwm-decor-accent-glow: rgba(16, 185, 129, 0.14);
  --rwm-decor-accent-soft: rgba(16, 185, 129, 0.04);
}

.rwm-accent--ruby,
[data-campaign-accent="ruby"] {
  --rwm-decor-accent: #e11d48;
  --rwm-decor-accent-glow: rgba(225, 29, 72, 0.14);
  --rwm-decor-accent-soft: rgba(225, 29, 72, 0.04);
}

.rwm-accent--sapphire,
[data-campaign-accent="sapphire"] {
  --rwm-decor-accent: #2563eb;
  --rwm-decor-accent-glow: rgba(37, 99, 235, 0.14);
  --rwm-decor-accent-soft: rgba(37, 99, 235, 0.04);
}

.rwm-accent--rose,
[data-campaign-accent="rose"] {
  --rwm-decor-accent: #f43f5e;
  --rwm-decor-accent-glow: rgba(244, 63, 94, 0.14);
  --rwm-decor-accent-soft: rgba(244, 63, 94, 0.04);
}

.rwm-accent--festive_purple,
[data-campaign-accent="festive_purple"] {
  --rwm-decor-accent: #8b5cf6;
  --rwm-decor-accent-glow: rgba(139, 92, 246, 0.14);
  --rwm-decor-accent-soft: rgba(139, 92, 246, 0.04);
}

.rwm-accent--silver,
[data-campaign-accent="silver"] {
  --rwm-decor-accent: #94a3b8;
  --rwm-decor-accent-glow: rgba(148, 163, 184, 0.12);
  --rwm-decor-accent-soft: rgba(148, 163, 184, 0.04);
}

.rwm-accent--default,
[data-campaign-accent="default"] {
  --rwm-decor-accent: #c5a059;
  --rwm-decor-accent-glow: rgba(197, 160, 89, 0.12);
  --rwm-decor-accent-soft: rgba(197, 160, 89, 0.04);
}

/* Ensure landing sections act as relative positioning contexts */
section[class*="rwm-"],
.rwm-section,
.rwm-hero,
.rwm-intro,
.rwm-mela-intro,
.rwm-value,
.rwm-founder,
.rwm-packages,
.rwm-templates,
.rwm-portfolio,
.rwm-testimonials,
.rwm-faq,
.rwm-final,
.rwm-booking-cta {
  position: relative;
}

/* Section content retains original stacking above the isolated decorative layer */
.rwm-hero__copy,
.rwm-hero__visual,
.rwm-intro__grid,
.rwm-value__grid,
.rwm-founder__experience,
.rwm-founder__story,
.rwm-package-grid,
.rwm-final__copy {
  position: relative;
  z-index: 2;
}

/* Base decor container — strictly isolated paint layer, z-index 1 and pointer-events none */
.rwm-campaign-decor {
  position: absolute !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  box-sizing: border-box !important;
  grid-column: auto !important;
  grid-row: auto !important;
  grid-area: auto !important;
  pointer-events: none !important;
  user-select: none !important;
  overflow: hidden !important;
  z-index: 1 !important;
}

.rwm-campaign-decor * {
  pointer-events: none !important;
}

/* Atmosphere Glow Backgrounds — strictly bounded and soft */
.rwm-decor-atmosphere {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.32;
  transition: opacity 0.3s ease;
}

/* Strict theme preservation: minimal ambient wash so original background is 100% authoritative */
[data-campaign-bg-policy="preserve_original"] .rwm-decor-atmosphere,
.rwm-bg-policy--preserve_original .rwm-decor-atmosphere,
.rwm-policy--preserve {
  opacity: 0.16 !important;
}

.rwm-glow--warm {
  background: radial-gradient(circle at 50% 18%, var(--rwm-decor-accent-glow) 0%, transparent 55%);
}

.rwm-glow--candlelight {
  background: radial-gradient(circle at 50% 25%, rgba(245, 158, 11, 0.14) 0%, rgba(234, 88, 12, 0.05) 35%, transparent 60%);
}

.rwm-glow--cool {
  background: radial-gradient(circle at 50% 15%, rgba(56, 189, 248, 0.12) 0%, rgba(37, 99, 235, 0.05) 35%, transparent 58%);
}

.rwm-glow--aurora {
  background: radial-gradient(ellipse at 30% 20%, rgba(16, 185, 129, 0.10) 0%, transparent 45%),
              radial-gradient(ellipse at 70% 25%, rgba(139, 92, 246, 0.10) 0%, transparent 48%);
}

.rwm-glow--subtle {
  background: radial-gradient(circle at 50% 20%, var(--rwm-decor-accent-soft) 0%, transparent 50%);
}

.rwm-glow--none {
  display: none !important;
}

/* Hanging Floral Toran / Marigold Garland */
.rwm-decor-garland {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 46px;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  display: flex;
  justify-content: center;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.12));
}

.rwm-svg-garland {
  display: block;
  width: 100%;
  min-width: 900px;
  height: 46px;
}

/* Edge Accents */
.rwm-decor-edge {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  pointer-events: none;
}

.rwm-decor-edge--top {
  top: 0;
}

.rwm-decor-edge--bottom {
  bottom: 0;
}

.rwm-decor-edge__line {
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--rwm-decor-accent) 50%, transparent 100%);
  opacity: 0.65;
}

.rwm-decor-edge__lights {
  display: flex;
  justify-content: space-around;
  padding: 4px 5%;
}

.rwm-light-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--rwm-decor-accent);
  box-shadow: 0 0 6px var(--rwm-decor-accent);
  opacity: 0.85;
}

/* Corner Flourish and Artwork Emblems */
.rwm-decor-corner {
  position: absolute;
  color: var(--rwm-decor-accent);
  opacity: 0.85;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px var(--rwm-decor-accent-glow));
  transition: opacity .3s ease;
}

.rwm-decor-corner--top-left {
  top: 14px;
  left: 18px;
}

.rwm-decor-corner--top-right {
  top: 14px;
  right: 18px;
}

.rwm-svg-corner {
  display: block;
  width: 44px;
  height: 44px;
}

.rwm-svg-artwork {
  display: block;
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 2px 6px var(--rwm-decor-accent-glow));
}

.rwm-decor-artwork-img {
  display: block;
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
  border-radius: 6px;
  filter: drop-shadow(0 2px 6px var(--rwm-decor-accent-glow));
}

/* Artwork Scale Modifiers */
.rwm-scale--compact .rwm-svg-artwork,
.rwm-scale--compact .rwm-decor-artwork-img {
  width: 36px !important;
  height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
}

.rwm-scale--standard .rwm-svg-artwork,
.rwm-scale--standard .rwm-decor-artwork-img {
  width: 48px !important;
  height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
}

.rwm-scale--large .rwm-svg-artwork,
.rwm-scale--large .rwm-decor-artwork-img {
  width: 60px !important;
  height: 60px !important;
  max-width: 60px !important;
  max-height: 60px !important;
}

/* Floating Elements */
.rwm-decor-floating {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.rwm-floating-item {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--rwm-decor-accent);
  pointer-events: none;
  opacity: 0.78;
  filter: drop-shadow(0 1px 4px var(--rwm-decor-accent-glow));
}

.rwm-floating-item[style*="--float-i: 0"] { top: 16%; left: 7%; }
.rwm-floating-item[style*="--float-i: 1"] { top: 22%; right: 8%; }
.rwm-floating-item[style*="--float-i: 2"] { top: 60%; left: 12%; }
.rwm-floating-item[style*="--float-i: 3"] { top: 68%; right: 10%; }
.rwm-floating-item[style*="--float-i: 4"] { top: 38%; left: 5%; }
.rwm-floating-item[style*="--float-i: 5"] { top: 48%; right: 6%; }
.rwm-floating-item[style*="--float-i: 6"] { top: 82%; left: 16%; }
.rwm-floating-item[style*="--float-i: 7"] { top: 86%; right: 15%; }

.rwm-svg-motif {
  display: block;
}

/* Intensity Presets */
.rwm-intensity--subtle,
.rwm-density--subtle {
  opacity: 0.65;
}

.rwm-intensity--festive,
.rwm-density--moderate {
  opacity: 0.88;
}

.rwm-intensity--celebration,
.rwm-density--celebration {
  opacity: 0.98;
}

/* ==========================================================================
   ENTRANCE ANIMATIONS (Deterministic, 1-time lifecycle, 2.5–3s max)
   ========================================================================== */

/* 1. Diwali Fireworks Burst */
.rwm-firework-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
  animation: rwm-firework-stage-fade 2.8s ease-out forwards;
}

@keyframes rwm-firework-stage-fade {
  0% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

.rwm-firework-burst {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.rwm-fw-1 { top: 20%; left: 32%; }
.rwm-fw-2 { top: 16%; right: 28%; animation-delay: 0.35s; }

.rwm-fw-spark {
  position: absolute;
  top: 0;
  left: 0;
  width: 2.5px;
  height: 14px;
  background: linear-gradient(to top, var(--rwm-decor-accent), #fef08a, transparent);
  border-radius: 2px;
  transform-origin: 50% 100%;
  animation: rwm-spark-radiate 1.8s cubic-bezier(0.1, 0.8, 0.2, 1) forwards;
}

@keyframes rwm-spark-radiate {
  0% {
    transform: rotate(var(--rot)) translateY(0) scaleY(0.2);
    opacity: 1;
  }
  60% {
    transform: rotate(var(--rot)) translateY(-55px) scaleY(1);
    opacity: 0.9;
  }
  100% {
    transform: rotate(var(--rot)) translateY(-72px) scaleY(0.4);
    opacity: 0;
  }
}

/* 2. Confetti Burst */
.rwm-confetti-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
  animation: rwm-firework-stage-fade 3.2s ease-out forwards;
}

.rwm-confetti-piece {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  opacity: 0.9;
  animation: rwm-confetti-fall 2.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes rwm-confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(480px) rotate(360deg);
    opacity: 0;
  }
}

/* 3. Sparkle Reveal */
.rwm-sparkle-reveal-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
  animation: rwm-firework-stage-fade 2.6s ease-out forwards;
}

.rwm-sparkle-burst {
  position: absolute;
  font-size: 20px;
  color: var(--rwm-decor-accent);
  opacity: 0;
  animation: rwm-sparkle-pop 2s ease-out forwards;
}

@keyframes rwm-sparkle-pop {
  0% { transform: scale(0.2); opacity: 0; }
  40% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0; }
}

/* 4. Petal Shower */
.rwm-petal-shower-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
  animation: rwm-firework-stage-fade 3.2s ease-out forwards;
}

.rwm-shower-petal {
  position: absolute;
  top: -12px;
  width: 10px;
  height: 14px;
  border-radius: 50% 0 50% 50%;
  opacity: 0.85;
  animation: rwm-petal-fall 3s ease-out forwards;
}

@keyframes rwm-petal-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(420px) rotate(180deg);
    opacity: 0;
  }
}

/* ==========================================================================
   AMBIENT MOTION KEYFRAMES
   ========================================================================== */

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

@keyframes rwm-slow-drift {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(4deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

@keyframes rwm-twinkle {
  0%, 100% { opacity: 0.45; transform: scale(0.94); }
  50% { opacity: 0.95; transform: scale(1.06); }
}

@keyframes rwm-falling-petals {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(10px) rotate(6deg); }
}

@keyframes rwm-snowfall {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(8px) rotate(-4deg); }
}

@keyframes rwm-lantern-sway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

/* Apply Motion by Class */
.rwm-motion--gentle_float .rwm-floating-item {
  animation: rwm-gentle-float 6s ease-in-out infinite;
}
.rwm-motion--gentle_float .rwm-floating-item:nth-child(even) {
  animation-duration: 8s;
  animation-delay: -3s;
}

.rwm-motion--slow_drift .rwm-floating-item {
  animation: rwm-slow-drift 9s ease-in-out infinite;
}
.rwm-motion--slow_drift .rwm-floating-item:nth-child(even) {
  animation-duration: 11s;
  animation-delay: -4s;
}

.rwm-motion--twinkle .rwm-floating-item,
.rwm-motion--twinkle .rwm-light-dot {
  animation: rwm-twinkle 3.5s ease-in-out infinite;
}
.rwm-motion--twinkle .rwm-floating-item:nth-child(even),
.rwm-motion--twinkle .rwm-light-dot:nth-child(even) {
  animation-duration: 4.5s;
  animation-delay: -1.8s;
}

.rwm-motion--falling_petals .rwm-floating-item {
  animation: rwm-falling-petals 7s ease-in-out infinite;
}

.rwm-motion--snowfall .rwm-floating-item {
  animation: rwm-snowfall 8s ease-in-out infinite;
}

.rwm-motion--lantern_sway .rwm-decor-corner,
.rwm-motion--lantern_sway .rwm-floating-item {
  transform-origin: 50% 0;
  animation: rwm-lantern-sway 5s ease-in-out infinite;
}

/* Accessibility Invariant: Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .rwm-campaign-decor,
  .rwm-campaign-decor *,
  .rwm-floating-item,
  .rwm-light-dot,
  .rwm-firework-stage,
  .rwm-confetti-stage,
  .rwm-sparkle-reveal-stage,
  .rwm-petal-shower-stage {
    animation: none !important;
    transition: none !important;
  }

  .rwm-firework-stage,
  .rwm-confetti-stage,
  .rwm-sparkle-reveal-stage,
  .rwm-petal-shower-stage {
    display: none !important;
  }
}
