:root {
    --new-year-branch-width: clamp(216px, 15.77vw, 301px);
    --new-year-scene-width: clamp(180px, 16.87vw, 322px);
    --new-year-scene-image: url("../../img/new-year/winter-scene.webp");
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
    width: calc(var(--new-year-branch-width) * 1.3);
    aspect-ratio: 301 / 179;
    background: url("../../img/new-year/tree-branch.webp") no-repeat center / contain;
    pointer-events: none;
}

.white_panel_header_left .logo,
.left_side_header .logo,
.site-main-container .header__logo img,
.first-screen__logo img,
.agreement-header__logo img {
    opacity: 0;
}

.new-year-scene {
    --new-year-scene-draw-width: min(var(--new-year-scene-width), var(--new-year-scene-max-width, 100vw));
    --new-year-scene-crop-right: 0px;
    position: fixed;
    right: max(0px, var(--new-year-scene-right, 0px));
    bottom: 0;
    z-index: 10;
    width: calc(var(--new-year-scene-draw-width) - var(--new-year-scene-crop-right));
    height: calc(var(--new-year-scene-draw-width) * 2 / 3);
    background: var(--new-year-scene-image) no-repeat left bottom / var(--new-year-scene-draw-width) auto;
    opacity: 0;
    pointer-events: none;
}

.site-wrap_responsive > .new-year-scene {
    --new-year-scene-draw-width: var(--new-year-scene-width);
    right: 0;
}

.new-year-scene[data-positioned] {
    opacity: 1;
}

@media (scripting: none) {
    .new-year-scene {
        opacity: 1;
    }
}

@media (min-width: 951px) {
    .site-wrap_responsive > .new-year-scene,
    .new-year-scene[data-placement="edge"] {
        --new-year-scene-width: clamp(180px, 20.17vw, 385px);
        --new-year-scene-crop-right: calc(var(--new-year-scene-draw-width) * 72 / 385);
    }

    .new-year-scene[data-placement="column"],
    .new-year-scene[data-placement="admin-edge"] {
        --new-year-scene-width: clamp(180px, 20.9vw, 399px);
    }

    .new-year-scene[data-placement="admin-edge"] {
        --new-year-scene-crop-right: calc(var(--new-year-scene-draw-width) * 21 / 399);
    }
}

.new-year-snow {
    display: none;
}

@media screen and (prefers-reduced-motion: no-preference) {
    .new-year-snow {
        position: fixed;
        inset: 0;
        z-index: 9;
        display: block;
        overflow: hidden;
        pointer-events: none;
    }

    .new-year-snow::before,
    .new-year-snow::after {
        content: "";
        position: absolute;
        inset: calc(-1 * var(--new-year-snow-fall)) -11px 0;
        background-repeat: repeat;
        animation: new-year-snow-fall 12s linear infinite;
    }

    .new-year-snow::before {
        --new-year-snow-fall: 390px;
        --new-year-snow-sway: 7px;
        background-image: url("../../img/new-year/snow-far.png");
    }

    .new-year-snow::after {
        --new-year-snow-fall: 515px;
        --new-year-snow-sway: -11px;
        background-image: url("../../img/new-year/snow-near.png");
    }

    /* Смещение за цикл равно высоте текстуры, поэтому переход незаметен. */
    @keyframes new-year-snow-fall {
        0% {
            transform: translate(0, 0);
        }

        25% {
            transform: translate(var(--new-year-snow-sway), calc(var(--new-year-snow-fall) / 4));
        }

        50% {
            transform: translate(0, calc(var(--new-year-snow-fall) / 2));
        }

        75% {
            transform: translate(calc(-1 * var(--new-year-snow-sway)), calc(var(--new-year-snow-fall) * 3 / 4));
        }

        100% {
            transform: translate(0, var(--new-year-snow-fall));
        }
    }
}

@media (max-width: 767px) {
    :root {
        --new-year-branch-width: min(180px, 43.5vw);
    }

    body:has(> .site-wrap_responsive) {
        --new-year-branch-width: min(189.2px, 45.7vw);
    }

    body::before {
        width: var(--new-year-branch-width);
    }
}

@media (max-width: 950px) {
    :root {
        --new-year-scene-width: min(226px, 55vw);
    }

    .new-year-scene {
        --new-year-scene-crop-right: calc(var(--new-year-scene-draw-width) * 45 / 226);
        right: 0;
        /* У WebP меньше прозрачного поля снизу, чем у изображения в макете. */
        background-position: left calc(100% + var(--new-year-scene-draw-width) * 6.5 / 226);
    }
}

@media (max-width: 500px) {
    .content:has(> .login_wrapper + .new-year-scene) {
        position: relative;
    }

    .content > .login_wrapper + .new-year-scene {
        position: absolute;
    }
}
