/* ==========================================================================
   LP03 · UNIT 8 · HOW IT WORKS — rising staircase
   --------------------------------------------------------------------------
   Desktop (≥ 64rem): five steps climb toward inline-end. Each step = a card
   resting on a riser block; cards share one height (CSS subgrid) and each
   column is lifted by --i × --rise, while its riser grows by the same amount
   so every riser still stands on one common baseline. The title sits in the
   empty corner the low steps leave at inline-start.
   Below 64rem: the shared touch slider (autoplay · loop · dots · drag);
   small stepped risers keep the "rising" cue. No-JS mobile: a plain stack.
   how.js raises the risers in sequence, then drops the cards onto them.
   ========================================================================== */

.how {
  --rise: 2.75rem;
  --base: 1.25rem;
  background:
    radial-gradient(ellipse 50% 60% at 100% 0%, rgba(0, 169, 182, 0.1), transparent 70%),
    linear-gradient(180deg, var(--c-white) 0%, var(--c-cloud) 100%);
}

/* Faint rising diagonal light behind the stairs */
.how__decor::before {
  content: "";
  position: absolute;
  inset-inline: -10%;
  inset-block-end: 8%;
  block-size: 50%;
  background: linear-gradient(90deg, transparent, rgba(0, 169, 182, 0.08));
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
}

[dir="rtl"] .how__decor {
  scale: -1 1;
}

.how__head {
  display: grid;
  gap: var(--space-md);
  justify-items: center;
  text-align: center;
  margin-block-end: clamp(2rem, 5vw, 3rem);
}

@media (min-width: 64rem) {
  .how__head {
    position: relative;
    z-index: 1;
    max-inline-size: 38%;
    justify-items: start;
    text-align: start;
    margin-block-end: calc(var(--rise) * -2.6);   /* tuck into the stairs' empty corner */
  }
}

/* Small "climb" mark beside the title */
.how__mark {
  display: inline-grid;
  place-items: center;
  inline-size: 2.75rem;
  block-size: 2.75rem;
  border-radius: 12px;
  background-color: var(--c-navy);
  color: var(--c-teal);
  box-shadow: var(--shadow-md);
}

.how__mark svg {
  inline-size: 1.375rem;
  block-size: 1.375rem;
}

/* ---------------------------------------------------------------------------
   Steps — base (mobile stack / slider)
   --------------------------------------------------------------------------- */
.how__steps {
  --slide-size: 82%;
  display: grid;
  gap: var(--space-md);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 48rem) {
  .how__steps {
    --slide-size: 46%;
  }
}

.how__step {
  display: flex;
  flex-direction: column;
}

.how__card {
  position: relative;
  display: grid;
  gap: 0.75rem;
  align-content: start;
  flex: 1;
  padding: 1.25rem;
  border-radius: var(--r-card);
  border: 1px solid var(--c-ink-a10);
  background-color: var(--c-white);
  box-shadow: var(--shadow-md);
}

.how__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.how__icon {
  display: grid;
  place-items: center;
  inline-size: 2.75rem;
  block-size: 2.75rem;
  border-radius: 12px;
  background-color: rgba(0, 169, 182, 0.12);
  color: var(--c-deep-teal);
}

.how__icon svg {
  inline-size: 1.375rem;
  block-size: 1.375rem;
}

/* quiet step index (the copy's own 1–5) */
.how__num {
  font-family: var(--ff-display);
  font-size: var(--fs-caption);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--c-mist);
}

.how__card h3 {
  font-size: var(--fs-h3);
}

.how__card p {
  font-size: var(--fs-small);
  line-height: 1.55;
  color: var(--c-slate);
}

/* Last step (.how__step--top — a class, since slider clones change :last-child): the summit, navy card */
.how__step--top .how__card {
  border-color: transparent;
  background:
    radial-gradient(ellipse 90% 70% at 100% 0%, rgba(0, 169, 182, 0.3), transparent 70%),
    var(--c-navy);
  box-shadow: var(--shadow-lg);
}

.how__step--top .how__card h3 { color: var(--c-on-dark); }
.how__step--top .how__card p  { color: var(--c-on-dark-body); }
.how__step--top .how__num     { color: var(--c-teal); }

.how__step--top .how__icon {
  background-color: var(--c-teal);
  color: var(--c-navy);
}

/* Riser: a small stepped bar under each card (slider), full block (desktop) */
.how__riser {
  display: block;
  block-size: calc(0.375rem + var(--i) * 0.3rem);
  margin-block-start: 0.5rem;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--c-teal), var(--c-deep-teal));
  transform-origin: 50% 100%;
}

/* Slider mode: align the rising bars on one baseline */
[data-slider].is-slider .how__steps {
  align-items: stretch;
}

/* ---------------------------------------------------------------------------
   Desktop staircase
   --------------------------------------------------------------------------- */
@media (min-width: 64rem) {
  .how__steps {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: auto auto;
    column-gap: clamp(0.75rem, 1.4vw, 1.25rem);
    row-gap: 0;
    align-items: start;
    padding-block-start: calc(var(--rise) * 4);   /* room for the lift */
  }

  .how__step {
    display: grid;
    grid-row: span 2;
    grid-template-rows: subgrid;   /* every card shares one height */
    translate: 0 calc(var(--i) * var(--rise) * -1);
  }

  .how__riser {
    /* grows by exactly the lift → all risers stand on one baseline */
    block-size: calc(var(--base) + var(--i) * var(--rise));
    margin-block-start: 0;
    border-radius: 0 0 4px 4px;
    background:
      linear-gradient(180deg, rgba(0, 169, 182, 0.55), rgba(1, 62, 106, 0.18));
  }

  /* the ul keeps (4 × rise) of unused height below the baseline — reclaim it */
  .how__steps {
    margin-block-end: calc(var(--rise) * -4);
  }

  .how__card {
    border-end-start-radius: 0;
    border-end-end-radius: 0;
  }
}

/* ---------------------------------------------------------------------------
   Section CTA (→ hero form)
   --------------------------------------------------------------------------- */
.how__cta {
  margin-block-start: clamp(2rem, 5vw, 3rem);
  justify-content: center;
}
