/* ══════════════════════════════════════════════════════════════════
   AEO-REX Motion Layer — scroll reveals, nav behaviour, button
   micro-interactions, marquee, video section. Pairs with js/motion.js
   and js/reveal.js. All effects disabled under prefers-reduced-motion.
   ══════════════════════════════════════════════════════════════════ */

/* ─────────── Scroll reveals (reveal.js adds .visible) ─────────── */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s cubic-bezier(.22,.61,.36,1), transform .7s cubic-bezier(.22,.61,.36,1);
  transition-delay: var(--reveal-delay, 0s);
  will-change: opacity, transform;
}
.reveal.visible { opacity: 1; transform: none; }

/* ─────────── Hero entrance (plays on load, no observer) ─────────── */
@keyframes heroRise {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: none; }
}
.hero-copy > * { animation: heroRise .8s cubic-bezier(.22,.61,.36,1) both; }
.hero-copy > *:nth-child(1) { animation-delay: .05s; }
.hero-copy > *:nth-child(2) { animation-delay: .18s; }
.hero-copy > *:nth-child(3) { animation-delay: .32s; }
.hero-copy > *:nth-child(4) { animation-delay: .46s; }
.hero-portrait { animation: heroRise .9s cubic-bezier(.22,.61,.36,1) .3s both; }

/* Gentle float on the hero proof thumbnails */
@keyframes proofFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.hero-portrait-proof { animation: proofFloat 6s ease-in-out infinite; }
.hero-portrait-proof:nth-child(2) { animation-delay: 3s; }

/* ─────────── Animated gradient shimmer on .accent headings ─────────── */
@keyframes accentShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
h1 .accent, h2 .accent {
  background: linear-gradient(100deg, var(--blue) 0%, #22d3ee 45%, var(--blue) 90%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--blue); /* fallback */
  animation: accentShift 7s ease-in-out infinite;
}

/* ─────────── Nav: hide on scroll down, reveal on scroll up ─────────── */
nav.site-nav {
  transition: transform .35s cubic-bezier(.22,.61,.36,1), box-shadow .3s, background .3s;
}
nav.site-nav.nav-hidden { transform: translateY(-100%); }
nav.site-nav.nav-scrolled {
  background: rgba(247, 249, 252, 0.97);
  box-shadow: 0 6px 24px rgba(14, 23, 38, 0.08);
}

/* ─────────── Buttons: shine sweep + dissolve ripple ─────────── */
.btn-primary, .btn-secondary, nav.site-nav a.nav-cta {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.btn-primary::after, nav.site-nav a.nav-cta::after {
  content: "";
  position: absolute;
  top: 0; left: -80%;
  width: 55%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.42), transparent);
  transform: skewX(-22deg);
  transition: left .55s ease;
  z-index: 1;
  pointer-events: none;
}
.btn-primary:hover::after, nav.site-nav a.nav-cta:hover::after { left: 130%; }

/* Click ripple — a soft circle that dissolves outward (motion.js injects the span) */
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.55);
  transform: scale(0);
  animation: rippleDissolve .65s ease-out forwards;
  pointer-events: none;
  z-index: 2;
}
@keyframes rippleDissolve {
  to { transform: scale(3.2); opacity: 0; }
}

/* ─────────── Credential ticker ───────────
   Uniform chips, 4-colour contrast cycle, no wrapping, edge fades.
   motion.js moves the label into .as-featured-head above the track. */
.as-featured.marquee { overflow: hidden; padding: 54px 0; }
.as-featured-head {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 21px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--secondary, #55607a);
  margin: 0 0 24px;
}
.as-featured-head .as-featured-label { margin: 0; font-size: inherit; }
.as-featured.marquee .marquee-track {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.as-featured.marquee .as-featured-inner {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 14px;
  width: max-content;
  max-width: none;
  padding-right: 14px; /* keeps the loop seam evenly spaced */
  animation: marqueeScroll 32s linear infinite;
}
.as-featured.marquee:hover .as-featured-inner { animation-play-state: paused; }
@keyframes marqueeScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
/* Uniform chips */
.as-featured .credential-pill {
  flex: 0 0 auto;
  height: 62px;
  padding: 0 32px;
  display: inline-flex; align-items: center; gap: 11px;
  white-space: nowrap;
  font-size: 20px; font-weight: 700; letter-spacing: 0.01em;
  background: transparent; text-decoration: none;
  border: 1.5px solid transparent;
  border-radius: 999px;
}
.as-featured .credential-pill::before {
  content: '\2713';
  color: currentColor; opacity: .95;
  font-weight: 800; font-size: 18px;
}
/* 4-colour contrast cycle — 8 pills per loop, so the pattern
   stays continuous across the duplicated seam (8 % 4 = 0) */
.as-featured .credential-pill:nth-child(4n+1) { background: transparent; border-color: #1f5fce; color: #1f5fce; } /* brand blue  */
.as-featured .credential-pill:nth-child(4n+2) { background: transparent; border-color: #0e1726; color: #0e1726; } /* ink navy    */
.as-featured .credential-pill:nth-child(4n+3) { background: transparent; border-color: #0d9488; color: #0d9488; } /* teal        */
.as-featured .credential-pill:nth-child(4n+4) { background: transparent; border-color: #7c3aed; color: #7c3aed; } /* violet      */
.as-featured a.credential-pill:hover { background: rgba(31, 95, 206, 0.06); }

/* ─────────── Card lift (journey steps, pricing, trust, FAQ) ─────────── */
.motion-lift {
  transition: transform .25s cubic-bezier(.22,.61,.36,1), box-shadow .25s;
}
.motion-lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 34px rgba(31, 95, 206, 0.13);
}

/* ─────────── Cinematic video section ─────────── */
.rex-cinema {
  background: #060a14;
  padding: 72px 24px;
  text-align: center;
}
.rex-cinema h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  letter-spacing: .07em;
  color: #e8eefb;
  margin: 0 0 10px;
}
.rex-cinema h2 .glow { color: #22d3ee; text-shadow: 0 0 24px rgba(34,211,238,.45); }
.rex-cinema p {
  color: #9fb2d4;
  max-width: 620px;
  margin: 0 auto 30px;
  font-size: 1.02rem;
}
.rex-cinema-frame {
  max-width: 960px;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(34,211,238,.25);
  box-shadow: 0 0 50px rgba(34,211,238,.18), 0 22px 50px rgba(0,0,0,.55);
}
.rex-cinema-frame video { display: block; width: 100%; height: auto; }

/* ─────────── Accessibility: kill all motion on request ─────────── */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-copy > *, .hero-portrait, .hero-portrait-proof,
  h1 .accent, h2 .accent,
  .as-featured.marquee .as-featured-inner,
  .btn-ripple { animation: none !important; }
  .btn-primary::after, nav.site-nav a.nav-cta::after { display: none; }
  nav.site-nav, .motion-lift { transition: none; }
  nav.site-nav.nav-hidden { transform: none; }
}
