/* ==========================================================================
   PACK HALLOWEEN — Menguz · tema estacional de campaña
   Adaptación del demo "Bacardí Superior Halloween Ghost Bottle"
   (generado con Kimi Agent). Canvas: ghost.js. Guía: /design-system/

   DOS CAPAS:
   1) RE-TEMA DE MARCA — redefine los 8 tokens del sitio bajo
      [data-theme="halloween"]: los 443 usos (bg-[var(--wine)]…) se
      re-teman solos, sin tocar un solo componente.
   2) DECORACIONES .hw-* — niebla, espíritus, brillo. Las clases solo
      existen en el DOM cuando el tema está activo (CampaignDecorations);
      respeta prefers-reduced-motion.
   ========================================================================== */

/* tokens propios del pack (paleta de campaña; la guía los lee del manifest) */
:root {
  --hw-black:        #0a0a0f;   /* noche encantada               */
  --hw-night:        #12121c;
  --hw-purple:       #2a1f3d;
  --hw-ectoplasm:    #39ff88;   /* verde que brilla en la obscuridad */
  --hw-ectoplasm-soft: rgba(57, 255, 136, .55);
  --hw-ghost:        #e8f4ec;
  --hw-bone:         #d9d9d0;
  --hw-bat-red:      #e2001a;   /* acento Bacardí                */
  --hw-gold:         #f2a900;   /* oro ron/herencia              */
  --hw-smoke:        rgba(20, 22, 34, .8);
  --hw-speed-slow:   14s;
  --hw-speed-med:    8s;
  --hw-speed-fast:   3s;
  --hw-ease-float:   cubic-bezier(.45, 0, .55, 1);
}

/* --- 1) RE-TEMA: la marca Menguz vestida de halloween ---------------- */
[data-theme="halloween"] {
  --cellar:   #0a0a0f;   /* fondo: noche encantada          */
  --cellar-2: #12121c;
  --cream:    #e8f4ec;   /* texto claro: blanco fantasma    */
  --cream-2:  #d9d9d0;
  --ink:      #0a0a0f;   /* tinta sobre fondos claros       */
  --wine:     #2fbf62;   /* CTA: ectoplasma accionable      */
  --wine-deep:#39ff88;   /* hover: brilla                   */
  --gold:     #f2a900;   /* acentos: oro Bacardí            */
  /* destacado (producto del mes): verde NOCHE — el fondo de la botella
     Bacardí — para que el texto fantasma lea bien (el wine-deep neón
     con texto blanco era ilegible). */
  --destacado-bg: #0d2b1c;
}
[data-theme="halloween"] ::selection {
  background: var(--hw-ectoplasm);
  color: var(--hw-black);
}

/* --- 2) DECORACIONES (del demo, clases .hw-*) ------------------------- */

/* CampaignDecorations monta las brumas en .hw-over (fixed z-30, sobre el
   fondo de secciones, bajo header/chat). Sin fondo opaco: la noche la da
   el re-tema de --cellar. Aquí se suavizan para no lavar el contenido. */
.hw-over .hw-fog { opacity: .55; }
.hw-over .hw-fog--2 { opacity: .35; }
.hw-over .hw-fog--3 { opacity: .2; }
.hw-over .hw-spirits { opacity: .7; }
.hw-over .hw-bg__glow { opacity: .8; }

/* Fondo encantado completo (legacy, no montado por defecto): .hw-bg */
.hw-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 110%, var(--hw-purple) 0%, transparent 60%),
    linear-gradient(180deg, var(--hw-black) 0%, var(--hw-night) 55%, #161226 100%);
}

/* Soft ectoplasm moon-glow that slowly breathes and drifts */
.hw-bg__glow {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  left: 50%;
  top: -20vmax;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(circle,
              rgba(57, 255, 136, .16) 0%,
              rgba(57, 255, 136, .05) 40%,
              transparent 70%);
  animation: hw-breathe var(--hw-speed-slow) var(--hw-ease-float) infinite;
}

@keyframes hw-breathe {
  0%, 100% { transform: scale(1)    translateX(0);    opacity: .8; }
  50%      { transform: scale(1.15) translateX(-4%);  opacity: 1;  }
}


/* ==========================================================================
   3. DRIFTING FOG  —  .hw-fog
   Layered ground fog sliding horizontally at different speeds/depths.
   ========================================================================== */
.hw-fog {
  position: absolute;
  width: 200%;
  height: 40%;
  left: -50%;
  bottom: -10%;
  background:
    radial-gradient(40% 60% at 20% 50%, rgba(232, 244, 236, .10), transparent 70%),
    radial-gradient(35% 55% at 55% 60%, rgba(232, 244, 236, .08), transparent 70%),
    radial-gradient(45% 65% at 85% 45%, rgba(57, 255, 136, .07), transparent 70%);
  /* sin filter: blur() — el gradiente ya es difuso y el blur sobre 200vw
     cuesta cada frame en GPUs modestas (arrastraba todas las animaciones) */
  animation: hw-fog-drift linear infinite;
  pointer-events: none;
}
.hw-fog--1 { animation-duration: 55s; opacity: .9; }
.hw-fog--2 { animation-duration: 80s; animation-direction: reverse; bottom: -4%;
             height: 30%; opacity: .6; }
.hw-fog--3 { animation-duration: 110s; bottom: 8%;
             height: 22%; opacity: .35; }

@keyframes hw-fog-drift {
  from { transform: translateX(-8%); }
  to   { transform: translateX(8%);  }
}


/* ==========================================================================
   4. RISING SPIRITS  —  .hw-spirits
   Tiny glowing motes (rum bubbles / spirits) floating up from the bottom,
   like bubbles rising in a glass of Bacardí Superior.
   ========================================================================== */
/* La capa mide 200% de alto con tile de 100% 50%: al deslizar
   translateY(-50%) el patrón coincide EXACTO → loop infinito con
   transform puro. (Antes animaba background-position: paint de 3
   capas fullscreen POR FRAME — el 50-60% de GPU constante en
   Chrome; bisección 15-nov.) */
.hw-spirits,
.hw-spirits::before,
.hw-spirits::after {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 200%;
  content: "";
  background-repeat: repeat;
  background-size: 100% 50%;
  background-image:
    radial-gradient(3px 3px at 12% 88%, var(--hw-ectoplasm-soft), transparent 60%),
    radial-gradient(2px 2px at 34% 95%, rgba(232,244,236,.5),  transparent 60%),
    radial-gradient(4px 4px at 57% 90%, rgba(57,255,136,.35),   transparent 60%),
    radial-gradient(2px 2px at 76% 97%, rgba(232,244,236,.4),   transparent 60%),
    radial-gradient(3px 3px at 90% 85%, rgba(57,255,136,.4),    transparent 60%);
  animation: hw-rise linear infinite;
  will-change: transform;
  pointer-events: none;
}
.hw-spirits        { animation-duration: 16s; }
.hw-spirits::before { animation-duration: 24s; animation-delay: -8s;
                      opacity: .7; }
.hw-spirits::after  { animation-duration: 32s; animation-delay: -16s;
                      opacity: .45; }

@keyframes hw-rise {
  from { transform: translateY(0); }
  to   { transform: translateY(-50%); }
}


/* ==========================================================================
   5. GHOST  —  .hw-ghost
   Pure-CSS ghost (Ghost Bottle mascot). Floats and phases in and out.
   Wrap in a positioned container or add your own position utility.
   ========================================================================== */
.hw-ghost {
  position: absolute;
  width: 90px;
  height: 120px;
  top: 20%;
  left: 8%;
  background: linear-gradient(180deg, var(--hw-ghost) 0%, #cfe8d8 100%);
  border-radius: 50% 50% 0 0 / 60% 60% 0 0;
  box-shadow: 0 0 30px rgba(57, 255, 136, .35),
              inset 0 -10px 24px rgba(57, 255, 136, .25);
  animation: hw-ghost-float 7s var(--hw-ease-float) infinite,
             hw-ghost-phase 11s ease-in-out infinite;
  pointer-events: none;
}
/* wavy skirt */
.hw-ghost::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -14px;
  height: 28px;
  background: radial-gradient(circle at 15px -8px, transparent 16px, #cfe8d8 17px);
  background-size: 30px 28px;
  background-repeat: repeat-x;
  filter: drop-shadow(0 6px 10px rgba(57,255,136,.2));
}
/* eyes + mouth */
.hw-ghost::after {
  content: "";
  position: absolute;
  top: 34%;
  left: 50%;
  width: 10px;
  height: 14px;
  translate: -50% 0;
  border-radius: 50%;
  background: var(--hw-night);
  box-shadow: -18px 0 0 var(--hw-night),   /* left eye  */
               18px 0 0 var(--hw-night),   /* right eye */
               0 22px 0 -2px var(--hw-night); /* little "o" mouth */
}
/* optional green-tinted variant */
.hw-ghost--green {
  background: linear-gradient(180deg, #d8ffe9 0%, var(--hw-ectoplasm) 140%);
}
/* optional size modifiers */
.hw-ghost--sm { scale: .6; }
.hw-ghost--lg { scale: 1.4; }

@keyframes hw-ghost-float {
  0%, 100% { transform: translate(0, 0)        rotate(-3deg); }
  33%      { transform: translate(2vw, -3vh)   rotate(2deg);  }
  66%      { transform: translate(-1vw, -5vh)  rotate(-2deg); }
}
@keyframes hw-ghost-phase {
  0%, 100% { opacity: .95; }
  50%      { opacity: .45; }
}


/* ==========================================================================
   6. BAT  —  .hw-bat
   The Bacardí bat as a flapping CSS silhouette flying across the screen.
   ========================================================================== */
.hw-bat {
  position: absolute;
  width: 60px;
  height: 34px;
  top: 12%;
  left: -10%;
  background: var(--hw-black);
  clip-path: polygon(
    0% 55%, 12% 20%, 26% 45%, 38% 10%, 50% 32%,
    62% 10%, 74% 45%, 88% 20%, 100% 55%,
    86% 60%, 74% 78%, 60% 66%, 50% 88%,
    40% 66%, 26% 78%, 14% 60%
  );
  animation: hw-bat-fly 18s linear infinite,
             hw-bat-flap .45s ease-in-out infinite alternate;
  pointer-events: none;
}
.hw-bat--2 { top: 22%; animation-duration: 24s, .5s;
             animation-delay: -9s, 0s; scale: .7; }
.hw-bat--3 { top: 6%;  animation-duration: 30s, .55s;
             animation-delay: -18s, 0s; scale: .5; opacity: .8; }

@keyframes hw-bat-fly {
  0%   { left: -10%;  transform: translateY(0); }
  25%  { transform: translateY(-4vh); }
  50%  { transform: translateY(3vh); }
  75%  { transform: translateY(-2vh); }
  100% { left: 110%;  transform: translateY(0); }
}
@keyframes hw-bat-flap {
  from { scale: 1 1; }
  to   { scale: 1 .72; }
}


/* ==========================================================================
   7. CHAIN  —  .hw-chain
   Hanging chain that swings gently, echoing the chained bottle in the promo.
   Put it at the top of a section; height is configurable via --hw-chain-len.
   ========================================================================== */
.hw-chain {
  position: absolute;
  top: 0;
  left: 50%;
  width: 10px;
  height: var(--hw-chain-len, 160px);
  transform-origin: top center;
  background:
    repeating-linear-gradient(180deg,
      transparent 0 2px,
      #6d6d78 2px 8px,
      #3d3d46 8px 14px,
      transparent 14px 18px);
  border-radius: 4px;
  animation: hw-chain-swing 5.5s ease-in-out infinite alternate;
  pointer-events: none;
}
.hw-chain::after {             /* hook / weight at the end */
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  translate: -50% 0;
  width: 16px;
  height: 16px;
  border: 3px solid #6d6d78;
  border-radius: 50%;
}
.hw-chain--left  { left: 12%; animation-duration: 6.5s; }
.hw-chain--right { left: 88%; animation-duration: 7.5s; animation-delay: -3s; }

@keyframes hw-chain-swing {
  from { transform: rotate(7deg);  }
  to   { transform: rotate(-7deg); }
}


/* ==========================================================================
   8. GLOW-IN-THE-DARK BOTTLE HALO  —  .hw-bottle-glow
   Wrap your bottle image; gives it the pulsing ectoplasm glow from the ad.
   ========================================================================== */
.hw-bottle-glow {
  position: relative;
  display: inline-block;
  isolation: isolate;
}
.hw-bottle-glow::before {
  content: "";
  position: absolute;
  inset: -18%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle,
              rgba(57,255,136,.45) 0%,
              rgba(57,255,136,.12) 45%,
              transparent 70%);
  filter: blur(14px);
  animation: hw-bottle-pulse var(--hw-speed-med) ease-in-out infinite;
}
/* slow shine sweep across the bottle surface */
.hw-bottle-glow::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg,
              transparent 30%,
              rgba(232,244,236,.28) 48%,
              rgba(232,244,236,.4) 50%,
              rgba(232,244,236,.28) 52%,
              transparent 70%);
  background-size: 250% 100%;
  mix-blend-mode: screen;
  animation: hw-shine 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes hw-bottle-pulse {
  0%, 100% { opacity: .6;  transform: scale(.96); }
  50%      { opacity: 1;   transform: scale(1.04); }
}
@keyframes hw-shine {
  0%, 55%   { background-position: 120% 0; }
  85%, 100% { background-position: -120% 0; }
}


/* ==========================================================================
   9. GLOWING HEADLINE  —  .hw-title-glow
   Neon ectoplasm flicker for hero copy. .hw-title-glow--red = Bacardí red.
   ========================================================================== */
.hw-title-glow {
  color: var(--hw-ghost);
  text-shadow:
    0 0 6px  rgba(57,255,136,.9),
    0 0 18px rgba(57,255,136,.55),
    0 0 42px rgba(57,255,136,.3);
  animation: hw-neon-flicker 4s linear infinite;
}
.hw-title-glow--red {
  color: #fff;
  text-shadow:
    0 0 6px  rgba(226,0,26,.95),
    0 0 18px rgba(226,0,26,.6),
    0 0 42px rgba(226,0,26,.35);
}

@keyframes hw-neon-flicker {
  0%, 100% { opacity: 1; }
  3%       { opacity: .6; }
  5%       { opacity: 1; }
  42%      { opacity: 1; }
  44%      { opacity: .7; }
  46%      { opacity: 1; }
  70%      { opacity: .85; }
  72%      { opacity: 1; }
}


/* ==========================================================================
   10. CTA BUTTON  —  .hw-btn
   Bacardí-red button with a breathing glow and hover lift.
   ========================================================================== */
.hw-btn {
  display: inline-block;
  padding: .9em 2.2em;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25);
  background: linear-gradient(180deg, #ff2438 0%, var(--hw-bat-red) 60%, #a80012 100%);
  color: #fff;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 0 0 rgba(226,0,26,0);
  transition: transform .25s ease, box-shadow .25s ease;
  animation: hw-btn-breathe 3.2s ease-in-out infinite;
}
.hw-btn:hover,
.hw-btn:focus-visible {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 10px 30px rgba(226,0,26,.45),
              0 0 24px rgba(57,255,136,.35);
}
.hw-btn:active { transform: translateY(0) scale(.98); }
/* ghost-green outline variant */
.hw-btn--ghost {
  background: transparent;
  border: 2px solid var(--hw-ectoplasm);
  color: var(--hw-ectoplasm);
  box-shadow: inset 0 0 18px rgba(57,255,136,.12);
}
.hw-btn--ghost:hover,
.hw-btn--ghost:focus-visible {
  background: rgba(57,255,136,.12);
  box-shadow: 0 0 26px rgba(57,255,136,.5);
}

@keyframes hw-btn-breathe {
  0%, 100% { box-shadow: 0 0 12px rgba(226,0,26,.25); }
  50%      { box-shadow: 0 0 26px rgba(226,0,26,.5);  }
}


/* ==========================================================================
   11. PRODUCT CARD  —  .hw-card
   Frosted dark card; --glow variant adds the haunted border pulse.
   ========================================================================== */
.hw-card {
  position: relative;
  border-radius: 18px;
  padding: 1.5rem;
  background: linear-gradient(160deg,
              rgba(255,255,255,.06) 0%,
              rgba(255,255,255,.02) 100%);
  border: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(8px);
  color: var(--hw-bone);
  transition: transform .3s ease, border-color .3s ease;
}
.hw-card:hover {
  transform: translateY(-6px);
  border-color: rgba(57,255,136,.5);
}
.hw-card--glow::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(120deg,
              transparent,
              rgba(57,255,136,.7),
              transparent,
              rgba(226,0,26,.6),
              transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  background-size: 300% 300%;
  animation: hw-border-run 6s linear infinite;
  pointer-events: none;
}

@keyframes hw-border-run {
  from { background-position: 0% 50%; }
  to   { background-position: 300% 50%; }
}


/* ==========================================================================
   12. FLOAT / BOB HELPERS
   Gentle idle motion for product shots, badges, pumpkins, etc.
   ========================================================================== */
.hw-float        { animation: hw-bob 5s  var(--hw-ease-float) infinite; }
.hw-float--fast  { animation-duration: 3s; }
.hw-float--delay { animation-delay: -2.5s; }

@keyframes hw-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

/* Subtle "heartbeat" pulse for prices, badges or limited-edition tags */
.hw-pulse { animation: hw-pulse 2.4s ease-in-out infinite; }

@keyframes hw-pulse {
  0%, 100% { transform: scale(1);    filter: brightness(1);   }
  50%      { transform: scale(1.06); filter: brightness(1.25); }
}


/* ==========================================================================
   13. SECTION DIVIDER  —  .hw-drip
   Melting/dripping top edge (rum-drip) to transition into a dark section.
   Add to the top of any section that has a solid dark background.
   ========================================================================== */
.hw-drip {
  position: relative;
  height: 46px;
  background:
    radial-gradient(circle at 8%  0, var(--hw-black) 62%, transparent 63%) 0 0 / 90px 46px repeat-x,
    radial-gradient(circle at 30% 0, var(--hw-black) 46%, transparent 47%) 45px 0 / 130px 46px repeat-x;
  animation: hw-drip-slide 20s linear infinite;
}

@keyframes hw-drip-slide {
  from { background-position: 0 0, 45px 0; }
  to   { background-position: 90px 0, 175px 0; }
}


/* ==========================================================================
   14. ACCESSIBILITY — respect reduced-motion preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .hw-bg__glow,
  .hw-fog,
  .hw-spirits,
  .hw-spirits::before,
  .hw-spirits::after,
  .hw-ghost,
  .hw-bat,
  .hw-chain,
  .hw-bottle-glow::before,
  .hw-bottle-glow::after,
  .hw-title-glow,
  .hw-btn,
  .hw-card--glow::before,
  .hw-float,
  .hw-pulse,
  .hw-drip {
    animation: none !important;
  }
  .hw-ghost { opacity: .9; }
}
