@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;

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

  &--animating &__layer {
    will-change: transform, opacity;
    backface-visibility: hidden;
    transform-style: preserve-3d;
  }

  // When both layers exist, current layer also needs positioning
  &--animating &__layer:not(&__layer--exit) {
    position: relative;
    z-index: 0;
  }
}
