/*
 * "How It Works" — the step-by-step on treatment pages.
 *
 * The theme's own `initScrollSteps` (main.js) drives this, and it is alive in
 * the mirror — there is no GSAP here, contrary to an earlier reading. It
 * implements the section as a scroll hijack: pin `.steps-trigger-wrapper`,
 * translate the step list inside a fixed-height window, and move an
 * `.is-active` class along one step and one image at a time.
 *
 * The pin never engages, because that wrapper holds some 6,300px of page
 * rather than this section alone, and a sticky element taller than the
 * viewport never sticks. So the list is translated inside a window that
 * nothing is holding still, which is what Mari reported as "part of the image
 * and part of the header get cut off":
 *
 *   - `.single-treatment__how-steps-wrapper` is `height: 300px` (200px on
 *     mobile) with `overflow: hidden`, and each step is a fixed 250px/150px.
 *     Three steps cannot fit, so the rest sit outside the window.
 *   - every step is `opacity: 0` until it gets `.is-active`, and so is every
 *     image after the first — so steps two onward were invisible as well as
 *     clipped.
 *
 * `src/lib/steps.mjs` stops that scroller before it runs. Rebuilt without the
 * pin: the steps run at their natural height and all
 * stand in the page at once, while the image column sticks alongside and
 * swaps as each step comes up. Page scrolling stays the page's own.
 *
 * Every override here repeats the `.single-treatment__how` ancestor. Live's
 * own rules are two classes deep, so a single-class rule loses on specificity
 * no matter how late it loads — which is exactly what happened on the first
 * attempt at this file.
 */

/* The clipping: both the window and the fixed step heights. */
.single-treatment__how .single-treatment__how-inner { overflow: visible; }
.single-treatment__how .single-treatment__how-steps-wrapper {
  height: auto;
  overflow: visible;
  align-items: stretch;
}
.single-treatment__how .single-treatment__how-steps { height: auto; }

/* Every step is readable now, not just the one the dropped script lit up. */
.single-treatment__how .single-treatment__how-steps .single-treatment__how-step {
  height: auto;
  opacity: 1;
  padding: 18px 0;
}

/*
 * The images column is a flex item; the default `stretch` would make it as
 * tall as the whole step list and leave sticky nothing to travel over.
 *
 * Opaque and raised, because once pinned it overlaps the steps passing behind
 * it on narrow screens. White is what this section resolves to (from body).
 */
.single-treatment__how .single-treatment__how-images {
  position: sticky;
  top: calc(var(--header-h, 137px) + 24px);
  align-self: flex-start;
  z-index: 1;
  background: #fff;
}

/*
 * Live gives the first image `opacity: 1` via `:first-child`, which outranks
 * its own `img { opacity: 0 }`. Without this the first image would stay lit
 * under whichever image is current. Same specificity as that rule, loaded
 * later, so it wins.
 */
.single-treatment__how .single-treatment__how-images img:not(.is-active) { opacity: 0; }
.single-treatment__how .single-treatment__how-images img { transition: opacity 400ms ease; }

@media (prefers-reduced-motion: reduce) {
  .single-treatment__how .single-treatment__how-images img { transition: none; }
}
