/* Chantier sur une parcelle : effets animés en code par-dessus l'image de chantier (poussière, étincelles, fumée, coups de marteau) */
/* Le chantier est dessiné plus large que les bâtiments : réduit autour de la pointe basse de la dalle (ancrage 93 %) */
.slot-chantier, .slot-chantier-fx {
  scale: 0.75;
  transform-origin: 50% 93%;
}

.slot-chantier {
  animation: cfx-hammer 1.6s steps(1, end) infinite;
}
@keyframes cfx-hammer {
  0%, 100% { transform: translateY(0); }
  8%       { transform: translateY(-1px); }
  14%      { transform: translateY(0); }
  58%      { transform: translateY(-1px); }
  64%      { transform: translateY(0); }
}

.slot-chantier-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Poussière qui monte au pied du chantier */
.cfx-dust {
  position: absolute;
  bottom: 12%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 197, 178, 0.8), rgba(212, 197, 178, 0) 70%);
  opacity: 0;
  animation: cfx-dust 2.6s ease-out infinite;
}
.cfx-dust.d1 { left: 14%; }
.cfx-dust.d2 { left: 38%; animation-delay: 0.7s; }
.cfx-dust.d3 { left: 60%; animation-delay: 1.3s; }
.cfx-dust.d4 { left: 78%; animation-delay: 1.9s; }
@keyframes cfx-dust {
  0%   { opacity: 0;    transform: translateY(0) scale(0.5); }
  20%  { opacity: 0.85; }
  100% { opacity: 0;    transform: translateY(-34px) scale(1.8); }
}

/* Étincelles de soudure : petits éclats qui clignotent à des endroits différents */
.cfx-spark {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #f3e3ce;
  box-shadow: 0 0 6px 3px rgba(218, 166, 97, 0.9);
  opacity: 0;
  animation: cfx-spark 1.5s steps(1, end) infinite;
}
.cfx-spark.s1 { left: 34%; top: 44%; }
.cfx-spark.s2 { left: 62%; top: 36%; animation-delay: 0.5s; animation-duration: 1.9s; }
.cfx-spark.s3 { left: 48%; top: 56%; animation-delay: 1s; animation-duration: 1.2s; }
@keyframes cfx-spark {
  0%, 100% { opacity: 0; }
  10%      { opacity: 1; transform: scale(1.2); }
  16%      { opacity: 0.3; }
  22%      { opacity: 1; transform: scale(0.8); }
  30%      { opacity: 0; }
}

/* Fumée grise qui s'élève du chantier */
.cfx-smoke {
  position: absolute;
  top: 22%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(150, 150, 150, 0.6), rgba(150, 150, 150, 0) 70%);
  opacity: 0;
  animation: cfx-smoke 3.8s ease-out infinite;
}
.cfx-smoke.m1 { left: 22%; }
.cfx-smoke.m2 { left: 70%; animation-delay: 1.9s; }
@keyframes cfx-smoke {
  0%   { opacity: 0;   transform: translate(0, 0) scale(0.5); }
  25%  { opacity: 0.7; }
  100% { opacity: 0;   transform: translate(8px, -40px) scale(1.9); }
}

@media (prefers-reduced-motion: reduce) {
  .slot-chantier, .cfx-dust, .cfx-spark, .cfx-smoke { animation: none; }
}

/* Animation du chantier : 27 images de 110 px (bande), aller-retour ; la dalle du chantier est celle des bâtiments, pas de réduction */
.slot-chantier-anim {
  /* un <div> vide se réduit dans la boîte flex de la parcelle (une <img> garde sa taille) : on fixe le cadre de 110 px comme celui des bâtiments */
  flex: 0 0 110px;
  width: 110px;
  height: 110px;
  background: url('../assets/images/buildings/chantier/chantier_anim.png?v=1') 0 0 / 2970px 110px no-repeat;
  animation: chantier-anim 2.2s steps(26) infinite alternate;
}
@keyframes chantier-anim {
  from { background-position: 0 0; }
  to   { background-position: -2860px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .slot-chantier-anim { animation: none; }
}
