/* Новорічна тема (module_block_newyear).
   Усе під html.ny-on: клас ставить рядок у afterhead до малювання сторінки; вимкнено — жодне правило не діє.
   Анімується тільки transform шарів снігу (композитор, без перемальовування сторінки). */

/* Сніг лише на рекламному банері головної (#js_information, клас ny-home ставить хук тільки на route home)
   і на шапці таблиць статистики. Псевдоелемент ::before у них шаблон і модулі не використовують. */
html.ny-on .stats-table-head {
    position: relative;
}

html.ny-on .stats-table-head::before,
html.ny-on.ny-home #js_information::before {
    content: "";
    position: absolute;
    left: 6px;
    right: 6px;
    top: -7px;
    height: 16px;
    z-index: 2;
    pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='16' viewBox='0 0 120 16'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23fff'/%3E%3Cstop offset='1' stop-color='%23d3dfeb'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath fill='url(%23g)' d='M0 6C10 2 20 2 30 5C40 1 52 1 62 4C74 0 88 1 98 4C106 2 114 2 120 6V9C114 12 110 10 104 11C100 12 99 16 96 16S93 12 88 11C80 10 74 13 66 11S54 13 46 12C42 12 41 15 38 15S35 11 30 11C22 11 16 13 10 11C6 10 3 11 0 9Z'/%3E%3C/svg%3E") repeat-x 0 0 / 120px 16px;
    filter: drop-shadow(0 1px 1px rgb(0 0 0 / 35%));
}

/* Банер великий: шапка снігу вища, плитка ширша, над слайдами (z-index). */
html.ny-on.ny-home #js_information::before {
    left: 8px;
    right: 8px;
    top: -9px;
    height: 22px;
    z-index: 3;
    background-size: 165px 22px;
}

/* Гірлянда під верхньою шапкою: .ny-garland додає script/1.js у .navbar_first.
   Шари: дріт із патронами, лампи A (червона, жовта), лампи B (зелена, синя); A і B мерехтять по черзі, анімується лише opacity. */
.ny-garland {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 24px;
    margin-top: -2px;
    z-index: 3;
    pointer-events: none;
}

.ny-garland i {
    position: absolute;
    inset: 0;
    background-repeat: repeat-x;
    background-size: 160px 24px;
}

.ny-garland i:nth-child(1) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='24' viewBox='0 0 160 24'%3E%3Cpath d='M0 2Q40 16 80 2T160 2' fill='none' stroke='%233d4045' stroke-width='1.4'/%3E%3Crect x='18.4' y='6.4' width='3.2' height='2.6' rx='.6' fill='%2355585c'/%3E%3Crect x='58.4' y='6.4' width='3.2' height='2.6' rx='.6' fill='%2355585c'/%3E%3Crect x='98.4' y='6.4' width='3.2' height='2.6' rx='.6' fill='%2355585c'/%3E%3Crect x='138.4' y='6.4' width='3.2' height='2.6' rx='.6' fill='%2355585c'/%3E%3C/svg%3E");
}

.ny-garland i:nth-child(2) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='24' viewBox='0 0 160 24'%3E%3Ccircle cx='20' cy='13.2' r='6.5' fill='%23e05555' fill-opacity='.18'/%3E%3Cellipse cx='20' cy='13.2' rx='2.7' ry='3.8' fill='%23e05555'/%3E%3Cellipse cx='19.1' cy='11.8' rx='.7' ry='1.1' fill='%23fff' fill-opacity='.55'/%3E%3Ccircle cx='100' cy='13.2' r='6.5' fill='%23e8b54a' fill-opacity='.18'/%3E%3Cellipse cx='100' cy='13.2' rx='2.7' ry='3.8' fill='%23e8b54a'/%3E%3Cellipse cx='99.1' cy='11.8' rx='.7' ry='1.1' fill='%23fff' fill-opacity='.55'/%3E%3C/svg%3E");
    will-change: opacity;
    animation: ny-twinkle 2.6s ease-in-out infinite;
}

.ny-garland i:nth-child(3) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='24' viewBox='0 0 160 24'%3E%3Ccircle cx='60' cy='13.2' r='6.5' fill='%235cc27e' fill-opacity='.18'/%3E%3Cellipse cx='60' cy='13.2' rx='2.7' ry='3.8' fill='%235cc27e'/%3E%3Cellipse cx='59.1' cy='11.8' rx='.7' ry='1.1' fill='%23fff' fill-opacity='.55'/%3E%3Ccircle cx='140' cy='13.2' r='6.5' fill='%235f9fe0' fill-opacity='.18'/%3E%3Cellipse cx='140' cy='13.2' rx='2.7' ry='3.8' fill='%235f9fe0'/%3E%3Cellipse cx='139.1' cy='11.8' rx='.7' ry='1.1' fill='%23fff' fill-opacity='.55'/%3E%3C/svg%3E");
    will-change: opacity;
    animation: ny-twinkle 2.6s ease-in-out -1.3s infinite;
}

@keyframes ny-twinkle {
    0%, 100% { opacity: 1; }
    50% { opacity: .25; }
}

html:not(.ny-on) .ny-garland {
    display: none;
}

/* Снігопад: три шари-плитки 512 px, зсув рівно на висоту плитки — безшовний цикл. */
.ny-snow {
    position: fixed;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    pointer-events: none;
    contain: strict;
}

.ny-snow i {
    position: absolute;
    left: -32px;
    top: -512px;
    width: calc(100% + 64px);
    height: calc(100% + 512px);
    background-repeat: repeat;
    will-change: transform;
    animation: ny-fall 40s linear infinite;
}

.ny-snow i:nth-child(1) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='512' height='512' fill='%23fff'%3E%3Ccircle cx='106' cy='325' r='0.9' fill-opacity='0.53'/%3E%3Ccircle cx='166' cy='437' r='0.9' fill-opacity='0.41'/%3E%3Ccircle cx='472' cy='294' r='1.4' fill-opacity='0.51'/%3E%3Ccircle cx='112' cy='183' r='0.9' fill-opacity='0.55'/%3E%3Ccircle cx='484' cy='481' r='1.0' fill-opacity='0.41'/%3E%3Ccircle cx='496' cy='123' r='1.1' fill-opacity='0.36'/%3E%3Ccircle cx='337' cy='57' r='1.1' fill-opacity='0.37'/%3E%3Ccircle cx='373' cy='194' r='1.0' fill-opacity='0.59'/%3E%3Ccircle cx='298' cy='317' r='1.1' fill-opacity='0.53'/%3E%3Ccircle cx='166' cy='51' r='1.2' fill-opacity='0.45'/%3E%3C/svg%3E");
    animation-duration: 46s;
}

.ny-snow i:nth-child(2) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='512' height='512' fill='%23fff'%3E%3Ccircle cx='327' cy='409' r='1.9' fill-opacity='0.61'/%3E%3Ccircle cx='74' cy='385' r='1.7' fill-opacity='0.55'/%3E%3Ccircle cx='129' cy='94' r='1.5' fill-opacity='0.53'/%3E%3Ccircle cx='402' cy='132' r='1.8' fill-opacity='0.59'/%3E%3Ccircle cx='244' cy='241' r='2.1' fill-opacity='0.58'/%3E%3C/svg%3E");
    background-position: 170px 0;
    animation-duration: 32s;
}

.ny-snow i:nth-child(3) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='512' height='512' fill='%23fff'%3E%3Ccircle cx='92' cy='235' r='2.6' fill-opacity='0.82'/%3E%3Ccircle cx='324' cy='277' r='2.4' fill-opacity='0.76'/%3E%3Ccircle cx='292' cy='57' r='2.4' fill-opacity='0.78'/%3E%3C/svg%3E");
    background-position: 340px 0;
    animation-duration: 22s;
}

@keyframes ny-fall {
    0% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(-24px, 256px, 0); }
    100% { transform: translate3d(0, 512px, 0); }
}

html:not(.ny-on) .ny-snow {
    display: none;
}

/* Кнопка-сніжинка в шапці: штатна .additional_item_navbar, вимкнено — приглушена іконка. */
.ny-toggle:focus-visible {
    outline: 2px solid var(--span-color);
    outline-offset: 2px;
}

/* Увімкнено: тонка рамка акцентом (як штатне наведення) і повільне обертання сніжинки — помітно, без світіння. */
html.ny-on .ny-toggle {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--span-color) 45%, transparent);
}

html.ny-on .ny-toggle svg {
    animation: ny-spin 14s linear infinite;
}

@keyframes ny-spin {
    to { transform: rotate(360deg); }
}

html:not(.ny-on) .ny-toggle svg {
    opacity: .4;
}

@media (max-width: 768px) {
    .ny-snow i:nth-child(3) {
        display: none;
    }
}

