:root {
  --glow-hue: 45deg;
  --bg-color: #190b0b;
  --spring-easing: linear(
    0,
    0.002,
    0.01 0.9%,
    0.038 1.8%,
    0.156,
    0.312 5.8%,
    0.789 11.1%,
    1.015 14.2%,
    1.096,
    1.157,
    1.199,
    1.224 20.3%,
    1.231,
    1.231,
    1.226,
    1.214 24.6%,
    1.176 26.9%,
    1.057 32.6%,
    1.007 35.5%,
    0.984,
    0.968,
    0.956,
    0.949 42%,
    0.946 44.1%,
    0.95 46.5%,
    0.998 57.2%,
    1.007,
    1.011 63.3%,
    1.012 68.3%,
    0.998 84%,
    1
  );
  --spring-duration: 1.33s;
}

@property --shimmer {
  syntax: '<angle>';
  inherits: false;
  initial-value: 33deg;
}

@keyframes shimmer {
  0% {
    --shimmer: 0deg;
  }
  100% {
    --shimmer: 360deg;
  }
}

@keyframes shine {
  0% {
    opacity: 0;
  }
  15%,
  55% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

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

.glow-button {
  --inset: 40px;

  color: var(--bg-color);
  font-family: 'Lora', serif;
  font-size: 18px;
  font-weight: 700;
  padding: 18px;
  position: relative;
  isolation: isolate;
  border-radius: 18px;
  scale: 1;
  text-align: center;
  background-image: linear-gradient(
    315deg,
    #f4d03f -10%,
    #eea238 50%,
    #d4ac0d 110%
  );
  box-shadow: 0 2px 3px 1px hsl(var(--glow-hue) 50% 20% / 50%);
  transition: all var(--spring-duration) var(--spring-easing);
}

.glow-button:hover:not(:active),
.glow-button.active {
  transition-duration: calc(var(--spring-duration) * 0.5);
  box-shadow:
    0 4px 8px -2px hsl(var(--glow-hue) 50% 20% / 50%),
    inset 0 0 0 transparent;
}

.glow-button:active {
  transition-duration: calc(var(--spring-duration) * 0.5);
}

.shimmer {
  position: absolute;
  inset: calc(var(--inset) * -1);
  border-radius: inherit;
  pointer-events: none;
  mask-image: conic-gradient(
    from var(--shimmer, 0deg),
    transparent 0%,
    transparent 20%,
    black 36%,
    black 45%,
    transparent 50%,
    transparent 70%,
    black 85%,
    black 95%,
    transparent 100%
  );
  mask-size: cover;
  mix-blend-mode: plus-lighter;
  animation: shimmer 1s linear infinite both;
}

/* Autoplay shimmer handled by JavaScript */

.shimmer::before,
.shimmer::after {
  content: '';
  position: absolute;
  inset: var(--inset);
  border-radius: inherit;
  pointer-events: none;
  mix-blend-mode: color;
  transition: all 0.5s ease;
  opacity: 0;
}

.shimmer::before {
  box-shadow:
    0 0 calc(var(--inset) * 0.1) 2px hsl(var(--glow-hue) 20% 95%),
    0 0 calc(var(--inset) * 0.18) 4px hsl(var(--glow-hue) 20% 80%),
    0 0 calc(var(--inset) * 0.33) 4px hsl(var(--glow-hue) 50% 70%),
    0 0 calc(var(--inset) * 0.66) 5px hsl(var(--glow-hue) 100% 70%);
  z-index: -1;
}

.shimmer::after {
  z-index: 2;
}

.glow-button:hover .shimmer::before,
.glow-button:hover .shimmer::after,
.glow-button.active .shimmer::before,
.glow-button.active .shimmer::after {
  opacity: 1 !important;
  animation: shine 1.2s ease-in 2 forwards !important;
  animation-delay: 0s !important;
}

.glow-button .text {
  color: var(--bg-color);
  background-color: var(--bg-color);
  background-image: linear-gradient(
    120deg,
    transparent,
    hsla(var(--glow-hue), 100%, 80%, 0.66) 40%,
    hsla(var(--glow-hue), 100%, 90%, 0.9) 50%,
    transparent 52%
  );
  background-clip: text;
  background-repeat: no-repeat;
  background-size: 300% 300%;
  background-position: center 200%;
}

.glow-button:hover .text,
.glow-button.active .text {
  animation: text 0.66s ease-in 2 both !important;
  animation-delay: 0s !important;
}
