/**
 * Villex Weihnachts-Overlay (Schnee + Lichterkette unter Header)
 * ENTFERNEN: siehe /assets/seasonal/REMOVE.txt
 */

#villex-seasonal-root,
#villex-seasonal-snow {
  position: fixed;
  inset: 0;
  pointer-events: none !important;
  overflow: hidden;
  contain: layout style paint;
}

/* Lichterkette unter dem Popup */
#villex-seasonal-root {
  z-index: 9400;
}

/* Schnee über allem (auch Weihnachts-Popup), blockiert keine Klicks */
#villex-seasonal-snow {
  z-index: 13000;
}

#villex-seasonal-root *,
#villex-seasonal-root *::before,
#villex-seasonal-root *::after,
#villex-seasonal-snow *,
#villex-seasonal-snow *::before,
#villex-seasonal-snow *::after {
  pointer-events: none !important;
}

/* —— Schnee —— */
.vx-snow {
  position: absolute;
  inset: 0;
}

.vx-flake {
  --vx-drift: 40;
  --vx-spin: 360deg;
  position: absolute;
  top: -6vh;
  width: var(--vx-size, 14px);
  height: var(--vx-size, 14px);
  color: #fff;
  opacity: var(--vx-op, 0.78);
  will-change: transform;
  animation: vx-fall var(--vx-dur, 14s) linear infinite;
  animation-delay: var(--vx-delay, 0s);
  user-select: none;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.55));
}

.vx-flake svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.vx-flake--crystal {
  filter: drop-shadow(0 0 4px rgba(210, 235, 255, 0.75))
    drop-shadow(0 0 1px rgba(255, 255, 255, 0.9));
}

.vx-flake--soft {
  opacity: 0.4;
  filter: blur(0.6px) drop-shadow(0 0 2px rgba(255, 255, 255, 0.35));
}

.vx-flake--powder {
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.35) 55%,
    transparent 70%
  );
  filter: blur(0.35px);
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.45);
}

/* Sanfter Fall mit Seitenschwingung */
@keyframes vx-fall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  20% {
    transform: translate3d(calc(var(--vx-drift) * 0.45px), 22vh, 0)
      rotate(calc(var(--vx-spin) * 0.2));
  }
  45% {
    transform: translate3d(calc(var(--vx-drift) * -0.25px), 48vh, 0)
      rotate(calc(var(--vx-spin) * 0.45));
  }
  70% {
    transform: translate3d(calc(var(--vx-drift) * 0.55px), 75vh, 0)
      rotate(calc(var(--vx-spin) * 0.7));
  }
  100% {
    transform: translate3d(calc(var(--vx-drift) * 0.15px), 110vh, 0)
      rotate(var(--vx-spin));
  }
}

/* —— Lichterkette: direkt unter der weißen Navigation —— */
.vx-garland {
  position: fixed;
  top: var(--vx-garland-top, 72px);
  left: 0;
  right: 0;
  height: 70px;
  z-index: 9401;
  transform: translateZ(0);
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

/* Mega-Menü (Desktop) oder Mobilmenü offen → Lichterkette ausblenden */
body:has(.site-header.is-mega-open) #villex-seasonal-root,
body:has(.site-header.is-open) #villex-seasonal-root,
body:has(.nav-item--mega.is-mega-open) #villex-seasonal-root {
  opacity: 0;
  visibility: hidden;
}

.vx-garland__wire {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.vx-garland__wire path {
  fill: none;
  stroke: #3d2a18;
  stroke-width: 1.6;
  stroke-linecap: round;
  opacity: 0.65;
}

.vx-garland__bulbs {
  position: absolute;
  inset: 0;
}

.vx-bulb {
  --vx-c: #ffd89a;
  position: absolute;
  top: var(--vx-y, 12px);
  left: var(--vx-x, 0%);
  width: 11px;
  height: 14px;
  margin-left: -5.5px;
  border-radius: 50% 50% 48% 48%;
  background: radial-gradient(
    circle at 32% 26%,
    #fff 0%,
    var(--vx-c) 42%,
    #3a1500 140%
  );
  box-shadow:
    0 0 6px 2px var(--vx-c),
    0 0 16px 5px rgba(255, 180, 80, 0.35),
    0 3px 6px rgba(0, 0, 0, 0.22);
  animation: vx-glow var(--vx-tw, 2.2s) ease-in-out infinite;
  transform-origin: 50% -6px;
}

.vx-bulb::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  width: 4px;
  height: 5px;
  margin-left: -2px;
  border-radius: 1px;
  background: linear-gradient(180deg, #a08960, #5a4328);
  box-shadow: 0 -6px 0 -1px #5a4328;
}

/* Bunte Weihnachtslichter */
.vx-bulb:nth-child(6n + 1) {
  --vx-c: #ff4d4d;
} /* rot */
.vx-bulb:nth-child(6n + 2) {
  --vx-c: #ffd24a;
} /* gold */
.vx-bulb:nth-child(6n + 3) {
  --vx-c: #3ecf7a;
} /* grün */
.vx-bulb:nth-child(6n + 4) {
  --vx-c: #fff1c9;
} /* warmweiß */
.vx-bulb:nth-child(6n + 5) {
  --vx-c: #4da3ff;
} /* blau */
.vx-bulb:nth-child(6n + 6) {
  --vx-c: #ff8a3d;
} /* orange/bernstein */

.vx-bulb--sm {
  width: 8px;
  height: 10px;
  margin-left: -4px;
  opacity: 0.9;
}

@keyframes vx-glow {
  0%,
  100% {
    opacity: 0.55;
    filter: brightness(0.85);
  }
  35% {
    opacity: 1;
    filter: brightness(1.35);
  }
  65% {
    opacity: 0.75;
    filter: brightness(1.05);
  }
}

@media (max-width: 720px) {
  .vx-garland {
    height: 48px;
  }
  .vx-garland__wire path {
    stroke-width: 1.2;
    opacity: 0.45;
  }
  .vx-bulb {
    width: 9px;
    height: 11px;
    margin-left: -4.5px;
    box-shadow:
      0 0 5px 1px var(--vx-c),
      0 0 12px 3px rgba(255, 180, 80, 0.28),
      0 2px 4px rgba(0, 0, 0, 0.18);
  }
  .vx-bulb::after {
    inset: -4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vx-flake,
  .vx-bulb {
    animation: none !important;
  }
  .vx-flake {
    opacity: 0.35;
    top: 12%;
  }
  .vx-bulb {
    opacity: 0.9;
  }
}

html.vx-seasonal-off #villex-seasonal-root {
  display: none !important;
}
