/* =========================================================
   HALLOWEEN POZADIE – iba homepage (index.html)
   Dekorácie sa vkladajú cez assets/js/halloween.js do vrstvy
   .hw-bg, ktorá leží POD obsahom sekcie a nad jej pozadím.
   Po Halloweene stačí z index.html odstrániť <link> a <script>.
   ========================================================= */

:root {
  --hw-orange: #ff7a1a;
  --hw-orange-lt: #ffb15c;
  --hw-purple: #7c3aed;
  --hw-glow: #ffd36b;
}

.hw-host {
  position: relative;
  isolation: isolate;
}

.hw-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.hw-bg > * { position: absolute; }

/* ---------- Atmosféra (žiara + vzor) ---------- */
.hw-atmo { inset: 0; }

.hw-dark .hw-atmo {
  background:
    radial-gradient(circle at 8% 92%, rgba(255,122,26,.20), transparent 26rem),
    radial-gradient(circle at 92% 8%, rgba(124,58,237,.22), transparent 28rem),
    radial-gradient(circle at 60% 120%, rgba(255,122,26,.10), transparent 30rem);
}

.hw-light .hw-atmo {
  background:
    radial-gradient(circle at 0% 100%, rgba(255,122,26,.07), transparent 24rem),
    radial-gradient(circle at 100% 0%, rgba(124,58,237,.05), transparent 26rem);
}

.hw-pattern {
  inset: 0;
  background-size: 340px 340px;
  background-repeat: repeat;
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.95), rgba(0,0,0,.55));
          mask-image: linear-gradient(180deg, rgba(0,0,0,.95), rgba(0,0,0,.55));
}

/* ---------- Pavučiny ---------- */
.hw-web {
  width: clamp(150px, 20vw, 290px);
  height: auto;
}
.hw-web--tl { top: 0; left: 0; }
.hw-web--tr { top: 0; right: 0; transform: scaleX(-1); }
.hw-dark  .hw-web { color: rgba(226,234,255,.20); }
.hw-light .hw-web { color: rgba(13,27,62,.14); }
.premium-hero .hw-web { color: rgba(226,234,255,.24); }

/* ---------- Visiaci pavúk ---------- */
.hw-spider {
  top: 0;
  width: 34px;
  transform-origin: 50% 0;
  animation: hw-swing 5.5s ease-in-out infinite alternate;
}
.hw-spider svg { display: block; width: 100%; height: auto; }
.hw-dark  .hw-spider { color: rgba(226,234,255,.55); }
.hw-light .hw-spider { color: rgba(13,27,62,.42); }

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

/* ---------- Netopiere ---------- */
.hw-bat { width: 54px; }
.hw-bat svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.hw-bat .hw-wing {
  transform-box: view-box;
  animation: hw-flap-r .34s ease-in-out infinite alternate;
}
.hw-bat .hw-wing--r { transform-origin: 54px 30px; }
.hw-bat .hw-wing--l { transform-origin: 46px 30px; animation-name: hw-flap-l; }
.hw-dark  .hw-bat { color: rgba(10,6,20,.92); filter: drop-shadow(0 0 10px rgba(255,122,26,.35)); }
.hw-light .hw-bat { color: rgba(13,27,62,.16); }
.hw-light .hw-bat .hw-wing { animation-duration: .55s; }

@keyframes hw-flap-r {
  from { transform: rotate(-14deg); }
  to   { transform: rotate(26deg) scaleX(.9); }
}
@keyframes hw-flap-l {
  from { transform: rotate(14deg); }
  to   { transform: rotate(-26deg) scaleX(.9); }
}

/* Lietajúce netopiere v hero */
.hw-bat--fly {
  left: 0;
  top: 0;
  animation: hw-fly var(--dur, 18s) linear infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}
@keyframes hw-fly {
  0%   { opacity: 0; transform: translate(var(--x0), var(--y0)) scale(var(--s, 1)); }
  6%   { opacity: 1; }
  50%  { transform: translate(var(--xm), var(--ym)) scale(var(--s, 1)); }
  94%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x1), var(--y1)) scale(var(--s, 1)); }
}

/* ---------- Duch ---------- */
.hw-ghost {
  width: clamp(64px, 7vw, 96px);
  animation: hw-float 6s ease-in-out infinite;
}
.hw-ghost svg { display: block; width: 100%; height: auto; }
.hw-dark  .hw-ghost { color: rgba(240,244,255,.13); filter: drop-shadow(0 0 22px rgba(190,170,255,.25)); }
.hw-light .hw-ghost { color: rgba(13,27,62,.07); }

@keyframes hw-float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-18px) rotate(3deg); }
}

/* ---------- Tekvice ---------- */
.hw-pumpkin { width: clamp(70px, 8vw, 118px); }
.hw-pumpkin svg { display: block; width: 100%; height: auto; overflow: visible; }
.hw-dark .hw-pumpkin,
.premium-hero .hw-pumpkin { filter: drop-shadow(0 0 26px rgba(255,122,26,.45)); }
.hw-light .hw-pumpkin { opacity: .9; }
.hw-pumpkin .hw-face { animation: hw-flicker 3.4s ease-in-out infinite; }

@keyframes hw-flicker {
  0%, 100% { opacity: 1; }
  42%      { opacity: .82; }
  46%      { opacity: .55; }
  50%      { opacity: .95; }
  71%      { opacity: .75; }
}

/* ---------- Mesiac + hmla (hero) ---------- */
.hw-moon {
  top: clamp(6.5rem, 14vh, 9rem);
  right: clamp(1.5rem, 9vw, 9rem);
  width: clamp(150px, 20vw, 290px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, rgba(255,255,255,.55), transparent 42%),
    radial-gradient(circle at 62% 64%, #f2b35c 0%, #e98d2c 58%, #c4631a 100%);
  box-shadow:
    0 0 60px rgba(255,160,70,.55),
    0 0 160px rgba(255,122,26,.35),
    0 0 320px rgba(255,122,26,.18);
  opacity: .9;
}
.hw-moon::before,
.hw-moon::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(150,70,10,.22);
}
.hw-moon::before { width: 18%; height: 18%; top: 28%; left: 56%; }
.hw-moon::after  { width: 11%; height: 11%; top: 60%; left: 30%; box-shadow: 4.2em 1.2em 0 -.3em rgba(150,70,10,.18); }

.hw-hero-tint {
  inset: 0;
  background:
    radial-gradient(circle at 82% 26%, rgba(255,122,26,.20), transparent 34rem),
    radial-gradient(circle at 15% 100%, rgba(124,58,237,.28), transparent 32rem),
    linear-gradient(180deg, transparent 55%, rgba(30,8,45,.45) 100%);
}

.hw-fog {
  left: -10%;
  right: -10%;
  bottom: -2rem;
  height: 14rem;
}
.hw-fog span {
  position: absolute;
  bottom: 0;
  width: 60%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(200,190,255,.16), transparent 70%);
  filter: blur(10px);
  animation: hw-drift 26s ease-in-out infinite alternate;
}
.hw-fog span:nth-child(1) { left: 0; }
.hw-fog span:nth-child(2) { left: 35%; animation-duration: 32s; animation-direction: alternate-reverse; }
.hw-fog span:nth-child(3) { left: 60%; height: 80%; animation-duration: 22s; }

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

/* ---------- Mobil ---------- */
@media (max-width: 760px) {
  .hw-web { width: 130px; }
  .hw-moon { width: 120px; top: 6.5rem; right: 1rem; opacity: .7; }
  .hw-pumpkin { width: 58px; }
  .hw-ghost { width: 54px; }
  .hw-bat { width: 38px; }
  .hw-hide-mobile { display: none !important; }
  .hw-pattern { background-size: 260px 260px; }
}

@media (prefers-reduced-motion: reduce) {
  .hw-bg *,
  .hw-bg *::before,
  .hw-bg *::after { animation: none !important; }
  .hw-bat--fly { opacity: 1; transform: translate(var(--xm), var(--ym)) scale(var(--s, 1)); }
}
