/* ===== Christmas Snow Effect - Non-blocking ===== */
/* Lightweight CSS-only falling snow animation for hero section */

.hero-snow-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.hero-snow {
  position: absolute;
  top: -10px;
  background: radial-gradient(circle, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.6) 50%, transparent 100%);
  border-radius: 50%;
  opacity: 0;
  animation: snowfall linear infinite;
  will-change: transform, opacity;
}

@keyframes snowfall {
  0% {
    opacity: 0;
    transform: translateY(0) translateX(0) scale(0);
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: translateY(100vh) translateX(var(--drift, 0)) scale(1);
  }
}

/* Generate multiple snowflakes with varying properties */
.hero-snow:nth-child(1)  { left: 5%;  width: 3px; height: 3px; animation-duration: 8s; animation-delay: 0s; --drift: 30px; }
.hero-snow:nth-child(2)  { left: 15%; width: 5px; height: 5px; animation-duration: 12s; animation-delay: 2s; --drift: -20px; }
.hero-snow:nth-child(3)  { left: 25%; width: 4px; height: 4px; animation-duration: 10s; animation-delay: 4s; --drift: 40px; }
.hero-snow:nth-child(4)  { left: 35%; width: 6px; height: 6px; animation-duration: 14s; animation-delay: 1s; --drift: -30px; }
.hero-snow:nth-child(5)  { left: 45%; width: 3px; height: 3px; animation-duration: 9s; animation-delay: 3s; --drift: 25px; }
.hero-snow:nth-child(6)  { left: 55%; width: 5px; height: 5px; animation-duration: 11s; animation-delay: 0s; --drift: -35px; }
.hero-snow:nth-child(7)  { left: 65%; width: 4px; height: 4px; animation-duration: 13s; animation-delay: 5s; --drift: 20px; }
.hero-snow:nth-child(8)  { left: 75%; width: 6px; height: 6px; animation-duration: 10s; animation-delay: 2s; --drift: -25px; }
.hero-snow:nth-child(9)  { left: 85%; width: 3px; height: 3px; animation-duration: 12s; animation-delay: 4s; --drift: 35px; }
.hero-snow:nth-child(10) { left: 95%; width: 5px; height: 5px; animation-duration: 9s; animation-delay: 1s; --drift: -15px; }
.hero-snow:nth-child(11) { left: 10%; width: 4px; height: 4px; animation-duration: 11s; animation-delay: 3s; --drift: 28px; }
.hero-snow:nth-child(12) { left: 20%; width: 6px; height: 6px; animation-duration: 14s; animation-delay: 0s; --drift: -22px; }
.hero-snow:nth-child(13) { left: 30%; width: 3px; height: 3px; animation-duration: 10s; animation-delay: 5s; --drift: 32px; }
.hero-snow:nth-child(14) { left: 40%; width: 5px; height: 5px; animation-duration: 12s; animation-delay: 2s; --drift: -28px; }
.hero-snow:nth-child(15) { left: 50%; width: 4px; height: 4px; animation-duration: 9s; animation-delay: 4s; --drift: 18px; }
.hero-snow:nth-child(16) { left: 60%; width: 6px; height: 6px; animation-duration: 13s; animation-delay: 1s; --drift: -33px; }
.hero-snow:nth-child(17) { left: 70%; width: 3px; height: 3px; animation-duration: 11s; animation-delay: 3s; --drift: 26px; }
.hero-snow:nth-child(18) { left: 80%; width: 5px; height: 5px; animation-duration: 10s; animation-delay: 0s; --drift: -18px; }
.hero-snow:nth-child(19) { left: 90%; width: 4px; height: 4px; animation-duration: 12s; animation-delay: 5s; --drift: 38px; }
.hero-snow:nth-child(20) { left: 8%;  width: 6px; height: 6px; animation-duration: 14s; animation-delay: 2s; --drift: -26px; }

/* Reduce animation on low-end devices */
@media (prefers-reduced-motion: reduce) {
  .hero-snow {
    animation: none;
    opacity: 0.3;
  }
}

/* Optional: Add subtle frost glow effect to hero */
.snow-enabled::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top, rgba(173,216,230,0.15) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ===== Santa Overlay (Top-Left) ===== */
/* Ensure hero is a positioned container */
.snow-enabled {
  position: relative;
}

/* Overlay container in the top-left corner */
.snow-enabled { /* add adjustable variables for precise Santa placement */
  --santa-top: 0;
  --santa-left: 0;
}

.santa-overlay {
  position: absolute;
  top: var(--santa-top);
  left: var(--santa-left);
  z-index: 50;
  max-width: 220px; /* slightly smaller while over moon */
  mix-blend-mode: screen;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.45));
  pointer-events: none; /* keep hero interactions unaffected */
  transition: top .25s ease, left .25s ease; /* smooth minor adjustments */
  transform: translateX(-200px); /* your offset, now responsive */
}

@media (max-width: 768px) {
  .santa-overlay {
    /* Mobile: adjust transform to keep over moon */
    transform: translateX(-120px);
    max-width: 150px;
  }
}

/* Video fades in when JS marks overlay as loaded */
.santa-overlay video {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity .6s ease;
}

.santa-overlay.loaded video {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .santa-overlay video {
    transition: none;
  }
}

/* Hide overlay on browsers without WebM support (fallback avoids black poster) */
.santa-overlay.no-webm {
  display: none !important;
}

/* Ensure the video itself blends away black backgrounds */
.santa-overlay video {
  mix-blend-mode: screen;
  background: transparent !important;
}

/* Image-based Santa (APNG/GIF) */
.santa-overlay img.santa-apng,
.santa-overlay img.santa-gif {
  display: block;
  width: 100%;
  height: auto;
  mix-blend-mode: screen;
  background: transparent !important;
  image-rendering: -webkit-optimize-contrast;
}

/* Safari fallback: strengthen silhouette and ensure blend */
.santa-overlay .safari-fallback {
  mix-blend-mode: screen;
  background: transparent !important;
  filter: brightness(1.35) contrast(150%);
}

/* Ensure snow canvas sits below overlay */
.snow-enabled .snow-canvas,
.hero-snow-container { z-index: 1; }

/* Full-page snow canvas - ensure it's above header */
canvas#snow {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  /* height controlled by JS - no !important so JS can override */
  pointer-events: none !important;
  z-index: 999999 !important;
}

/* Collapse Raw HTML wrapper used only to place the santa video */
.santa-raw-collapsed {
  margin: 0 !important;
  padding: 0 !important;
  height: 0 !important;
  line-height: 0 !important;
}

/* Prevent initial layout shift before JS wraps the video */
.santa-video {
  display: block;
}
.santa-video:not([data-santa-placed="1"]) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
