/**
 * Celebration Popper & Confetti – Frontend Styles
 * Handles overlay, popper positioning, text animations, and CTA.
 */

@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@700;900&family=Montserrat:wght@400;700;900&display=swap');

/* ─────────────────────────────────────────────
   Overlay
   ─────────────────────────────────────────────*/
#cpc-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483639;
  pointer-events: none;
  overflow: hidden;
}

/* ─────────────────────────────────────────────
   Party Poppers
   ─────────────────────────────────────────────*/
.cpc-popper {
  position: fixed;
  bottom: -20px;
  pointer-events: none;
  transition: opacity 0.5s, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2147483641;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.35));
}

.cpc-popper-left {
  left: -20px;
  transform-origin: bottom right;
}

.cpc-popper-right {
  right: -20px;
  transform-origin: bottom left;
}

/* Boom shake animation */
.cpc-popper-boom {
  animation: cpcPopperBoom 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes cpcPopperBoom {
  0%   { filter: drop-shadow(0 8px 24px rgba(0,0,0,0.35)); }
  20%  { transform: rotate(var(--cpc-rot-bump, -2deg)) scale(1.08) !important; filter: drop-shadow(0 0 24px rgba(255,215,0,0.9)) brightness(1.4); }
  40%  { transform: rotate(var(--cpc-rot-base, 0deg)) scale(0.97) !important; }
  60%  { transform: rotate(var(--cpc-rot-bump2, 1deg)) scale(1.03) !important; }
  80%  { transform: rotate(var(--cpc-rot-base, 0deg)) scale(1.0) !important; }
  100% { filter: drop-shadow(0 8px 24px rgba(0,0,0,0.35)); }
}

/* ─────────────────────────────────────────────
   Center Text Container
   ─────────────────────────────────────────────*/
#cpc-text-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 2147483642;
  text-align: center;
  padding: 20px;
  pointer-events: none;
}

.cpc-main-title {
  font-family: 'Cinzel Decorative', 'Montserrat', serif;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0.06em;
  text-shadow:
    0 0 40px rgba(255, 215, 0, 0.6),
    0 4px 20px rgba(0, 0, 0, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.8);
  word-break: break-word;
  max-width: 90vw;
}

.cpc-cta {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 12px 36px;
  border: 2px solid currentColor;
  border-radius: 50px;
  display: inline-block;
  opacity: 0;
  transform: translateY(12px);
  cursor: pointer;
  transition: opacity 0.4s, transform 0.4s, background-color 0.25s, color 0.25s;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

a.cpc-cta {
  pointer-events: auto;
}

a.cpc-cta:hover {
  background-color: rgba(255,255,255,0.15);
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

/* ─────────────────────────────────────────────
   Text Entrance Animations
   ─────────────────────────────────────────────*/

/* Fade */
.cpc-anim-fade {
  animation: cpcFadeIn 0.6s ease forwards;
}

@keyframes cpcFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Fade + Scale (default) */
.cpc-anim-fadescale {
  animation: cpcFadeScale 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cpcFadeScale {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

/* Slide Up */
.cpc-anim-slideup {
  animation: cpcSlideUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes cpcSlideUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Zoom */
.cpc-anim-zoom {
  animation: cpcZoom 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cpcZoom {
  from { opacity: 0; transform: scale(0.1); }
  to   { opacity: 1; transform: scale(1); }
}

/* Blur Reveal */
.cpc-anim-blur {
  animation: cpcBlurReveal 0.8s ease forwards;
}

@keyframes cpcBlurReveal {
  from { opacity: 0; filter: blur(20px); }
  to   { opacity: 1; filter: blur(0); }
}

/* ─────────────────────────────────────────────
   Confetti Canvas (handled by JS, just z-index)
   ─────────────────────────────────────────────*/
#cpc-confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2147483640;
}

/* ─────────────────────────────────────────────
   Shortcode trigger button
   ─────────────────────────────────────────────*/
.cpc-shortcode-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: linear-gradient(135deg, #FFD700, #DAA520);
  color: #1a1a1a;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.08em;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(218,165,32,0.45);
}

.cpc-shortcode-trigger:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(218,165,32,0.6);
}

.cpc-shortcode-trigger:active {
  transform: translateY(0) scale(0.98);
}

/* ─────────────────────────────────────────────
   Responsive
   ─────────────────────────────────────────────*/
@media (max-width: 768px) {
  .cpc-main-title {
    font-size: clamp(28px, 10vw, 56px) !important;
  }

  .cpc-cta {
    font-size: clamp(14px, 4vw, 20px) !important;
    padding: 10px 24px;
  }

  .cpc-popper {
    /* Slightly smaller on mobile, handled by popperSize JS setting */
  }
}

@media (max-width: 480px) {
  .cpc-main-title {
    font-size: clamp(22px, 8vw, 42px) !important;
    letter-spacing: 0.03em;
  }

  .cpc-cta {
    padding: 8px 20px;
  }
}

/* ─────────────────────────────────────────────
   Reduced motion
   ─────────────────────────────────────────────*/
@media (prefers-reduced-motion: reduce) {
  .cpc-anim-fade,
  .cpc-anim-fadescale,
  .cpc-anim-slideup,
  .cpc-anim-zoom,
  .cpc-anim-blur {
    animation: cpcFadeIn 0.5s ease forwards !important;
  }

  .cpc-popper-boom {
    animation: none !important;
  }
}
