/*
 * Новогоднее оформление веб-бота. Подключается только с 1 декабря по 10 января (src/NewYear.php) и только
 * добавляет своё: без этого файла страницы выглядят как обычно. Общий для чата (chat.css) и страниц входа
 * (style.css). Классы на <html>: ny - оформление включено, ny-chat - чат, ny-page - страницы входа,
 * ny-gar - с гирляндой, ny-jan - уже январь, ny-off - клиент убрал оформление чата в меню (ny.js).
 * Картинки - в папке ny/ рядом (правила страниц пускают только свои файлы). Только обычный дефис в текстах.
 */

/*
 * Снег: три слоя - дальние точки, ближние точки, снежинки. Рисунок слоя повторяется плиткой; слой выше
 * окна на одну плитку и едет вниз ровно на неё, потом начинает заново - шва не видно. Движется только
 * transform. В чате слои лежат под лентой (.nysnow, z-index -1 внутри .app), на страницах входа - под
 * карточкой, на весь экран.
 */
.ny-chat .app { isolation: isolate; }
.nysnow { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.nysnow i { position: absolute; left: 0; right: 0; bottom: 0; will-change: transform; }
.ny-page body::before,
.ny-page .wrap::before,
.ny-page .wrap::after { content: ""; position: fixed; left: 0; right: 0; bottom: 0; z-index: -1; pointer-events: none; will-change: transform; }

.nysnow i:nth-child(1),
.ny-page body::before {
  top: -150px;
  opacity: .45;
  background-image:
    radial-gradient(circle at 18px 22px, #fff 0, #fff 1px, transparent 1.7px),
    radial-gradient(circle at 96px 48px, #fff 0, #fff 1.1px, transparent 1.8px),
    radial-gradient(circle at 54px 92px, #fff 0, #fff .9px, transparent 1.6px),
    radial-gradient(circle at 128px 118px, #fff 0, #fff 1px, transparent 1.7px),
    radial-gradient(circle at 72px 138px, #fff 0, #fff .9px, transparent 1.6px);
  background-size: 150px 150px;
  animation: nyfall1 14s linear infinite;
}
.nysnow i:nth-child(2),
.ny-page .wrap::before {
  top: -210px;
  opacity: .6;
  background-image:
    radial-gradient(circle at 30px 40px, #fff 0, #fff 1.7px, transparent 2.5px),
    radial-gradient(circle at 150px 20px, #fff 0, #fff 1.5px, transparent 2.3px),
    radial-gradient(circle at 100px 110px, #fff 0, #fff 1.9px, transparent 2.7px),
    radial-gradient(circle at 184px 150px, #fff 0, #fff 1.6px, transparent 2.4px),
    radial-gradient(circle at 44px 180px, #fff 0, #fff 1.8px, transparent 2.6px);
  background-size: 210px 210px;
  animation: nyfall2 9.3s linear infinite;
}
.nysnow i:nth-child(3),
.ny-page .wrap::after {
  top: -280px;
  opacity: .72;
  background-image: url(ny/flakes.svg);
  background-size: 280px 280px;
  animation: nyfall3 7s linear infinite;
}
@keyframes nyfall1 { to { transform: translateY(150px); } }
@keyframes nyfall2 { to { transform: translateY(210px); } }
@keyframes nyfall3 { to { transform: translateY(280px); } }

/*
 * Чат: снежная кромка под шапкой (и под полосой «ожидаем платёж», когда она есть) и гирлянда из-под неё.
 * Блок без высоты - ленту не сдвигает и нажатия не перехватывает; сообщения при прокрутке уходят под него.
 * Лампочки - четыре слоя по цвету, мигают по очереди. Цвет кромки и провода - по теме чата.
 */
.nytop { position: relative; flex: none; height: 0; z-index: 2; pointer-events: none; }
.nytop::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 14px; z-index: 1; background: url(ny/cap-dark.svg) 0 0 / 160px 14px repeat-x; }
body.light .nytop::before { background-image: url(ny/cap-light.svg); filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .2)); }
.ny-gar .nytop::after { content: ""; position: absolute; left: 0; right: 0; top: 3px; height: 24px; background: url(ny/wire-dark.svg) 0 0 / 120px 24px repeat-x; }
.ny-gar body.light .nytop::after { background-image: url(ny/wire-light.svg); }
.nytop i { position: absolute; left: 0; right: 0; top: 3px; height: 24px; background-size: 120px 24px; background-repeat: repeat-x; animation: nyblink 2.4s ease-in-out infinite; }
.nytop i:nth-child(1) { background-image: radial-gradient(3.4px 4.6px at 15px 14.6px, #ff5a5f 0, #ff5a5f 92%, transparent 100%); filter: drop-shadow(0 0 4px #ff5a5f); }
.nytop i:nth-child(2) { background-image: radial-gradient(3.4px 4.6px at 45px 14.6px, #ffc94d 0, #ffc94d 92%, transparent 100%); filter: drop-shadow(0 0 4px #ffc94d); animation-delay: .6s; }
.nytop i:nth-child(3) { background-image: radial-gradient(3.4px 4.6px at 75px 14.6px, #4cd787 0, #4cd787 92%, transparent 100%); filter: drop-shadow(0 0 4px #4cd787); animation-delay: 1.2s; }
.nytop i:nth-child(4) { background-image: radial-gradient(3.4px 4.6px at 105px 14.6px, #5ab0ff 0, #5ab0ff 92%, transparent 100%); filter: drop-shadow(0 0 4px #5ab0ff); animation-delay: 1.8s; }
@keyframes nyblink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
/* первое сообщение ленты, докрученной до верха, не остаётся под кромкой и лампочками */
.ny-chat:not(.ny-off) .feed { padding-top: 22px; }
.ny-chat.ny-gar:not(.ny-off) .feed { padding-top: 34px; }

/* снежинка у аватара магазина в шапке чата */
.ny-chat:not(.ny-off) .head .ava { position: relative; }
.ny-chat:not(.ny-off) .head .ava::after { content: ""; position: absolute; top: -5px; right: -8px; width: 20px; height: 20px; border-radius: 50%; background: #fff url(ny/flake.svg) center / 14px 14px no-repeat; box-shadow: 0 0 0 2px var(--head); }

/* полоска под шапкой, пока бот отвечает, - в цветах гирлянды */
.ny-chat:not(.ny-off) .prog::before { background: linear-gradient(90deg, transparent, #e5484d, #ffc94d, #2f9e44, transparent); }

/* клиент убрал оформление чата в меню */
.ny-off .nysnow, .ny-off .nytop { display: none; }

/*
 * Страницы входа: шапочка Деда Мороза на кружке с буквой магазина, поздравление под названием магазина,
 * сугроб по нижнему краю окна. Поздравление - из стилей, чтобы не трогать сами страницы; у карточек без
 * кружка магазина («страница не найдена») его нет.
 */
.ny-page .logo { position: relative; }
.ny-page .logo::after { content: ""; position: absolute; left: 16px; top: -20px; width: 44px; height: 34.4px; background: url(ny/hat.svg) center / contain no-repeat; transform-origin: 47% 70%; transform: rotate(20deg); filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .4)); pointer-events: none; }
.ny-page .logo + h1::after { content: "С наступающим Новым годом!"; display: block; margin-top: 4px; font-size: 14px; font-weight: 500; line-height: 1.4; color: #ffd27a; }
.ny-page.ny-jan .logo + h1::after { content: "С Новым годом!"; }
.ny-page body::after { content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 46px; z-index: -1; pointer-events: none; background: url(ny/drift.svg) 0 100% / 640px 46px repeat-x; }

/* в системе выключена анимация: снег стоит на месте, лампочки горят ровно (!important - правила слоёв выше точнее этого) */
@media (prefers-reduced-motion: reduce) {
  .nysnow i, .ny-page body::before, .ny-page .wrap::before, .ny-page .wrap::after, .nytop i { animation: none !important; }
}
