/* =====================================================================
   SCAP home — desktop "wow" layer. Everything here is scoped to
   body.wow-on / body.wow-gl, which home-fx.js only sets on wide screens
   with a mouse and motion allowed. Phones never see any of it.
   ===================================================================== */

/* ---------- living nebula backdrop ---------- */
.wow-nebula {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  display: none;
  pointer-events: none;
}
.wow-gl .wow-nebula { display: block; animation: wow-fade-in 2.4s ease both; }
@keyframes wow-fade-in { from { opacity: 0; } to { opacity: 1; } }

.wow-gl .deck { z-index: 1; }

/* let the backdrop show through the slides */
.wow-gl .slide--hero { background: radial-gradient(120% 80% at 50% 40%, rgba(41, 195, 255, .05), transparent 60%); }
.wow-gl .slide--words {
  background: linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px) 0 0 / 8.333% 100%;
}
.wow-gl .slide--end { background: radial-gradient(90% 70% at 50% 45%, rgba(245, 196, 76, .06), transparent 60%); }
.wow-gl .hero-bg::after {
  background:
    linear-gradient(90deg, rgba(41, 171, 226, .06) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(0deg, rgba(255, 255, 255, .035) 1px, transparent 1px) 0 0 / 56px 56px,
    radial-gradient(ellipse at 50% 45%, transparent 35%, rgba(5, 7, 10, .85) 90%),
    linear-gradient(180deg, transparent 65%, rgba(5, 7, 10, .6));
}

/* ---------- cursor spotlight: a dot grid only lit around the pointer ---------- */
.wow-spot { display: none; }
.wow-on .wow-spot {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--wow-in, 0);
  background:
    radial-gradient(circle, rgba(255, 255, 255, .26) 1px, transparent 1.6px) 0 0 / 26px 26px;
  -webkit-mask-image: radial-gradient(240px circle at var(--wow-mx) var(--wow-my), #000 0%, rgba(0, 0, 0, .35) 45%, transparent 100%);
  mask-image: radial-gradient(240px circle at var(--wow-mx) var(--wow-my), #000 0%, rgba(0, 0, 0, .35) 45%, transparent 100%);
}

/* ---------- slide change: a light sweep carrying the slide label ---------- */
.wow-sweep { display: none; }
.wow-on .wow-sweep {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 950;
  pointer-events: none;
  overflow: hidden;
}
.wow-sweep i,
.wow-sweep b {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
}
.wow-sweep i {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(41, 195, 255, .9) 22%, #fff 50%, rgba(245, 196, 76, .9) 78%, transparent 100%);
  box-shadow: 0 0 18px 2px rgba(41, 195, 255, .55), 0 0 60px 8px rgba(245, 196, 76, .18);
}
.wow-sweep i::after {
  /* the wake behind the line */
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 26vh;
  background: linear-gradient(180deg, rgba(41, 195, 255, .07), transparent);
}
.wow-sweep.is-down i::after { bottom: 1px; transform: scaleY(-1); transform-origin: bottom; }
.wow-sweep.is-up i::after { top: 1px; }
.wow-sweep b {
  left: 6vw;
  margin-top: -22px;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  text-shadow: 0 0 12px rgba(41, 195, 255, .8);
  white-space: nowrap;
}
.wow-sweep.is-down i,
.wow-sweep.is-down b { animation: wow-sweep-down .95s cubic-bezier(.65, 0, .35, 1) both; }
.wow-sweep.is-up i,
.wow-sweep.is-up b { animation: wow-sweep-up .95s cubic-bezier(.65, 0, .35, 1) both; }
.wow-sweep b { animation-duration: 1.05s !important; }
@keyframes wow-sweep-down {
  0% { transform: translateY(-2vh); opacity: 0; }
  12% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(102vh); opacity: 0; }
}
@keyframes wow-sweep-up {
  0% { transform: translateY(102vh); opacity: 0; }
  12% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(-2vh); opacity: 0; }
}

/* ---------- hero: letterbox opens, an anamorphic flare crosses the word ---------- */
.wow-letterbox, .wow-flare { display: none; }
.wow-on .wow-letterbox {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}
.wow-letterbox i {
  position: absolute;
  left: 0; right: 0;
  height: 50%;
  background: #000;
  transform: scaleY(1);
}
.wow-letterbox i:first-child { top: 0; transform-origin: top; }
.wow-letterbox i:last-child { bottom: 0; transform-origin: bottom; }
.wow-letterbox i::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(41, 195, 255, .8), transparent);
  opacity: .8;
}
.wow-letterbox i:first-child::after { bottom: 0; }
.wow-letterbox i:last-child::after { top: 0; }
.wow-on.deck-ready .wow-letterbox i { animation: wow-letterbox 1.6s cubic-bezier(.76, 0, .24, 1) .1s both; }
@keyframes wow-letterbox {
  0% { transform: scaleY(1); }
  35% { transform: scaleY(.985); }
  100% { transform: scaleY(0); }
}

.wow-on .wow-flare {
  display: block;
  position: absolute;
  left: 0; right: 0;
  top: 44%;
  z-index: 3;
  height: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}
.wow-flare i {
  position: absolute;
  left: -10%; right: -10%;
  top: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(41, 195, 255, .0) 10%, rgba(41, 195, 255, .9) 40%, #fff 50%, rgba(41, 195, 255, .9) 60%, rgba(41, 195, 255, 0) 90%, transparent 100%);
  box-shadow: 0 0 22px 4px rgba(41, 195, 255, .55);
  opacity: 0;
  transform: scaleX(0);
}
.wow-flare b {
  position: absolute;
  left: 50%; top: 0;
  width: 46vw; height: 22vh;
  margin: -11vh 0 0 -23vw;
  background: radial-gradient(closest-side, rgba(150, 225, 255, .35), rgba(41, 195, 255, .08) 55%, transparent);
  opacity: 0;
}
.wow-on.deck-ready .wow-flare i { animation: wow-flare-line 2.2s cubic-bezier(.16, 1, .3, 1) 1.9s both; }
.wow-on.deck-ready .wow-flare b { animation: wow-flare-glow 2.2s ease-out 1.9s both; }
@keyframes wow-flare-line {
  0% { opacity: 0; transform: scaleX(0); }
  18% { opacity: 1; }
  45% { opacity: .9; transform: scaleX(1); }
  100% { opacity: 0; transform: scaleX(1.15); }
}
@keyframes wow-flare-glow {
  0% { opacity: 0; transform: scale(.4, .2); }
  25% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.4, .6); }
}

.wow-on .hero-bg,
.wow-on .hero-frame { will-change: transform; }
.wow-on .hero-frame { position: absolute; inset: 0; pointer-events: none; }

/* ---------- feature images: 3D tilt, glare, velocity skew ---------- */
.wow-on .feature { perspective: 1400px; }
.wow-on .feature-media {
  transform: rotateX(var(--wow-rx, 0deg)) rotateY(var(--wow-ry, 0deg)) skewY(var(--wow-skew, 0deg));
  transform-style: preserve-3d;
  will-change: transform;
}
.wow-on .feature-mask {
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .06);
  transition: box-shadow .5s ease;
}
.wow-on .feature-media:hover .feature-mask {
  box-shadow: 0 50px 110px -40px rgba(0, 0, 0, .95), 0 0 0 1px rgba(41, 195, 255, .35), 0 0 60px -10px rgba(41, 195, 255, .25);
}
.wow-glare { display: none; }
.wow-on .wow-glare {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: calc(var(--wow-on, 0) * .9);
  background:
    radial-gradient(420px circle at var(--wow-gx, 50%) var(--wow-gy, 50%), rgba(255, 255, 255, .22), transparent 55%),
    linear-gradient(115deg, transparent 30%, rgba(41, 195, 255, .08) 50%, transparent 70%);
  mix-blend-mode: overlay;
}
.wow-on .feature-media figcaption { transform: translateZ(30px); }

.wow-on .chapter-title { transform: skewY(var(--wow-skew, 0deg)); }

/* ---------- chapter numbers: light runs through the outline ---------- */
.wow-on .chapter-no {
  background: linear-gradient(100deg, transparent 35%, rgba(41, 195, 255, .95) 47%, #fff 50%, rgba(245, 196, 76, .95) 53%, transparent 65%) 0 0 / 300% 100% no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  background-position: 120% 0;
}
.wow-on .chapter-head.is-in .chapter-no { animation: wow-shine 2.6s cubic-bezier(.65, 0, .35, 1) .3s both; }
@keyframes wow-shine {
  from { background-position: 120% 0; }
  to { background-position: -20% 0; }
}

/* ---------- words scene: soft glow under the giant type ---------- */
.wow-on .word-big { filter: drop-shadow(0 0 40px rgba(41, 195, 255, .18)); }

/* ---------- magnetic buttons ---------- */
.wow-on .wow-magnet { will-change: transform; }
.wow-on .feature-link,
.wow-on .end-cta { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

/* ---------- end slide: ring pulse behind the CTA ---------- */
.wow-on .end-cta { animation: wow-ring 2.4s cubic-bezier(.16, 1, .3, 1) infinite; }
@keyframes wow-ring {
  0% { box-shadow: 0 0 0 0 rgba(245, 196, 76, .55), 0 0 40px -6px rgba(245, 196, 76, .35); }
  100% { box-shadow: 0 0 0 22px rgba(245, 196, 76, 0), 0 0 40px -6px rgba(245, 196, 76, .35); }
}

@media (prefers-reduced-motion: reduce) {
  .wow-nebula, .wow-spot, .wow-sweep, .wow-letterbox, .wow-flare, .wow-glare { display: none !important; }
}
