/**
 * OSAPEX GROUP — Cinematic Animation & Motion Design System
 * Premium keyframes, micro-interactions, scroll reveals, glassmorphism effects
 */

/* ═══════════════════════════════════════════════════════════════════════════
   GLOBAL SCROLL FEEL
   ═══════════════════════════════════════════════════════════════════════════ */
html { scroll-behavior: smooth; }

/* ═══════════════════════════════════════════════════════════════════════════
   SCROLL PROGRESS BAR
   ═══════════════════════════════════════════════════════════════════════════ */
#osapex-scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, #0757C9 0%, #00BFFF 50%, #FFB703 100%);
  box-shadow: 0 0 14px rgba(0, 191, 255, 0.9);
  z-index: 99999; transition: width 0.08s ease-out; pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CORE KEYFRAMES
   ═══════════════════════════════════════════════════════════════════════════ */
@keyframes floatHero {
  0%   { transform: translateY(0px) rotate(0deg); }
  33%  { transform: translateY(-14px) rotate(0.6deg); }
  66%  { transform: translateY(-8px) rotate(-0.4deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes osapexPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50%       { transform: scale(1.04); opacity: 1; }
}

@keyframes osapexFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

@keyframes osapexAuraPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0,191,255,0.2), 0 0 40px rgba(7,87,201,0.1); }
  50%       { box-shadow: 0 0 50px rgba(0,191,255,0.55), 0 0 80px rgba(255,183,3,0.25); }
}

@keyframes osapexGlowPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%       { opacity: 1; transform: scale(1.06); }
}

@keyframes osapexShimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes osapexFadeIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes osapexFadeInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes osapexFadeInRight {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes osapexZoomIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes osapexSlideUp {
  from { opacity: 0; transform: translateY(100%); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes osapexSlideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes osapexBounce {
  0%, 100% { transform: translateY(0); }
  20%       { transform: translateY(-12px); }
  40%       { transform: translateY(-4px); }
  60%       { transform: translateY(-8px); }
  80%       { transform: translateY(-2px); }
}

@keyframes osapexSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes osapexGradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes osapexBorderGlow {
  0%, 100% { border-color: rgba(0,191,255,0.25); box-shadow: 0 0 0 rgba(0,191,255,0); }
  50%       { border-color: rgba(0,191,255,0.7);  box-shadow: 0 0 16px rgba(0,191,255,0.3); }
}

@keyframes osapexCounterTick {
  from { transform: translateY(6px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

@keyframes osapexRipple {
  0%   { transform: scale(0); opacity: 0.6; }
  100% { transform: scale(4); opacity: 0; }
}

@keyframes osapexParticle {
  0%   { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-60px) scale(0); opacity: 0; }
}

@keyframes osapexTypewriter {
  from { width: 0; }
  to   { width: 100%; }
}

@keyframes osapexCursor {
  50% { border-color: transparent; }
}

@keyframes osapexHeartbeat {
  0%, 100% { transform: scale(1); }
  14%       { transform: scale(1.08); }
  28%       { transform: scale(1); }
  42%       { transform: scale(1.05); }
  70%       { transform: scale(1); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCROLL-DRIVEN REVEAL SYSTEM
   ═══════════════════════════════════════════════════════════════════════════ */
.osapex-reveal,
.osapex-reveal-scale,
.osapex-reveal-left,
.osapex-reveal-right {
  opacity: 1;
  transform: none;
  transition: opacity 0.75s cubic-bezier(0.16,1,0.3,1), transform 0.75s cubic-bezier(0.16,1,0.3,1);
  will-change: opacity, transform;
}

.js-reveal-enabled .osapex-reveal        { opacity: 0; transform: translateY(28px); }
.js-reveal-enabled .osapex-reveal-scale  { opacity: 0; transform: scale(0.94); }
.js-reveal-enabled .osapex-reveal-left   { opacity: 0; transform: translateX(-28px); }
.js-reveal-enabled .osapex-reveal-right  { opacity: 0; transform: translateX(28px); }

.osapex-reveal.active,
.osapex-reveal-scale.active,
.osapex-reveal-left.active,
.osapex-reveal-right.active {
  opacity: 1 !important;
  transform: translate(0,0) scale(1) !important;
}

/* Stagger Delays */
.delay-100 { transition-delay: 0.10s !important; }
.delay-150 { transition-delay: 0.15s !important; }
.delay-200 { transition-delay: 0.20s !important; }
.delay-300 { transition-delay: 0.30s !important; }
.delay-400 { transition-delay: 0.40s !important; }
.delay-500 { transition-delay: 0.50s !important; }
.delay-600 { transition-delay: 0.60s !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   HELPER ANIMATION CLASSES
   ═══════════════════════════════════════════════════════════════════════════ */
.animate-float      { animation: osapexFloat 6s ease-in-out infinite; }
.animate-pulse      { animation: osapexPulse 3s ease-in-out infinite; }
.animate-spin       { animation: osapexSpin 2s linear infinite; }
.animate-bounce     { animation: osapexBounce 1.5s ease-in-out; }
.animate-heartbeat  { animation: osapexHeartbeat 2s infinite; }
.animate-fade-in    { animation: osapexFadeIn 0.55s ease both; }
.animate-zoom-in    { animation: osapexZoomIn 0.4s ease both; }
.animate-slide-up   { animation: osapexSlideUp 0.4s cubic-bezier(0.16,1,0.3,1) both; }
.animate-slide-down { animation: osapexSlideDown 0.35s ease both; }

/* Hero float graphic */
.hero-float-graphic {
  animation: floatHero 7s ease-in-out infinite;
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
}
.hero-float-graphic:hover { transform: scale(1.04) translateY(-10px); }

/* Aura Cards */
.osapex-aura-card { animation: osapexAuraPulse 5s ease-in-out infinite; }

/* Animated gradient text */
.osapex-gradient-text {
  background: linear-gradient(90deg, #00BFFF, #0757C9, #FFB703, #00BFFF);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: osapexGradientShift 6s ease infinite;
}

/* Animated border glow — apply to featured cards */
.osapex-border-glow { animation: osapexBorderGlow 3s ease-in-out infinite; }

/* Skeleton loading shimmer */
.osapex-skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.10) 50%, rgba(255,255,255,.04) 75%);
  background-size: 200% 100%;
  animation: osapexShimmer 1.5s infinite;
  border-radius: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RIPPLE EFFECT (apply via JS on click)
   ═══════════════════════════════════════════════════════════════════════════ */
.osapex-ripple-host { position: relative; overflow: hidden; }
.osapex-ripple-wave {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.22);
  pointer-events: none;
  animation: osapexRipple 0.65s ease-out forwards;
  transform-origin: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MICRO-INTERACTIONS — Hover lifts, press scales
   ═══════════════════════════════════════════════════════════════════════════ */
.hover-lift {
  transition: transform 0.22s cubic-bezier(0.16,1,0.3,1), box-shadow 0.22s;
}
.hover-lift:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0,0,0,0.4); }

.hover-glow {
  transition: box-shadow 0.22s, border-color 0.22s;
}
.hover-glow:hover {
  box-shadow: 0 0 24px rgba(0,191,255,0.4);
  border-color: rgba(0,191,255,0.6) !important;
}

.press-scale {
  transition: transform 0.14s;
  user-select: none;
}
.press-scale:active { transform: scale(0.96); }

/* ═══════════════════════════════════════════════════════════════════════════
   PARTICLE EMITTER (solar sparks — injected via JS)
   ═══════════════════════════════════════════════════════════════════════════ */
.osapex-particle {
  position: absolute; width: 6px; height: 6px;
  border-radius: 50%; pointer-events: none;
  animation: osapexParticle 1s ease-out forwards;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PAGE TRANSITION OVERLAY
   ═══════════════════════════════════════════════════════════════════════════ */
#osapex-page-curtain {
  position: fixed; inset: 0; z-index: 999990;
  background: #020B18;
  pointer-events: none;
  animation: osapexFadeOut 0.5s 0.1s ease forwards;
}
@keyframes osapexFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; visibility: hidden; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   GLASSMORPHIC CARD HOVER
   ═══════════════════════════════════════════════════════════════════════════ */
.osapex-glass-card {
  background: rgba(3,27,61,0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0,191,255,0.18);
  border-radius: 14px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.osapex-glass-card:hover {
  border-color: rgba(0,191,255,0.5);
  box-shadow: 0 0 32px rgba(0,191,255,0.2), 0 20px 50px rgba(0,0,0,0.5);
  transform: translateY(-3px);
}

/* Reduced motion override */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
