.steps {
  position: relative;
  row-gap: var(--grid-gap);
}

.step {
  --step-delay: 0.3s;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

.step:nth-child(2) {
  --step-delay: 1.5s;
}

.step:nth-child(3) {
  --step-delay: 2.7s;
}

.step:not(:last-child)::before,
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 21px;
  left: 50%;
  width: calc(100% + var(--grid-gap));
  height: 2px;
}

.step:not(:last-child)::before {
  background: var(--color-border-strong);
}

.step:not(:last-child)::after {
  background: linear-gradient(90deg, var(--color-accent) 0%, var(--color-action) 100%);
  transform-origin: left center;
}

.step__number {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  background: var(--color-action);
  color: var(--color-text-inverse);
  font-weight: 700;
  box-shadow: 0 0 0 6px var(--color-surface-plane), 0 10px 24px var(--iso-shadow);
}

.step__card {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-sm);
  align-self: stretch;
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
  padding-inline: var(--space-lg);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  background: var(--color-surface-card);
}

.step__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.step__icon {
  display: grid;
  place-items: center;
  width: var(--size-icon-box);
  height: var(--size-icon-box);
  border-radius: var(--radius-md);
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.step__time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-size: var(--text-small-size);
  font-weight: 600;
}

.step__time-icon {
  width: 14px;
  height: 14px;
}

.step__title {
  font-size: var(--text-h3-size);
  font-weight: var(--text-h3-weight);
  line-height: var(--text-h3-line);
  letter-spacing: var(--text-h3-tracking);
}

.step__text {
  color: var(--color-text-secondary);
  font-size: var(--text-small-size);
  line-height: var(--text-small-line);
}

.steps-total {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  margin-top: var(--space-2xl);
  color: var(--color-text-secondary);
  font-weight: 600;
  text-align: center;
}

.steps-total__icon {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--color-action);
}

.is-reveal-ready .steps.is-visible .step__number {
  animation: step-on 0.6s var(--ease-out) var(--step-delay) both;
}

.is-reveal-ready .steps.is-visible .step:not(:last-child)::after {
  animation: step-line 0.9s linear calc(var(--step-delay) + 0.3s) both;
}

.is-reveal-ready .steps.is-visible .step__card {
  animation: step-card 0.6s var(--ease-out) var(--step-delay) both;
}

.is-reveal-ready .steps + .steps-total {
  opacity: 0;
}

.is-reveal-ready .steps.is-visible + .steps-total {
  animation: steps-total 0.6s var(--ease-out) 3.4s both;
}

@keyframes step-on {
  0% {
    background: var(--color-surface-card);
    color: var(--color-text-muted);
    box-shadow: 0 0 0 6px var(--color-surface-plane);
  }

  55% {
    scale: 1.18;
  }

  100% {
    background: var(--color-action);
    color: var(--color-text-inverse);
    box-shadow: 0 0 0 6px var(--color-surface-plane), 0 0 0 12px var(--color-accent-soft), 0 10px 24px var(--iso-shadow);
    scale: 1;
  }
}

@keyframes step-line {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

@keyframes step-line-down {
  from {
    transform: scaleY(0);
  }

  to {
    transform: scaleY(1);
  }
}

@keyframes step-card {
  from {
    opacity: 0.2;
    translate: 0 14px;
  }

  to {
    opacity: 1;
    translate: none;
  }
}

@keyframes steps-total {
  from {
    opacity: 0;
    translate: 0 10px;
  }

  to {
    opacity: 1;
    translate: none;
  }
}

@media (max-width: 1024px) {
  .step {
    flex-direction: row;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .step:not(:last-child)::before,
  .step:not(:last-child)::after {
    top: 22px;
    left: 21px;
    width: 2px;
    height: calc(100% + var(--grid-gap));
  }

  .step:not(:last-child)::after {
    background: linear-gradient(180deg, var(--color-accent) 0%, var(--color-action) 100%);
    transform-origin: center top;
  }

  .is-reveal-ready .steps.is-visible .step:not(:last-child)::after {
    animation-name: step-line-down;
  }

  .step__number {
    flex: none;
  }
}
