/* Trenó do Papai Noel. A posição é dada pelo treno.js (transform); aqui ficam o balanço, as renas, o
 * balão com a mensagem (mouse em cima) e as partículas. */

.treno-camada {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 6; /* acima dos botões, abaixo do topo (10) e dos diálogos */
  overflow: hidden;
  pointer-events: none;
}

:root:not([data-sazonal='natal']) .treno-camada {
  display: none;
}

.treno {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
  filter: drop-shadow(0 10px 12px rgba(4, 17, 13, 0.28));
}

/* entre passagens: invisível mas com layout (com display: none o Chrome não resolve os gradientes do SVG) */
.treno--fora {
  visibility: hidden;
}

.treno--fora .treno__alvo {
  pointer-events: none;
}

.treno__corpo,
.treno__tremor {
  width: 100%;
  height: 100%;
}

/* leve balanço do trenó, além da oscilação do voo */
.treno__corpo {
  transform-origin: 20% 80%;
  animation: treno-balanco 2.6s ease-in-out infinite alternate;
}

@keyframes treno-balanco {
  from {
    transform: rotate(-1.6deg);
  }
  to {
    transform: rotate(1.4deg);
  }
}

.treno__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.treno__arte {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* renas (arte "Voo de Natal"): o corpo sobe e desce e as pernas galopam em fases opostas. As pernas
   giram em volta da origem do próprio <path> (o quadril) — por isso sem transform-box: fill-box. */
.rena {
  animation: rena-trote 0.85s ease-in-out infinite;
  animation-delay: var(--fase);
}

@keyframes rena-trote {
  0%,
  100% {
    transform: translateY(3px);
  }
  50% {
    transform: translateY(-6px);
  }
}

.rena__perna {
  fill: none;
  stroke: #975643;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: rena-galope 0.85s ease-in-out infinite alternate;
  animation-delay: var(--fase);
}

.rena__perna--tras {
  stroke: #66404c;
}

.rena__perna--alt {
  animation-direction: alternate-reverse;
}

@keyframes rena-galope {
  from {
    transform: rotate(-29deg);
  }
  to {
    transform: rotate(35deg);
  }
}

/* ---------- Balão da mensagem ---------- */
.treno__balao {
  position: absolute;
  bottom: 100%;
  left: 4%;
  margin-bottom: 6px;
  padding: 8px 14px;
  border-radius: 14px;
  background: #fffdf6;
  color: #8f1b1e;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 14.5px;
  font-style: italic;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 10px 22px -10px rgba(4, 17, 13, 0.6), inset 0 0 0 1.5px #d4af37, inset 0 -3px 0 #bb2528;
  opacity: 0;
  transform: translateY(8px) scale(0.6);
  transform-origin: 20% 100%;
  transition: opacity 200ms ease, transform 320ms cubic-bezier(0.3, 1.5, 0.5, 1);
}

.treno__balao::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 30px;
  border: 7px solid transparent;
  border-top-color: #bb2528;
}

.treno--falando .treno__balao {
  opacity: 1;
  transform: none;
  transition-delay: 120ms;
}

/* área que recebe o mouse/toque: o trenó e o motorista (não as renas), tamanho fixo */
.treno__alvo {
  position: absolute;
  top: 0;
  left: 0;
  width: 38%;
  height: 100%;
  pointer-events: auto;
  border-radius: 40%;
  -webkit-tap-highlight-color: transparent;
}

.treno__efeitos {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
}

.faisca {
  position: absolute;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: #f3dc8a;
  box-shadow: 0 0 8px 2px rgba(212, 175, 55, 0.85);
  opacity: 0;
  animation: faisca 560ms ease-out both;
}

@keyframes faisca {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.4);
  }
  25% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--dx) * 1.6), calc(var(--dy) * 1.6)) scale(1);
  }
}

/* rastro: faíscas douradas e flocos de neve */
.rastro {
  position: absolute;
  width: var(--tam);
  height: var(--tam);
  border-radius: 50%;
  background: #f3dc8a;
  box-shadow: 0 0 6px 1px rgba(212, 175, 55, 0.8);
  animation: rastro 1.3s ease-out forwards;
}

.rastro--floco {
  background: #f8f5e9;
  box-shadow: 0 0 3px rgba(248, 245, 233, 0.9);
}

@keyframes rastro {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(0.2);
  }
}

@media (max-width: 699px) {
  .treno__balao {
    font-size: 12px;
    padding: 5px 9px;
  }
}
