/* =========================================================================
   Service paragraph section — word-by-word scroll-reveal animation
   Triggers every time the section enters the viewport (replays on re-entry).
   Reset is INSTANT (no out-animation) so the reveal is always clean.
   ========================================================================= */

.service-para {
  position: relative;
  padding: 110px 24px;
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.service-para .services-para {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: clamp(18px, 2vw, 20px);
  line-height: 2;
  font-weight: 400;
  color: #1a2744;
  letter-spacing: -0.005em;
  margin: 0;
}

/* Each word is wrapped by the JS as:
     <span class="sp-word"><span class="sp-word-inner">Word</span></span>
   The outer span clips; the inner span translates / fades in. */
.service-para .sp-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.08em;
  line-height: inherit;
}

/* Hidden state — applied by default AND whenever the section is out of view.
   NOTE: no `transition` here, so leaving the viewport snaps back instantly
   instead of animating out (which would cause the half-blurred mess). */
.service-para .sp-word-inner {
  display: inline-block;
  transform: translateY(110%) rotate(6deg);
  opacity: 0;
  filter: blur(6px);
  will-change: transform, opacity, filter;
}

/* Reveal state — transitions ONLY apply when entering the view.
   Because the transition declaration disappears when `.is-in-view` is
   removed, the reset back to hidden is instantaneous. */
.service-para.is-in-view .sp-word-inner {
  transform: translateY(0) rotate(0);
  opacity: 1;
  filter: blur(0);
  transition:
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--sp-i, 0) * 28ms);
}

/* Subtle highlight bar that draws in under the paragraph */
.service-para::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #5477ad, transparent);
}
.service-para.is-in-view::after {
  transform: translateX(-50%) scaleX(1);
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.35s;
}

/* Respect users who prefer no motion */
@media (prefers-reduced-motion: reduce) {
  .service-para .sp-word-inner {
    transform: none;
    opacity: 1;
    filter: none;
  }
  .service-para::after { transform: translateX(-50%) scaleX(1); }
  .service-para.is-in-view .sp-word-inner,
  .service-para.is-in-view::after { transition: none; }
}

@media (max-width: 768px) {
  .service-para { padding: 56px 20px; }
  .service-para .services-para { font-size: 17px; line-height: 1.65; }
  .service-para::after { bottom: 28px; }
}
