/* === HALLOWEEN ===
   Подключается из template/header.php, когда тема включена в админке («Сайт → Оформление сайта»),
   все правила висят на body.halloween. Анимации отключаются переключателем в меню
   (класс halloween-nofx, кука halloween_fx=0) и системной настройкой «уменьшить движение». */

/* Заголовки блоков — тёплый «тыквенный» свет */
.halloween .text1,
.halloween .text11,
.halloween .text2 {
    color: #ffb54a;
    text-shadow: 0 0 6px rgba(255, 110, 0, .55), 0 1px 1px #000;
}

.halloween .link1 span {
    transition: color .2s, text-shadow .2s;
}

.halloween #menu .link1:hover span {
    color: #ffa230;
    text-shadow: 0 0 8px rgba(255, 120, 0, .8);
}

.halloween .list1 a:hover {
    color: #ffa230;
}

/* Стык баннера с фоном шапки: левый край растворяется в фактуре homepage022.jpg
   (баннер желтее и темнее фона; слева у него 65px чистой фактуры, дальше мыши).
   Такой же край у логотипа задан для всех тем в layout.css */
.halloween #search {
    -webkit-mask-image: linear-gradient(to right, transparent, rgba(0, 0, 0, .55) 40px, #000 95px);
    mask-image: linear-gradient(to right, transparent, rgba(0, 0, 0, .55) 40px, #000 95px);
}

/* Паутина в верхних углах центральной колонки (под шапкой блока, за текстом) */
.halloween #cc_right {
    background: url(../images/halloween/cobweb_l.svg) no-repeat left 8px top 50px,
                url(../images/halloween/cobweb_r.svg) no-repeat right 8px top 50px,
                url(../images/ccr.jpg) right repeat-y;
}

/* Тыква в шляпе на правом краю шапки центрального блока */
.halloween #line3 {
    position: relative;
}

.halloween #line3::after {
    content: "";
    position: absolute;
    right: 34px;
    bottom: 1px;
    width: 60px;
    height: 58px;
    background: url(../images/halloween/pumpkin_hat.png) no-repeat center bottom / contain;
    pointer-events: none;
    animation: hw-flicker 3.2s ease-in-out infinite;
}

@keyframes hw-flicker {
    0%, 100% { filter: drop-shadow(0 0 5px rgba(255, 130, 0, .55)); }
    45%      { filter: drop-shadow(0 0 11px rgba(255, 110, 0, .9)); }
    55%      { filter: drop-shadow(0 0 7px rgba(255, 140, 0, .65)); }
}

/* Переключатель в меню (вместо снега) */
.halloween .hw-toggle label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.halloween .hw-toggle input {
    margin: 0 5px 0 0;
    cursor: pointer;
    accent-color: #e8650c;
}

/* Паук на нитке в шапке, между логотипом и баннером */
.halloween #header {
    position: relative;
}

.hw-spider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 30px;
    margin-left: -15px;
    z-index: 5;
    animation: hw-spider-drop 7s ease-in-out infinite;
    transform-origin: 50% 0;
}

.hw-spider-thread {
    width: 1px;
    height: 100%;
    margin: 0 auto;
    background: linear-gradient(rgba(232, 226, 214, .15), rgba(232, 226, 214, .55));
}

.hw-spider svg {
    position: absolute;
    bottom: -24px;
    left: 0;
    width: 30px;
    height: 30px;
    cursor: pointer;
    filter: drop-shadow(0 0 2px rgba(255, 190, 140, .35));
    animation: hw-spider-sway 2.6s ease-in-out infinite alternate;
    transform-origin: 50% 0;
}

@keyframes hw-spider-drop {
    0%, 100% { height: 14px; }
    40%, 60% { height: 62px; }
}

@keyframes hw-spider-sway {
    from { transform: rotate(-6deg); }
    to   { transform: rotate(6deg); }
}

/* Летучие мыши и призраки (создаёт js/halloween.js) */
.hw-flyer {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 9990;
    pointer-events: none;
    user-select: none;
    will-change: transform, opacity;
}

.hw-bat .hw-wing {
    transform-box: view-box;
    transform-origin: 50px 21px;
    animation: hw-flap .22s ease-in-out infinite alternate;
}

.hw-bat svg {
    display: block;
    filter: drop-shadow(0 0 2px rgba(255, 150, 60, .9)) drop-shadow(0 0 6px rgba(255, 110, 0, .45));
}

@keyframes hw-flap {
    from { transform: scaleY(1); }
    to   { transform: scaleY(-.35); }
}

.hw-ghost svg {
    display: block;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, .45));
    animation: hw-ghost-wobble 1.8s ease-in-out infinite alternate;
}

@keyframes hw-ghost-wobble {
    from { transform: rotate(-5deg) translateX(-6px); }
    to   { transform: rotate(5deg) translateX(6px); }
}

/* Анимации выключены переключателем или системной настройкой */
.halloween-nofx .hw-flyer {
    display: none;
}

.halloween-nofx .hw-spider,
.halloween-nofx .hw-spider svg,
.halloween-nofx #line3::after {
    animation: none;
}

.halloween-nofx .hw-spider {
    height: 40px;
}

@media (prefers-reduced-motion: reduce) {
    .hw-flyer {
        display: none;
    }

    .hw-spider,
    .hw-spider svg,
    .halloween #line3::after {
        animation: none;
    }

    .hw-spider {
        height: 40px;
    }
}
