/* ============================================================
   Новогоднее оформление (просьба владельца 18.11.2026)
   Подключается из layout.html только в праздничные недели
   (services/new_year.py), поэтому в остальное время на странице нет ни
   правил, ни разметки.

   Цвета лампочек — золото, лёд, розовый и лавандовый, а не красный,
   жёлтый и зелёный: в анализаторе эти три значат класс нарушения, и
   гирлянда над карточкой проверки не должна ими «говорить».
   ============================================================ */

/* ---------- Гирлянда над шапкой ----------
   Шаг лампочки — 33 px (ширина 7 + поля 13 + 13); провод (::after) той же
   ширины тянется до соседней лампочки и провисает между ними. */
.mm-garland {
  display: flex;
  justify-content: center;
  overflow: hidden;
  height: 24px;
  /* Фон шапки: гирлянда читается её частью, а не отдельной полосой. */
  background: var(--mm-card);
  pointer-events: none;
  user-select: none;
}

/* На телефоне с нижними вкладками шапки нет — гирлянда висит прямо над
   строкой логотипа, на фоне страницы. */
@media (max-width: 760px) {
  body.has-tabbar .mm-garland { background: transparent; }
}

.mm-garland i {
  --bulb: #f6c445;
  position: relative;
  flex: 0 0 auto;
  width: 7px;
  height: 11px;
  margin: 8px 13px 0;
  border-radius: 50%;
  background: var(--bulb);
  box-shadow: 0 2px 8px 1px var(--bulb);
  /* Мерцает только прозрачность: её браузер анимирует без перерисовки, и
     восемьдесят лампочек не греют телефон весь день на точке. */
  animation: mm-ny-twinkle 2.8s ease-in-out infinite;
}

.mm-garland i:nth-child(4n + 2) { --bulb: #6cc3f5; animation-delay: -0.7s; }
.mm-garland i:nth-child(4n + 3) { --bulb: #f58bb4; animation-delay: -1.4s; }
.mm-garland i:nth-child(4n + 4) { --bulb: #ae98f5; animation-delay: -2.1s; }
.mm-garland i:nth-child(3n) { animation-duration: 3.4s; }

/* Цоколь. */
.mm-garland i::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 1px;
  width: 5px;
  height: 4px;
  border-radius: 1.5px;
  background: var(--mm-ink-2);
}

/* Провод до следующей лампочки. */
.mm-garland i::after {
  content: "";
  position: absolute;
  top: -8px;
  left: 3px;
  width: 33px;
  height: 9px;
  border-bottom: 1.5px solid var(--mm-muted);
  border-radius: 50%;
}

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

@media (prefers-reduced-motion: reduce) {
  .mm-garland i { animation: none; }
}

/* В мастере и совместной проверке глобальной шапки нет — нет и гирлянды:
   там человек заполняет зону одной рукой, и лишнее движение сверху мешает.
   На печать гирлянда тоже не идёт. */
body.mm-focus .mm-garland { display: none; }

@media print {
  .mm-garland { display: none; }
}

/* ---------- Снег на логотипе ----------
   Обёртка .mm-snowy появляется вокруг логотипа только в праздники, поэтому
   размеры логотипа задают прежние правила app.css и mm-shell.css. */
.mm-snowy {
  position: relative;
  display: block;
  flex: none;
  /* Путь снежинки: от полосы над логотипом до его низа. */
  --mm-snow-from: -12px;
  --mm-snow-to: 44px;
}

.mm-brandbar__logo .mm-snowy {
  --mm-snow-from: -8px;
  --mm-snow-to: 26px;
}

/* Вход, сброс пароля, приглашение: логотип стоит по центру карточки
   строчной картинкой — обёртка сжимается до неё, иначе снег растянулся бы
   на ширину карточки. Над логотипом в карточке места больше — снежинки
   начинают выше. */
.login-card__brand .mm-snowy {
  display: inline-block;
  vertical-align: top;
  --mm-snow-from: -20px;
  --mm-snow-to: 62px;
}

.login-card__brand .mm-snowy .login-logo { display: block; }

/* Сугробы привязаны к ширине логотипа, а не к высоте блока: в узкой шапке
   (чип совместной проверки, ≤ 400 px) max-width сжимает картинку внутри
   блока (object-fit: contain), и блок выше самой картинки. Высота слоя —
   по пропорциям рисунка (1128 × 285 с запасом над значком), а сдвиг вверх
   на 162,5 из 285 единиц ставит низ слоя на низ картинки, отцентрованной
   по вертикали. */
.mm-snowcap {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: auto;
  aspect-ratio: 1128 / 285;
  transform: translateY(-57.02%);
  overflow: visible;
  fill: #fff;
  /* Белый снег на белой шапке не виден — тонкая тень даёт ему край. */
  filter: drop-shadow(0 0.5px 0.7px rgba(0, 61, 122, 0.55));
  pointer-events: none;
}

.mm-snow {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mm-snow i {
  position: absolute;
  top: 0;
  left: 10%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 1.5px 0.5px rgba(0, 61, 122, 0.35);
  opacity: 0;
  animation: mm-snowfall 5.2s linear infinite;
}

/* Девять снежинок с разным местом, размером, скоростью и задержкой —
   поток выглядит случайным. Каждая третья «ложится» на сугроб плашки и
   тает в нём, остальные пролетают сквозь логотип. */
.mm-snow i:nth-child(1) { left: 8%;  animation-delay: -0.4s; }
.mm-snow i:nth-child(2) { left: 21%; width: 3px; height: 3px; animation-duration: 6.4s; animation-delay: -3.1s; }
.mm-snow i:nth-child(3) { left: 33%; animation-name: mm-snowland; animation-duration: 4.4s; animation-delay: -1.8s; }
.mm-snow i:nth-child(4) { left: 46%; width: 5px; height: 5px; animation-duration: 5.8s; animation-delay: -4.6s; }
.mm-snow i:nth-child(5) { left: 57%; width: 3px; height: 3px; animation-delay: -2.4s; }
.mm-snow i:nth-child(6) { left: 66%; animation-name: mm-snowland; animation-duration: 4.9s; animation-delay: -0.9s; }
.mm-snow i:nth-child(7) { left: 76%; width: 3px; height: 3px; animation-duration: 6.9s; animation-delay: -5.3s; }
.mm-snow i:nth-child(8) { left: 85%; width: 4px; height: 4px; animation-duration: 5.5s; animation-delay: -3.7s; }
.mm-snow i:nth-child(9) { left: 93%; animation-name: mm-snowland; animation-duration: 4.6s; animation-delay: -2.9s; }

@keyframes mm-snowfall {
  0%   { opacity: 0; transform: translate(0, var(--mm-snow-from)); }
  12%  { opacity: 1; }
  50%  { transform: translate(4px, calc((var(--mm-snow-from) + var(--mm-snow-to)) / 2)); }
  85%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-2px, var(--mm-snow-to)); }
}

/* Садится на верх плашки (около 15 % высоты логотипа) и тает. */
@keyframes mm-snowland {
  0%   { opacity: 0; transform: translate(0, var(--mm-snow-from)); }
  15%  { opacity: 1; }
  60%  { opacity: 1; transform: translate(3px, 2px); }
  100% { opacity: 0; transform: translate(3px, 2px); }
}

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

/* ---------- Поздравление на главной ----------
   Во флекс-строке шапки личной главной (.hm-rhero) встаёт отдельной
   строкой, в «Рабочем обзоре» — обычным абзацем под подзаголовком. */
.mm-ny-greet {
  flex: 1 0 100%;
  margin: 10px 0 0;
}

.mm-ny-greet__pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--mm-radius-pill);
  background: var(--mm-blue-soft);
  color: var(--mm-blue-deep);
  font: 600 13.5px/1.3 var(--mm-font);
}
