/* Unlock celebration — requer tokens :root (--font, --wa-*, etc.) do site */

.waf-unlock-burst {
  position: fixed;
  inset: 0;
  z-index: 10050;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.waf-unlock-burst__flash {
  position: absolute;
  inset: -20%;
  background: radial-gradient(
    circle at 50% 45%,
    color-mix(in srgb, var(--wa-green) 45%, transparent) 0%,
    color-mix(in srgb, var(--wa-teal) 40%, transparent) 22%,
    color-mix(in srgb, #059669 28%, transparent) 38%,
    transparent 65%
  );
  opacity: 0;
  transform: scale(0.3);
}

.waf-unlock-burst--active .waf-unlock-burst__flash {
  animation: wafUnlockFlash 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.waf-unlock-burst__ring {
  position: absolute;
  width: min(120vw, 900px);
  height: min(120vw, 900px);
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, color-mix(in srgb, var(--wa-green) 45%, var(--wa-teal)) 72%, transparent);
  opacity: 0;
  transform: scale(0.15);
}

.waf-unlock-burst--active .waf-unlock-burst__ring {
  animation: wafUnlockRing 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.05s forwards;
}

.waf-unlock-burst__confetti {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 0;
  height: 0;
  z-index: 1;
}

.waf-unlock-burst__bit {
  position: absolute;
  left: 0;
  top: 0;
  width: 9px;
  height: 14px;
  margin: -7px 0 0 -4px;
  border-radius: 2px;
  opacity: 0;
  box-shadow: 0 0 0 1px color-mix(in srgb, #fff 25%, transparent);
}

.waf-unlock-burst__bit--round {
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
}

.waf-unlock-burst--active .waf-unlock-burst__bit {
  animation: wafUnlockBit var(--dur, 2s) cubic-bezier(0.22, 0.9, 0.35, 1) var(--delay, 0s) forwards;
}

.waf-unlock-burst__hero {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 24px 32px;
  max-width: min(90vw, 360px);
  background: color-mix(in srgb, var(--wa-surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--wa-teal) 40%, var(--wa-border));
  box-shadow:
    0 24px 80px color-mix(in srgb, #000 32%, transparent),
    0 0 48px color-mix(in srgb, var(--wa-green) 22%, transparent),
    0 0 0 1px color-mix(in srgb, var(--wa-teal) 35%, transparent) inset;
  opacity: 0;
  transform: scale(0.5) rotate(-4deg);
}

.waf-unlock-burst--active .waf-unlock-burst__hero {
  animation: wafUnlockHero 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.08s forwards;
}

.waf-unlock-burst__emoji {
  display: block;
  font-size: clamp(2.5rem, 8vw, 3.25rem);
  line-height: 1;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px color-mix(in srgb, var(--wa-teal) 50%, transparent));
  animation: wafUnlockEmoji 0.9s ease-in-out 0.15s infinite alternate;
}

.waf-unlock-burst__title {
  font-family: var(--font);
  font-size: clamp(1.15rem, 3.5vw, 1.45rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
  background: linear-gradient(
    105deg,
    #075e54 0%,
    var(--wa-teal) 22%,
    var(--wa-green) 48%,
    #20df83 68%,
    var(--wa-teal) 88%,
    #059669 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: wafUnlockShimmer 2.2s linear infinite;
}

.waf-unlock-burst__sub {
  font-family: var(--font);
  font-size: 0.82rem;
  color: color-mix(in srgb, var(--wa-text-muted) 82%, var(--wa-teal) 18%);
  margin: 0;
  font-weight: 500;
}

.waf-unlock-burst--out .waf-unlock-burst__hero,
.waf-unlock-burst--out .waf-unlock-burst__flash,
.waf-unlock-burst--out .waf-unlock-burst__ring {
  animation: none;
  opacity: 0;
  transform: scale(1.05);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.waf-unlock-burst--out .waf-unlock-burst__bit {
  animation: none !important;
  opacity: 0;
  transition: opacity 0.35s ease;
}

@keyframes wafUnlockFlash {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  35% {
    opacity: 0.95;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.25);
  }
}

@keyframes wafUnlockRing {
  0% {
    opacity: 0.85;
    transform: scale(0.15);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

@keyframes wafUnlockBit {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0.35);
  }
}

@keyframes wafUnlockHero {
  0% {
    opacity: 0;
    transform: scale(0.5) rotate(-5deg);
  }
  70% {
    opacity: 1;
    transform: scale(1.06) rotate(1deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes wafUnlockEmoji {
  from {
    transform: translateY(0) rotate(-6deg);
  }
  to {
    transform: translateY(-6px) rotate(6deg);
  }
}

@keyframes wafUnlockShimmer {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 200% center;
  }
}

.waf-unlock-burst--reduced .waf-unlock-burst__flash,
.waf-unlock-burst--reduced .waf-unlock-burst__ring {
  display: none;
}

.waf-unlock-burst--reduced .waf-unlock-burst__hero {
  transform: none;
  opacity: 0;
}

.waf-unlock-burst--reduced.waf-unlock-burst--active .waf-unlock-burst__hero {
  animation: wafUnlockHeroReduced 0.55s ease forwards;
}

.waf-unlock-burst--reduced .waf-unlock-burst__emoji {
  animation: none;
}

.waf-unlock-burst--reduced .waf-unlock-burst__title {
  animation: none;
  background: none;
  color: var(--wa-teal);
  -webkit-background-clip: unset;
  background-clip: unset;
}

@keyframes wafUnlockHeroReduced {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
