/* How FastBridge Works — Figma Section / HowItWorks / desktop (1440 × 809) */

.hiw {
  overflow-x: clip;
  background: transparent;
  opacity: 1;
  transform: none;
}

.hiw__stage {
  position: relative;
  width: 100%;
  max-width: var(--section-max);
  height: 809px;
  margin: 0 auto;
  background: transparent;
  isolation: isolate;
}

/* ========== Background layers (match Figma node order) ========== */

.hiw__gradient-wrap {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 0;
  width: 100vw;
  height: 688px;
  overflow: hidden;
  pointer-events: none;
  transform: translateX(-50%);
}

.hiw__gradient {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.hiw__curve-fill {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  height: 227px;
  pointer-events: none;
}

.hiw__curve-fill svg {
  display: block;
  width: 100%;
  height: 100%;
}

.hiw__curve-wave {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  height: 227px;
  overflow: hidden;
  pointer-events: none;
}

.hiw__curve-wave img {
  position: absolute;
  top: -0.17%;
  left: -0.28%;
  width: 100.28%;
  max-width: none;
  height: 100.34%;
  object-fit: fill;
}

/* ========== Title + product card ========== */

.hiw__title {
  position: absolute;
  top: 80px;
  left: var(--section-pad-x);
  z-index: 3;
  max-width: 459px;
  margin: 0;
  font-family: "Google Sans Flex", sans-serif;
  font-size: 48px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--brand-white);
}

/* Desktop: each word on its own line (How / FastBridge / Works) */
.hiw__title-word {
  display: block;
}

.hiw__product-wrap {
  --hiw-widget-height: 460px;
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 3;
  display: flex;
  justify-content: center;
  width: 632px;
  max-width: calc(100% - 2 * var(--section-pad-x));
  transform: translateX(-50%);
}

/* ========== Steps — absolute on white section bg, no extra band ========== */

.hiw__steps {
  position: absolute;
  top: 564px;
  right: var(--section-pad-x);
  left: var(--section-pad-x);
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.hiw__steps > li {
  display: flex;
  min-width: 0;
  margin: 0;
}

.hiw-step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  min-height: 243px;
  padding: 0 0 28px;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  background: none;
  border: none;
  transition: opacity 0.35s ease;
}

/* Loader / timer bar — shown on the active step only */
.hiw-step--active::before,
.hiw-step--active::after {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  content: "";
  border-radius: 2px;
}

.hiw-step--active::before {
  width: 100%;
  background: rgba(0, 101, 255, 0.16);
}

.hiw-step--active::after {
  width: 0;
  background: var(--brand-blue);
  animation: hiw-loader 6s linear forwards;
}

@keyframes hiw-loader {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hiw-step--active::after {
    width: 100%;
    animation: none;
  }

  .hiw-step:not(.hiw-step--active):hover .hiw-step__num {
    font-size: 40px;
    color: var(--step-num-active);
  }
}

.hiw-step:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 4px;
  border-radius: 4px;
}

.hiw-step:not(.hiw-step--active) {
  gap: 12px;
  justify-content: flex-end;
  opacity: 0.6;
}

.hiw-step:not(.hiw-step--active):hover {
  opacity: 0.9;
}

.hiw-step__num {
  display: block;
  font-family: "Google Sans Flex", sans-serif;
  font-size: 84px;
  font-weight: 400;
  line-height: 1;
  color: var(--step-num-active);
  transition:
    font-size 0.35s ease,
    color 0.25s ease;
}

.hiw-step:not(.hiw-step--active) .hiw-step__num {
  font-size: 40px;
}

.hiw-step:not(.hiw-step--active):hover .hiw-step__num {
  font-size: 56px;
  color: #a8c8f8;
}

.hiw-step__label {
  display: block;
  font-family: "Google Sans Flex", sans-serif;
  font-size: 11px;
  font-weight: 400;
  color: var(--brand-blue);
  text-transform: uppercase;
  letter-spacing: 0.66px;
}

.hiw-step__heading {
  max-width: 340px;
  margin: 0;
  font-family: "Google Sans Flex", sans-serif;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--fg-primary);
}

.hiw-step__desc {
  max-width: 380px;
  margin: 0;
  font-family: "Google Sans Flex", sans-serif;
  font-size: 14px;
  line-height: 20px;
  color: var(--fg-body);
  text-wrap: balance;
}

/* ========== Product card ========== */

/* Cinematic per-step widget video — transparent card animation composited
   over the section gradient. Requires Remotion exports with true alpha
   (yuva420p WebM + HEVC hvc1 derived via tools/encode-hiw-hevc.sh). */
.hiw__widget {
  position: relative;
  width: auto;
  max-width: 100%;
  height: 600px;
  aspect-ratio: 1256 / 1660;
  overflow: visible;
  background: transparent;
}

/* One <video> per step, stacked and crossfaded. All are preloaded so
   advancing never shows an empty (black) reload gap. */
.hiw__widget-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
  background: transparent;
  opacity: 0;
  /* Elevation is applied here, not baked into the video — drop-shadow hugs
     the card's alpha silhouette and stays vector-crisp (a baked alpha shadow
     posterizes/bands over a contrasting background). */
  filter: drop-shadow(0 2px 4px rgba(12, 24, 56, 0.1))
    drop-shadow(0 18px 36px rgba(12, 24, 56, 0.2));
  transition: opacity 0.4s ease;
}

.hiw__widget-video--active {
  z-index: 1;
  opacity: 1;
}

/* When the cinematic video is present, the hand-built card is the
   reduced-motion / no-JS fallback only. */
.hiw__product-wrap .product-card {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .hiw__widget {
    display: none;
  }
  .hiw__product-wrap .product-card {
    display: block;
  }
}

.product-card {
  width: min(100%, 459px);
  overflow: hidden;
  background: var(--brand-white);
  border-radius: 22px;
  box-shadow:
    0 -5.93px 58.764px rgba(69, 103, 255, 0.15),
    0 11.018px 22.037px rgba(69, 202, 255, 0.16),
    0 1.836px 3.673px rgba(85, 176, 255, 0.04),
    0 0 0 12.855px rgba(242, 246, 255, 0.55),
    inset 0 0.918px 0 rgba(255, 255, 255, 0.9);
}

.product-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 39px;
  padding: 9px 18px 0;
}

.product-card__title {
  font-family: "Geist", sans-serif;
  font-size: 15.6px;
  font-weight: 600;
  color: #1f1f1f;
  letter-spacing: -0.234px;
}

.product-card__actions {
  display: flex;
  gap: 15px;
  align-items: center;
}

.product-card__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 29px;
  height: 29px;
  padding: 0;
  background: var(--brand-white);
  border: 0.918px solid rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  box-shadow:
    0 1.836px 1.836px rgba(60, 40, 100, 0.04),
    0 0.918px 0.918px rgba(60, 40, 100, 0.06);
}

.product-card__body {
  display: flex;
  flex-direction: column;
  gap: 11px;
  justify-content: center;
  min-height: var(--hiw-widget-height, 460px);
  padding: 0 9px 6px;
}

.product-card__field {
  padding: 18px;
  background: var(--brand-white);
  border-radius: 11px;
  box-shadow: 0 0 0.918px rgba(60, 40, 100, 0.15);
}

.product-card__field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 11px;
}

.product-card__field-label {
  display: block;
  font-size: 10.1px;
  font-weight: 600;
  color: #8e8e89;
  text-transform: uppercase;
  letter-spacing: 1.01px;
}

.product-card__add-asset {
  font-family: "Geist", sans-serif;
  font-size: 12.9px;
  font-weight: 500;
  color: #9e9e9c;
}

.product-card__field-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.product-card__amount {
  font-family: "Geist", sans-serif;
  font-size: 40.4px;
  font-weight: 500;
  line-height: 1;
  color: #c8c8c8;
  letter-spacing: -1.414px;
}

.product-card__fiat {
  margin-top: 11px;
  font-family: "Geist", sans-serif;
  font-size: 11.9px;
  color: #8e8e89;
}

.product-card__pill {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 5.5px 13px 5.5px 5.5px;
  font-size: 13.8px;
  font-weight: 600;
  color: #1f1f1f;
  background: var(--brand-white);
  border: 0.918px solid rgba(0, 0, 0, 0.04);
  border-radius: 999px;
  box-shadow:
    0 1.836px 3.673px rgba(60, 40, 100, 0.04),
    0 0.918px 0.918px rgba(60, 40, 100, 0.06);
}

.product-card__pill::before {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  content: "";
  border: 1.377px dashed #c8c8c7;
  border-radius: 50%;
}

.product-card__field--receive .product-card__field-label {
  margin-bottom: 11px;
}

.product-card__divider {
  height: 1px;
  margin: 11px 0;
  background: #f6f6f6;
}

.product-card__recipient-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-card__address {
  font-family: "Geist", sans-serif;
  font-size: 13.8px;
  font-weight: 500;
  color: var(--brand-blue);
  letter-spacing: -0.069px;
}

.product-card__edit {
  padding: 5.5px 13px;
  font-family: "Geist", sans-serif;
  font-size: 11.9px;
  font-weight: 500;
  color: #1f1f1f;
  border: 0.918px solid rgba(0, 0, 0, 0.04);
  border-radius: 999px;
  box-shadow: 0 0.918px 0.918px rgba(60, 40, 100, 0.06);
}

.product-card__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - 18px);
  height: 48px;
  margin: 0 auto 6px;
  font-family: "Geist", sans-serif;
  font-size: 14.7px;
  font-weight: 500;
  color: #9e9e9c;
  background: #eff0f3;
  border-radius: 13px;
}

/* ========== TABLET ≤768px ========== */

@media (max-width: 768px) {
  .hiw__stage {
    height: auto;
    padding-bottom: 0;
  }

  .hiw__gradient-wrap {
    height: clamp(480px, 72vw, 564px);
  }

  .hiw__curve-fill {
    top: auto;
    bottom: 0;
    height: clamp(80px, 14vw, 120px);
  }

  .hiw__curve-wave {
    top: auto;
    bottom: 0;
    height: clamp(80px, 14vw, 120px);
  }

  .hiw__title {
    position: relative;
    top: auto;
    left: auto;
    max-width: none;
    padding: 48px var(--section-pad-x) 0;
    font-size: 48px;
    text-align: center;
  }

  /* Flow words inline again on tablet/mobile (centered, natural wrap) */
  .hiw__title-word {
    display: inline;
  }

  .hiw__product-wrap {
    position: relative;
    top: auto;
    left: auto;
    z-index: 2;
    width: min(96%, 560px);
    margin: 10px auto 0;
    isolation: isolate;
    transform: none;
  }

  .hiw__widget {
    width: 100%;
    height: auto;
    aspect-ratio: 1256 / 1660;
  }

  .hiw__widget-video {
    object-position: center top;
  }

  .product-card__body {
    justify-content: flex-start;
    min-height: auto;
  }

  .product-card {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
  }

  .hiw__steps {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    z-index: 1;
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 0 var(--section-pad-x) 64px;
    /* Pull the steps up into the transparent shadow-padding at the bottom of
       the widget video (which otherwise reads as dead space). Sized to stay
       within that transparent zone so it never overlaps the card. */
    margin-top: -7vw;
  }

  .hiw__steps > li {
    order: var(--step-order, 0);
  }

  .hiw-step {
    min-height: auto;
  }

  /* Mobile is single-column, so the desktop 340px desc cap is needlessly
     narrow and forces the copy into 4 lines. Widen it and balance the wrap so
     it settles into ~3 even lines. */
  .hiw-step__desc {
    max-width: 32em;
    text-wrap: balance;
  }

  .hiw-step:not(.hiw-step--active) {
    justify-content: flex-start;
  }
}

/* ========== MOBILE ≤460px ========== */

@media (max-width: 460px) {
  .hiw__title {
    padding-top: 40px;
    font-size: 32px;
  }

  .hiw__product-wrap {
    width: calc(100% - 24px);
    max-width: none;
  }

  .hiw__steps {
    padding-bottom: 48px;
  }

  .hiw-step__num {
    font-size: 56px;
  }

  .hiw-step:not(.hiw-step--active) .hiw-step__num {
    font-size: 32px;
  }

  .hiw-step:not(.hiw-step--active):hover .hiw-step__num {
    font-size: 44px;
  }

  .hiw-step__heading {
    font-size: 18px;
  }
}
