@use '@/styles/variables.scss' as *;

.page-transition {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;

  &__layer {
    display: flex;
    flex-direction: column;
    gap: $spacing-lg;
    min-height: 0;
    flex: 1;
    backface-visibility: hidden;
    transform: translateZ(0);

    // During animation, exit layer uses absolute positioning
    &--exit {
      position: absolute;
      inset: 0;
      z-index: 1;
      overflow: hidden;
      pointer-events: none;
      will-change: transform, opacity;
    }
  }

  &--animating &__layer {
    will-change: transform, opacity;
  }

  &--animating &__layer:not(.page-transition__layer--exit) {
    position: relative;
    z-index: 0;
  }
}
