/* ==========================================================================
   Festive Wishes modal — Granil PolyTrade
   Themes: .fw-theme-dhanteras | .fw-theme-diwali | .fw-theme-generic
   ========================================================================== */

.fw-overlay {
  --fw-bg-1: #2a0718;
  --fw-bg-2: #12030c;
  --fw-gold: #f6c453;
  --fw-gold-2: #ffe7a3;
  --fw-gold-3: #c98a1b;
  --fw-accent: #ff7a1a;
  --fw-text: #fff7e6;
  --fw-muted: rgba(255, 240, 214, 0.78);
  --fw-glow: rgba(246, 196, 83, 0.45);

  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(ellipse at 50% 40%, rgba(40, 8, 24, 0.72), rgba(4, 2, 8, 0.88));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.45s ease;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow-y: auto;
}
.fw-overlay.fw-open { opacity: 1; }
.fw-overlay.fw-closing { opacity: 0; transition-duration: 0.35s; }

.fw-theme-diwali {
  --fw-bg-1: #1a1046;
  --fw-bg-2: #070a22;
  --fw-gold: #ffcf5c;
  --fw-accent: #ff6b3d;
  --fw-glow: rgba(255, 190, 80, 0.5);
  background: radial-gradient(ellipse at 50% 35%, rgba(26, 16, 70, 0.7), rgba(3, 4, 16, 0.9));
}
.fw-theme-generic {
  --fw-bg-1: #0b2538;
  --fw-bg-2: #061622;
  --fw-gold: #5fe0bf;
  --fw-gold-2: #c9fff0;
  --fw-gold-3: #0f9073;
  --fw-accent: #0f9073;
  --fw-glow: rgba(15, 144, 115, 0.45);
  background: radial-gradient(ellipse at 50% 35%, rgba(6, 22, 34, 0.72), rgba(2, 6, 10, 0.9));
}

.fw-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- Card ---------- */
.fw-card {
  position: relative;
  width: min(460px, 100%);
  margin: auto;
  border-radius: 28px;
  padding: 2px; /* gradient border */
  background: linear-gradient(140deg, var(--fw-gold-2), var(--fw-gold-3) 35%, rgba(255,255,255,0.08) 55%, var(--fw-gold) 100%);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    0 0 60px var(--fw-glow);
  transform: translateY(40px) scale(0.92);
  opacity: 0;
  transition: transform 0.7s cubic-bezier(0.2, 1.2, 0.3, 1), opacity 0.5s ease;
}
.fw-open .fw-card { transform: none; opacity: 1; transition-delay: 0.08s; }
.fw-closing .fw-card { transform: translateY(20px) scale(0.96); opacity: 0; transition-duration: 0.3s; }

.fw-body {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  padding: 58px 28px 26px;
  text-align: center;
  color: var(--fw-text);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 210, 120, 0.22), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(255, 122, 26, 0.16), transparent 50%),
    linear-gradient(180deg, var(--fw-bg-1), var(--fw-bg-2));
}
/* shimmering sweep */
.fw-body::before {
  content: "";
  position: absolute;
  inset: -50%;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 230, 160, 0.10) 50%, transparent 58%);
  animation: fw-sweep 5s ease-in-out infinite;
  pointer-events: none;
}
/* subtle dotted pattern */
.fw-body::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 220, 150, 0.09) 1px, transparent 1.2px);
  background-size: 18px 18px;
  pointer-events: none;
  mask-image: linear-gradient(180deg, #000, transparent 70%);
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 70%);
}
.fw-body > * { position: relative; z-index: 1; }

/* ---------- Toran (marigold garland) ---------- */
.fw-toran {
  position: absolute;
  top: 2px;
  left: 18px;
  right: 18px;
  height: 46px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.fw-toran::before {
  content: "";
  position: absolute;
  left: -6px; right: -6px; top: 4px;
  height: 22px;
  border-bottom: 2px solid rgba(255, 210, 120, 0.55);
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.fw-toran span {
  position: relative;
  width: 12px;
  height: 12px;
  margin-top: var(--y, 6px); /* curve offset set inline by PHP */
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe08a, #ff9f1a 55%, #e2620b);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transform-origin: 50% -20px;
  animation: fw-swing 3.2s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.22s);
}
.fw-toran span:nth-child(odd) {
  background: radial-gradient(circle at 35% 35%, #fff3a8, #ffcd1f 55%, #d99100);
}
.fw-toran span::after { /* mango leaf */
  content: "";
  position: absolute;
  left: 3px;
  top: 10px;
  width: 6px;
  height: 11px;
  border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%;
  background: linear-gradient(#3fae5a, #1e6b33);
}

/* ---------- Close ---------- */
.fw-close {
  position: absolute;
  top: -12px;
  right: -12px;
  z-index: 5;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--fw-gold);
  border-radius: 50%;
  background: var(--fw-bg-2);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  color: var(--fw-gold-2);
  cursor: pointer;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
}
.fw-close:hover { transform: rotate(90deg); background: var(--fw-gold); color: #2a0718; }
.fw-close:focus-visible { outline: 2px solid var(--fw-gold-2); outline-offset: 3px; }

/* ---------- Logo + mandala ---------- */
.fw-logo-stage {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
}
.fw-mandala {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--fw-gold);
  opacity: 0.55;
  animation: fw-spin 28s linear infinite;
}
.fw-logo-wrap {
  position: relative;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, #fffaf0 0%, #fff1d2 70%, #f3d38a 100%);
  box-shadow:
    0 0 0 3px rgba(246, 196, 83, 0.6),
    0 0 30px var(--fw-glow),
    0 0 70px var(--fw-glow);
  animation: fw-pulse 3s ease-in-out infinite;
}
.fw-logo-wrap img {
  width: 84%;
  height: 84%;
  object-fit: contain;
}

/* ---------- Text ---------- */
.fw-eyebrow {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fw-muted);
}
.fw-title {
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'DM Sans', sans-serif;
  font-size: clamp(2rem, 7vw, 2.75rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--fw-text);
}
.fw-title-hl {
  display: inline-block;
  background: linear-gradient(90deg, var(--fw-gold-3), var(--fw-gold-2) 30%, var(--fw-gold) 50%, var(--fw-gold-2) 70%, var(--fw-gold-3));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: fw-shine 3.5s linear infinite;
  filter: drop-shadow(0 2px 12px rgba(246, 196, 83, 0.35));
}

.fw-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 16px auto;
}
.fw-divider i {
  width: 64px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--fw-gold));
}
.fw-divider i:last-child { transform: scaleX(-1); }
.fw-divider b {
  width: 9px;
  height: 9px;
  transform: rotate(45deg);
  background: var(--fw-gold);
  box-shadow: 0 0 12px var(--fw-glow);
}

.fw-message {
  margin: 0 auto;
  max-width: 36ch;
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--fw-muted);
}
.fw-tagline {
  margin: 14px auto 0;
  font-size: 1rem;
  font-style: italic;
  font-weight: 600;
  color: var(--fw-gold-2);
}

/* ---------- Diyas ---------- */
.fw-diyas {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 22px;
  margin: 22px 0 18px;
  height: 46px;
}
.fw-diya {
  position: relative;
  width: 38px;
  height: 14px;
  border-radius: 0 0 40px 40px;
  background: linear-gradient(180deg, #e06a1b, #9a3a08);
  box-shadow: inset 0 3px 0 rgba(255, 220, 140, 0.55), 0 6px 14px rgba(0, 0, 0, 0.4);
}
.fw-diya--lg { transform: scale(1.25); transform-origin: bottom; }
.fw-diya::before { /* glow */
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 60px;
  height: 60px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 200, 80, 0.45), transparent 65%);
  animation: fw-glow 2s ease-in-out infinite;
}
.fw-diya i { /* flame */
  position: absolute;
  left: 50%;
  bottom: 11px;
  width: 11px;
  height: 22px;
  margin-left: -5.5px;
  border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
  background: radial-gradient(ellipse at 50% 80%, #fff 0%, #ffe680 35%, #ff9d1c 70%, rgba(255, 90, 0, 0) 100%);
  transform-origin: 50% 100%;
  animation: fw-flicker 0.9s ease-in-out infinite alternate;
}
.fw-diya:nth-child(2) i { animation-delay: -0.3s; }
.fw-diya:nth-child(3) i { animation-delay: -0.55s; }

/* ---------- CTA ---------- */
.fw-actions { display: flex; justify-content: center; }
.fw-cta {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 190px;
  padding: 13px 28px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: #2a1203;
  background: linear-gradient(135deg, var(--fw-gold-2), var(--fw-gold) 45%, var(--fw-gold-3));
  box-shadow: 0 10px 26px rgba(246, 170, 40, 0.35);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.fw-cta::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  animation: fw-btn-shine 3s ease-in-out infinite;
}
.fw-cta:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(246, 170, 40, 0.5); color: #2a1203; }
.fw-cta:focus-visible { outline: 2px solid var(--fw-gold-2); outline-offset: 3px; }

.fw-sign {
  margin: 14px 0 0;
  font-size: 0.82rem;
  color: rgba(255, 240, 214, 0.6);
}

/* ---------- Illustrated scene (Maa Lakshmi, pots of gold, diyas …) ---------- */
.fw-body--scene { padding-top: 40px; }
.fw-hero {
  position: relative;
  margin: 0 -10px;
  aspect-ratio: 440 / 210;
  border-radius: 46% 46% 18px 18px / 40% 40% 18px 18px;
  background:
    radial-gradient(ellipse at 50% 35%, #fffaf0 0%, #fff1d6 55%, #f7dfae 100%);
  box-shadow:
    inset 0 0 0 2px rgba(201, 138, 27, 0.55),
    inset 0 0 0 6px #fff6e3,
    inset 0 0 0 7px rgba(201, 138, 27, 0.35),
    0 12px 30px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.fw-theme-diwali .fw-hero {
  background: radial-gradient(ellipse at 50% 30%, #fff8ea 0%, #ffe9c2 50%, #f3c98a 100%);
}
.fw-hero svg { display: block; width: 100%; height: 100%; overflow: visible; }

.fw-hero-mandala {
  transform-box: fill-box;
  transform-origin: center;
  animation: fw-spin 40s linear infinite;
}
.fw-drop {
  opacity: 0;
  animation: fw-drop 3s ease-in infinite;
}
.fw-swing {
  transform-box: fill-box;
  transform-origin: 50% 0;
  animation: fw-swing 3.4s ease-in-out infinite;
}
.fw-swing--b { animation-delay: -1.7s; }
.fw-svg-flame {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: fw-flicker 0.9s ease-in-out infinite alternate;
}

/* Logo sits on the bottom edge of the scene */
.fw-body--scene .fw-logo-stage {
  width: 104px;
  height: 104px;
  margin: -34px auto 6px;
}
.fw-body--scene .fw-logo-wrap { width: 74px; height: 74px; }

.fw-subtitle {
  margin: 4px 0 0;
  font-family: 'Noto Sans Devanagari', 'Nirmala UI', 'Mangal', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--fw-gold);
}
.fw-body--scene .fw-divider { margin: 12px auto; }
.fw-body--scene .fw-tagline { margin-bottom: 18px; }

/* ---------- Staggered entrance ---------- */
.fw-body > * {
  opacity: 0;
  transform: translateY(14px);
}
.fw-open .fw-body > * {
  animation: fw-rise 0.6s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}
.fw-open .fw-body > :nth-child(1) { animation-delay: 0.25s; }
.fw-open .fw-body > :nth-child(2) { animation-delay: 0.38s; }
.fw-open .fw-body > :nth-child(3) { animation-delay: 0.48s; }
.fw-open .fw-body > :nth-child(4) { animation-delay: 0.58s; }
.fw-open .fw-body > :nth-child(5) { animation-delay: 0.66s; }
.fw-open .fw-body > :nth-child(6) { animation-delay: 0.74s; }
.fw-open .fw-body > :nth-child(7) { animation-delay: 0.82s; }
.fw-open .fw-body > :nth-child(8) { animation-delay: 0.9s; }
.fw-open .fw-body > :nth-child(9) { animation-delay: 0.98s; }

/* Prevent page scroll while open */
html.fw-lock, html.fw-lock body { overflow: hidden !important; }

/* ---------- Keyframes ---------- */
@keyframes fw-rise   { to { opacity: 1; transform: none; } }
@keyframes fw-drop   { 0% { opacity: 0; transform: translateY(0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(46px); } }
@keyframes fw-spin   { to { transform: rotate(360deg); } }
@keyframes fw-pulse  { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes fw-shine  { to { background-position: 200% center; } }
@keyframes fw-sweep  { 0% { transform: translateX(-30%); } 60%, 100% { transform: translateX(30%); } }
@keyframes fw-btn-shine { 0% { left: -60%; } 55%, 100% { left: 130%; } }
@keyframes fw-glow   { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }
@keyframes fw-swing  { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes fw-flicker {
  0%   { transform: scale(1, 1) rotate(-2deg); opacity: 0.95; }
  50%  { transform: scale(0.92, 1.08) rotate(2deg); opacity: 1; }
  100% { transform: scale(1.05, 0.94) rotate(-1deg); opacity: 0.9; }
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .fw-body { padding: 54px 20px 22px; }
  .fw-body--scene { padding-top: 38px; }
  .fw-hero { margin: 0 -8px; }
  .fw-body--scene .fw-logo-stage { width: 90px; height: 90px; margin-top: -30px; }
  .fw-body--scene .fw-logo-wrap { width: 64px; height: 64px; }
  .fw-body--scene .fw-message { font-size: 0.9rem; line-height: 1.55; }
  .fw-logo-stage { width: 128px; height: 128px; }
  .fw-logo-wrap { width: 90px; height: 90px; }
  .fw-message { font-size: 0.93rem; }
  .fw-cta { width: 100%; }
}
@media (max-height: 640px) {
  .fw-logo-stage { width: 110px; height: 110px; margin-bottom: 8px; }
  .fw-logo-wrap { width: 78px; height: 78px; }
  .fw-diyas { margin: 14px 0 12px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .fw-overlay *, .fw-overlay *::before, .fw-overlay *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
  .fw-body > * { opacity: 1; transform: none; }
  .fw-canvas { display: none; }
}
