/* ==========================================================================
   How it works (hx). Scoped under .how. Uses site.css tokens only.
   Modes:
   - default / no JS / reduced motion: calm stacked list, each step
     followed by its vignette card. Phones: step cards (deck with motion).
   - .how.hx-pinned (set by js/how.js on wide, tall screens with motion):
     sticky stage, steps on the left, one vignette at a time on the right.
   Animations use transform and opacity only.
   ========================================================================== */

.how { --hx-ease: var(--ease-out); --hx-row: 52px; }
.how .hx-head { margin-bottom: clamp(40px, 5vw, 72px); }

/* ---------- Stacked layout (base) ---------- */
.how .hx-stage { display: none; }
.how .hx-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(56px, 8vw, 96px); }
.how .hx-step { display: grid; gap: 22px; }

.how .hx-text {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 16px; align-content: start;
}
.how .hx-num {
  grid-row: 1 / span 2; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 750; letter-spacing: .02em; font-variant-numeric: tabular-nums;
  color: #fff; background: var(--primary);
}
.how .hx-text h3 { font-size: clamp(21px, .5vw + 18px, 24px); line-height: 1.2; font-weight: 720; letter-spacing: -.02em; margin-top: 4px; }
.how .hx-text p { margin: 8px 0 0; color: var(--text-2); font-size: 16.5px; line-height: 1.55; max-width: 44ch; }

/* ---------- Vignette card ---------- */
.how .hx-scene {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-md);
  color: var(--text);
}
.how .hx-bar {
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 16px;
  border-bottom: 1px solid var(--border); background: var(--card-2);
  font-size: 12.5px; font-weight: 650; color: var(--text-3); white-space: nowrap;
}
.how .hx-bar > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.how .hx-dots { display: inline-flex; gap: 6px; flex: none; }
.how .hx-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); }
.how .hx-body { position: relative; padding: 18px; min-height: 300px; display: grid; align-content: start; gap: 14px; }

.how .hx-ic { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* rows (shared) */
.how .hx-list { display: grid; gap: 8px; }
.how .hx-row {
  display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 12px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--card);
}
.how .hx-row .ml-av { width: 30px; height: 30px; font-size: 11px; }
.how .hx-name { flex: 1; min-width: 0; display: grid; gap: 6px; font-size: 13.5px; font-weight: 650; line-height: 1.2; }
.how .hx-name small { font-size: 11.5px; font-weight: 550; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.how .hx-skel { display: block; height: 6px; width: var(--w, 60%); border-radius: 4px; background: var(--border); }
.how .hx-top { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }

/* 1 · Collect */
.how .hx-srcs { display: flex; flex-wrap: wrap; gap: 8px; }
.how .hx-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--card-2);
  font-size: 12.5px; font-weight: 650; color: var(--text-2);
}
.how .hx-chip .hx-ic { color: var(--primary-text); }
.how .hx-tag {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--card-2); color: var(--text-3);
}

/* 2 · Rank */
.how .hx-pos { width: 18px; flex: none; font-size: 12.5px; font-weight: 750; color: var(--text-3); font-variant-numeric: tabular-nums; }
.how .hx-top .hx-pos { color: var(--primary-text); }
.how .hx-meter { width: 34%; flex: none; height: 6px; border-radius: 4px; background: var(--border); overflow: hidden; }
.how .hx-meter b { display: block; height: 100%; border-radius: inherit; background: var(--primary); transform-origin: 0 50%; transform: scaleX(var(--s, .5)); }
.how .hx-row:not(.hx-top) .hx-meter b { background: color-mix(in srgb, var(--primary) 45%, var(--border-strong)); }
.how .hx-reasons { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px 4px 42px; }
.how .hx-reasons span {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px;
  border-radius: 999px; background: var(--card-2); border: 1px solid var(--border);
  font-size: 11.5px; font-weight: 650; color: var(--text-2);
}
.how .hx-reasons .hx-ic { width: 12px; height: 12px; color: var(--ok); stroke-width: 2.6; }

/* 3 · Interview */
.how .hx-s3 .hx-body { background: color-mix(in srgb, var(--wa-out) 12%, var(--card)); }
.how .hx-langs { display: inline-flex; justify-self: start; padding: 3px; gap: 2px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); }
.how .hx-langs span { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 650; color: var(--text-3); }
.how .hx-langs .is-on { background: var(--primary-soft); color: var(--primary-text); }
.how .hx-chat { display: grid; gap: 8px; }
.how .hx-msg {
  margin: 0; max-width: 78%; padding: 8px 12px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.45; color: var(--wa-text); box-shadow: 0 1px .5px rgba(11, 20, 26, .13);
}
.how .hx-msg[lang="ar"] { font-family: var(--font-ar); font-size: 14.5px; }
.how .hx-msg.in { justify-self: start; background: var(--wa-in); border-top-left-radius: 4px; }
.how .hx-msg.out { justify-self: end; background: var(--wa-out); border-top-right-radius: 4px; }
.how .hx-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.how .hx-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--wa-meta); opacity: .5; }
.how .hx-note {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: 999px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  font-size: 12.5px; font-weight: 700; color: var(--primary-text);
}

/* 4 · Schedule */
.how .hx-cal { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.how .hx-day { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--text-3); padding-bottom: 2px; }
.how .hx-slot {
  position: relative; height: 34px; border-radius: 9px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--card);
  font-size: 12px; font-weight: 650; color: var(--text-2); font-variant-numeric: tabular-nums;
}
.how .hx-slot.is-off { border-style: dashed; background: transparent; }
.how .hx-pick { overflow: hidden; }
.how .hx-pick::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; background: var(--primary);
  transition: opacity 400ms var(--hx-ease), transform 500ms var(--ease-spring);
  transition-delay: calc(var(--d, 0) * 80ms + 650ms);
}
.how .hx-pick::after { content: "10:30"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 750; }
.how .hx-pick { color: transparent; }
.how .hx-confirm {
  display: flex; align-items: center; gap: 12px; padding: 12px; margin-top: 4px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--card); box-shadow: var(--shadow-sm);
}
.how .hx-cic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.how .hx-cic .hx-ic { width: 17px; height: 17px; }
.how .hx-cmeta { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 13.5px; }
.how .hx-cmeta small { font-size: 12px; color: var(--text-3); font-weight: 550; }
.how .hx-ok {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px;
  background: var(--ok-bg); color: var(--ok); font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.how .hx-ok .hx-ic { width: 12px; height: 12px; stroke-width: 2.6; }

/* 5 · Decide */
.how .hx-s5 .hx-row { height: 58px; }
.how .hx-act { position: relative; flex: none; display: grid; }
.how .hx-act > * { grid-area: 1 / 1; }
.how .hx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 30px; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--border-strong); background: var(--card);
  font-size: 12px; font-weight: 700; color: var(--text-2); white-space: nowrap;
}
.how .hx-go { background: var(--primary); border-color: var(--primary); color: #fff; }
.how .hx-done { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.how .hx-done .hx-ic { width: 12px; height: 12px; stroke-width: 2.6; }
.how .hx-go { opacity: 0; }
.how .hx-foot { display: flex; align-items: center; gap: 10px; margin-top: 4px; font-size: 12.5px; font-weight: 650; color: var(--text-3); }
.how .hx-team { display: inline-flex; }
.how .hx-team .ml-av { width: 24px; height: 24px; font-size: 9.5px; box-shadow: 0 0 0 2px var(--card); }
.how .hx-team .ml-av + .ml-av { margin-left: -6px; }

/* ---------- Entrance states (only when JS runs) ---------- */
.how .hx-a {
  transition: opacity 600ms var(--hx-ease), transform 800ms var(--hx-ease);
  transition-delay: calc(var(--d, 0) * 80ms + 120ms);
}
.how.hx-js .hx-scene:not(.is-on) .hx-a { opacity: 0; transform: translate3d(0, 10px, 0); transition-duration: 250ms; transition-delay: 0ms; }
.how.hx-js .hx-scene:not(.is-on) .hx-drop { transform: translate3d(0, -14px, 0); }
.how.hx-js .hx-scene:not(.is-on) .hx-move { opacity: .35; transform: translate3d(0, calc(var(--from, 0) * (var(--hx-row) + 8px)), 0); }
.how.hx-js .hx-scene:not(.is-on) .hx-meter b { opacity: 1; transform: scaleX(0); }
.how.hx-js .hx-scene:not(.is-on) .hx-pick::before { opacity: 0; transform: scale(.6); transition-delay: 0ms; }
.how.hx-js .hx-scene:not(.is-on) .hx-pick { color: var(--text-2); }
.how.hx-js .hx-scene:not(.is-on) .hx-pick::after { opacity: 0; }
.how .hx-pick::after { transition: opacity 300ms var(--hx-ease) calc(var(--d, 0) * 80ms + 650ms); }
.how.hx-js .hx-scene:not(.is-on) .hx-go { opacity: 1; transition-delay: 0ms; }
.how .hx-go { transition: opacity 300ms var(--hx-ease) calc(5 * 80ms + 120ms); }
.how.hx-js .hx-scene:not(.is-on) .hx-done { transform: scale(.9); }
.how .hx-meter b { transition-duration: 900ms; }

@media (prefers-reduced-motion: no-preference) {
  .how .hx-scene.is-on .hx-typing i { animation: hx-dot 1.2s var(--ease) infinite; animation-delay: 1.1s; }
  .how .hx-scene.is-on .hx-typing i:nth-child(2) { animation-delay: 1.25s; }
  .how .hx-scene.is-on .hx-typing i:nth-child(3) { animation-delay: 1.4s; }
}
@keyframes hx-dot { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: .9; transform: translate3d(0, -2px, 0); } }

/* ---------- Stacked, wider screens: two columns per step ---------- */
@media (min-width: 900px) {
  .how .hx-step { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(40px, 6vw, 96px); align-items: center; }
  .how .hx-text h3 { font-size: 26px; }
}
@media (max-width: 520px) {
  .how .hx-body { padding: 14px; min-height: 0; }
  .how .hx-pos { font-size: .8125rem; }
  .how .hx-meter { width: 28%; }
  .how .hx-reasons { padding-left: 4px; }
  .how .hx-msg { max-width: 88%; }
  .how .hx-slot { font-size: 11px; }
  .how .hx-cal { gap: 5px; }
  .how .hx-confirm { flex-wrap: wrap; }
  .how .hx-btn { padding: 0 9px; font-size: 11.5px; }
}

/* ==========================================================================
   Phones (below 768px): white step cards on the grey band (MOBILE_DESIGN.md v3,
   section 7). With motion, js/how.js runs the 'deck' mode: the cards stick and
   stack under a sticky 1-5 step rail, and each scene plays once when its card
   arrives. Reduced motion ('still'), large text ('.hx-flat') and no JS: the
   same cards in a plain column, joined by a short connector.
   ========================================================================== */
@media (max-width: 767px) {
  .how .hx-head { margin-bottom: 24px; }
  .how { --hx-row: 36px; }
  .how .hx-grid { display: block; }
  .how .hx-steps { display: block; }
  .how .hx-step {
    position: relative; display: flex; flex-direction: column;
    padding: 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card);
    box-shadow: var(--shadow-md);
  }
  .how .hx-step + .hx-step { margin-top: 16px; }
  .how .hx-text { display: grid; grid-template-columns: 32px minmax(0, 1fr); column-gap: 12px; }
  .how .hx-num { grid-row: 1; width: 32px; height: 32px; font-size: .8125rem; }
  .how .hx-text h3 { grid-column: 2; grid-row: 1; align-self: center; margin: 0; font-size: 1.25rem; line-height: 1.25; font-weight: 700; }
  .how .hx-text p { grid-column: 1 / -1; margin: 8px 0 0; max-width: none; font-size: 1rem; line-height: 1.5; }
  .how .hx-scene {
    flex: 1 1 auto; margin-top: 12px; border: 0; box-shadow: none; border-radius: var(--r-in, 12px);
    background: var(--card-2); /* one nesting level less */
  }
  .how .hx-bar { height: 32px; padding: 0 12px; font-size: .8125rem; background: transparent; border-bottom: 0; }
  .how .hx-bar .hx-dots { display: none; }
  .how .hx-body { min-height: 0; height: auto; padding: 0 12px 12px; gap: 10px; align-content: start; grid-template-columns: minmax(0, 1fr); }
  .how .hx-s3 .hx-body { background: none; }
  .how .hx-typing { display: none; } /* a looping indicator, not a message */

  /* rows: no borders inside the scene (P4) */
  .how .hx-list { grid-template-columns: minmax(0, 1fr); }
  .how .hx-row { height: 36px; gap: 10px; padding: 0 10px; min-width: 0; border-color: transparent; }
  .how .hx-row .ml-av { width: 24px; height: 24px; font-size: .75rem; }
  .how .hx-name { font-size: .875rem; }
  .how .hx-name small { font-size: .8125rem; }
  /* 1 · Collect */
  .how .hx-srcs { flex-wrap: wrap; gap: 6px; }
  .how .hx-chip { height: 30px; font-size: .8125rem; border-color: transparent; background: var(--card); }
  /* 2 · Rank */
  .how .hx-meter { width: 28%; }
  .how .hx-reasons { padding: 0; }
  .how .hx-reasons span { height: 26px; font-size: .8125rem; border-color: transparent; background: var(--card); }
  /* 3 · Interview */
  .how .hx-langs span { font-size: .8125rem; }
  .how .hx-msg { max-width: 88%; font-size: .8125rem; }
  .how .hx-msg[lang="ar"] { font-size: .875rem; }
  .how .hx-note { font-size: .8125rem; border-color: transparent; box-shadow: none; }
  /* 4 · Schedule */
  .how .hx-cal { gap: 6px; }
  .how .hx-slot { height: 32px; font-size: .8125rem; }
  .how .hx-day { font-size: .8125rem; }
  /* step 4 confirmation (W1): icon across two rows, time and room one line each, the pill under them */
  .how .hx-confirm {
    display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 10px; row-gap: 6px;
    align-items: center; padding: 10px 12px; margin-top: 0; box-shadow: none; border-color: transparent;
  }
  .how .hx-cic { grid-row: 1 / span 2; }
  .how .hx-cmeta { grid-column: 2; font-size: .875rem; overflow-wrap: anywhere; }
  .how .hx-cmeta small { font-size: .8125rem; }
  .how .hx-ok { grid-column: 2; justify-self: start; margin-left: 0; font-size: .8125rem; }
  /* 5 · Decide (W5): name and action on row 1, the status line on row 2 */
  .how .hx-s5 .hx-row {
    display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; column-gap: 10px; row-gap: 2px;
    height: auto; min-height: 56px; padding: 8px 10px; align-items: center;
  }
  .how .hx-s5 .hx-row .ml-av { width: 28px; height: 28px; grid-column: 1; grid-row: 1 / span 2; }
  .how .hx-s5 .hx-name { display: contents; } /* the name text fills row 1, column 2 */
  .how .hx-s5 .hx-name small { grid-column: 2 / -1; grid-row: 2; white-space: nowrap; }
  .how .hx-s5 .hx-act { grid-column: 3; grid-row: 1; }
  .how .hx-btn { height: 28px; padding: 0 10px; font-size: .8125rem; }
  .how .hx-team .ml-av { width: 28px; height: 28px; font-size: .75rem; box-shadow: none; }
  .how .hx-team .ml-av + .ml-av { margin-left: 4px; }
  .how .hx-foot { margin-top: 0; font-size: .8125rem; }

  /* plain column ('still', '.hx-flat', no JS): a 2px connector in the gap joins badge to badge */
  .how:not(.hx-deck) .hx-step:not(:last-child)::before,
  .how.hx-flat .hx-step:not(:last-child)::before {
    content: ""; position: absolute; left: 31px; top: 100%; height: 16px; width: 2px;
    background: color-mix(in srgb, var(--primary) 30%, var(--border));
  }

  /* ---------- the deck (motion allowed): sticky step rail + scroll-stacking cards ---------- */
  .how.hx-deck:not(.hx-flat) .hx-stage {
    display: block; position: sticky; top: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + 8px);
    z-index: 7; height: 40px; margin-bottom: 8px;
  }
  .how.hx-deck .hx-glow, .how.hx-deck .hx-plate > .hx-dots { display: none; }
  /* equal-height cards: the spare height splits above and below the scene's content (P9) */
  .how.hx-deck:not(.hx-flat) .hx-scene { display: flex; flex-direction: column; }
  .how.hx-deck:not(.hx-flat) .hx-body { flex: 1 1 auto; align-content: center; }
  .how.hx-deck .hx-plate {
    display: flex; align-items: center; height: 40px; padding: 0 12px; border-radius: 999px;
    background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  }
  .how.hx-deck .hx-segs { position: relative; isolation: isolate; flex: 1; display: flex; justify-content: space-between; counter-reset: hxs; }
  .how.hx-deck .hx-segs::before, .how.hx-deck .hx-segs::after {
    content: ""; position: absolute; left: 12px; right: 12px; top: 11px;
    height: 2px; border-radius: 2px; background: var(--border-strong); z-index: -1;
  }
  .how.hx-deck .hx-segs::after {
    background: var(--primary); transform-origin: 0 50%; transform: scaleX(var(--hx-p, 0));
    transition: transform var(--m-slow) var(--ease-ios);
  }
  .how.hx-deck .hx-segs i {
    counter-increment: hxs; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
    background: var(--card); border: 2px solid var(--border-strong); color: var(--text-3); font-size: .8125rem; font-weight: 750;
    font-style: normal; line-height: 1;
    transition: background-color var(--m) var(--ease-ios), border-color var(--m) var(--ease-ios), color var(--m) var(--ease-ios);
  }
  .how.hx-deck .hx-segs i::before { content: counter(hxs); }
  .how.hx-deck .hx-segs i b { display: none; }
  .how.hx-deck .hx-segs i.is-past { border-color: var(--primary); color: var(--primary-text); }
  .how.hx-deck .hx-segs i.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
  :root.is-dark .how.hx-deck .hx-segs i.is-on { color: #0B1220; background: var(--primary-text); border-color: var(--primary-text); }

  .how.hx-deck:not(.hx-flat) .hx-step {
    position: sticky; top: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + 56px + var(--k) * 8px);
    z-index: calc(var(--k) + 1); height: var(--hx-h, auto);
    transform-origin: 50% 0; transform: scale(calc(1 - .04 * var(--cover, 0)));
  }
  .how.hx-deck .hx-step:nth-child(1) { --k: 0; }
  .how.hx-deck .hx-step:nth-child(2) { --k: 1; }
  .how.hx-deck .hx-step:nth-child(3) { --k: 2; }
  .how.hx-deck .hx-step:nth-child(4) { --k: 3; }
  .how.hx-deck .hx-step:nth-child(5) { --k: 4; }
  .how.hx-deck:not(.hx-flat) .hx-step::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: var(--bg-2); opacity: calc(.55 * var(--cover, 0));
  }
  :root.is-dark .how.hx-deck:not(.hx-flat) .hx-step::after { background: color-mix(in srgb, var(--card) 62%, var(--bg)); }
}
@media (max-width: 374px) {
  .how .hx-step { padding: 14px; }
  /* narrow phones: a little less air inside the scenes, so the deck fits a 640px-tall screen */
  .how .hx-scene { margin-top: 10px; }
  .how .hx-text p { margin-top: 6px; }
  .how .hx-body { gap: 8px; padding: 0 10px 10px; }
  .how .hx-chat { gap: 6px; }
  .how .hx-msg { padding: 6px 10px; }
  .how:not(.hx-deck) .hx-step:not(:last-child)::before, .how.hx-flat .hx-step:not(:last-child)::before { left: 29px; }
}

/* ==========================================================================
   Pinned mode (desktop, motion allowed). Class set by js/how.js.
   ========================================================================== */
.how.hx-pinned { --hx-seg: 62vh; --hx-pin-h: calc(100vh - var(--nav-h, 72px)); }
.how.hx-pinned .hx-track { height: calc(var(--hx-pin-h) + 5 * var(--hx-seg)); }
.how.hx-pinned .hx-pin {
  position: sticky; top: var(--nav-h, 72px); height: var(--hx-pin-h);
  display: flex; align-items: center;
}
.how.hx-pinned .hx-pin > .container { width: 100%; }
.how.hx-pinned .hx-grid {
  --hx-sw: 56%; --hx-sh: min(480px, calc(var(--hx-pin-h) - 64px));
  position: relative; display: grid; align-items: center;
  grid-template-columns: minmax(0, 1fr) var(--hx-sw); column-gap: clamp(48px, 6vw, 104px);
  min-height: var(--hx-sh);
}
.how.hx-pinned .hx-steps { grid-column: 1; grid-row: 1; gap: 26px; align-content: center; }
.how.hx-pinned .hx-step { display: block; cursor: pointer; }
.how.hx-pinned .hx-text { position: relative; }
.how.hx-pinned .hx-text h3 { font-size: 22px; margin-top: 5px; }
.how.hx-pinned .hx-text p { font-size: 15.5px; margin-top: 4px; }
.how.hx-pinned .hx-num { background: var(--card); color: var(--text-3); box-shadow: inset 0 0 0 1.5px var(--border-strong); position: relative; z-index: 1; }
.how.hx-pinned .hx-num::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--primary); z-index: -1;
  opacity: 0; transform: scale(.4); transition: opacity 350ms var(--ease), transform 500ms var(--ease-spring);
}
.how.hx-pinned .hx-step.is-past .hx-num { color: var(--primary-text); box-shadow: inset 0 0 0 1.5px var(--primary); }
.how.hx-pinned .hx-step.is-on .hx-num { color: #fff; box-shadow: none; }
.how.hx-pinned .hx-step.is-on .hx-num::before { opacity: 1; transform: none; }
/* connector line from this number to the next */
.how.hx-pinned .hx-step:not(:last-child) .hx-text::before,
.how.hx-pinned .hx-step:not(:last-child) .hx-text::after {
  content: ""; position: absolute; left: 16px; top: 40px; width: 2px; height: calc(100% - 46px + 26px);
  border-radius: 2px; background: var(--border);
}
.how.hx-pinned .hx-step:not(:last-child) .hx-text::after {
  background: var(--primary); transform-origin: 50% 0; transform: scaleY(var(--hx-f, 0)); will-change: transform;
}
/* dim the words of inactive steps, not the number or connector */
.how.hx-pinned .hx-text > * { transition: opacity 450ms var(--ease); }
.how.hx-pinned .hx-step:not(.is-on) .hx-text > h3,
.how.hx-pinned .hx-step:not(.is-on) .hx-text > p { opacity: .42; }
.how.hx-pinned .hx-step:not(.is-on):hover .hx-text > h3,
.how.hx-pinned .hx-step:not(.is-on):hover .hx-text > p { opacity: .72; }

/* stage */
.how.hx-pinned .hx-stage { display: block; grid-column: 2; grid-row: 1; position: relative; height: var(--hx-sh); }
.how.hx-pinned .hx-glow {
  position: absolute; inset: -16% -12% -18% -14%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(closest-side at 80% 24%, color-mix(in srgb, var(--accent) 20%, transparent), transparent),
    radial-gradient(closest-side at 20% 80%, color-mix(in srgb, var(--primary) 16%, transparent), transparent);
  transform: translate3d(0, var(--hx-gy, 0px), 0); will-change: transform;
}
.how.hx-pinned .hx-plate {
  position: absolute; inset: 0; z-index: 1; border-radius: var(--r-xl);
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; align-items: flex-start; justify-content: space-between;
}
.how.hx-pinned .hx-plate::before {
  content: ""; position: absolute; left: 0; right: 0; top: 48px; height: 1px; background: var(--border);
}
.how.hx-pinned .hx-plate > .hx-dots { margin: 19px 0 0 20px; }
.how.hx-pinned .hx-segs { display: flex; gap: 5px; margin: 21px 20px 0 0; }
.how.hx-pinned .hx-segs i { width: 22px; height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.how.hx-pinned .hx-segs b { display: block; height: 100%; background: var(--primary); transform-origin: 0 50%; transform: scaleX(var(--hx-f, 0)); will-change: transform; }

/* scenes stack inside the plate */
.how.hx-pinned .hx-scene {
  position: absolute; z-index: 2; top: 50%; right: 0; width: var(--hx-sw); height: var(--hx-sh); margin-top: calc(var(--hx-sh) / -2);
  background: transparent; border: 0; box-shadow: none; border-radius: var(--r-xl);
  opacity: 0; visibility: hidden; transform: translate3d(0, 28px, 0) scale(.985);
  transition: opacity 450ms var(--ease), transform 700ms var(--hx-ease), visibility 0s linear 700ms;
  pointer-events: none;
}
.how.hx-pinned .hx-scene.is-past { transform: translate3d(0, -28px, 0) scale(.985); }
.how.hx-pinned .hx-scene.is-on {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity 550ms var(--ease) 120ms, transform 800ms var(--hx-ease) 60ms, visibility 0s;
}
.how.hx-pinned .hx-bar { height: 49px; padding: 0 140px 0 78px; background: transparent; border: 0; }
.how.hx-pinned .hx-bar .hx-dots { display: none; }
.how.hx-pinned .hx-body { padding: 24px 30px 30px; min-height: 0; height: calc(100% - 49px); gap: 16px; align-content: center; }
.how.hx-pinned .hx-row { height: 56px; }
.how.hx-pinned { --hx-row: 56px; }
.how.hx-pinned .hx-s5 .hx-row { height: 62px; }

/* set for one frame while switching modes, so nothing fades on setup */
.how.hx-instant *, .how.hx-instant *::before, .how.hx-instant *::after { transition: none !important; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .how *, .how *::before, .how *::after { transition: none !important; animation: none !important; }
}

/* keep the decorative glow from widening the page (clip keeps sticky working) */
.how { overflow-x: clip; }
