/* ==========================================================
   HALLOWEEN DECORATION (Адмінка -> Загальні -> Декорації -> Хелоуїн)
   ========================================================== */
:root {
  --hw-orange: #ff7e00;
  --hw-green: #3dffb0;
  --hw-web-size: clamp(130px, 13vw, 260px);
  --hw-index: 150;
}

/* Помаранчеве світіння зверху сторінки */
.hw-glow {
  position: fixed;
  inset: 0 0 auto 0;
  height: 520px;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 55% 70% at 50% -10%, rgba(255, 126, 0, 0.16), transparent 70%),
    radial-gradient(ellipse 30% 45% at 8% -5%, rgba(255, 126, 0, 0.10), transparent 70%),
    radial-gradient(ellipse 30% 45% at 92% -5%, rgba(255, 126, 0, 0.10), transparent 70%);
}

/* Павутина в кутах (прокручується разом зі сторінкою) */
.hw-web {
  position: absolute;
  top: 0;
  width: var(--hw-web-size);
  height: var(--hw-web-size);
  background: url('../img/halloween/web.svg') no-repeat 0 0 / contain;
  pointer-events: none;
  z-index: var(--hw-index);
  opacity: 0.75;
  filter: drop-shadow(0 0 6px rgba(61, 255, 176, 0.25));
}

.hw-web--left {
  left: 0;
}

.hw-web--right {
  right: 0;
  transform: scaleX(-1);
}

/* Павук на нитці під правою павутиною */
.hw-spider {
  position: absolute;
  top: 0;
  right: calc(var(--hw-web-size) * 0.16);
  width: 2px;
  height: calc(var(--hw-web-size) * 1.15);
  pointer-events: none;
  z-index: var(--hw-index);
  transform-origin: top center;
  animation: hw-swing 4.5s ease-in-out infinite;
}

.hw-spider::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.55));
}

.hw-spider img {
  position: absolute;
  bottom: -30px;
  left: 50%;
  width: 66px;
  height: 61px;
  transform: translateX(-50%);
  filter: drop-shadow(0 0 10px rgba(255, 126, 0, 0.35));
  animation: hw-bob 3s ease-in-out infinite;
}

/* Гарбуз: іконка перед назвою сайту (в одному ряду, нічого не перекриває) */
.logo-text.hw-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.hw-pumpkin {
  order: -1;
  width: 38px;
  height: auto;
  flex-shrink: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(255, 126, 0, 0.55));
  animation: hw-pumpkin 3.2s ease-in-out infinite;
}

/* Відьма: на вільному полі справа від аватара, не перекриває навбар і банер */
#profMenuOpen.hw-has-witch {
  position: relative;
}

.hw-witch {
  position: absolute;
  top: -8px;
  left: calc(100% + 8px);
  width: 112px;
  height: auto;
  pointer-events: none;
  z-index: 5;
  filter: drop-shadow(0 0 12px rgba(255, 126, 0, 0.35));
  animation: hw-fly 4s ease-in-out infinite;
}

/* Привид унизу праворуч (лівіше кнопки чату) */
.hw-ghost {
  position: fixed;
  right: 115px;
  bottom: 0;
  width: 115px;
  height: auto;
  pointer-events: none;
  z-index: 9990;
  filter: drop-shadow(0 0 18px rgba(61, 255, 176, 0.35));
  animation: hw-float 4s ease-in-out infinite;
}

/* Кнопка ввімкнення/вимкнення декорацій у навбарі */
.hw-toggle {
  background: linear-gradient(45deg, #ff7e00, #c43c00);
  box-shadow: inset 0 0 5px 1px rgb(255 255 255 / 0%);
  transition: var(--transition-duration);
}

.hw-toggle img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  transition: var(--transition-duration);
}

.hw-toggle:hover {
  box-shadow: inset 0 0 5px 1px rgb(255 255 255 / 50%);
}

.hw-toggle:hover img {
  scale: 0.9;
}

html.hw-off .hw-toggle {
  filter: grayscale(1);
  opacity: 0.6;
}

/* Користувач вимкнув декорації (зберігається в браузері) */
html.hw-off .hw-glow,
html.hw-off .hw-web,
html.hw-off .hw-spider,
html.hw-off .hw-pumpkin,
html.hw-off .hw-witch,
html.hw-off .hw-ghost {
  display: none !important;
}

/* Анімації */
@keyframes hw-swing {
  0%, 100% { transform: rotate(4deg); }
  50% { transform: rotate(-4deg); }
}

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

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

@keyframes hw-fly {
  0%, 100% { transform: translate(0, 0) rotate(-3deg); }
  50% { transform: translate(-10px, -6px) rotate(2deg); }
}

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

/* Адаптив */
/* Відьмі потрібне вільне поле праворуч, на вужчих екранах її не показуємо */
@media (max-width: 1900px) {
  .hw-witch {
    display: none;
  }
}

@media (max-width: 768px) {
  .hw-witch,
  .hw-spider {
    display: none;
  }

  .hw-ghost {
    width: 70px;
    right: 85px;
  }

  .hw-web {
    opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hw-spider,
  .hw-spider img,
  .hw-pumpkin,
  .hw-witch,
  .hw-ghost {
    animation: none;
  }
}
