/* Adaptateur Alliance — visibilité renforcée + fantômes / sorcières */

:root.theme-halloween,
:root.halloween {
  --hw-watermark: rgb(255 150 70 / 0.24);
  --hw-watermark-strong: rgb(255 190 120 / 0.42);
  --hw-bat-color: rgb(8 6 5 / 0.92);
  --hw-ghost-color: rgb(250 246 240 / 0.72);
  --hw-witch-color: rgb(26 18 8 / 0.88);
}

:root.theme-halloween .hw-fx,
:root.halloween .hw-fx {
  z-index: 45 !important;
}

.theme-halloween .at-messenger-fab,
.theme-halloween #fb-root,
.theme-halloween .fb_dialog {
  position: fixed !important;
  z-index: 9999 !important;
}

.theme-halloween header {
  z-index: 50;
}

/* —— Plus voyant : filigrane, toiles, brume —— */
:root.theme-halloween .hw-bats-pattern,
:root.halloween .hw-bats-pattern {
  opacity: 0.88 !important;
}

:root.theme-halloween .hw-web,
:root.halloween .hw-web {
  opacity: 1 !important;
  filter: drop-shadow(0 0 14px rgb(255 140 60 / 0.35));
}

:root.theme-halloween .hw-web--bl,
:root.halloween .hw-web--bl {
  opacity: 0.95 !important;
}

:root.theme-halloween .hw-fog,
:root.halloween .hw-fog {
  height: 26vh !important;
  opacity: 1 !important;
}

:root.theme-halloween .hw-spider__body,
:root.halloween .hw-spider__body {
  filter: drop-shadow(0 0 10px rgb(255 122 26 / 0.85));
}

/* Chauves-souris plus contrastées */
:root.theme-halloween .hw-bat__wings,
:root.halloween .hw-bat__wings {
  filter: drop-shadow(0 0 12px rgb(255 122 26 / 0.65));
}

/* —— Fantômes (marges, flottement) —— */
.hw-ghost {
  --hw-top: 30vh;
  --hw-size: 60px;
  --hw-dur: 18s;
  --hw-delay: 0s;
  position: absolute;
  top: var(--hw-top);
  width: var(--hw-size);
  aspect-ratio: 64 / 80;
  opacity: 0;
  will-change: transform, opacity;
  animation: hw-ghost-drift var(--hw-dur) ease-in-out var(--hw-delay) infinite;
}

.hw-ghost--left {
  left: clamp(8px, 4vw, 48px);
}

.hw-ghost--right {
  right: clamp(8px, 4vw, 48px);
}

.hw-ghost__shape {
  width: 100%;
  height: 100%;
  background-color: var(--hw-ghost-color);
  -webkit-mask-image: url("ghost.svg");
  mask-image: url("ghost.svg");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  filter: drop-shadow(0 0 16px rgb(255 200 140 / 0.5));
}

@keyframes hw-ghost-drift {
  0% {
    transform: translate3d(0, 0, 0) scale(0.9);
    opacity: 0.35;
  }
  25% {
    transform: translate3d(12px, -22px, 0) scale(1);
    opacity: 0.78;
  }
  50% {
    transform: translate3d(-8px, -38px, 0) scale(1.04);
    opacity: 0.82;
  }
  75% {
    transform: translate3d(10px, -18px, 0) scale(0.98);
    opacity: 0.7;
  }
  100% {
    transform: translate3d(0, 0, 0) scale(0.92);
    opacity: 0.4;
  }
}

/* —— Sorcières (traversée de l'écran) —— */
.hw-witch {
  --hw-top: 30vh;
  --hw-size: 76px;
  --hw-dur: 34s;
  --hw-delay: 0s;
  position: absolute;
  top: var(--hw-top);
  left: 0;
  width: var(--hw-size);
  aspect-ratio: 120 / 64;
  opacity: 0;
  will-change: transform, opacity;
  animation: hw-witch-fly var(--hw-dur) linear var(--hw-delay) infinite;
}

.hw-witch--rtl {
  animation-name: hw-witch-fly-rtl;
}

.hw-witch__shape {
  width: 100%;
  height: 100%;
  background-color: var(--hw-witch-color);
  -webkit-mask-image: url("witch.svg");
  mask-image: url("witch.svg");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  filter: drop-shadow(0 0 14px rgb(255 107 0 / 0.5));
}

@keyframes hw-witch-fly {
  0% {
    transform: translate3d(-12vw, 0, 0);
    opacity: 0;
  }
  8% {
    opacity: 0.75;
  }
  50% {
    transform: translate3d(50vw, -4vh, 0);
  }
  92% {
    opacity: 0.75;
  }
  100% {
    transform: translate3d(112vw, 2vh, 0);
    opacity: 0;
  }
}

@keyframes hw-witch-fly-rtl {
  0% {
    transform: translate3d(112vw, 0, 0) scaleX(-1);
    opacity: 0;
  }
  8% {
    opacity: 0.75;
  }
  50% {
    transform: translate3d(48vw, 5vh, 0) scaleX(-1);
  }
  92% {
    opacity: 0.75;
  }
  100% {
    transform: translate3d(-12vw, 0, 0) scaleX(-1);
    opacity: 0;
  }
}

/* —— Citrouilles (roulement au bas de l'écran) —— */
.hw-pumpkin {
  --hw-bottom: 8vh;
  --hw-size: 48px;
  --hw-dur: 24s;
  --hw-delay: 0s;
  position: absolute;
  bottom: var(--hw-bottom);
  left: 0;
  width: var(--hw-size);
  aspect-ratio: 80 / 72;
  opacity: 0;
  will-change: transform, opacity;
  animation: hw-pumpkin-roll var(--hw-dur) linear var(--hw-delay) infinite;
}

.hw-pumpkin--rtl {
  animation-name: hw-pumpkin-roll-rtl;
}

.hw-pumpkin__shape {
  width: 100%;
  height: 100%;
  background-color: #ff7a1a;
  -webkit-mask-image: url("pumpkin.svg");
  mask-image: url("pumpkin.svg");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  filter: drop-shadow(0 0 14px rgb(255 100 20 / 0.75))
    drop-shadow(0 4px 8px rgb(0 0 0 / 0.35));
}

@keyframes hw-pumpkin-roll {
  0% {
    transform: translate3d(-14vw, 0, 0) rotate(0deg);
    opacity: 0;
  }
  6% {
    opacity: 0.92;
  }
  25% {
    transform: translate3d(22vw, -6px, 0) rotate(180deg);
  }
  50% {
    transform: translate3d(52vw, 0, 0) rotate(360deg);
  }
  75% {
    transform: translate3d(82vw, -5px, 0) rotate(540deg);
  }
  94% {
    opacity: 0.9;
  }
  100% {
    transform: translate3d(114vw, 0, 0) rotate(720deg);
    opacity: 0;
  }
}

@keyframes hw-pumpkin-roll-rtl {
  0% {
    transform: translate3d(114vw, 0, 0) rotate(0deg);
    opacity: 0;
  }
  6% {
    opacity: 0.92;
  }
  50% {
    transform: translate3d(48vw, -4px, 0) rotate(-360deg);
  }
  94% {
    opacity: 0.9;
  }
  100% {
    transform: translate3d(-14vw, 0, 0) rotate(-720deg);
    opacity: 0;
  }
}

:root.theme-halloween .hw-pumpkin__shape,
:root.halloween .hw-pumpkin__shape {
  background-color: #ff8c1a !important;
  filter: drop-shadow(0 0 16px rgb(255 122 26 / 0.85))
    drop-shadow(0 4px 10px rgb(0 0 0 / 0.4));
}

@media (max-width: 640px) {
  .hw-ghost ~ .hw-ghost ~ .hw-ghost {
    display: none;
  }
  .hw-witch ~ .hw-witch {
    display: none;
  }
  .hw-pumpkin ~ .hw-pumpkin ~ .hw-pumpkin {
    display: none;
  }
  .hw-ghost {
    --hw-dur: 12s;
  }
  .hw-witch {
    --hw-dur: 22s;
  }
  .hw-pumpkin {
    --hw-dur: 18s;
  }
}
