/* RIVAN effects layer: dot shapes, word launch timing, hero image motion. Loaded after styles.css */

.geo-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.has-geo {
  position: relative;
  isolation: isolate;
}

.has-geo>.geo-canvas {
  z-index: -1;
}

/* Words animate individually, staggered by --wd */
.rivan-word-launch {
  display: inline-block;
}

.rivan-word-launch.is-launched {
  animation-delay: var(--wd, 0ms);
}

/* Gradient accent: move gradient from <em> to each word span */
.hero h1 em,
.section-heading em,
.journey em,
.faq-intro em,
.lab-copy h2 em,
.foundation-cta em {
  background: none;
  -webkit-text-fill-color: currentColor;
  animation: none;
}

.hero h1 em .rivan-word-launch,
.section-heading em .rivan-word-launch,
.journey em .rivan-word-launch,
.faq-intro em .rivan-word-launch,
.lab-copy h2 em .rivan-word-launch,
.foundation-cta em .rivan-word-launch {
  background: var(--gtext);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero h1 em .rivan-word-launch.is-launched,
.section-heading em .rivan-word-launch.is-launched,
.journey em .rivan-word-launch.is-launched,
.faq-intro em .rivan-word-launch.is-launched,
.lab-copy h2 em .rivan-word-launch.is-launched,
.foundation-cta em .rivan-word-launch.is-launched {
  animation: rivanWordLaunch .82s cubic-bezier(.2, .75, .25, 1) var(--wd, 0ms) both,
    rivanAccentShimmer 5s linear 1.2s infinite;
}

/* Hero text launches from JS when visible, not on page load */
.hero-copy h1 {
  animation: none;
}

.hero-copy .eyebrow.rivan-text-launch,
.hero-copy .hero-intro.rivan-text-launch {
  animation: none;
}

.hero-copy .eyebrow.rivan-text-launch.is-launched {
  animation: rivanTextLaunch .78s cubic-bezier(.2, .75, .25, 1) .05s both;
}

.hero-copy .hero-intro.rivan-text-launch.is-launched {
  animation: rivanTextLaunch .78s cubic-bezier(.2, .75, .25, 1) .5s both;
}

/* Hero image: entrance, then slow float/zoom, glow pulse, scan sweep */
.hero-image {
  animation: rivanImageLaunch 1.25s cubic-bezier(.2, .75, .25, 1) .12s both,
    rivanHeroFloat 10s ease-in-out 1.4s infinite;
  will-change: transform;
}

.hero-image::before,
.hero-image::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.hero-image::before {
  right: 8%;
  top: 50%;
  width: 46vw;
  max-width: 640px;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translateY(-50%);
  background: radial-gradient(circle, #19d9f533 0%, #2a8bff1f 40%, transparent 68%);
  animation: rivanHeroGlow 5s ease-in-out infinite;
}

.hero-image::after {
  top: 0;
  bottom: 0;
  width: 18%;
  left: 0;
  background: linear-gradient(90deg, transparent, #19d9f524, transparent);
  animation: rivanHeroScan 6s ease-in-out 2s infinite;
}

@keyframes rivanHeroFloat {

  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  50% {
    transform: translate3d(-10px, -12px, 0) scale(1.035);
  }
}

@keyframes rivanHeroGlow {

  0%,
  100% {
    opacity: .55;
    transform: translateY(-50%) scale(.94);
  }

  50% {
    opacity: 1;
    transform: translateY(-50%) scale(1.08);
  }
}

@keyframes rivanHeroScan {
  0% {
    left: 0;
    opacity: 0;
  }

  15%,
  70% {
    opacity: 1;
  }

  100% {
    left: 100%;
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {

  .hero-image,
  .hero-image::before,
  .hero-image::after {
    animation: none;
  }

  .rivan-text-launch,
  .rivan-word-launch {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

/* ---------- Wave dividers ---------- */
.wave-divider {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 90px;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
  transform: scaleY(-1);
}

.wave-divider .wave {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 100%;
  animation: rivanWaveDrift 18s linear infinite;
}

.wave-divider .w2 {
  animation-duration: 26s;
  animation-direction: reverse;
  opacity: .9;
}

.wave-divider .w3 {
  animation-duration: 34s;
  opacity: .8;
}

@keyframes rivanWaveDrift {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-50%);
  }
}

/* ---------- Glitter ---------- */
.glitter-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.has-geo>.glitter-canvas {
  z-index: -1;
}

.hero>.glitter-canvas {
  z-index: 2;
}

/* Glitter on gradient buttons and the CTA band */
.button-grad::before,
.foundation-cta::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 12% 30%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 34% 72%, #fff 0 1.2px, transparent 2.4px),
    radial-gradient(circle at 58% 24%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 78% 66%, #fff 0 1.4px, transparent 2.6px),
    radial-gradient(circle at 92% 28%, #fff 0 1px, transparent 2px);
  animation: rivanGlitter 2.6s ease-in-out infinite;
}

.foundation-cta::after {
  z-index: 0;
  animation-duration: 3.4s;
}

@keyframes rivanGlitter {

  0%,
  100% {
    opacity: .15;
  }

  50% {
    opacity: 1;
  }
}

/* Glittering card borders */
.programme-card,
.glass,
.enquiry-card {
  animation: rivanBorderGlow 4.5s ease-in-out infinite;
}

@keyframes rivanBorderGlow {

  0%,
  100% {
    box-shadow: 0 0 24px #2a8bff33, inset 0 0 22px #2a8bff1a;
  }

  50% {
    box-shadow: 0 0 34px #19d9f566, 0 0 8px #ffffff44, inset 0 0 26px #8b5cf633;
  }
}

.programme-card:hover {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {

  .wave-divider .wave,
  .button-grad::before,
  .foundation-cta::after,
  .programme-card,
  .glass,
  .enquiry-card {
    animation: none;
  }
}
