/* Professional AI Edits Section Styles */
.ai-edits-section {
  height: 200vh; /* Reduced height for faster scrolling */
  display: block;
  background: #000000;
  padding: 0 80px;
  position: relative;
  overflow: visible;
  z-index: 2;
}

/* Galaxy Background */
.galaxy-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  contain: strict;
}

.galaxy-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.ai-edits-container {
  max-width: 100%;
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 5;
  pointer-events: none;
  gap: 60px;
  padding: 100px 0;
  box-sizing: border-box;
}

.ai-edits-container * {
  pointer-events: auto;
}

.ai-edits-content {
  max-width: 650px;
  flex-shrink: 0;
  text-align: left;
  position: relative;
  z-index: 10;
}



.ai-edits-heading {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: #ffffff;
  display: flex;
  flex-wrap: nowrap;
  line-height: 1.2;
  white-space: nowrap;
}

/* Word-by-word slide in animation */
.ai-edits-heading .word {
  display: inline-block;
  opacity: 0;
  transform: translateX(-100px);
  margin-right: 0.3em;
}

.ai-edits-heading.in-view .word {
  animation: wordSlideIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.ai-edits-heading.in-view .word:nth-child(1) { animation-delay: 0s; }
.ai-edits-heading.in-view .word:nth-child(2) { animation-delay: 0.2s; }
.ai-edits-heading.in-view .word:nth-child(3) { animation-delay: 0.4s; }

@keyframes wordSlideIn {
  0% {
    opacity: 0;
    transform: translateX(-100px);
  }
  60% {
    opacity: 1;
    transform: translateX(10px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* AI gradient text effect */
.ai-edits-heading .word:nth-child(2) {
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ai-edits-text {
  font-family: 'Space Mono', monospace;
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.01em;
  min-height: 150px;
  text-align: left;
  word-spacing: 0.1em;
}

/* Falling word animation */
.ai-edits-text .word {
  display: inline-block;
  margin-right: 0.35em;
  opacity: 1;
  transform: translateY(0);
}

.ai-edits-text .word.animate {
  opacity: 0;
  transform: translateY(-30px);
  animation: wordFallAI 0.4s ease-out forwards;
}

@keyframes wordFallAI {
  0% {
    opacity: 0;
    transform: translateY(-30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive - Large Tablet / iPad Landscape */
@media (max-width: 1366px) {
  .ai-edits-section {
    padding: 0 60px;
  }
  
  .ai-edits-container {
    gap: 50px;
  }
  
  .ai-edits-content {
    max-width: 500px;
  }
  
  .comparison-cards-wrapper {
    width: 450px;
    height: 600px;
    right: 60px;
  }
}

/* Responsive - Tablet / iPad Portrait */
@media (max-width: 1024px) {
  .ai-edits-section {
    padding: 0 40px;
  }
  
  .ai-edits-container {
    max-width: 100%;
    gap: 40px;
    padding: 80px 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  
  .ai-edits-content {
    max-width: 100%;
    text-align: center;
  }
  
  .ai-edits-heading {
    font-size: 3rem;
    justify-content: center;
  }
  
  .ai-edits-text {
    font-size: 1.1rem;
  }
  
  .comparison-cards-wrapper {
    position: relative;
    right: auto;
    top: auto;
    margin-top: 0;
    width: 400px;
    height: 520px;
    max-width: 90vw;
  }
  
  .comparison-card {
    width: 100%;
    height: 100%;
  }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
  .ai-edits-section {
    padding: 60px 20px;
    height: auto;
    min-height: 100vh;
  }
  
  .ai-edits-container {
    max-width: 100%;
    gap: 30px;
    padding: 20px 0;
    height: auto;
    min-height: auto;
    position: relative;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
  }
  
  .ai-edits-content {
    max-width: 100%;
    text-align: center;
    position: relative;
    z-index: 10;
  }
  
  .ai-edits-heading {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    white-space: normal;
  }
  
  /* Force heading words to be visible on mobile */
  .ai-edits-heading .word {
    opacity: 1 !important;
    transform: translateX(0) !important;
    animation: none !important;
  }
  
  .ai-edits-text {
    font-size: 1rem;
    line-height: 1.7;
    min-height: auto;
    opacity: 1 !important;
    margin-bottom: 30px;
  }
  
  /* Force falling text words to be visible */
  .ai-edits-text .word {
    opacity: 1 !important;
    transform: translateY(0) !important;
  }
  
  .comparison-cards-wrapper {
    position: relative !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    opacity: 1 !important;
    width: 100%;
    max-width: 320px;
    height: 420px;
    margin: 0 auto;
  }
  
  .comparison-cards-wrapper.rocket-enter {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}

/* Responsive - Small Mobile */
@media (max-width: 480px) {
  .ai-edits-section {
    padding: 60px 20px;
  }
  
  .ai-edits-heading {
    font-size: 1.8rem;
  }
  
  .ai-edits-text {
    font-size: 0.9rem;
    min-height: 100px;
  }
}


/* Before/After Comparison Cards */
.comparison-cards-wrapper {
  position: absolute;
  right: 40px;
  top: 50%;
  width: 550px;
  height: 700px;
  transform: translate3d(0, calc(-50% + 100%), 0);
  opacity: 0;
  z-index: 10;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.comparison-cards-wrapper.rocket-enter {
  animation: rocketEntrance 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes rocketEntrance {
  0% {
    opacity: 0;
    transform: translate3d(0, calc(-50% + 100%), 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, -50%, 0);
  }
}

.comparison-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translate3d(0, 100px, 0);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  contain: strict;
  will-change: transform, opacity;
}

.comparison-card.active {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  z-index: 3;
  pointer-events: auto;
}

.comparison-card.prev {
  opacity: 0.5;
  transform: translate3d(0, -30px, 0);
  z-index: 2;
  pointer-events: none;
}

.comparison-card.next {
  opacity: 0;
  transform: translate3d(0, 50px, 0);
  z-index: 1;
  pointer-events: none;
}

.comparison-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: ew-resize;
}

.comparison-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: translateZ(0);
  backface-visibility: hidden;
  transform: translateZ(0);
}

.comparison-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comparison-image.before {
  z-index: 1;
  clip-path: inset(0 50% 0 0);
  backface-visibility: hidden;
  will-change: clip-path;
}

/* Only animate the active card's slider */
.comparison-card.active .comparison-image.before {
  animation: sliderReveal 6s linear infinite;
}

.comparison-container.user-interacting .comparison-image.before {
  animation: none !important;
}

@keyframes sliderReveal {
  0% { clip-path: inset(0 95% 0 0); }
  50% { clip-path: inset(0 5% 0 0); }
  100% { clip-path: inset(0 95% 0 0); }
}

.comparison-image.after {
  z-index: 0;
}

/* Slider */
.comparison-slider {
  position: absolute;
  top: 0;
  left: 50%;
  width: 44px;
  height: 100%;
  z-index: 10;
  transform: translateX(-50%);
  cursor: ew-resize;
  /* Invisible touch area - the visual line is inside */
  background: transparent;
}

/* Only animate the active card's slider */
.comparison-card.active .comparison-slider {
  animation: sliderMove 6s linear infinite;
}

.comparison-container.user-interacting .comparison-slider {
  animation: none !important;
}

@keyframes sliderMove {
  0% { left: 5%; }
  50% { left: 95%; }
  100% { left: 5%; }
}

.slider-line {
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 100%;
  background: #ffffff;
  transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.slider-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  background: #ffffff;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  cursor: ew-resize;
  pointer-events: auto;
  touch-action: none;
}

.slider-handle span {
  width: 20px;
  height: 2px;
  background: #333;
  border-radius: 1px;
}



/* Responsive */
@media (max-width: 1200px) {
  .ai-edits-container {
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  
  .ai-edits-content {
    max-width: 100%;
    text-align: center;
    margin-bottom: 40px;
  }
  
  .comparison-cards-wrapper {
    position: relative;
    right: auto;
    top: auto;
    margin-top: 0;
    width: 100%;
    max-width: 400px;
    height: 500px;
  }
}

@media (max-width: 768px) {
  .slider-handle {
    width: 36px;
    height: 36px;
  }
  
  /* GPU optimization for mobile */
  .comparison-card {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }
  
  .comparison-image.before {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }
  
  /* Enable auto slider animation on mobile */
  .comparison-card.active .comparison-image.before {
    animation: sliderReveal 5s linear infinite !important;
  }
  
  .comparison-card.active .comparison-slider {
    animation: sliderMove 5s linear infinite !important;
  }
  
  /* Pause animation when user is interacting */
  .comparison-container.user-interacting .comparison-image.before,
  .comparison-container.user-interacting .comparison-slider {
    animation: none !important;
  }
}

@media (max-width: 480px) {
  .ai-edits-section {
    padding: 40px 15px;
  }
  
  .ai-edits-heading {
    font-size: 1.8rem;
  }
  
  .comparison-cards-wrapper {
    max-width: 280px;
    height: 380px;
  }
}
