/* Новогоднее оформление (тумблер в админке, src/lib/festive.js).
   Подключается только когда включено: гирлянда под шапкой, ёлочка у логотипа,
   снег (festive.js). Всё декоративное, без кликов и без влияния на вёрстку. */

/* --- Гирлянда: провод провисает дугами, лампочка в нижней точке каждой дуги --- */
.festive-garland {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 24px;
  overflow: hidden;
  pointer-events: none;
  /* Провод: одна дуга на 56px, повторяется по ширине. */
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='16' viewBox='0 0 56 16'%3E%3Cpath d='M0 1.5 Q28 15 56 1.5' fill='none' stroke='%23232a24' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x 0 0 / 56px 16px;
}

.festive-garland__bulbs { display: flex; width: max-content; }
.festive-garland__slot { flex: 0 0 56px; height: 24px; position: relative; }

.festive-garland__bulb {
  --c: #FFC94A;
  position: absolute;
  left: 50%;
  top: 9px;
  width: 7px;
  height: 11px;
  margin-left: -3.5px;
  border-radius: 50% 50% 46% 46% / 42% 42% 58% 58%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .85) 0 18%, var(--c) 45%);
  box-shadow: 0 0 6px 1px var(--c), 0 0 14px 2px color-mix(in srgb, var(--c) 45%, transparent);
  animation: festive-twinkle 2.6s ease-in-out infinite;
}
/* Цоколь лампочки */
.festive-garland__bulb::before {
  content: '';
  position: absolute;
  left: 1.5px;
  top: -3px;
  width: 4px;
  height: 3.5px;
  border-radius: 1px;
  background: #3a3f3b;
}

.festive-garland__slot:nth-child(5n+1) .festive-garland__bulb { --c: #FFC94A; }
.festive-garland__slot:nth-child(5n+2) .festive-garland__bulb { --c: #FF5A5F; }
.festive-garland__slot:nth-child(5n+3) .festive-garland__bulb { --c: #4CD07D; }
.festive-garland__slot:nth-child(5n+4) .festive-garland__bulb { --c: #5AB0FF; }
.festive-garland__slot:nth-child(5n+5) .festive-garland__bulb { --c: #FF8A3D; }

/* Мерцание вразнобой: соседние лампочки не гаснут вместе. */
.festive-garland__slot:nth-child(3n+1) .festive-garland__bulb { animation-delay: -0.4s; }
.festive-garland__slot:nth-child(3n+2) .festive-garland__bulb { animation-delay: -1.3s; animation-duration: 3.1s; }
.festive-garland__slot:nth-child(3n+3) .festive-garland__bulb { animation-delay: -2.1s; animation-duration: 2.2s; }
.festive-garland__slot:nth-child(7n) .festive-garland__bulb { animation-delay: -0.9s; }

@keyframes festive-twinkle {
  0%, 100% { opacity: 1; filter: brightness(1.05); }
  50% { opacity: .45; filter: brightness(.8); }
}

/* Шапка при прокрутке становится ниже — гирлянда остаётся под её краем сама
   (top: 100%), отдельной подстройки не нужно. */

/* --- Ёлочка у логотипа --- */
.festive-tree {
  flex-shrink: 0;
  margin-left: 2px;
  align-self: center;
  transform: translateY(-1px);
}
.festive-tree__star {
  transform-origin: 11px 4px;
  animation: festive-star 3.2s ease-in-out infinite;
}
.festive-tree__ball { animation: festive-twinkle 2.4s ease-in-out infinite; }
.festive-tree__ball--2 { animation-delay: -0.8s; }
.festive-tree__ball--3 { animation-delay: -1.5s; }
.festive-tree__ball--4 { animation-delay: -2s; }

@keyframes festive-star {
  0%, 100% { opacity: 1; filter: drop-shadow(0 0 2px #FFC94A); }
  50% { opacity: .75; filter: drop-shadow(0 0 5px #FFC94A); }
}

/* --- Снег: холст на весь экран, под шапкой и окнами --- */
.festive-snow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 150;
}

@media (max-width: 680px) {
  .festive-garland { height: 20px; background-size: 44px 13px; }
  .festive-garland__slot { flex-basis: 44px; height: 20px; }
  .festive-garland__bulb { top: 7px; width: 6px; height: 9px; margin-left: -3px; }
  .festive-garland__bulb::before { left: 1px; }
  .festive-tree { width: 18px; height: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .festive-garland__bulb, .festive-tree__star, .festive-tree__ball { animation: none; }
}
