/* =========================================
   Scroll-Based Animations
   Stripe-style sticky scroll & reveal effects
   ========================================= */

/* =========================================
   1. Sticky Scroll Section (How It Works)
   ========================================= */

.sticky-scroll-section {
  min-height: 180vh; /* Controls scroll distance - reduced for smoother experience */
  position: relative;
}

.sticky-scroll-wrapper {
  position: sticky;
  top: 100px; /* Below fixed nav */
  height: auto;
  min-height: 500px;
  max-height: calc(100vh - 140px);
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 60px;
  align-items: center;
  padding: 20px 0;
}

/* Left side: Steps list */
.sticky-scroll-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sticky-step {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 24px 0;
  position: relative;
  cursor: default;
}

/* Vertical line connecting steps */
.sticky-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 27px;
  top: 72px;
  bottom: -24px;
  width: 2px;
  background: var(--border-gray);
  transition: background 0.4s ease;
}

.sticky-step.active:not(:last-child)::after {
  background: var(--accent-lime);
}

.sticky-step-number {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  flex-shrink: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 2;
}

.sticky-step.active .sticky-step-number {
  background: var(--accent-lime);
  transform: scale(1.1);
}

.sticky-step-content {
  flex: 1;
  padding-top: 8px;
  opacity: 0.5;
  transition: opacity 0.4s ease;
}

.sticky-step.active .sticky-step-content {
  opacity: 1;
}

.sticky-step-content h4 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.sticky-step-content p {
  font-size: 15px;
  color: var(--text-gray);
  line-height: 1.6;
  margin: 0;
}

/* Right side: Screenshots */
.sticky-scroll-visual {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screenshot-stack {
  position: relative;
  width: 100%;
  max-width: 600px;
  aspect-ratio: 16/10;
}

.screenshot-item {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(30px) scale(0.96);
  transition:
    opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

.screenshot-item.active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.screenshot-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  box-shadow:
    0 25px 80px -12px rgba(0, 0, 0, 0.15),
    0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Screenshot placeholder (for when images aren't available) */
.screenshot-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f8faf9 0%, #e9eeea 100%);
  border-radius: 16px;
  box-shadow:
    0 25px 80px -12px rgba(0, 0, 0, 0.15),
    0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-gray);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.screenshot-placeholder .placeholder-icon {
  width: 64px;
  height: 64px;
  background: var(--accent-lime);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.screenshot-placeholder .placeholder-icon svg {
  width: 32px;
  height: 32px;
  color: var(--text-dark);
}

.screenshot-placeholder .placeholder-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.screenshot-placeholder .placeholder-desc {
  font-size: 14px;
  color: var(--text-gray);
  text-align: center;
  max-width: 280px;
}

/* Scroll triggers (invisible elements that trigger step changes) */
.scroll-trigger {
  position: absolute;
  width: 100%;
  height: 60vh; /* Each step gets 1/3 of 180vh scroll distance */
  pointer-events: none;
}

.scroll-trigger[data-step="0"] {
  top: 0;
}
.scroll-trigger[data-step="1"] {
  top: 60vh;
}
.scroll-trigger[data-step="2"] {
  top: 120vh;
}

/* =========================================
   2. Scroll Reveal Animations
   ========================================= */

.scroll-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger animation for lists */
.scroll-reveal-stagger {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal-stagger.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays */
.scroll-reveal-stagger[data-delay="1"] {
  transition-delay: 0.1s;
}
.scroll-reveal-stagger[data-delay="2"] {
  transition-delay: 0.2s;
}
.scroll-reveal-stagger[data-delay="3"] {
  transition-delay: 0.3s;
}
.scroll-reveal-stagger[data-delay="4"] {
  transition-delay: 0.4s;
}

/* Slide from left */
.scroll-reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition:
    opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

/* Slide from right */
.scroll-reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition:
    opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

/* Scale up reveal */
.scroll-reveal-scale {
  opacity: 0;
  transform: scale(0.95);
  transition:
    opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* =========================================
   3. Mobile & Tablet Responsive
   ========================================= */

/* Tablet: Simplified sticky scroll */
@media (max-width: 1024px) {
  .sticky-scroll-section {
    min-height: auto;
  }

  .sticky-scroll-wrapper {
    position: relative;
    top: 0;
    height: auto;
    grid-template-columns: 1fr;
    gap: 48px;
    padding: 0;
  }

  .sticky-scroll-steps {
    order: 2;
  }

  .sticky-scroll-visual {
    order: 1;
    height: 400px;
  }

  .screenshot-stack {
    max-width: 100%;
  }

  /* On tablet, show all steps as expanded */
  .sticky-step .sticky-step-content {
    opacity: 1;
  }

  /* Scroll triggers hidden on mobile */
  .scroll-trigger {
    display: none;
  }
}

/* Mobile: Fully stacked layout */
@media (max-width: 768px) {
  .sticky-scroll-section {
    min-height: auto;
  }

  .sticky-scroll-wrapper {
    position: relative;
    top: 0;
    height: auto;
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 0;
  }

  .sticky-scroll-visual {
    height: 280px;
  }

  .screenshot-item {
    /* On mobile, all screenshots visible - just stack them */
    position: relative;
    opacity: 1;
    transform: none;
    display: none;
  }

  .screenshot-item.active {
    display: block;
  }

  .sticky-step {
    padding: 20px 0;
  }

  .sticky-step-number {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }

  .sticky-step:not(:last-child)::after {
    left: 23px;
    top: 64px;
  }

  .sticky-step-content h4 {
    font-size: 16px;
  }

  .sticky-step-content p {
    font-size: 14px;
  }

  /* Reveal animations: reduce movement on mobile */
  .scroll-reveal,
  .scroll-reveal-stagger {
    transform: translateY(20px);
  }

  .scroll-reveal-left,
  .scroll-reveal-right {
    transform: translateY(20px);
  }
}

/* =========================================
   4. Reduced Motion Support
   ========================================= */

@media (prefers-reduced-motion: reduce) {
  .scroll-reveal,
  .scroll-reveal-stagger,
  .scroll-reveal-left,
  .scroll-reveal-right,
  .scroll-reveal-scale {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .screenshot-item {
    transition: opacity 0.01ms;
    transform: none;
  }

  .screenshot-item.active {
    transform: none;
  }

  .sticky-step-number,
  .sticky-step-content {
    transition: none;
  }

  .sticky-step:not(:last-child)::after {
    transition: none;
  }
}
