/* ==========================================================================
   Animated sparkle icon
   Used in the "Start a project" navigation button. It is an inline SVG, so
   it stays sharp at any size and takes the button's colours in light and dark
   mode (a GIF can't do either). Markup: see the .spark SVG in the nav.
   ========================================================================== */

.spark {
  flex: none;
  overflow: visible;
}
.spark path {
  transform-box: fill-box;
  transform-origin: center;
}

/* Big star: gently breathes while turning a quarter turn (a 4-point star
   looks identical every 90°, so the loop is seamless). */
.spark-main {
  animation: spark-spin 2.6s ease-in-out infinite;
}
/* Two small stars twinkle in and out, out of step with each other. */
.spark-s1 {
  animation: spark-twinkle 2.6s ease-in-out 0.35s infinite;
}
.spark-s2 {
  animation: spark-twinkle 2.6s ease-in-out 1.25s infinite;
}

@keyframes spark-spin {
  0% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(0.8) rotate(45deg);
  }
  100% {
    transform: scale(1) rotate(90deg);
  }
}
@keyframes spark-twinkle {
  0%,
  100% {
    opacity: 0;
    transform: scale(0.2) rotate(-45deg);
  }
  35%,
  65% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* Hover: speed things up. The nav button's generic icon wiggle is switched off for this icon. */
.btn:hover .spark {
  transform: none;
}
.btn:hover .spark-main {
  animation-duration: 0.9s;
}
.btn:hover .spark-s1,
.btn:hover .spark-s2 {
  animation-duration: 1.1s;
}

/* Colour: lime on the dark button (light mode); follows the button text in dark mode. */
nav .btn.fill .spark {
  color: var(--lime, #f1ff5e);
}
[data-theme='dark'] nav .btn.fill .spark {
  color: currentColor;
}

/* No motion for people who ask for it: show a still sparkle. */
@media (prefers-reduced-motion: reduce) {
  .spark-main,
  .spark-s1,
  .spark-s2 {
    animation: none;
  }
  .spark-s1,
  .spark-s2 {
    opacity: 1;
  }
}
