/* ==========================================================
   "How it works" redesign — all classes prefixed hiw-
   Only uses colour tokens from styles.css.
   ========================================================== */

/* Heading on the left, calculator button on the right (wraps below on small screens) */
.hiw-head {
  margin-bottom: var(--sp-6);
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: var(--sp-4); flex-wrap: wrap;
}
.hiw-head p { margin-bottom: 0; }
/* Calculator teaser card next to the heading: no extra top margin here */
.hiw-head .calc-teaser { margin-top: 0; }

/* The list: 4 equal columns on desktop. position:relative so the track can sit inside. */
.hiw-steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-5);
  position: relative;
}

/* The horizontal track: a line behind the number circles,
   from the centre of column 1 to the centre of column 4 (12.5% in from each side). */
.hiw-steps::before {
  content: ""; position: absolute;
  top: 20px; height: 3px; border-radius: 2px;
  left: 12.5%; right: 12.5%;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand) 70%, var(--gold) 100%);
  opacity: .4;
}

.hiw-step { position: relative; display: flex; flex-direction: column; align-items: center; }

/* Numbered circle sitting on the track */
.hiw-num {
  position: relative; z-index: 1;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink);
  font-weight: 800;
  border: 4px solid var(--bg);   /* page-coloured ring makes the line look "cut" around the circle */
  margin-bottom: var(--sp-4);
}
.hiw-step-final .hiw-num { background: var(--gold); }

.hiw-card { width: 100%; flex: 1; text-align: center; }
.hiw-card h3 { font-size: var(--fs-md); margin-bottom: var(--sp-2); }
.hiw-card p { margin-bottom: 0; }

/* Icon inside a soft brand-coloured circle */
.hiw-icon {
  display: inline-grid; place-items: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  margin-bottom: var(--sp-3);
}

/* Step 4 = the climax: gold border, slightly bigger, stronger shadow */
.hiw-step-final .hiw-card {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft), 0 8px 28px rgba(0,0,0,.10);
  transform: scale(1.04);
}
.hiw-step-final .hiw-icon { background: var(--gold-soft); color: var(--gold); }

/* The two chips: colours come from .pill-prize (gold) and .pill-pay (green) in styles.css */
.hiw-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; margin-top: var(--sp-4); }
.hiw-chip { padding: 4px 12px; font-size: var(--fs-xs); }

/* ---------- Reveal animation ----------
   JS adds .hiw-js (only if motion is allowed), so without JS everything stays visible.
   Each step has --i (0..3) set by JS, which staggers the delay. */
.hiw-js .hiw-step { opacity: 0; transform: translateY(18px); transition: opacity .5s ease, transform .5s ease; }
.hiw-js .hiw-step.hiw-shown { opacity: 1; transform: none; transition-delay: calc(var(--i) * 120ms); }

/* ---------- Mobile: vertical timeline ---------- */
@media (max-width: 760px) {
  .hiw-steps { grid-template-columns: 1fr; gap: var(--sp-5); }
  /* vertical line through the circles' centre (circle is 42px wide, so centre is ~21px) */
  .hiw-steps::before {
    top: 20px; bottom: 20px; left: 19px; right: auto; width: 3px; height: auto;
    background: linear-gradient(180deg, var(--brand) 0%, var(--brand) 70%, var(--gold) 100%);
  }
  .hiw-step { flex-direction: row; align-items: flex-start; gap: var(--sp-4); }
  .hiw-num { margin-bottom: 0; flex: none; }
  .hiw-card { text-align: left; }
  .hiw-chips { justify-content: flex-start; }
  .hiw-step-final .hiw-card { transform: none; }
}

/* ---------- Reduced motion: show everything instantly ---------- */
@media (prefers-reduced-motion: reduce) {
  .hiw-js .hiw-step { opacity: 1; transform: none; transition: none; }
}
