@use "./variables" as *;

.#{$component-prefix}rolling-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: $rolling-text-font-size;
  color: $rolling-text-color;

  &-item {
    width: $rolling-text-item-width;
    margin-right: $rolling-text-gap;
    overflow: hidden;
    background: $rolling-text-background;
    border-radius: $rolling-text-item-border-radius;

    &:last-child {
      margin-right: 0;
    }

    &__box {
      overflow: hidden;

      &.animate {
        animation: #{$component-prefix}-up $rolling-text-duration ease-in-out $rolling-text-delay;
        animation-iteration-count: 1;
        animation-fill-mode: both;
      }
    }

    &__item {
      text-align: center;
    }

    &--down {
      .#{$component-prefix}rolling-text-item__box {
        transform: translateY($rolling-text-translate);

        &.animate {
          animation-name: #{$component-prefix}-down;
        }
      }
    }
  }
}


@keyframes #{$component-prefix}-down {
  0% {
    transform: translateY($rolling-text-translate);
  }

  100% {
    transform: translateY(0);
  }
}

@keyframes #{$component-prefix}-up {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY($rolling-text-translate);
  }
}
