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

.backdrop {
  position: fixed;
  z-index: 999;
  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);
  transform: scale(1);
}

.wrapper {
  position: relative;
  width: 46.5625rem;
  height: 44.1875rem;

  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%);
  padding: 0.75rem 0.875rem;
  display: flex;
  flex-direction: column;

  .backgroundEffect {
    position: absolute;
    opacity: 0.5;
    left: -4rem;
    top: 5rem;
    z-index: 0;
    background-repeat: no-repeat;
    background-size: cover;
    width: 45.375rem;
    height: 35.8125rem;
  }
  .streak {
    position: absolute;
    display: flex;
    align-items: center;
    width: 7rem;
    height: 4.375rem;

    top: -3.5625rem;
    right: 42%;
    z-index: 10;
    background-size: cover;

    .streakNumber {
      text-align: center;
      position: absolute;
      top: 20%;
      z-index: 11;
      font-size: 2rem;
      line-height: 1rem;
      font-weight: 400;
      color: $yellowText;
      text-shadow: 0.0925rem 0.225rem $purple-600;
      display: flex;
      left: 50%;
      transform: translate(-50%, -50%);
    }

    .streakLabel {
      position: absolute;
      bottom: 0.1875rem;
      right: 0.25rem;
      width: 7rem;
      height: 1.5625rem;
      z-index: 11;
      font-size: 0.8125rem;
      font-weight: 400;
      line-height: 1rem;
      text-align: center;
      color: $neutral-300;
      background-color: $purple-600;
      display: flex;
      align-items: center;
      gap: 0.1875rem;
      padding: 0.5rem;
      border-radius: 3.125rem;
    }
  }

  .header {
    display: flex;
    flex-direction: column-reverse;
    .heading {
      font-size: 4rem;
      font-weight: 400;
      line-height: 5.44rem;
      margin: 0 auto 1rem auto;
    }

    .closeButton {
      align-self: end;
    }
  }

  .content {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 4.25rem;
    padding: 0 1rem;

    .day {
      border-radius: $secondaryBorderRadius;
      background: rgba($neutral-600, 0.1);
      // TODO: add variable
      border: 0.0625rem solid #9298b44d;

      padding: 0.75rem;
      border-radius: 0.375rem;
      min-width: 5rem;

      .icon {
        display: flex;
        justify-content: center;
        gap: 0.25rem;
        font-size: 1.25rem;
        color: $mainText;
        margin-bottom: 0.75rem;
        font-weight: 400;
        line-height: 100%;
      }

      .dayText {
        color: $mainText;
        font-size: 0.75rem;
        font-weight: 300;
        text-align: center;
      }

      .xpText {
        color: rgba($whiteText, 0.5);
        font-size: 0.75rem;
        vertical-align: top;
        line-height: 100%;
        font-weight: 300;
      }
    }

    .passed {
      background-color: $midnightDark;

      .dayText {
        color: $mainText;
      }
    }

    .current {
      border: 0.125rem solid $purpleText;
      background-color: rgba($neutral-600, 0.2);

      .icon {
        color: $purpleText;
      }

      .dayText {
        font-weight: 600;
      }
    }
  }

  .chestWrapper {
    display: flex;
    position: relative;
    margin-bottom: 3.4375rem;
    justify-content: center;

    .chest {
      height: 14.6875rem;
    }

    .chain {
      position: absolute;
      width: 19.375rem;
      height: 7.86rem;
      top: 10.8125rem;
      left: 12.8125rem;

      transition: transform 10s ease-out;
      animation: tease 5s infinite;
      animation-delay: 2s;
      &.unlocking {
        animation: none;
      }
      &.unlocked {
        animation: unlock 1s forwards;
      }
    }
  }

  .button {
    @include primary-button;
    font-size: 1.25rem;
    font-weight: 400;
    align-self: center;
    min-width: 24.625rem;
    width: max-content;
    max-width: 37.625rem;
    z-index: 10;
  }
}

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

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