/* Reversible milestone trial. Remove this stylesheet's link from both landing
   pages to restore the uninterrupted line and unfilled, stationary circles.
   The confetti markup stays hidden without this stylesheet. */

.steps.steps-timeline {
  --timeline-complete-bg: #845322;
  --timeline-complete-ink: var(--cream);
  --timeline-track-size: 6px;
  --timeline-line-duration: .7s;
}

.steps.steps-timeline > article {
  --timeline-circle-delay: 0s;
  --timeline-line-delay: .45s;
  --timeline-segment-end: calc(0px - var(--timeline-gap) - var(--timeline-marker-size) / 2);
}

.steps.steps-timeline > article:nth-child(2) {
  --timeline-circle-delay: 1.15s;
  --timeline-line-delay: 1.6s;
}

.steps.steps-timeline > article:nth-child(3) {
  --timeline-circle-delay: 2.3s;
  --timeline-line-delay: 2.75s;
}

/* Clip particles and the exit line horizontally, leaving the top edge visible. */
.how {
  overflow-x: clip;
}

.steps.steps-timeline > article::before,
.steps.steps-timeline > article::after {
  content: "";
  position: absolute;
  top: calc((var(--timeline-marker-size) - var(--timeline-track-size)) / 2);
  left: calc(var(--timeline-marker-size) / 2);
  right: var(--timeline-segment-end);
  width: auto;
  height: var(--timeline-track-size);
  margin: 0;
  border-radius: 999px;
  opacity: 1;
  transform: none;
  pointer-events: none;
}

/* The fill grows by its edge, preserving a round cap throughout the motion. */
.steps.steps-timeline > article::before {
  z-index: 1;
  background: var(--timeline-complete-bg);
}

.steps.steps-timeline > article::after {
  z-index: 0;
  background: #fff;
}

/* The completed state is also the static and reduced-motion fallback. */
.steps.steps-timeline > article .step-number {
  z-index: 2;
  border: 0;
  background-color: var(--timeline-complete-bg);
  border-color: var(--timeline-complete-bg);
  color: var(--timeline-complete-ink);
}

.timeline-confetti {
  display: none;
  position: absolute;
  top: calc(var(--timeline-marker-size) / 2);
  left: calc(var(--timeline-marker-size) / 2);
  z-index: 4;
  width: 0;
  height: 0;
  pointer-events: none;
}

.timeline-confetti > i {
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 10px;
  border-radius: 2px;
  background: var(--berry);
  opacity: 0;
}

.timeline-confetti > i:nth-child(4n + 2) { background: #d59b35; }
.timeline-confetti > i:nth-child(4n + 3) { background: #74974e; }
.timeline-confetti > i:nth-child(4n) { background: var(--art-icing); }
.timeline-confetti > i:nth-child(3n) { width: 7px; height: 7px; border-radius: 50%; }

/* Particle directions live here because the site blocks inline styles. */
.timeline-confetti > i:nth-child(1) { --confetti-x: -72px; --confetti-y: -12px; --confetti-spin: -130deg; }
.timeline-confetti > i:nth-child(2) { --confetti-x: -64px; --confetti-y: -42px; --confetti-spin: 90deg; }
.timeline-confetti > i:nth-child(3) { --confetti-x: -42px; --confetti-y: -72px; --confetti-spin: -80deg; }
.timeline-confetti > i:nth-child(4) { --confetti-x: -15px; --confetti-y: -86px; --confetti-spin: 150deg; }
.timeline-confetti > i:nth-child(5) { --confetti-x: 16px; --confetti-y: -90px; --confetti-spin: -160deg; }
.timeline-confetti > i:nth-child(6) { --confetti-x: 44px; --confetti-y: -74px; --confetti-spin: 110deg; }
.timeline-confetti > i:nth-child(7) { --confetti-x: 68px; --confetti-y: -42px; --confetti-spin: -100deg; }
.timeline-confetti > i:nth-child(8) { --confetti-x: 78px; --confetti-y: -10px; --confetti-spin: 170deg; }
.timeline-confetti > i:nth-child(9) { --confetti-x: 64px; --confetti-y: 26px; --confetti-spin: -120deg; }
.timeline-confetti > i:nth-child(10) { --confetti-x: 35px; --confetti-y: 44px; --confetti-spin: 100deg; }
.timeline-confetti > i:nth-child(11) { --confetti-x: -34px; --confetti-y: 44px; --confetti-spin: -170deg; }
.timeline-confetti > i:nth-child(12) { --confetti-x: -64px; --confetti-y: 24px; --confetti-spin: 140deg; }

@media (prefers-reduced-motion: no-preference) {
  .steps.steps-timeline.timeline-ready > article .step-number {
    background-color: #fff;
    border-color: transparent;
    color: var(--timeline-complete-bg);
  }

  .steps.steps-timeline.timeline-ready.timeline-drawn > article .step-number {
    transform-origin: center;
    animation: timeline-milestone-complete .45s ease-in-out var(--timeline-circle-delay) 1 both;
  }

  .steps.steps-timeline.timeline-ready > article::before {
    right: calc(100% - var(--timeline-marker-size) / 2);
    transform: none;
    transition: none;
  }

  .steps.steps-timeline.timeline-ready.timeline-drawn > article::before {
    right: var(--timeline-segment-end);
    transform: none;
    transition: none;
    animation: timeline-track-fill var(--timeline-line-duration) linear var(--timeline-line-delay) 1 both;
  }

  @keyframes timeline-track-fill {
    from { right: calc(100% - var(--timeline-marker-size) / 2); }
    to { right: var(--timeline-segment-end); }
  }

  @keyframes timeline-track-fill-vertical {
    from { bottom: calc(100% - var(--timeline-marker-size) / 2); }
    to { bottom: var(--timeline-segment-end); }
  }

  /* The hidden attribute provides a no-style fallback for this decoration. */
  .steps.steps-timeline.timeline-ready.timeline-drawn .timeline-confetti[hidden] {
    display: block;
  }

  .steps.steps-timeline.timeline-ready.timeline-drawn .timeline-confetti > i {
    animation: timeline-confetti-burst .9s cubic-bezier(.2, .7, .3, 1) calc(var(--timeline-circle-delay) + .2s) 1 both;
  }

  @keyframes timeline-milestone-complete {
    0% {
      transform: scale(1);
      background-color: #fff;
      border-color: transparent;
      color: var(--timeline-complete-bg);
    }
    45% {
      transform: scale(1.18);
      background-color: var(--timeline-complete-bg);
      border-color: var(--timeline-complete-bg);
      color: var(--timeline-complete-ink);
    }
    100% {
      transform: scale(1);
      background-color: var(--timeline-complete-bg);
      border-color: var(--timeline-complete-bg);
      color: var(--timeline-complete-ink);
    }
  }

  @keyframes timeline-confetti-burst {
    0% {
      opacity: 0;
      transform: translate(-50%, -50%) rotate(0deg) scale(.3);
    }
    8% { opacity: 1; }
    60% {
      opacity: 1;
      transform: translate(calc(-50% + var(--confetti-x)), calc(-50% + var(--confetti-y))) rotate(var(--confetti-spin)) scale(1);
    }
    100% {
      opacity: 0;
      transform: translate(calc(-50% + var(--confetti-x)), calc(-50% + var(--confetti-y) + 26px)) rotate(calc(var(--confetti-spin) + 45deg)) scale(.8);
    }
  }
}

@media (min-width: 601px) {
  .steps.steps-timeline > article:last-child {
    /* Matches .wrap's 1240px maximum width and 40px inner padding. */
    --timeline-segment-end: calc(-4px - max(40px, calc((100vw - 1240px) / 2 + 40px)));
  }
}

@media (max-width: 600px) {
  .steps.steps-timeline > article::before,
  .steps.steps-timeline > article::after {
    top: calc(var(--timeline-marker-size) / 2);
    left: calc((var(--timeline-marker-size) - var(--timeline-track-size)) / 2);
    right: auto;
    bottom: var(--timeline-segment-end);
    width: var(--timeline-track-size);
    height: auto;
  }

  .steps.steps-timeline > article:last-child::before,
  .steps.steps-timeline > article:last-child::after {
    content: none;
    display: none;
  }

  @media (prefers-reduced-motion: no-preference) {
    .steps.steps-timeline.timeline-ready > article::before {
      right: auto;
      bottom: calc(100% - var(--timeline-marker-size) / 2);
    }

    .steps.steps-timeline.timeline-ready.timeline-drawn > article::before {
      right: auto;
      bottom: var(--timeline-segment-end);
      transition: none;
      animation-name: timeline-track-fill-vertical;
    }
  }
}
