/* "How it works" timeline on the Services page: centred steps on one track (desktop),
   2 x 2 cards (tablet), vertical timeline (phone). Animates in once when scrolled into view. */

.as-steps {
  --dot: 48px;
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}
/* the track runs from the centre of the first dot to the centre of the last one */
.as-steps::before,
.as-steps::after {
  content: "";
  position: absolute;
  top: calc(var(--dot) / 2 - 1px);
  left: 12.5%;
  right: 12.5%;
  height: 2px;
}
.as-steps::before {
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.28) 0 8px, transparent 8px 14px);
}
.as-steps::after {
  background: var(--as-accent);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 1.4s cubic-bezier(0.65, 0, 0.35, 1) 0.2s;
}
.as-steps.is-in::after {
  transform: scaleX(1);
}

.as-step {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: calc(var(--i) * 0.25s + 0.2s);
}
.as-steps.is-in .as-step {
  opacity: 1;
  transform: none;
}
.as-step-num {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  background: var(--as-accent);
  color: var(--as-navy);
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 0 0 7px var(--as-navy), 0 0 0 9px rgba(255, 184, 0, 0.35);
}
/* soft ring that pulses once as each step appears */
.as-step-num::after {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 2px solid var(--as-accent);
  opacity: 0;
}
.as-steps.is-in .as-step-num::after {
  animation: as-ring 1.2s ease-out calc(var(--i) * 0.25s + 0.4s) 1;
}
@keyframes as-ring {
  0% {
    opacity: 0.8;
    transform: scale(0.85);
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}
.as-step h3 {
  margin: 22px 0 8px;
  font-size: clamp(17px, 1.25vw, 20px);
  font-weight: 700;
  color: #fff;
}
.as-step p {
  margin: 0;
  max-width: 240px;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.72);
}
.as-step:hover .as-step-num {
  transform: translateY(-3px);
}
.as-step-num {
  transition: transform 0.25s ease;
}

/* headline + CTA centred to match the centred steps */
.as-journey-box .as-head {
  text-align: center;
}
.as-journey-box .as-head .as-eyebrow {
  justify-content: center;
}

/* tablet: 2 x 2 glass cards, no track */
@media (max-width: 991px) {
  .as-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
  .as-steps::before,
  .as-steps::after {
    display: none;
  }
  .as-step {
    padding: 24px 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  .as-step h3 {
    margin-top: 18px;
  }
}

/* phone: vertical timeline, dots on the left joined by a line that draws downwards */
@media (max-width: 575px) {
  .as-journey-box .as-head {
    text-align: left;
  }
  .as-journey-box .as-head .as-eyebrow {
    justify-content: flex-start;
  }
  .as-steps {
    --dot: 40px;
    grid-template-columns: 1fr;
    gap: 0;
  }
  .as-steps::before,
  .as-steps::after {
    display: block;
    top: 20px;
    bottom: 20px;
    left: calc(var(--dot) / 2 - 1px);
    right: auto;
    width: 2px;
    height: auto;
  }
  .as-steps::before {
    background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0 8px, transparent 8px 14px);
  }
  .as-steps::after {
    transform-origin: center top;
    transform: scaleY(0);
  }
  .as-steps.is-in::after {
    transform: scaleY(1);
  }
  .as-step {
    display: grid;
    grid-template-columns: var(--dot) 1fr;
    column-gap: 16px;
    align-items: start;
    text-align: left;
    padding: 0 0 26px;
    background: none;
    border: 0;
    border-radius: 0;
  }
  .as-step:last-child {
    padding-bottom: 0;
    background: var(--as-navy); /* hides the track below the last dot */
  }
  .as-step-num {
    grid-row: span 2;
    font-size: 16px;
  }
  .as-step h3 {
    margin: 8px 0 4px;
  }
  .as-step p {
    max-width: none;
  }
  .as-cta h3 {
    font-size: 21px;
  }
}

/* no motion for people who ask for less */
@media (prefers-reduced-motion: reduce) {
  .as-step,
  .as-steps::after {
    transition: none;
    opacity: 1;
    transform: none;
  }
  .as-steps.is-in .as-step-num::after {
    animation: none;
  }
}

/* tablet: centre the closing CTA under the centred steps */
@media (min-width: 576px) and (max-width: 991px) {
  .as-journey-box .as-cta {
    align-items: center;
    text-align: center;
  }
  .as-journey-box .as-cta-btns {
    justify-content: center;
  }
}
