/* 1. Setup the section height so there is room to scroll */
.parallax-section {
  position: relative;
  height: 100dvh;
  overflow: hidden;
  background: #111; /* Fallback background */
}

/* 2. Center the text wrapper */
.parallax-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  text-align: center;
}

/* 1. Base text configurations */
.parallax-text {
  /* Dynamic sizing: ensures the font size matches the screen width */
  font-size: clamp(1.8rem, 7vw, 4.5rem); 
  font-weight: 600;
  color: white;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
  will-change: transform; 
  
  /* CRITICAL CHANGES: */
  white-space: normal;       /* Allows long text strings to break naturally if they exceed the width */
  max-width: 90vw;           /* Forces the text box to never exceed 90% of the viewport width */
  margin: 0 auto;            /* Centers the text box inside its parent */
  display: inline-block;     /* Keeps the animation boundaries tight around the box layout */
}

/* 2. Parent wrapper boundaries */
.parallax-wrapper, 
.video-container {
  overflow-x: hidden !important; /* Hard cutoff to prevent any mobile layout shaking */
  width: 100vw;                  /* Matches exactly the layout viewport width */
}

/* 3. Scroll-Linked Animations */
.parallax-text.from-left {
  animation: moveTextFromLeft linear;
  animation-timeline: scroll(root);    
}

.parallax-text.from-right {
  animation: moveTextFromRight linear;
  animation-timeline: scroll(root); 
}

/* 4. Safe Mobile-First Animation Keyframes 
   By reducing the translate percentages, the text drifts gracefully across the screen
   instead of flying entirely off-screen. */
@keyframes moveTextFromLeft {
  from {
    transform: translateX(-10%); /* Start slightly shifted left */
  }
  to {
    transform: translateX(10%);  /* End slightly shifted right */
  }
}

@keyframes moveTextFromRight {
  from {
    transform: translateX(30%);  /* Start slightly shifted right */
  }
  to {
    transform: translateX(-10%); /* End slightly shifted left */
  }
}

/* Base state: Hidden and shifted 150px to the left */
.fly-in {
  opacity: 0;
  transform: translateX(-150px);
  /* Fast exit, smooth entry curve */
  transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.6s ease-in-out;
  will-change: transform, opacity;
}

/* Active state: Visible and centered */
.fly-in.show {
  opacity: 1;
  transform: translateX(0);
}
