/*
  How It Works 14 — standalone HTML/CSS/JS implementation.
  No build step, no framework, no external dependency: copy these three
  files into any project and open index.html as-is.
*/

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --white: #ffffff;
  --slate-200: #e2e8f0;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-900: #0f172a;
  --blue-600: #2563eb;
  --font-sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--slate-900);
  background-color: var(--white);
  line-height: 1.5;
}

.hiw {
  padding: clamp(3rem, 2.5rem + 2vw, 5rem) clamp(1rem, 0.3rem + 3vw, 2rem);
}

.hiw__inner {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
}

.hiw__intro {
  max-width: 34rem;
  margin: 0 auto;
  text-align: center;
}

.hiw__heading {
  margin: 0;
  font-weight: 600;
  font-size: clamp(1.875rem, 1.5rem + 1.9vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.hiw__lede {
  margin: 0.75rem 0 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--slate-600);
}

.stepper {
  position: relative;
  margin-top: 3.5rem;
}

.stepper__track {
  position: absolute;
  left: 1.25rem;
  top: 1.25rem;
  bottom: 1.25rem;
  width: 2px;
  background-color: var(--slate-200);
}

.stepper__track-fill {
  position: absolute;
  left: 1.25rem;
  top: 1.25rem;
  width: 2px;
  height: var(--progress, 0%);
  background-color: var(--blue-600);
}

.stepper__list {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.step__dot {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background-color: var(--slate-200);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--slate-500);
}

.step__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.step__text {
  margin: 0.25rem 0 0;
  max-width: 20rem;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--slate-600);
}

@media (min-width: 640px) {
  .stepper__track {
    left: 1.25rem;
    right: 1.25rem;
    top: 1.25rem;
    bottom: auto;
    width: auto;
    height: 2px;
  }

  .stepper__track-fill {
    left: 1.25rem;
    top: 1.25rem;
    width: var(--progress, 0%);
    height: 2px;
  }

  .stepper__list {
    flex-direction: row;
    justify-content: space-between;
    gap: 1rem;
  }

  .step {
    flex: 1;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .step__title {
    margin-top: 0.25rem;
    font-size: 1rem;
  }

  .step__text {
    margin: 0.25rem auto 0;
    font-size: 0.875rem;
  }
}

/* Active-state logic — script.js toggles .is-active on each dot and sets
   --progress on the fill track as the visitor scrolls each step into
   view. Reduced motion keeps the same state changes but drops the eased
   transition below, so updates happen instantly. */
.step__dot.is-active {
  background-color: var(--blue-600);
  color: var(--white);
}

@media (prefers-reduced-motion: no-preference) {
  .stepper__track-fill {
    transition: height 500ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .step__dot {
    transition:
      background-color 400ms ease,
      color 400ms ease,
      transform 400ms cubic-bezier(0.34, 1.35, 0.64, 1);
  }

  .step__dot.is-active {
    transform: scale(1.08);
  }
}

@media (min-width: 640px) and (prefers-reduced-motion: no-preference) {
  .stepper__track-fill {
    transition: width 500ms cubic-bezier(0.16, 1, 0.3, 1);
  }
}
