/* ============================
   HOW IT WORKS - Scroll-Driven Animation Component
   Reusable component for scroll-driven content transitions
   ============================ */

/* Scroll-driven animation container */
.how-scroll-container{
  position: relative;
  /* Total scroll distance: 720px per section × 3 sections = 2160px */
  /* Plus viewport height for sticky positioning */
  height: calc(100vh + 2160px);
}

/* Fixed viewport - stays in place while content changes */
.how-viewport{
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Color-shift gradient background for how-viewport */
.how-viewport-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  opacity: 0.75;
  -webkit-mask-image: radial-gradient(ellipse at center, transparent 0%, transparent 20%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,1) 100%);
  mask-image: radial-gradient(ellipse at center, transparent 0%, transparent 20%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,1) 100%);
  pointer-events: none;
  z-index: 0;
}

/* Scroll spacer - creates the scrollable distance */
.how-scroll-spacer{
  height: 2160px; /* 3 sections worth of scroll (720px each) */
  position: relative;
  z-index: 0;
}

/* Content wrapper - contains all steps */
.how-content-wrapper{
  position: relative;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
  height: 100%;
  display: flex;
  align-items: center;
}

/* Each content step - positioned absolutely, crossfades based on scroll */
.how-content-step{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.how-content-step.active{
  opacity: 1;
  pointer-events: auto;
}

.how-content-step .how-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  width: 100%;
}

.how-content-step .how-text{
  flex: 0 0 56%;
}

.how-content-step .how-media{
  flex: 0 0 40%;
  display: flex;
  justify-content: center;
  position: relative;
  background: transparent !important;
  background-color: transparent !important;
}

/* Overlay positioning for step 1 and step 3 */
.how-content-step[data-step="1"] .how-overlay-wrap{
  bottom: 32%;
  width: 56%;
  max-width: 360px;
}

.how-content-step[data-step="3"] .how-overlay-wrap{
  bottom: 22%;
  width: 78%;
  max-width: 380px;
}

/* Overlay wrapper (reusable) */
.how-overlay-wrap{
  position: absolute;
  left: 50%;
  bottom: -30%;
  width: 78%;
  max-width: 380px;
  z-index: 2;
  pointer-events: none;
  will-change: transform;
}

/* Initial overlay state - hidden until animated */
.how-content-step .how-overlay{
  opacity: 0;
  transform: translateX(-50%);
  transition: none; /* Let JavaScript handle animation */
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  will-change: transform, opacity;
}

.how-content-step[data-step="1"] .how-overlay,
.how-content-step[data-step="3"] .how-overlay{
  transform: translateX(-50%); /* Start centered */
}

/* Background stays consistent - using color-shift gradient */

/* Step number styling */
.step-num{
  display: block;
  padding-bottom: 16px;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1;
  background: linear-gradient(
    to right,
    rgba(29, 38, 57, 0.55) 0%,
    rgba(29, 38, 57, 0) 23%,
    rgba(29, 38, 57, 0.0) 100%
  );
  background-clip: text;
  color: transparent;
}

.how-content-step .how-text h3{
  margin-top: 2px;
  color: var(--primary-color);
}

.how-img{
  width: 100%;
  max-width: 280px;
  border-radius: 0;
  box-shadow: none;
}

/* Mobile responsive */
@media (max-width: 880px){
  .how-scroll-container{
    height: auto !important;
    display: block !important;
    position: relative !important;
  }
  
  .how-viewport{
    position: relative !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
    display: block !important;
  }
  
  .how-viewport-bg {
    display: none !important;
  }
  
  .how-viewport .container{
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
  }
  
  .how-viewport .container.how-inner{
    display: block !important;
    width: 100% !important;
    position: relative !important;
  }
  
  .how-scroll-spacer{
    display: none !important;
    height: 0 !important;
  }
  
  .how-content-wrapper{
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 var(--container-padding) !important;
    height: auto !important;
    display: block !important;
  }
  
  /* Make all steps visible and stack vertically */
  .how-content-step,
  .how-content-step[data-step="1"],
  .how-content-step[data-step="2"],
  .how-content-step[data-step="3"]{
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    display: block !important;
    padding: 60px 0 !important;
    margin-bottom: 0 !important;
    margin-top: 0 !important;
    clear: both !important;
    float: none !important;
    transform: none !important;
  }

  /* Reduce padding-top on first step to reduce gap above "How it Works" section */
  .how-content-step[data-step="1"]{
    padding-top: 24px !important; /* Reduced from 60px to 24px */
  }
  
  .how-content-step.active{
    opacity: 1 !important;
    position: relative !important;
    display: block !important;
  }
  
  .how-content-step .how-inner{
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 24px !important;
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
    display: flex !important;
    margin: 0 auto !important;
    padding: 0 !important;
  }
  
  .how-content-step .how-text{
    flex: 0 0 auto !important;
    width: 100% !important;
    text-align: left !important;
    position: relative;
    padding: 0 var(--container-padding) !important;
  }

  /* Normalize header/description spacing on mobile (avoid stacked default h3/p margins) */
  .how-content-step .how-text h3{
    margin: 2px 0 8px 0;
  }
  .how-content-step .how-text p{
    margin-top: 0;
  }
  
  .how-content-step .how-media{
    flex: 0 0 auto !important;
    width: 100% !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: left !important;
    margin-top: 0;
    position: relative;
    min-height: 250px;
    display: flex !important;
    flex-direction: column;
    background: transparent !important;
    background-color: transparent !important;
  }
  
  .how-img{
    max-width: 224px !important;
    width: 80% !important;
    display: block !important;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    opacity: 1 !important;
    visibility: visible !important;
  }
  
  .how-overlay-wrap{
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    width: 70%;
    max-width: 280px;
    margin: 16px auto 0;
    z-index: 2;
  }
  
  .how-content-step[data-step="1"] .how-overlay-wrap{
    width: 70%;
    max-width: 280px;
  }
  
  .how-content-step[data-step="3"] .how-overlay-wrap{
    width: 70%;
    max-width: 280px;
  }
  
  .how-content-step .how-overlay{
    position: relative !important;
    left: auto !important;
    transform: none !important;
    opacity: 1 !important;
    display: block !important;
    width: 100% !important;
    visibility: visible !important;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce){
  .how-content-step{
    transition: none;
  }
  
  .how-content-step .how-overlay{
    transition: none !important;
  }
}

