/* Camada fixa da neve; nao bloqueia cliques nem interfere no scroll. */
.seasonal-snow {
  position: fixed;
  inset: 0;
  z-index: 1031;
  overflow: hidden;
  pointer-events: none;
}

/* Area preenchida dinamicamente pelos flocos gerados no JavaScript. */
.seasonal-snowfall {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* Aparencia, contraste em fundos claros e animacao individual de cada floco. */
.seasonal-snowflake {
  position: absolute;
  top: -10vh;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1;
  text-shadow:
    0 0 2px rgba(60, 80, 95, 0.55),
    0 1px 3px rgba(60, 80, 95, 0.4),
    0 0 5px rgba(100, 145, 180, 0.35);
  will-change: transform;
  animation: seasonal-snowfall var(--fall-duration) linear var(--fall-delay) infinite;
}

/* Recipiente fixo das tres camadas acumuladas na parte inferior da tela. */
.seasonal-snow-ground {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: var(--snow-ground-height);
}

.seasonal-snow-layer {
  position: absolute;
  inset: 0;
}

/* Fundo: ondas amplas com alguns picos curtos no contorno do polygon. */
.seasonal-snow-layer--back {
  z-index: 1;
  background: linear-gradient(180deg, #d8e5ed 0%, #eaf1f5 100%);
  clip-path: polygon(
    0 42%, 7% 29%, 12% 27%, 14% 14%, 16% 28%, 21% 32%,
    28% 43%, 35% 45%, 40% 42%, 42% 33%, 44% 40%,
    49% 24%, 53% 22%, 55% 13%, 57% 23%, 61% 24%,
    68% 39%, 74% 42%, 80% 37%, 83% 35%, 85% 25%,
    87% 34%, 92% 34%, 100% 44%, 100% 100%, 0 100%
  );
  filter: drop-shadow(0 -1px 2px rgba(125, 148, 165, 0.13));
}

/* Camada intermediaria com picos menores e deslocados dos picos do fundo. */
.seasonal-snow-layer--middle {
  z-index: 2;
  background: linear-gradient(180deg, #e8f0f4 0%, #f5f8fa 100%);
  clip-path: polygon(
    0 54%, 8% 45%, 14% 44%, 16% 32%, 18% 45%, 25% 50%,
    32% 59%, 40% 62%, 46% 59%, 48% 49%, 50% 56%,
    55% 44%, 59% 42%, 62% 31%, 65% 42%, 69% 43%,
    76% 53%, 83% 57%, 88% 54%, 90% 43%, 92% 51%,
    100% 54%, 100% 100%, 0 100%
  );
  filter: drop-shadow(0 -1px 2px rgba(145, 162, 174, 0.12));
}

/* Camada frontal branca com contorno suave para contrastar em fundos claros. */
.seasonal-snow-layer--front {
  z-index: 3;
  background: linear-gradient(180deg, #fbfcfd 0%, #ffffff 70%);
  clip-path: polygon(
    0 70%, 8% 61%, 14% 60%, 16% 46%, 18% 61%, 24% 64%,
    31% 72%, 39% 76%, 45% 73%, 47% 62%, 49% 69%,
    54% 60%, 59% 58%, 61% 47%, 63% 59%, 69% 59%,
    77% 67%, 84% 71%, 90% 68%, 92% 56%, 94% 66%,
    100% 69%, 100% 100%, 0 100%
  );
  filter: drop-shadow(0 -1px 2px rgba(143, 160, 173, 0.22));
}

/* Christmas sleigh flies behind navbar content without intercepting clicks. */
header.bd-navbar.fixed-top {
  isolation: isolate;
}

header.bd-navbar.fixed-top > nav {
  position: relative;
  z-index: 1;
}

.christmas-sleigh-track {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.christmas-sleigh-flight {
  /* Ajuste o tamanho da imagem do Papai Noel (tamanho da tela >= 992px): 1 = tamanho original da imagem; 0.9 = 10% menor; 1.1 = 10% maior. */
  --christmas-sleigh-scale: 0.7;
  position: absolute;
  top: 50%;
  left: 0;
  width: 235px;
  opacity: 0;
  will-change: transform;
}

.christmas-sleigh-track.is-flying .christmas-sleigh-flight {
  animation: christmas-sleigh-cross var(--sleigh-duration) linear both;
}

/* The inner layer bobs gently to make the horizontal pass feel like flight. */
.christmas-sleigh-bob {
  transform-origin: center;
  animation: christmas-sleigh-bob 2.8s ease-in-out infinite;
}

.christmas-sleigh-image {
  display: block;
  width: 100%;
  height: auto;
  transform: scale(var(--christmas-sleigh-scale));
  transform-origin: center;
}

@media (max-width: 991.98px) {
  .christmas-sleigh-flight {
    /* Escala fixa abaixo de 992px: ajuste aqui; nao varia com a largura da tela. */
    --christmas-sleigh-scale: 0.5;
  }
}

@keyframes christmas-sleigh-cross {
  0% {
    opacity: 0;
    transform: translate3d(-100%, 0, 0);
  }

  4% {
    opacity: 1;
    transform: translate3d(-96%, 0, 0);
  }

  96% {
    opacity: 1;
    transform: translate3d(calc(100vw - 4%), 0, 0);
  }

  100% {
    opacity: 0;
    transform: translate3d(100vw, 0, 0);
  }
}

@keyframes christmas-sleigh-bob {
  0%, 100% {
    transform: translateY(calc(-50% + 3px)) rotate(1deg);
  }

  25% {
    transform: translateY(calc(-50% - 5px)) rotate(-1.5deg);
  }

  50% {
    transform: translateY(calc(-50% + 4px)) rotate(1deg);
  }

  75% {
    transform: translateY(calc(-50% - 4px)) rotate(-1deg);
  }
}

/* Contorno que move os flocos do topo ate abaixo da area visivel. */
@keyframes seasonal-snowfall {
  from {
    transform: translate3d(0, -10vh, 0);
  }

  to {
    transform: translate3d(var(--horizontal-drift), 110vh, 0);
  }
}

/* Mantem o acúmulo proporcional em telas estreitas. */
@media (max-width: 575.98px) {
  .seasonal-snow-ground {
    height: var(--snow-ground-height-mobile);
  }
}
