body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(120deg, #f7fbff 0%, #eaf4fc 100%);
  color: #202b38;
  height: 100%;
  overflow-x: hidden;
}

#howitworks-bgparticles {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* SECTION WRAPPER */
.howitworks-section {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  min-height: 520px;
  padding: 42px 2vw 32px 2vw;
  gap: 4vw;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  box-sizing: border-box;
  overflow: visible;
  z-index: 1;
}

/* LEFT SIDE (Title box) */
.howitworks-left {
  flex: 0 1 340px;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: auto;
  background: linear-gradient(135deg, #e3f0fd 0%, #f4faff 100%);
  border-radius: 22px;
  box-shadow: 0 4px 16px rgba(70,110,210,0.09);
  padding: 32px 28px;
  margin: 0;
  align-items: flex-start;
  z-index: 2;
}

/* Unified subtitle */
.howitworks-subtitle {
  font-size: clamp(0.94rem, 1.4vw, 1.14rem);
  font-weight: 600;
  color: #2366f6;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  margin-bottom: 10px;
}

/* Unified section title */
.howitworks-title {
  font-size: clamp(1.5rem, 4vw, 2.3rem);
  font-weight: 700;
  color: #232e47;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0;
}

/* CARDS ROW */
.howitworks-cards {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 2vw;
  flex: 1 1 0;
  min-width: 0;
  max-width: 1000px;
  justify-content: center;
}

.howitworks-card {
  --x: 0; /* Custom property for parallax effect */
  --y: 0; /* Custom property for parallax effect */
  position: relative;
  flex: 1 1 100px;
  min-width: 92px;
  max-width: 320px;
  border-radius: 22px;
  background-size: cover;
  background-position: calc(50% + var(--x, 0) * 1px) calc(50% + var(--y, 0) * 1px);
  box-shadow: 0 4px 20px rgba(55,90,200,0.10), 0 1px 7px rgba(80,90,120,0.09);
  overflow: hidden;
  cursor: pointer;
  height: 340px;
  margin: 0;
  transition:
    flex 0.66s cubic-bezier(.44,.66,.36,1),
    max-width 0.66s cubic-bezier(.44,.66,.36,1),
    box-shadow 0.36s cubic-bezier(.44,.66,.36,1),
    filter 0.32s cubic-bezier(.44,.66,.36,1),
    transform 0.36s cubic-bezier(.44,.66,.36,1);
  z-index: 1;
  background-blend-mode: multiply;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  will-change: flex, max-width, filter, transform;
}
.howitworks-card.expanded {
  flex: 3 1 580px;
  max-width: 560px;
  box-shadow: 0 0 0 12px #387eff10, 0 24px 60px 0 #3a78ff21, 0 4px 18px rgba(70,80,120,0.13);
  filter: none;
  transform: scale(1.018);
  z-index: 10;
}
.howitworks-card.collapsed {
  flex: 0.6 1 70px;
  max-width: 120px;
  filter: brightness(0.88) grayscale(0.14) blur(0.1px) saturate(0.89);
  transform: scale(0.97);
  z-index: 1;
}

.howitworks-card video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.38s cubic-bezier(.44,.66,.36,1);
  z-index: 0;
  border-radius: 22px;
}
.howitworks-card.expanded video {
  opacity: 1;
  pointer-events: auto;
}

/* Card overlays and step badge */
.howitworks-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: 22px;
  background: linear-gradient(
    170deg,
    rgba(34,44,80,0.32) 10%,
    rgba(44,58,111,0.17) 45%,
    rgba(46,78,145,0.17) 100%
  );
  opacity: 1;
  transition: opacity 0.32s;
}
.howitworks-card.expanded::before { opacity: 0; }

.howitworks-step-label {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 14px;
  font-size: 0.89rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #f6f8fc;
  background: rgba(30, 41, 64, 0.18);
  border: 1.1px solid rgba(255, 255, 255, 0.09);
  border-radius: 13px;
  backdrop-filter: blur(4px) saturate(1.01);
  z-index: 8;
  pointer-events: none;
  white-space: nowrap;
}

/* Card Inner */
.howitworks-card-inner {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  padding: 0 16px 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  opacity: 0;
  pointer-events: none;
  transform: translateY(28px);
  transition:
    opacity 0.44s cubic-bezier(.48,1.22,.36,1.12),
    transform 0.51s cubic-bezier(.53,1.03,.38,.97);
  z-index: 6;
}
.howitworks-card.expanded .howitworks-card-inner {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0.07s;
}

/* Unified card title */
.howitworks-step-title {
  font-size: 1.14rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.24;
  margin: 0 0 8px 0;
}

/* Unified card text */
.howitworks-card-desc {
  font-size: 0.97rem;
  font-weight: 400;
  line-height: 1.5;
  color: #e9f1fa;
  max-width: 95%;
  margin: 0;
}

/* ========== RESPONSIVE ADJUSTMENTS ========== */

/* ✅ TABLET: (601px to 991px) - Title on top */
@media (max-width: 991px) {
  .howitworks-section {
    flex-direction: column; /* Stack title and cards vertically */
    gap: 15px; /* Reduced space between title and cards */
    padding: 32px 4vw;
  }
  .howitworks-left {
    flex: 0 1 auto; /* Allow the box to size naturally */
    max-width: 100%;
    align-items: center; /* Center the text */
    text-align: center;
    padding: 24px 20px;
  }
  .howitworks-cards {
    gap: 1.5vw;
    width: 100%;
    max-width: 820px; /* Prevent cards from becoming too wide */
  }
  .howitworks-card {
    height: 320px;
  }
  .howitworks-card.expanded .howitworks-card-inner {
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.75) 100%);
    padding-top: 30px;
    border-radius: 0 0 22px 22px;
  }
}

/* ✅ MOBILE: (600px and below) */
@media (max-width: 600px) {
  .howitworks-section {
    flex-direction: column;
    padding: 20px 0;
    gap: 20px;
  }
  .howitworks-left {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    padding: 16px 4vw;
    text-align: left;
    align-items: flex-start;
    background: none;
    box-shadow: none;
  }
  .howitworks-cards {
    position: relative; /* Needed for positioning the slide indicator */
    display: flex;
    flex-direction: row;
    justify-content: flex-start; 
    gap: 16px;
    width: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 0 4vw 12px 4vw;
  }
  .howitworks-cards::-webkit-scrollbar {
    display: none;
  }
  .howitworks-card,
  .howitworks-card.collapsed,
  .howitworks-card.expanded {
    flex: 0 0 90% !important;
    max-width: 90% !important;
    height: 85vw !important;
    max-height: 400px !important;
    scroll-snap-align: center !important; /* ✅ FIX: Snap to the center of the card */
    cursor: default !important;
    filter: none !important;
    transform: none !important;
  }
  
  .howitworks-card video {
    display: none !important;
  }

  .howitworks-card::before {
    opacity: 0 !important;
  }
  .howitworks-card .howitworks-card-inner {
    opacity: 1 !important;
    transform: none !important;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.75) 100%);
    padding: 16px;
    border-radius: 0 0 22px 22px;
  }

  .slide-indicator {
    position: absolute;
    bottom: 20px;
    right: -10px; 
    background-color: #2366f6;
    color: white;
    padding: 6px 14px 6px 18px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    pointer-events: none;
    opacity: 0;
    animation: slideInAndPulse 2.5s 1s ease-in-out forwards;
    transition: opacity 0.3s;
  }
  .slide-indicator.hidden {
    opacity: 0;
  }
  .slide-indicator svg {
    width: 16px;
    height: 16px;
    stroke: white;
    stroke-width: 2.5;
  }

  @keyframes slideInAndPulse {
    0% { opacity: 0; transform: translateX(0); }
    20% { opacity: 1; transform: translateX(-30px); }
    40% { transform: translateX(-25px); }
    60% { transform: translateX(-30px); }
    100% { opacity: 1; transform: translateX(-30px); }
  }
}
