/* Hero headline typing effect */
.dynamic-text-container {
  display: inline-flex;
  position: relative;
  vertical-align: baseline;
  padding-inline: 0.2rem;
  align-items: baseline;
}

.dynamic-text {
  display: inline-block;
  position: relative;
  letter-spacing: -0.01em;
}

/* Underline bar */
.dynamic-text::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: var(--accent-400);
  transform-origin: left;
  transform: scaleX(0);
}

.dynamic-text.is-underlined::after {
  animation: dynamic-underline-in 0.5s ease forwards;
}

.dynamic-text.is-retracting::after {
  animation: dynamic-underline-out 0.5s ease forwards;
}

/* Caret element that follows the typed text */
.dynamic-text-caret {
  display: inline-block;
  margin-left: 0.02em;
  color: var(--accent-400);
  animation: caret-blink 0.8s steps(1) infinite;
}

.dynamic-text-container.is-paused .dynamic-text-caret {
  opacity: 0;
  animation: none;
}

@keyframes dynamic-underline-in {
  from {
    transform-origin: left;
    transform: scaleX(0);
  }
  to {
    transform-origin: left;
    transform: scaleX(1);
  }
}

@keyframes dynamic-underline-out {
  from {
    transform-origin: left;
    transform: scaleX(1);
  }
  to {
    transform-origin: left;
    transform: scaleX(0);
  }
}

@keyframes caret-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* Timeline drawing animation */
.timeline {
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  height: 100%;
  width: 2px;
  border-radius: 999px;
  background: var(--border-soft);
}

.timeline.timeline--animated::before {
  transform-origin: top;
  transform: scaleY(0);
  transition: transform 1.2s ease-out;
}

.timeline.timeline--animated.is-drawing::before {
  transform: scaleY(1);
}

.timeline.timeline--animated .timeline__item {
  opacity: 0;
  transform: translateX(-24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline.timeline--animated .timeline__item.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Stat counter legibility */
.stat__value {
  font-variant-numeric: tabular-nums;
}
