@import '@legends/styles/base.scss';

.backdrop {
  position: fixed;
  z-index: 999;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: $backdrop;
  backdrop-filter: blur(0.5rem);
  display: flex;
  justify-content: center;
  align-items: center;
  // Don't touch this, it works too well
  font-size: min(1.8vh, 1.2vw);
}

.wrapper {
  position: relative;
  width: 47em;
  height: 47em;

  background-size: cover;
  background-color: $neutral-700;
  border-radius: $tertiaryBorderRadius;
  border: 0.25rem solid transparent;
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
  background-image: linear-gradient($secondaryBackground, $secondaryBackground), 
                    linear-gradient(152.35deg, rgba(207, 162, 255, 0.6) 9.38%, rgba(78, 25, 168, 0.6) 96.89%);

  .backgroundEffect {
    position: absolute;
    right: -11em;
    top: 2em;
    z-index: 0;
    background-repeat: no-repeat;
    background-size: contain;
    width: 64.375em;
    height: 42.8125em;
  }
  .content {
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;

    .confetti {
      position: absolute;
      z-index: 2;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
    }

    .title {
      font-size: 2.5rem;
      font-weight: 400;
      line-height: 1;
      margin: 0 auto;
      color: $mainText;
    }

    .closeButton {
      font-size: inherit;
      align-self: end;
      margin-right: 0.813em;
      margin-top: 0.813em;
      display: block;
      width: 2em;
      height: 2em;

      svg {
        width: 2em;
        height: 2em;
      }
    }
    .spinner {
      position: absolute;
      transition: transform 10s ease-out;
      top: 10em;
      left: 10.6875em;
      width: 25em;
      height: 25em;
      object-fit: contain;
      animation: tease 5s infinite;
      animation-delay: 2s;
    }

    .chain {
      position: absolute;
      left: 6.7em;
      bottom: 15.75em;
      width: 32.9em;
      
      height: 9.75em;
      z-index: 4;

      &.unlocked {
        animation: unlock 1s forwards;
      }
    }

    .pointer {
      position: absolute;
      top: 8.5em;
      left: 22em;
      width: 2.5em;
      height: 2.5em;
      object-fit: contain;
    }

    .spinButton {
      @include primary-button;
      position: absolute;
      bottom: 2.5em;
      left: 50%;
      transform: translateX(-50%);
      min-width: 18.25em;
      width: max-content;
      max-width: 37.625rem;
      height: 3.25em;
      font-size: 1.25em; 
      font-weight: 400;
    }
  }
}

@keyframes tease {
  0% {
    transform: rotate(0deg);
  }
  10% {
    transform: rotate(-10deg);
  }
  20% {
    transform: rotate(10deg);
  }
  30% {
    transform: rotate(-10deg);
  }
  40%,
  100% {
    transform: rotate(0deg);
  }
}

@keyframes unlock {
  0% {
    transform: rotate(0deg) translateY(0);
    opacity: 1;
  }
  100% {
    transform: rotate(20deg) translateY(4em);
    opacity: 0;
  }
}
