/**
 * KEN Biz Academy — Animation Stylesheet
 * GSAP ScrollTrigger initial states & keyframes
 */

/* ============================================================
   GSAP Initial States (set before animation)
   ============================================================ */

/* Elements that fade/slide in on scroll */
.gsap-reveal {
  opacity: 0;
  transform: translateY(30px);
}

.gsap-split-text .char {
  opacity: 0;
  transform: translateY(60px) rotateX(-15deg);
  display: inline-block;
  transform-origin: bottom center;
}

.gsap-stagger-item {
  opacity: 0;
  transform: translateY(40px);
}

.gsap-stat-item {
  opacity: 0;
  transform: scale(0.85) translateY(60px);
}

.gsap-bonus-item {
  opacity: 0;
  transform: translateY(50px);
}

.gsap-module-item {
  opacity: 0;
  transform: translateX(-30px) scale(0.85);
}

/* ============================================================
   LOADING SCREEN
   ============================================================ */
#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  transition: opacity 0.6s ease;
}

#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading__logo {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: 2rem;
  letter-spacing: 0.05em;
}

.loading__logo-img {
  height: 60px;
  width: auto;
  object-fit: contain;
}

.loading__bar-wrap {
  width: 200px;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 100px;
  overflow: hidden;
}

.loading__bar {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #ec4899);
  border-radius: 100px;
  width: 0%;
  animation: loadBar 1.8s var(--ease-expo) forwards;
}

@keyframes loadBar {
  0%   { width: 0%; }
  60%  { width: 80%; }
  100% { width: 100%; }
}

/* ============================================================
   PROGRESS BAR (scroll progress)
   ============================================================ */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, #7c3aed, #ec4899, #f59e0b);
  z-index: 9998;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.6);
}

/* ============================================================
   SMOOTH PAGE ENTRANCE
   ============================================================ */
body.is-ready {
  animation: bodyReveal 0.6s ease forwards;
}

@keyframes bodyReveal {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   FLOATING PARTICLES (CSS fallback)
   ============================================================ */
.particle-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle-bg__dot {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(124, 58, 237, 0.5);
  border-radius: 50%;
  animation: floatParticle linear infinite;
}

@keyframes floatParticle {
  0%   { transform: translateY(100vh) translateX(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(-100px) translateX(30px); opacity: 0; }
}

/* ============================================================
   GLITCH EFFECT (hero badge)
   ============================================================ */
@keyframes glitch {
  0%, 100% { transform: none; }
  10% { transform: translate(-2px, -1px); }
  20% { transform: translate(2px, 1px); }
  30% { transform: translate(-1px, 2px); }
  40% { transform: translate(1px, -1px); }
  50% { transform: translate(-2px, 1px); }
}

/* ============================================================
   GRADIENT ANIMATED BORDER
   ============================================================ */
.gradient-border {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: conic-gradient(
    from var(--angle, 0deg),
    #7c3aed, #ec4899, #f59e0b, #7c3aed
  );
  border-radius: inherit;
  animation: rotateBorder 4s linear infinite;
  z-index: -1;
}

@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes rotateBorder {
  to { --angle: 360deg; }
}

/* ============================================================
   TEXT SHIMMER
   ============================================================ */
.shimmer-text {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.4) 0%,
    rgba(255,255,255,1) 40%,
    rgba(255,255,255,0.4) 80%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
  from { background-position: 200% center; }
  to   { background-position: -200% center; }
}

/* ============================================================
   MAGNETIC BUTTON EFFECT
   ============================================================ */
.btn--magnetic {
  position: relative;
  overflow: visible;
}

.btn--magnetic::after {
  content: '';
  position: absolute;
  inset: -20px;
  border-radius: inherit;
}

/* ============================================================
   CANVAS OVERLAYS
   ============================================================ */
#hero-canvas,
#architect-canvas,
#ecosystem-canvas,
#final-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   HORIZONTAL SCROLL TRACK
   ============================================================ */
.voices__track {
  will-change: transform;
}

/* ============================================================
   PREFERS-REDUCED-MOTION OVERRIDES
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .gsap-reveal,
  .gsap-split-text .char,
  .gsap-stagger-item,
  .gsap-stat-item,
  .gsap-bonus-item,
  .gsap-module-item,
  .hero__line {
    opacity: 1 !important;
    transform: none !important;
  }

  .scroll-line,
  .model__ring,
  .model__node,
  .model__center,
  .loading__bar,
  .shimmer-text {
    animation: none !important;
  }

  #hero-canvas,
  #architect-canvas,
  #ecosystem-canvas,
  #final-canvas,
  #system-canvas {
    display: none;
  }
}
