/* New Year effects (2026-11-24): loaded only while the decoration is on (admin panel, home page).
   Overlays only: nothing here changes the layout, colours or pictures of the site. No scripts: the snow moves with
   transforms (compositor), never repaints, never catches clicks. Same file on l2-scripts.ru and l2-scripts.com. */
.ny-snow, .ny-hat, .ny-garland, .ny-drift { pointer-events: none; user-select: none; }

/* ---- snow: three seamless tiles, each layer slides down by exactly one tile ---- */
.ny-snow { position: fixed; inset: 0; z-index: 900; overflow: hidden; contain: strict; }
.ny-snow i { position: absolute; left: -40px; right: -40px; bottom: 0; background-repeat: repeat; will-change: transform; }
.ny-snow i:nth-child(1) { top: -520px; background-image: url(../images/newyear/snow-far.svg?v=2); animation: ny-fall-1 26s linear infinite; }
.ny-snow i:nth-child(2) { top: -680px; background-image: url(../images/newyear/snow-mid.svg?v=2); animation: ny-fall-2 21s linear infinite, ny-sway 9s ease-in-out infinite alternate; }
.ny-snow i:nth-child(3) { top: -900px; background-image: url(../images/newyear/snow-near.svg?v=2); animation: ny-fall-3 18s linear infinite, ny-sway 7s ease-in-out infinite alternate-reverse; }
@keyframes ny-fall-1 { to { transform: translate3d(0, 520px, 0); } }
@keyframes ny-fall-2 { to { transform: translate3d(0, 680px, 0); } }
@keyframes ny-fall-3 { to { transform: translate3d(0, 900px, 0); } }
@keyframes ny-sway { from { translate: -18px 0; } to { translate: 18px 0; } }

/* ---- santa hats of the two heroes: each sprite covers a rectangle of hero-banner.jpg (1947x808), see make_hats.py ---- */
.ny-hat { position: absolute; z-index: 2; display: block; background: center / 100% 100% no-repeat; --bw: min(100vw, 1400px); }
.hero-banner .ny-hat { left: calc(var(--x) / 1947 * 100%); top: calc(120px + (var(--y) / 808 - .4) * .415 * var(--bw)); width: calc(var(--w) / 1947 * var(--bw)); aspect-ratio: var(--w) / var(--h); }
.ny-hat-elf { --x: 1660; --y: 112; --w: 256; --h: 156; background-image: url(../images/newyear/hat-elf.webp); }
.ny-hat-angel { --x: 414; --y: 226; --w: 72; --h: 70; background-image: url(../images/newyear/hat-angel.webp); }

/* ---- garland along the top of the banner, two sets of lights twinkle in turn ---- */
.ny-garland { position: absolute; left: 0; right: 0; top: 0; height: 54px; z-index: 1; background: url(../images/newyear/garland.svg?v=2) center top / 260px 54px repeat-x; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 33%, transparent 38.5%, transparent 61.5%, #000 67%); mask-image: linear-gradient(90deg, #000 33%, transparent 38.5%, transparent 61.5%, #000 67%); } /* the lettering of the banner stays clear */
.ny-garland::before, .ny-garland::after { content: ""; position: absolute; inset: 0; background: url(../images/newyear/lights-a.svg?v=2) center top / 260px 54px repeat-x;
  animation: ny-blink 2.6s ease-in-out infinite alternate; will-change: opacity; }
.ny-garland::after { background-image: url(../images/newyear/lights-b.svg?v=2); animation-direction: alternate-reverse; }
@keyframes ny-blink { from { opacity: 1; } to { opacity: .12; } }

/* ---- snow lying on the lower edge of the dark header ---- */
.ny-drift { position: absolute; left: 0; right: 0; bottom: 0; height: 12px; z-index: 1; background: url(../images/newyear/drift.svg?v=2) center bottom / 360px 12px repeat-x; }
.ny .hero-zone { position: relative; }

/* ---- the hat on the round Telegram button (phones) ---- */
.ny .fab-tg::before { content: ""; position: absolute; left: -7px; top: -30px; width: 68px; height: 50px; background: url(../images/newyear/hat-tg.webp) center / 100% 100% no-repeat; pointer-events: none; }

/* phones and tablets: the banner is shown uncropped, one snow layer less */
@media (max-width: 980px) {
  .ny .hero-zone { position: sticky; }
  .hero-banner .ny-hat { --bw: 100vw; top: calc(var(--y) / 808 * .415 * var(--bw)); }
  .ny-snow i:nth-child(2) { display: none; }
  .ny-garland { height: 34px; background-size: 164px 34px; }
  .ny-garland::before, .ny-garland::after { background-size: 164px 34px; }
  .ny-drift { display: none; }
}
/* visitors who ask for less motion get hats and the garland without movement and snow */
@media (prefers-reduced-motion: reduce) {
  .ny-snow { display: none; }
  .ny-garland::before, .ny-garland::after { animation: none; opacity: .8; }
}
@media print { .ny-snow, .ny-hat, .ny-garland, .ny-drift { display: none; } }
