/* ============================================
   Astral Tech - Animation Styles
   GSAP + ScrollTrigger Animation States
   ============================================ */

/* ---------- Initial hidden states for GSAP ---------- */

/* Fade Up with Blur - the main reveal animation */
[data-animate] {
    opacity: 0;
    will-change: transform, opacity;
}

@media (min-width: 1025px) {
    [data-animate] {
        will-change: transform, opacity, filter;
    }
}

[data-animate="fade-up"] {
    transform: translateY(40px);
    filter: blur(8px);
}

[data-animate="fade-up-sm"] {
    transform: translateY(20px);
    filter: blur(4px);
}

[data-animate="fade-left"] {
    transform: translateX(-50px);
    filter: blur(6px);
}

[data-animate="fade-right"] {
    transform: translateX(50px);
    filter: blur(6px);
}

[data-animate="scale-in"] {
    transform: scale(0.9);
    filter: blur(6px);
}

[data-animate="fade-in"] {
    filter: blur(6px);
}

/* Override the old reveal class - let GSAP handle everything */
.reveal {
    opacity: 1 !important;
    transform: none !important;
}

/* ---------- Gradient Text Shimmer Animation ---------- */
.gradient-text-animated {
    background: linear-gradient(
        90deg,
        #3b82f6 0%,
        #60a5fa 25%,
        #ff9a9e 50%,
        #60a5fa 75%,
        #3b82f6 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShimmer 4s ease-in-out infinite;
}

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

/* ---------- Stagger children animation setup ---------- */
[data-stagger-parent] > * {
    opacity: 0;
    transform: translateY(30px);
    filter: blur(6px);
    will-change: transform, opacity, filter;
}

/* ---------- Line-by-line text reveal ---------- */
.text-reveal-line {
    overflow: hidden;
    display: block;
}

.text-reveal-inner {
    display: block;
    transform: translateY(100%);
    will-change: transform;
}

/* ---------- Smooth Scroll overrides ---------- */
html.lenis,
html.lenis body {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

/* ---------- Counter Glow Effect ---------- */
.stat-number.counting {
    text-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
}

/* ---------- Service Card Enhanced Glow ---------- */
.service-card {
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Section Divider Glow Line ---------- */
.section-glow-line {
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(59, 130, 246, 0.4) 50%,
        transparent 100%
    );
    width: 0%;
    margin: 0 auto;
    will-change: width;
}

/* ---------- Parallax depth ---------- */
[data-speed] {
    will-change: transform;
}

/* ---------- Magnetic button effect ---------- */
.btn-magnetic {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Card tilt 3D ---------- */
.tilt-card {
    transform-style: preserve-3d;
    perspective: 800px;
}

.tilt-card > * {
    transform: translateZ(20px);
}

/* ---------- Hero text lines clip ---------- */
.hero-title .line-wrapper {
    overflow: hidden;
    display: block;
}

.hero-title .line-inner {
    display: block;
}

/* ---------- Scroll Progress Indicator ---------- */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--gradient-primary);
    z-index: 9999;
    transform-origin: left;
    transform: scaleX(0);
    will-change: transform;
}

/* ---------- Enhanced floating cards ---------- */
.floating-card {
    animation: none; /* GSAP controls this now */
}

/* ---------- Smooth blur transition for performance ---------- */

/* ---------- Galaxy Canvas ---------- */
#galaxy-canvas {
    opacity: 0.85;
    mix-blend-mode: screen;
}

/* ---------- Ambient Light Orbs ---------- */
.ambient-lights {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.ambient-orb {
    position: absolute;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: ambientFloat 20s ease-in-out infinite alternate;
    filter: blur(80px);
    will-change: transform;
}

@keyframes ambientFloat {
    0% {
        transform: translate(-50%, -50%) scale(1) translateX(0) translateY(0);
    }
    25% {
        transform: translate(-50%, -50%) scale(1.15) translateX(40px) translateY(-30px);
    }
    50% {
        transform: translate(-50%, -50%) scale(0.9) translateX(-30px) translateY(50px);
    }
    75% {
        transform: translate(-50%, -50%) scale(1.1) translateX(50px) translateY(20px);
    }
    100% {
        transform: translate(-50%, -50%) scale(1) translateX(-20px) translateY(-40px);
    }
}

/* ---------- Hero section cosmic glow overlay ---------- */
.hero::after {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
    animation: cosmicPulse 8s ease-in-out infinite;
    pointer-events: none;
}

.hero::before {
    content: '';
    position: absolute;
    bottom: -50px;
    left: -150px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(180, 30, 50, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
    animation: cosmicPulse 10s ease-in-out infinite reverse;
    pointer-events: none;
}

@keyframes cosmicPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
}

/* ---------- Section ambient glow accents ---------- */
.services::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -200px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
    animation: cosmicPulse 12s ease-in-out infinite;
}

.cta-section::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 60%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
    animation: cosmicPulse 15s ease-in-out infinite;
}

.stats-section::before {
    content: '';
    position: absolute;
    top: -100px;
    left: -100px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 100, 100, 0.04) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

/* Ensure content is above galaxy effects */
.hero-content,
.container,
.nav,
.section > .container,
.footer > .container {
    position: relative;
    z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
    [data-animate],
    [data-stagger-parent] > * {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
        transition: none !important;
    }

    .gradient-text-animated {
        animation: none;
    }

    #galaxy-canvas {
        display: none;
    }

    .ambient-orb {
        animation: none;
    }

    .hero::after,
    .hero::before,
    .services::after,
    .cta-section::after {
        animation: none;
    }
}

@media (max-width: 768px) {
    #galaxy-canvas {
        opacity: 0.5;
    }

    .ambient-orb {
        filter: blur(60px);
        opacity: 0.7;
    }
}
