.flow {
  --pill: 13.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: min(100%, 48rem);
  margin: 3rem auto 0;
}

.flow__step {
  display: grid;
  grid-template-columns: var(--pill) minmax(0, 1fr);
  column-gap: 2.75rem;
  align-items: center;
  width: 100%;
}

.pill {
  box-sizing: border-box;
  min-width: 10.5rem;
  min-height: 3.6rem;
  padding: 0.95rem 1.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  color: var(--card-ink);
  border: 1px solid var(--card-line);
  border-radius: 999px;
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-align: center;
  animation: pill-in 0.5s ease both;
}

.flow .pill {
  width: 100%;
  min-width: 0;
  min-height: 4.35rem;
  padding: 0.7rem 1.35rem;
  background: #fff;
  color: #111;
  border: 1px solid #111;
  outline: 1px solid rgba(255, 255, 255, 0.72);
  outline-offset: 5px;
  font-size: 0.92rem;
  line-height: 1.15;
}

.flow__note {
  margin: 0;
  max-width: 26rem;
  text-align: left;
  color: var(--ink-soft);
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-size: 0.98rem;
  line-height: 1.45;
  letter-spacing: -0.02em;
}

.flow .arrow--down {
  height: 2rem;
  align-self: flex-start;
  margin-left: calc(var(--pill) / 2 - 0.5px);
}

.loop .pill {
  min-width: 0;
  min-height: 1.28rem;
  padding: 0.08rem 0.46rem;
  background: #111;
  color: #fff;
  border-color: #111;
  font-size: 0.54rem;
  line-height: 1.15;
  animation: none;
}

.loop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.38rem 0;
  margin-top: 0.85rem;
}

.loop__step {
  display: flex;
  align-items: center;
}

.loop .arrow--right {
  align-self: center;
  width: 16px;
  height: 7px;
  flex: 0 0 16px;
  margin-inline: 4px;
  background: center / 16px 7px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='7' viewBox='0 0 16 7' fill='none'%3E%3Cpath d='M0 3.5H12.5' stroke='%23111' stroke-width='1'/%3E%3Cpath d='M8.5.5 12.5 3.5 8.5 6.5' stroke='%23111' stroke-width='1' stroke-linejoin='miter' stroke-miterlimit='8'/%3E%3C/svg%3E");
  transform: none;
  animation: loop-arrow-in 0.45s ease both;
}

.loop .arrow--right::after {
  content: none;
}

@keyframes loop-arrow-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.flow__p1 { animation-delay: 0.12s; }
.flow__a1 { animation-delay: 0.3s; }
.flow__p2 { animation-delay: 0.48s; }
.flow__a2 { animation-delay: 0.66s; }
.flow__p3 { animation-delay: 0.84s; }
.flow__a3 { animation-delay: 1.02s; }
.flow__p4 { animation-delay: 1.2s; }
.flow__a4 { animation-delay: 1.38s; }
.flow__p5 { animation-delay: 1.56s; }
.flow__a5 { animation-delay: 1.74s; }
.flow__p6 { animation-delay: 1.92s; }
.flow__a6 { animation-delay: 2.1s; }
.flow__p7 { animation-delay: 2.28s; }
.flow__a7 { animation-delay: 2.46s; }
.flow__p8 { animation-delay: 2.64s; }

@media (max-width: 40rem) {
  .flow {
    --pill: 9.5rem;
  }

  .flow__step {
    column-gap: 1rem;
  }

  .flow .pill {
    min-height: 3.5rem;
    padding: 0.4rem 0.5rem;
    outline-offset: 3px;
    font-size: 0.72rem;
  }

  .flow__note {
    font-size: 0.78rem;
    line-height: 1.35;
  }
}

@keyframes pill-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

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

@media (prefers-reduced-motion: reduce) {
  .pill,
  .flow .arrow {
    animation: none;
  }
}

.flow.flow--home {
  display: grid;
  grid-template-columns: auto 2.6rem auto 2.6rem auto 2.6rem auto;
  grid-template-rows: auto 1.85rem auto 1.85rem auto;
  justify-content: center;
  align-items: center;
  width: max-content;
  max-width: 100%;
  margin: 3rem auto 0;
}

.flow.flow--home .pill {
  width: auto;
  min-width: 10.5rem;
  min-height: 4.35rem;
  padding: 0.7rem 1.25rem;
  background: var(--card);
  color: var(--card-ink);
  border: 1px solid var(--card-line);
  outline: none;
  font-size: 0.92rem;
  line-height: 1.15;
}

.flow.flow--home .arrow {
  color: var(--rule);
}

.flow.flow--home .arrow--down {
  height: auto;
  align-self: stretch;
  margin-left: 0;
}

.flow.flow--home .flow__p1 { grid-column: 1; grid-row: 1; animation-delay: 0.12s; }
.flow.flow--home .flow__a1 { grid-column: 2; grid-row: 1; animation-delay: 0.32s; }
.flow.flow--home .flow__p2 { grid-column: 3; grid-row: 1; animation-delay: 0.5s; }
.flow.flow--home .flow__a2 { grid-column: 4; grid-row: 1; animation-delay: 0.7s; }
.flow.flow--home .flow__p3 { grid-column: 5; grid-row: 1; animation-delay: 0.88s; }
.flow.flow--home .flow__a3 { grid-column: 5; grid-row: 2; animation-delay: 1.08s; }
.flow.flow--home .flow__p4 { grid-column: 5; grid-row: 3; animation-delay: 1.26s; }
.flow.flow--home .flow__a4 { grid-column: 5; grid-row: 4; animation-delay: 1.46s; }
.flow.flow--home .flow__p5 { grid-column: 5; grid-row: 5; animation-delay: 1.64s; }
.flow.flow--home .flow__a5 { grid-column: 6; grid-row: 5; animation-delay: 1.84s; }
.flow.flow--home .flow__p6 { grid-column: 7; grid-row: 5; animation-delay: 2.02s; }

@media (max-width: 52.5rem) {
  .flow.flow--home {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    grid-template-columns:
      minmax(0, 1fr) clamp(0.55rem, 2vw, 1.5rem)
      minmax(0, 1fr) clamp(0.55rem, 2vw, 1.5rem)
      minmax(0, 1fr) clamp(0.55rem, 2vw, 1.5rem)
      minmax(0, 1fr);
    grid-template-rows: auto clamp(0.9rem, 2.6vw, 1.85rem) auto clamp(0.9rem, 2.6vw, 1.85rem) auto;
  }

  .flow.flow--home .pill {
    width: 100%;
    min-width: 0;
    min-height: clamp(2.2rem, 7.2vw, 4.35rem);
    padding: 0.3rem 0.2rem;
    font-size: clamp(0.5rem, 2.45vw, 0.92rem);
    line-height: 1.1;
    letter-spacing: -0.03em;
  }
}
