Ronalds Vilciņš

You can transition z-index

transition is a CSS property that allows you to specify the transition effect that should occur when an element’s state changes. For example, you can use the transition property to specify that an element should smoothly transition to a new size, color, or position when it is hovered over, or when it is clicked.

You can also transition z-index:

@keyframes move {
  from { z-index: 0; transform: scale(1); }
  to { z-index: 4; transform: scale(2.5); }
}