/* Лунный карнавал: гирлянда флажков с лампочками и месяц на ниточке.
   Подключается одной строкой (+ блок .carnival в разметке), убирается так же.
   Сгенерировано скриптом, картинки зашиты в data:URI - отдельных файлов нет. */

.carnival { position: absolute; inset: 0 0 auto 0; height: 160px; pointer-events: none; z-index: 3; overflow: hidden; }

/* флажки + нить; на тёмной теме нить светлее и мягче */
.carnival-flags {
  position: absolute; left: 0; right: 0; top: 0; height: 48px;
  background: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22200%22 height=%2248%22 viewBox=%220 0 200 48%22%3E%3Cg transform=%22translate(40.0 17.8) rotate(13.5)%22%3E%3Cpath d=%22M-12 0 L12 0 L0 27 Z%22 fill=%22%23e2337a%22/%3E%3Cpath d=%22M0 0 L12 0 L0 27 Z%22 fill=%22%23000%22 fill-opacity=%22.14%22/%3E%3Ccircle cx=%220%22 cy=%228%22 r=%222.4%22 fill=%22%23fff%22 fill-opacity=%22.85%22/%3E%3C/g%3E%3Cg transform=%22translate(80.0 24.2) rotate(4.6)%22%3E%3Cpath d=%22M-12 0 L12 0 L0 27 Z%22 fill=%22%23ffc53d%22/%3E%3Cpath d=%22M0 0 L12 0 L0 27 Z%22 fill=%22%23000%22 fill-opacity=%22.14%22/%3E%3C/g%3E%3Cg transform=%22translate(120.0 24.2) rotate(-4.6)%22%3E%3Cpath d=%22M-12 0 L12 0 L0 27 Z%22 fill=%22%233a1f86%22/%3E%3Cpath d=%22M0 0 L12 0 L0 27 Z%22 fill=%22%23000%22 fill-opacity=%22.14%22/%3E%3Cpolygon points=%220.0,3.9 1.2,6.8 4.4,7.1 2.0,9.1 2.7,12.2 0.0,10.6 -2.7,12.2 -2.0,9.1 -4.4,7.1 -1.2,6.8%22 fill=%22%23ffe7a3%22/%3E%3C/g%3E%3Cg transform=%22translate(160.0 17.8) rotate(-13.5)%22%3E%3Cpath d=%22M-12 0 L12 0 L0 27 Z%22 fill=%22%2322bfb3%22/%3E%3Cpath d=%22M0 0 L12 0 L0 27 Z%22 fill=%22%23000%22 fill-opacity=%22.14%22/%3E%3C/g%3E%3Cpath d=%22M0 5 Q100.0 45 200 5%22 fill=%22none%22 stroke=%22%23ffffff%22 stroke-width=%221.6%22/%3E%3C/svg%3E") repeat-x;
  background-position: center top;
  animation: carnival-sway 6s ease-in-out infinite alternate;
  transform-origin: 50% 0;
}
@media (prefers-color-scheme: dark) {
  .carnival-flags { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22200%22 height=%2248%22 viewBox=%220 0 200 48%22%3E%3Cg transform=%22translate(40.0 17.8) rotate(13.5)%22%3E%3Cpath d=%22M-12 0 L12 0 L0 27 Z%22 fill=%22%23e2337a%22/%3E%3Cpath d=%22M0 0 L12 0 L0 27 Z%22 fill=%22%23000%22 fill-opacity=%22.14%22/%3E%3Ccircle cx=%220%22 cy=%228%22 r=%222.4%22 fill=%22%23fff%22 fill-opacity=%22.85%22/%3E%3C/g%3E%3Cg transform=%22translate(80.0 24.2) rotate(4.6)%22%3E%3Cpath d=%22M-12 0 L12 0 L0 27 Z%22 fill=%22%23ffc53d%22/%3E%3Cpath d=%22M0 0 L12 0 L0 27 Z%22 fill=%22%23000%22 fill-opacity=%22.14%22/%3E%3C/g%3E%3Cg transform=%22translate(120.0 24.2) rotate(-4.6)%22%3E%3Cpath d=%22M-12 0 L12 0 L0 27 Z%22 fill=%22%233a1f86%22/%3E%3Cpath d=%22M0 0 L12 0 L0 27 Z%22 fill=%22%23000%22 fill-opacity=%22.14%22/%3E%3Cpolygon points=%220.0,3.9 1.2,6.8 4.4,7.1 2.0,9.1 2.7,12.2 0.0,10.6 -2.7,12.2 -2.0,9.1 -4.4,7.1 -1.2,6.8%22 fill=%22%23ffe7a3%22/%3E%3C/g%3E%3Cg transform=%22translate(160.0 17.8) rotate(-13.5)%22%3E%3Cpath d=%22M-12 0 L12 0 L0 27 Z%22 fill=%22%2322bfb3%22/%3E%3Cpath d=%22M0 0 L12 0 L0 27 Z%22 fill=%22%23000%22 fill-opacity=%22.14%22/%3E%3C/g%3E%3Cpath d=%22M0 5 Q100.0 45 200 5%22 fill=%22none%22 stroke=%22%23e9d4f1%22 stroke-width=%221.6%22/%3E%3C/svg%3E"); opacity: .92; }
}

/* лампочки двумя слоями - мигают по очереди */
.carnival-bulbs { position: absolute; left: 0; right: 0; top: 0; height: 48px; background-position: calc(50% - 100px) top; background-repeat: repeat-x; }
.carnival-bulbs.a { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22400%22 height=%2248%22 viewBox=%220 0 400 48%22%3E%3Cdefs%3E%3CradialGradient id=%22g%22%3E%3Cstop offset=%220%22 stop-color=%22%23fff6c2%22 stop-opacity=%22.95%22/%3E%3Cstop offset=%22.45%22 stop-color=%22%23ffd25a%22 stop-opacity=%22.45%22/%3E%3Cstop offset=%221%22 stop-color=%22%23ffb02e%22 stop-opacity=%220%22/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx=%220%22 cy=%2214%22 r=%2213%22 fill=%22url(%23g)%22/%3E%3Crect x=%22-2.6%22 y=%224%22 width=%225.2%22 height=%224.6%22 rx=%221%22 fill=%22%236b5a7a%22/%3E%3Cellipse cx=%220%22 cy=%2213.5%22 rx=%224.3%22 ry=%225.6%22 fill=%22%23ffe88a%22/%3E%3Cellipse cx=%22-1.3%22 cy=%2212%22 rx=%221.3%22 ry=%222%22 fill=%22%23fff%22 fill-opacity=%22.85%22/%3E%3Ccircle cx=%22400%22 cy=%2214%22 r=%2213%22 fill=%22url(%23g)%22/%3E%3Crect x=%22397.4%22 y=%224%22 width=%225.2%22 height=%224.6%22 rx=%221%22 fill=%22%236b5a7a%22/%3E%3Cellipse cx=%22400%22 cy=%2213.5%22 rx=%224.3%22 ry=%225.6%22 fill=%22%23ffe88a%22/%3E%3Cellipse cx=%22398.7%22 cy=%2212%22 rx=%221.3%22 ry=%222%22 fill=%22%23fff%22 fill-opacity=%22.85%22/%3E%3C/svg%3E"); animation: carnival-blink 2.4s ease-in-out infinite; }
.carnival-bulbs.b { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22400%22 height=%2248%22 viewBox=%220 0 400 48%22%3E%3Cdefs%3E%3CradialGradient id=%22g%22%3E%3Cstop offset=%220%22 stop-color=%22%23fff6c2%22 stop-opacity=%22.95%22/%3E%3Cstop offset=%22.45%22 stop-color=%22%23ffd25a%22 stop-opacity=%22.45%22/%3E%3Cstop offset=%221%22 stop-color=%22%23ffb02e%22 stop-opacity=%220%22/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx=%22200%22 cy=%2214%22 r=%2213%22 fill=%22url(%23g)%22/%3E%3Crect x=%22197.4%22 y=%224%22 width=%225.2%22 height=%224.6%22 rx=%221%22 fill=%22%236b5a7a%22/%3E%3Cellipse cx=%22200%22 cy=%2213.5%22 rx=%224.3%22 ry=%225.6%22 fill=%22%23ffe88a%22/%3E%3Cellipse cx=%22198.7%22 cy=%2212%22 rx=%221.3%22 ry=%222%22 fill=%22%23fff%22 fill-opacity=%22.85%22/%3E%3C/svg%3E"); animation: carnival-blink 2.4s ease-in-out -1.2s infinite; }

/* месяц на ниточке в левом углу, звезда-близнец справа */
.carnival-moon {
  position: absolute; top: 6px; width: 72px; height: 160px;
  background: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2272%22 height=%22160%22 viewBox=%220 0 72 160%22%3E%3Cdefs%3E%3Cmask id=%22m%22%3E%3Crect width=%2272%22 height=%22160%22 fill=%22%23fff%22/%3E%3Ccircle cx=%2247%22 cy=%2294%22 r=%2224%22 fill=%22%23000%22/%3E%3C/mask%3E%3CradialGradient id=%22h%22%3E%3Cstop offset=%220%22 stop-color=%22%23ffe9a0%22 stop-opacity=%22.55%22/%3E%3Cstop offset=%221%22 stop-color=%22%23ffd34d%22 stop-opacity=%220%22/%3E%3C/radialGradient%3E%3C/defs%3E%3Cpath d=%22M30 0 V76%22 stroke=%22%23fff%22 stroke-opacity=%22.75%22 stroke-width=%221.4%22/%3E%3Ccircle cx=%2234%22 cy=%22104%22 r=%2240%22 fill=%22url(%23h)%22/%3E%3Cg mask=%22url(%23m)%22%3E%3Ccircle cx=%2234%22 cy=%22104%22 r=%2228%22 fill=%22%23ffd34d%22/%3E%3Ccircle cx=%2230%22 cy=%22108%22 r=%2222%22 fill=%22%23ffe27a%22/%3E%3Ccircle cx=%2218%22 cy=%2298%22 r=%222.6%22 fill=%22%23e8a91c%22/%3E%3Ccircle cx=%2216%22 cy=%22114%22 r=%221.8%22 fill=%22%23e8a91c%22/%3E%3Ccircle cx=%2226%22 cy=%22124%22 r=%222.2%22 fill=%22%23e8a91c%22/%3E%3C/g%3E%3Cpath d=%22M52 128 V140%22 stroke=%22%23fff%22 stroke-opacity=%22.6%22 stroke-width=%221%22/%3E%3Cpolygon points=%2252.0,139.0 53.9,143.5 58.7,143.8 55.0,147.0 56.1,151.7 52.0,149.2 47.9,151.7 49.0,147.0 45.3,143.8 50.1,143.5%22 fill=%22%233fe0d0%22/%3E%3Cpolygon points=%2214.0,68.0 15.1,70.5 17.8,70.8 15.7,72.6 16.4,75.2 14.0,73.8 11.6,75.2 12.3,72.6 10.2,70.8 12.9,70.5%22 fill=%22%23ff7eb6%22/%3E%3C/svg%3E") no-repeat center top / contain;
  transform-origin: 50% 0;
  animation: carnival-swing 5s ease-in-out infinite alternate;
}
.carnival-moon.l { left: max(12px, 3vw); }
.carnival-moon.r { right: max(12px, 3vw); transform: scaleX(-1); animation-name: carnival-swing-r; animation-delay: -2.5s; }

/* шапка опускается под гирлянду */
body.has-carnival header { margin-top: 34px; }

@keyframes carnival-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes carnival-sway { from { transform: translateY(0); } to { transform: translateY(2px); } }
@keyframes carnival-swing { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
@keyframes carnival-swing-r { from { transform: scaleX(-1) rotate(-4deg); } to { transform: scaleX(-1) rotate(4deg); } }

/* узкие экраны: месяц мешал бы логотипу и бургеру - только гирлянда, чуть мельче */
@media (max-width: 1100px) { .carnival-moon { display: none; } }
@media (max-width: 600px) {
  .carnival-flags, .carnival-bulbs { background-size: auto 36px; height: 36px; }
  .carnival-bulbs.a, .carnival-bulbs.b { background-size: auto 36px; background-position: calc(50% - 75px) top; }
  body.has-carnival header { margin-top: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .carnival-flags, .carnival-bulbs, .carnival-moon { animation: none; }
}
