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

@keyframes switchLevels {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-60%);
  }
  70% {
    transform: translateY(-55%);
  }
  90% {
    transform: translateY(-52%);
  }
  100% {
    transform: translateY(-50%);
  }
}

@keyframes switchCharacters {
  0% {
    opacity: 1;
    transform: scale(1) translateX(-50%);
  }
  100% {
    opacity: 0;
    transform: scale(0.5) translateX(-100%);
  }
}

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

  &:not(.visible) {
    opacity: 0;
    pointer-events: none;

    .modal {
      transform: scale(0.9);
      opacity: 0;
    }
  }

  &.visible {
    opacity: 1;
    pointer-events: all;

    .modal {
      transform: scale(1);
      opacity: 1;

      .card {
        &.evolution {
          .characterImage.oldCharacterImage {
            animation: switchCharacters 0.5s forwards;
            animation-delay: 0.5s;
          }
          .characterImage.newCharacterImage {
            opacity: 0;
            animation: switchCharacters 0.5s forwards;
            animation-delay: 0.6s;
            animation-direction: reverse;
          }
        }
        .badge {
          .badgeLevels {
            .badgeLevelsInner {
              animation: switchLevels 0.5s forwards;
              animation-delay: 0.5s;
            }
          }
        }
      }
    }
  }
}

.confetti {
  z-index: 10;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: 0.3s transform ease-in-out, 0.2s opacity ease-in-out;

  .title {
    font-size: 4rem;
    font-weight: 400;
    color: $whiteText;
    margin-bottom: 1.25rem;
    text-align: center;
  }

  .card {
    position: relative;
    height:  38.5625rem;
    width: 24.75rem;
    background-size: cover;
    margin-bottom: 1.5em;

    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%);
                      
    
    .background {
      height: 100%;
    }

    .characterImage {
      display: block;
      position: absolute;
      z-index: 1;
      top: 5em;
      left: 50%;
      transform: translateX(-50%);
      width: 100%;
      height: 28.375rem;
      object-fit: contain;
      object-position: top center;
    }

    .badge {
      position: absolute;
      z-index: 2;
      bottom: 3.75em;
      left: 0;
      right: 0;
      margin: 0 auto;
      width: 19rem;
      height: 15.3125rem;
      background-size: cover;

      .badgeLevels {
        z-index: 3;
        position: relative;
        width: 7em;
        height: 5em;
        left: 50%;
        top: 3.5em;
        transform: translateX(-50%);
        overflow: hidden;
        display: flex;
        flex-direction: column;
        align-items: center;
        font-weight: 700;
        
      .badgeLevelsInner {
        position: relative;

        .level {
          text-align: center;
          font-size: 4em;
          color: $whiteText;
          text-shadow: -0.0625rem -0.0625rem $accent;
        }
      }
      }
    }
  }

  .button {
    @include primary-button;
    height: 4rem;
    width: 24.75rem;
    
    font-size: 1.25rem;
    font-weight: 400;
  }
}
