/* Sparky loader: Sparky doing things (DJ, vinilo, fiesta, selfie…) one after another, each popping out of a liquid
   holo blob. Pure CSS so the same loader runs in index.html before the app loads and inside the app (SparkyLoader.jsx). */
.sl { --sl: 220px; --sl-n: 9; --sl-step: 1.15s; position: relative; width: var(--sl); height: calc(var(--sl) * 1.18); display: grid; place-items: center; }
.sl.full { position: fixed; inset: 0; width: auto; height: auto; z-index: 999998; background: radial-gradient(120% 80% at 50% 40%, #16101f 0%, #07060a 60%, #000 100%); }
.sl.full .sl-box { position: relative; width: var(--sl); height: calc(var(--sl) * 1.18); }
.sl:not(.full) .sl-box { position: absolute; inset: 0; }

/* the liquid: holo blobs merged by an svg goo filter, orbiting and breathing */
.sl-goo { position: absolute; left: 50%; top: 44%; width: calc(var(--sl) * 1.18); height: calc(var(--sl) * 1.18); opacity: 0.9; transform: translate(-50%, -50%); filter: url(#sl-goo); }
.sl-goo i { position: absolute; left: 50%; top: 50%; border-radius: 50%; mix-blend-mode: screen; }
.sl-goo i:nth-child(1) { width: 58%; height: 58%; margin: -29% 0 0 -29%; background: radial-gradient(circle at 35% 30%, #ff6ad5, #ff2e63 70%); animation: sl-orbit 3.6s ease-in-out infinite; }
.sl-goo i:nth-child(2) { width: 46%; height: 46%; margin: -23% 0 0 -23%; background: radial-gradient(circle at 40% 35%, #8af7ff, #4d7cff 70%); animation: sl-orbit 4.4s ease-in-out -1.1s infinite reverse; }
.sl-goo i:nth-child(3) { width: 40%; height: 40%; margin: -20% 0 0 -20%; background: radial-gradient(circle at 40% 35%, #e3ff8a, #3dffb0 70%); animation: sl-orbit2 3.1s ease-in-out -0.6s infinite; }
.sl-goo i:nth-child(4) { width: 36%; height: 36%; margin: -18% 0 0 -18%; background: radial-gradient(circle at 40% 35%, #ffd27a, #ff7a33 70%); animation: sl-orbit2 4.9s ease-in-out -2s infinite reverse; }
.sl-goo i:nth-child(5) { width: 70%; height: 70%; margin: -35% 0 0 -35%; background: radial-gradient(circle at 45% 40%, #b98cff, #6a3cff 72%); animation: sl-breathe 2.3s ease-in-out infinite; opacity: 0.85; }
.sl-glow { position: absolute; left: 50%; top: 44%; width: calc(var(--sl) * 1.1); height: calc(var(--sl) * 1.1); transform: translate(-50%, -50%); border-radius: 50%; background: conic-gradient(from 0deg, #ff2e63, #ff7a33, #c8ff4d, #4df0ff, #8a5cff, #ff2e63); filter: blur(calc(var(--sl) * 0.16)); opacity: 0.35; animation: sl-spin 6s linear infinite; }

/* Sparky: each look pops in with a squish, floats, then melts out into the next */
.sl-stage { position: absolute; left: 50%; top: 44%; width: calc(var(--sl) * 0.86); height: calc(var(--sl) * 0.86); transform: translate(-50%, -50%); animation: sl-float 2.4s ease-in-out infinite; }
.sl-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transform-origin: 50% 70%; will-change: transform, opacity, filter;
  filter: drop-shadow(0 10px 24px rgba(0,0,0,0.45)); animation: sl-look calc(var(--sl-step) * var(--sl-n)) cubic-bezier(.3,.7,.2,1) infinite; }
.sl-stage img:nth-child(1) { animation-delay: calc(var(--sl-step) * 0); }
.sl-stage img:nth-child(2) { animation-delay: calc(var(--sl-step) * 1); }
.sl-stage img:nth-child(3) { animation-delay: calc(var(--sl-step) * 2); }
.sl-stage img:nth-child(4) { animation-delay: calc(var(--sl-step) * 3); }
.sl-stage img:nth-child(5) { animation-delay: calc(var(--sl-step) * 4); }
.sl-stage img:nth-child(6) { animation-delay: calc(var(--sl-step) * 5); }
.sl-stage img:nth-child(7) { animation-delay: calc(var(--sl-step) * 6); }
.sl-stage img:nth-child(8) { animation-delay: calc(var(--sl-step) * 7); }
.sl-stage img:nth-child(9) { animation-delay: calc(var(--sl-step) * 8); }

/* a liquid puddle under Sparky that squashes with each landing */
.sl-puddle { position: absolute; left: 50%; bottom: 2%; width: calc(var(--sl) * 0.5); height: calc(var(--sl) * 0.07); transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(180,140,255,0.55), rgba(77,240,255,0.18) 60%, transparent); filter: blur(4px); animation: sl-puddle 2.4s ease-in-out infinite; }

@keyframes sl-look {
  0%    { opacity: 0; transform: translateY(18%) scale(0.35, 0.5); filter: blur(10px) drop-shadow(0 10px 24px rgba(0,0,0,0.45)); }
  2.6%  { opacity: 1; transform: translateY(-4%) scale(1.14, 0.86); filter: blur(0) drop-shadow(0 10px 24px rgba(0,0,0,0.45)); }
  4.4%  { transform: translateY(0) scale(0.93, 1.08); }
  6%    { transform: scale(1.03, 0.98); }
  7.5%  { transform: scale(1); }
  10.2% { opacity: 1; transform: scale(1) rotate(0deg); filter: blur(0) drop-shadow(0 10px 24px rgba(0,0,0,0.45)); }
  12.4% { opacity: 0; transform: translateY(-6%) scale(1.22, 1.08) rotate(4deg); filter: blur(12px) drop-shadow(0 10px 24px rgba(0,0,0,0.45)); }
  100%  { opacity: 0; transform: scale(0.35); }
}
@keyframes sl-orbit { 0%, 100% { transform: translate(-42%, -14%) scale(1); } 33% { transform: translate(34%, -36%) scale(1.15); } 66% { transform: translate(22%, 40%) scale(0.9); } }
@keyframes sl-orbit2 { 0%, 100% { transform: translate(52%, 24%) scale(1); } 40% { transform: translate(-50%, 36%) scale(1.2); } 75% { transform: translate(-10%, -56%) scale(0.9); } }
@keyframes sl-breathe { 0%, 100% { transform: scale(0.98) rotate(0deg); border-radius: 46% 54% 52% 48%; } 50% { transform: scale(1.1) rotate(12deg); border-radius: 56% 44% 45% 55%; } }
@keyframes sl-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes sl-float { 0%, 100% { transform: translate(-50%, -50%); } 50% { transform: translate(-50%, -56%); } }
@keyframes sl-puddle { 0%, 100% { transform: translateX(-50%) scaleX(1); opacity: 0.9; } 50% { transform: translateX(-50%) scaleX(0.72); opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) {
  .sl-goo i, .sl-glow, .sl-stage, .sl-puddle { animation: none; }
  .sl-stage img { animation: none; }
  .sl-stage img:first-child { opacity: 1; }
}

/* leaving: Sparky comes toward you and dissolves, the liquid spreads out, the dark fades to the app */
#initial-preloader.leaving, .sl.full.leaving { animation: sl-out 0.6s cubic-bezier(.4,0,.2,1) forwards; }
#initial-preloader.leaving .sl-stage, .sl.full.leaving .sl-stage { animation: sl-stage-out 0.55s cubic-bezier(.4,0,.2,1) forwards; }
#initial-preloader.leaving .sl-goo, #initial-preloader.leaving .sl-glow { transition: transform .55s cubic-bezier(.4,0,.2,1), opacity .5s; transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
@keyframes sl-out { 0% { opacity: 1; } 35% { opacity: 1; } 100% { opacity: 0; } }
@keyframes sl-stage-out { to { transform: translate(-50%, -50%) scale(1.6); filter: blur(14px); opacity: 0; } }
