/* ==========================================================================
   Component: scroll-text  →  assets/component-scroll-text.css
   Section headings that swap for a copy of themselves when scrolled into view
   (assets/js/components/scroll-text.js). At rest only the real text is there; the two
   letter-by-letter copies exist only while the swap runs.
   ========================================================================== */
scroll-text {
  display: inline-block;
  position: relative;
}

.scroll-text__line {
  position: absolute;
  inset: 0;
  pointer-events: none;
  user-select: none;
}

/* No will-change here: it moves each letter onto its own layer, which draws the text lighter than
   the real heading, so the hand-back at the end of the swap would visibly flicker. */
.scroll-text__char {
  position: absolute;
  white-space: pre;
}

/* The letter's column of its whole word (clip-path set per letter). The clip sits on this inner
   box and GSAP's blur on the outer one, so the blur still spreads past the column's edges. */
.scroll-text__slice {
  display: block;
}

/* While playing, the letters are clipped just outside the text's left and right edges, so the
   outgoing text and the incoming copy slide out of and into the box (the reference clips them at
   the box). The 0.2em keeps glyphs that lean past their box, like the top of an "ff", whole. */
scroll-text.is-playing {
  clip-path: inset(-0.4em -0.2em);
}

scroll-text.is-playing .scroll-text__text {
  opacity: 0;
}
