/* SolutionTee Edu Academy — motion layer
   =========================================================================
   Kept in its own file because it belongs to GSAP, Lenis and
   interactions.js: if any of them is removed, this file goes with it and
   nothing else has to be untangled.

   Nothing here is load-bearing. Every hidden state is behind .js, so a
   page rendered without JavaScript shows its content outright rather than
   waiting for an animation that will never arrive.
   ====================================================================== */

/* ---- Lenis -------------------------------------------------------------
   Lenis drives scrolling itself and the browser's own smooth behaviour
   fights it. `overscroll-behavior` stops a flick inside a scroller from
   chaining to the page behind it. */
html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}


/* ==========================================================================
   WORD SPLIT
   ==========================================================================
   motion.js rebuilds a `data-gsap="words"` heading as one span per word.
   inline-block is what makes them transformable — an inline span ignores
   translate entirely, which is the silent way this effect fails.

   The trailing space lives inside each span, so line breaking is exactly
   what it was before the split.
   ========================================================================== */

.word {
  display: inline-block;
  white-space: pre-wrap;
  will-change: transform, opacity;
}


/* ==========================================================================
   HOVER
   A vocabulary of small, consistent responses. The rule throughout: the
   element acknowledges the pointer without moving anything around it.
   ========================================================================== */

/* Only where a pointer can actually hover. On a touch screen these states
   stick after a tap, which reads as a stuck element. */
@media (hover: hover) and (pointer: fine) {

  /* The row hover used to shift padding-inline-start, so the text
     stepped toward the reader. sections.css replaced that with a gold
     marker on the leading edge, which says the same thing without
     reflowing the row — and a directory that twitches under the cursor
     is measurably harder to read down. The rule is gone rather than
     overridden: two files animating the same property is how you get a
     hover that fights itself. */

  /* ---- Media that settles under the pointer --------------------------- */
  .media--hover {
    overflow: hidden;
  }

  .media--hover img {
    transition: transform var(--dur-slow) var(--ease-out);
  }

  .media--hover:hover img {
    transform: scale(1.03);
  }

  /* ---- A link whose underline draws in from the left ------------------ */
  .link-draw {
    position: relative;
    text-decoration: none;
  }

  .link-draw::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--dur-base) var(--ease-out);
  }

  .link-draw:hover::after {
    transform: scaleX(1);
  }

  /* A keyboard user gets the same affordance: the focus ring says where
     you are, the underline says what it is. */
  .link-draw:focus-visible::after {
    transform: scaleX(1);
  }

  /* ---- Magnetic --------------------------------------------------------
     interactions.js writes the transform; the transition is what makes
     the release spring back rather than snap. The pull itself is
     deliberately capped at 6px in the script — a control that visibly
     chases the pointer is harder to hit, and Fitts's law does not care
     how good it looks. */
  [data-magnetic] {
    transition: transform var(--dur-slow) var(--ease-spring);
  }

  [data-tilt] {
    transform-style: preserve-3d;
    transition: transform var(--dur-slow) var(--ease-out);
  }
}


/* ==========================================================================
   WILL-CHANGE
   ==========================================================================
   Promotion is a cost, not a free win: every promoted element is another
   layer the compositor holds in memory, and on a mid-range Android that
   is the difference between smooth and not. So it is set only on elements
   that are definitely about to move, and only while JavaScript is present
   to move them.
   ========================================================================== */

.js [data-gsap="rise"],
.js [data-gsap="fade"],
.js [data-gsap="settle"],
.js [data-gsap="headline"] {
  will-change: transform, opacity;
}


/* ==========================================================================
   REDUCED MOTION
   ==========================================================================
   motion.js and interactions.js both return early under this preference,
   so nothing is animating by the time these rules apply. They exist for
   the one case that matters: the preference being turned on after the
   attributes were written, leaving an element concealed with no script
   left running to reveal it.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .js [data-gsap],
  .js .word {
    opacity: 1 !important;
    transform: none !important;
    will-change: auto;
  }

  .status--live .status__dot {
    animation: none;
  }
}
