/* ============================================================
   HLOPHE OUTDOOR MEDIA — Motion Layer
   Every effect is transform/opacity only, and every one of them
   is disabled under prefers-reduced-motion at the bottom of this file.
   ============================================================ */

/* ---- 1. Scroll progress rail ---- */
#scroll-rail {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 950;
  pointer-events: none; background: transparent;
}
#scroll-rail span {
  display: block; height: 100%; width: 100%;
  transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light), var(--accent-pale));
  box-shadow: 0 0 12px rgba(167,139,250,0.55);
}

/* ---- 2. Word-by-word heading reveal ---- */
.mw {
  display: inline-block; overflow: hidden; vertical-align: top;
  padding-bottom: 0.14em; margin-bottom: -0.14em;   /* keep descenders */
}
.mw-i {
  display: inline-block; transform: translateY(108%);
  transition: transform 0.85s var(--ease-spring);
  will-change: transform;
}
.split-in .mw-i { transform: translateY(0); }

/* ---- 3. Image reveal: wipe + settle ---- */
.img-reveal { position: relative; overflow: hidden; }
.img-reveal > img,
.img-reveal > picture > img {
  transform: scale(1.12);
  transition: transform 1.25s var(--ease-spring), filter 1.25s var(--ease-out);
  filter: saturate(0.7) brightness(0.85);
}
.img-reveal::after {
  content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: var(--bg-base);
  transform-origin: 100% 50%;
  transition: transform 1.0s var(--ease-spring);
}
.img-reveal.in > img,
.img-reveal.in > picture > img { transform: scale(1); filter: none; }
.img-reveal.in::after { transform: scaleX(0); }

/* ---- 4. Cursor spotlight on glass surfaces ---- */
.spot-glow {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0;
  opacity: 0; transition: opacity 0.4s var(--ease-out);
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%),
              rgba(167,139,250,0.16) 0%, rgba(124,58,237,0.06) 35%, transparent 65%);
}
[data-spot]:hover > .spot-glow { opacity: 1; }
[data-spot] { position: relative; }

/* ---- 5. Magnetic buttons ---- */
.magnetic { will-change: transform; }

/* ---- 6. Animated ambient background ---- */
.bg-ambient {
  animation: ambientDrift 26s var(--ease-io) infinite alternate;
}
@keyframes ambientDrift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  50%  { transform: translate3d(-1.5%, 1.2%, 0) scale(1.05); }
  100% { transform: translate3d(1.5%, -1%, 0) scale(1.03); }
}

/* ---- 7. Sliding nav indicator ---- */
.nav-links { position: relative; }
#nav-pill {
  position: absolute; top: 50%; left: 0; height: 34px; border-radius: 9px;
  background: var(--glass-2); border: 1px solid var(--border-dim);
  transform: translateY(-50%) translateX(var(--px, 0px));
  width: var(--pw, 0px); opacity: 0; z-index: 0;
  transition: transform 0.45s var(--ease-spring), width 0.45s var(--ease-spring), opacity 0.3s;
  pointer-events: none;
}
.nav-links.pill-on #nav-pill { opacity: 1; }
.nav-links a { position: relative; z-index: 1; }
.nav-links a.active, .nav-links a:hover { background: transparent !important; }
.nav-links .nav-cta, .nav-links .nav-cta:hover { background: linear-gradient(135deg, var(--accent), var(--accent-mid)) !important; }

/* ---- 8. Link underline draw ---- */
.u-draw { position: relative; }
.u-draw::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: 100% 50%;
  transition: transform 0.4s var(--ease-out);
}
.u-draw:hover::after { transform: scaleX(1); transform-origin: 0 50%; }

/* ---- 9. Strapline ticker ---- */
.ticker {
  position: relative; overflow: hidden;
  padding: 26px 0;
  border-top: 1px solid var(--border-dim);
  border-bottom: 1px solid var(--border-dim);
  background: rgba(255,255,255,0.015);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.ticker-track {
  display: flex; width: max-content; gap: 0;
  animation: tickerRun 34s linear infinite;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item {
  display: inline-flex; align-items: center; gap: 26px; padding-right: 26px;
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: clamp(0.95rem, 2vw, 1.35rem);
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--t2); white-space: nowrap;
}
.ticker-item i {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-light); box-shadow: 0 0 10px rgba(167,139,250,0.7);
}
.ticker-item.alt { color: transparent; -webkit-text-stroke: 1px rgba(196,181,253,0.55); }
@keyframes tickerRun { to { transform: translateX(-50%); } }

/* ---- 10. Page transition veil ----
   Default state is fully transparent and click-through, so a stalled
   script can never leave the page covered or unusable. The arrival fade
   is a one-shot CSS animation (runs on the compositor, always finishes)
   rather than an rAF callback, which browsers throttle in background tabs. */
#page-veil {
  position: fixed; inset: 0; z-index: 99998;
  pointer-events: none; opacity: 0;
  background: var(--bg-base);
  transition: opacity 0.28s var(--ease-out);
}
#page-veil.arrive { animation: veilOut 0.42s var(--ease-out) forwards; }
@keyframes veilOut { from { opacity: 1; } to { opacity: 0; } }
/* only the outgoing state blocks input, and only briefly */
#page-veil.on { opacity: 1; pointer-events: all; animation: none; }

/* ---- 11. Counter tick ---- */
.stat-value, .kpi-tile .val, .cov-count { font-variant-numeric: tabular-nums; }

/* ---- 12. Card lift polish ---- */
[data-spot] { transition: transform 0.45s var(--ease-spring), border-color 0.35s, box-shadow 0.35s; }

/* ============================================================
   Respect the user's motion preference — kill all of it.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  #scroll-rail { display: none; }
  .mw { overflow: visible; padding-bottom: 0; margin-bottom: 0; }
  .mw-i { transform: none !important; transition: none !important; }
  .img-reveal::after { display: none; }
  .img-reveal > img, .img-reveal > picture > img { transform: none !important; filter: none !important; transition: none !important; }
  .spot-glow { display: none; }
  .magnetic { transform: none !important; }
  .bg-ambient { animation: none !important; }
  #nav-pill { transition: none !important; }
  .u-draw::after { transition: none !important; }
  .ticker-track { animation: none !important; }
  #page-veil { display: none !important; }
  .reveal, .reveal-left, .reveal-right, .reveal-scale {
    opacity: 1 !important; transform: none !important; transition: none !important;
  }
}
