@import 'styles/_functions';

.item {
  // border-bottom: desktop-vw(1px) solid transparent;

  position: relative;

  .inner {
    padding: mobile-vw(16px) 0;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    flex-direction: column;

    @include desktop {
      flex-direction: row;
      align-items: center;
      padding: desktop-vw(16px) 0;
    }
  }

  &::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: desktop-vw(1px);
    background-color: var(--grey);
    bottom: 0;
  }

  &::before {
    position: absolute;
    left: 0;
    top: 0;
    content: '';
    width: 100%;
    height: 100%;
    background-color: var(--theme-contrast);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 600ms var(--ease-out-expo);
  }

  @include mobile {
    flex-direction: column;

    &::before {
      content: none;
    }
  }

  .title {
    display: flex;
    align-items: center;
    transition: transform 600ms var(--ease-out-expo);
    // will-change: transform;
    overflow: hidden;
    flex-shrink: 0;

    .text {
      font-family: var(--font-roboto);
      font-weight: 500;
      line-height: 100%;
      font-size: mobile-vw(20px);
      letter-spacing: -0.03em;

      @include mobile {
        max-width: 70%;
        margin-bottom: mobile-vw(8px);
      }

      @include desktop {
        line-height: 114%;
        font-size: desktop-vw(28px);
      }
    }

    .arrow {
      aspect-ratio: 1 / 1;
      margin-left: auto;
      width: mobile-vw(19px);

      @include mobile {
        flex-shrink: 0;
      }

      @include desktop {
        transform: translate(-20%, 20%);
        opacity: 0;
        margin-left: desktop-vw(24px);
        width: desktop-vw(19px);
      }
    }
  }

  .source {
    font-family: var(--font-roboto);
    font-weight: 900;
    transition: transform 600ms var(--ease-out-expo);
    line-height: 100%;
    letter-spacing: -0.03em;
    font-size: mobile-vw(20px);
    will-change: transform;

    @include desktop {
      text-align: end;
      line-height: 114%;
      font-size: desktop-vw(28px);
    }
  }

  @include hover {
    &:hover {
      &::before {
        transform: scaleY(1);
        transform-origin: bottom;
      }

      .title {
        transform: translateX(desktop-vw(16px));

        .arrow {
          transition: opacity 600ms var(--ease-out-expo),
            transform 600ms var(--ease-out-expo);
          opacity: 1;
          transform: translate(0, 0);
          transition-delay: 100ms;
        }
      }

      .source {
        transform: translateX(desktop-vw(-16px));
      }
    }
  }

  //animation

  @include desktop {
    display: inline-block;
    width: 100%;
    transition: transform 1.2s var(--ease-out-expo);
    transition-delay: calc(100ms * var(--i));

    &::after {
      transition: transform 1.2s var(--ease-out-expo);
      transform-origin: right;
      transition-delay: calc(100ms * var(--i));
    }

    .source {
      overflow: hidden;
    }

    .text,
    .source > * {
      transition: transform 1.2s var(--ease-out-expo);
      display: block;
      transition-delay: calc(100ms * var(--i));
    }

    &:not(.visible) {
      transform: translateY(100%);

      &::after {
        transform: scaleX(0);
      }

      .text,
      .source > * {
        transform: translateY(100%);
      }
    }
  }
}
