/* ============================================================
   HERO TEXT ANIMATION — slot-machine word reveal
   Design → Build → Scale → powered by AI → full tagline → loop
   ============================================================ */

.hero-animated-text-container {
  position: relative;
  width: 100%;
  height: 68px;
  margin: 8px 0 16px;
  overflow: hidden;
}

/* width:100% ensures wrapper has size even with absolute children (fixes mobile) */
.hero-animated-text-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  margin: 0;
}

/* Words positioned at top:50% so all font sizes center vertically the same way */
.hero-animated-word {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  /* resting off-screen below: top=50% + push down past wrapper bottom */
  transform: translateY(calc(-50% + 80px));
  opacity: 0;

  font-family: 'Poppins', sans-serif;
  font-size: clamp(28px, 3.2vw, 46px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.5px;
  white-space: nowrap;
  text-align: left;
  will-change: transform, opacity;

  /* Gradient matching site hero-highlight */
  background: linear-gradient(90deg, #004643, #00897b, #004643);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Light streak on entry */
.hero-animated-word::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 55%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
  pointer-events: none;
}

.hero-animated-word.active {
  animation: wordIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero-animated-word.active::after {
  animation: lightStreak 0.85s ease-out 0.25s forwards;
}

.hero-animated-word.exit {
  animation: wordOut 0.45s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

/* "powered by AI" — same font size, different colour so height is identical */
.hero-animated-word.is-phrase {
  font-size: clamp(28px, 3.2vw, 46px);
  font-weight: 600;
  background: none;
  -webkit-text-fill-color: #004643;
  color: #004643;
  letter-spacing: -0.3px;
}

/* Keyframes — all relative to top:50%, centered at translateY(-50%) */
@keyframes wordIn {
  0%   { opacity: 0; transform: translateY(calc(-50% + 80px)); }
  100% { opacity: 1; transform: translateY(-50%); }
}

@keyframes wordOut {
  0%   { opacity: 1; transform: translateY(-50%); }
  100% { opacity: 0; transform: translateY(calc(-50% - 80px)); }
}

@keyframes lightStreak {
  0%   { left: -80%; opacity: 1; }
  100% { left: 130%; opacity: 0; }
}

/* Keep original hero background */
.hero.with-text-animation {
  position: relative;
}

/* Tablet — centered layout needs centered text */
@media screen and (max-width: 991px) {
  .hero-animated-text-container,
  .hero-animated-text-wrapper {
    height: 58px;
  }
  .hero-animated-word,
  .hero-animated-word.is-phrase {
    font-size: clamp(22px, 4vw, 36px);
    text-align: center;
  }
}

@media screen and (max-width: 768px) {
  .hero-animated-text-container,
  .hero-animated-text-wrapper {
    height: 50px;
  }
  .hero-animated-word,
  .hero-animated-word.is-phrase {
    font-size: clamp(20px, 5vw, 30px);
    text-align: center;
  }
}

@media screen and (max-width: 480px) {
  .hero-animated-text-container,
  .hero-animated-text-wrapper {
    height: 44px;
  }
  .hero-animated-word,
  .hero-animated-word.is-phrase {
    font-size: clamp(18px, 6.5vw, 26px);
    text-align: center;
  }
}