/* ============================================================
   BAZARES — Splash screen de abertura do app
   Sequência: cesta corre → aterrissa → escreve "BAZARES" → spinner
============================================================ */

#bz-splash {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #15803D 0%, #16A34A 55%, #22C55E 100%);
  overflow: hidden;
}

#bz-splash.bz-splash--hide {
  animation: bzSplashFadeOut 0.5s ease forwards;
  pointer-events: none;
}

@keyframes bzSplashFadeOut {
  to { opacity: 0; visibility: hidden; }
}

/* ---------- Palco da cesta ---------- */
.bz-splash-stage {
  position: relative;
  width: 220px;
  height: 140px;
}

.bz-basket-rig {
  position: absolute;
  left: 50%;
  bottom: 46px;
  width: 96px;
  height: 74px;
  transform: translateX(calc(-50% - 260px));
  animation:
    bzRun 1.15s cubic-bezier(.45,.05,.55,.95) forwards,
    bzRunBob 0.22s ease-in-out infinite;
  animation-delay: 0.15s, 0.15s;
}

@keyframes bzRun {
  0%   { transform: translateX(calc(-50% - 260px)); }
  78%  { transform: translateX(-50%); }
  87%  { transform: translateX(-50%) translateY(-14px); }
  100% { transform: translateX(-50%) translateY(0); }
}

@keyframes bzRunBob {
  0%, 100% { margin-top: 0; }
  50%      { margin-top: -5px; }
}

/* Cesta (corpo trapezoidal + alça) */
.bz-basket {
  position: absolute;
  top: 0;
  left: 0;
  width: 96px;
  height: 56px;
}

.bz-basket-body {
  position: absolute;
  bottom: 0;
  left: 8px;
  width: 80px;
  height: 40px;
  background: #FFFFFF;
  clip-path: polygon(12% 0%, 88% 0%, 100% 100%, 0% 100%);
  box-shadow: inset 0 -6px 0 rgba(21,128,61,.12);
}

.bz-basket-body::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 34%;
  height: 2px;
  background: rgba(21,128,61,.28);
}

.bz-basket-handle {
  position: absolute;
  top: -22px;
  left: 22px;
  width: 52px;
  height: 34px;
  border: 7px solid #FFFFFF;
  border-bottom: none;
  border-radius: 50px 50px 0 0;
}

/* Pernas — efeito de corrida via rotação alternada */
.bz-leg {
  position: absolute;
  bottom: -22px;
  width: 8px;
  height: 24px;
  background: #14532D;
  border-radius: 4px;
  transform-origin: top center;
  animation: bzLegRun 0.22s ease-in-out infinite;
}

.bz-leg--l { left: 26px; animation-delay: 0s; }
.bz-leg--r { left: 62px; animation-delay: 0.11s; }

@keyframes bzLegRun {
  0%, 100% { transform: rotate(35deg); }
  50%      { transform: rotate(-35deg); }
}

/* Poeirinha ao correr */
.bz-dust {
  position: absolute;
  bottom: -20px;
  left: -6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,.55);
  animation: bzDust 1.15s ease-out forwards;
  animation-delay: 0.15s;
}
.bz-dust:nth-child(2) { left: -20px; animation-delay: 0.28s; width: 7px; height: 7px; }
.bz-dust:nth-child(3) { left: -32px; animation-delay: 0.4s; width: 5px; height: 5px; }

@keyframes bzDust {
  0%   { opacity: 0; transform: scale(.4); }
  10%  { opacity: .8; }
  75%  { opacity: 0; transform: scale(1.6) translateY(4px); }
  100% { opacity: 0; }
}

/* Ao aterrissar: pequena onda de impacto */
.bz-impact {
  position: absolute;
  left: 50%;
  bottom: 40px;
  width: 10px;
  height: 10px;
  transform: translateX(-50%) scale(0);
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.75);
  animation: bzImpact 0.5s ease-out forwards;
  animation-delay: 1.02s;
}

@keyframes bzImpact {
  0%   { transform: translateX(-50%) scale(0); opacity: 1; }
  100% { transform: translateX(-50%) scale(6); opacity: 0; }
}

/* ---------- Texto "BAZARES" ---------- */
.bz-wordmark {
  margin-top: 22px;
  display: flex;
  font-family: 'Sora', system-ui, sans-serif;
  font-weight: 800;
  font-size: 34px;
  letter-spacing: 2px;
  color: #FFFFFF;
}

.bz-wordmark span {
  opacity: 0;
  transform: translateY(10px);
  animation: bzLetterIn 0.4s cubic-bezier(.2,.8,.3,1) forwards;
}

/* delay escalonado por letra, começando depois da cesta aterrissar */
.bz-wordmark span:nth-child(1)  { animation-delay: 1.10s; }
.bz-wordmark span:nth-child(2)  { animation-delay: 1.15s; }
.bz-wordmark span:nth-child(3)  { animation-delay: 1.20s; }
.bz-wordmark span:nth-child(4)  { animation-delay: 1.25s; }
.bz-wordmark span:nth-child(5)  { animation-delay: 1.30s; }
.bz-wordmark span:nth-child(6)  { animation-delay: 1.35s; }
.bz-wordmark span:nth-child(7)  { animation-delay: 1.40s; }

@keyframes bzLetterIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Spinner ---------- */
.bz-spinner {
  margin-top: 26px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.3);
  border-top-color: #FFFFFF;
  opacity: 0;
  animation:
    bzSpinnerIn 0.35s ease forwards,
    bzSpin 0.8s linear infinite;
  animation-delay: 1.75s, 1.75s;
}

@keyframes bzSpinnerIn { to { opacity: 1; } }
@keyframes bzSpin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .bz-basket-rig, .bz-leg, .bz-dust, .bz-impact, .bz-wordmark span, .bz-spinner {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
