.flip-text-wrapper {
  position: relative;
  height: 50px;
  perspective: 1000px;
}

.flip-text {
  position: absolute;
  width: 100%;
  text-align: center;
  backface-visibility: hidden;
  transition: transform 0.6s, opacity 0.6s;
}

.flip-text.front {
  transform: rotateY(0deg);
  z-index: 2;
}

.flip-text.back {
  transform: rotateY(180deg);
  z-index: 1;
}

.flip-text-wrapper.flipped .front {
  transform: rotateY(-180deg);
  opacity: 0;
}

.flip-text-wrapper.flipped .back {
  transform: rotateY(0deg);
  opacity: 1;
}