/**
 * Animation Library
 * Scroll-triggered reveals, hover effects, and dynamic animations
 */

/* =============================================
   SCROLL-TRIGGERED ANIMATIONS
   ============================================= */

/* Base state for animated elements */
/* Note: GSAP handles initial opacity via gsap.from() - don't hide with CSS */
[data-animate] {
    transition:
        opacity 0.8s var(--ease-out-expo),
        transform 0.8s var(--ease-out-expo),
        filter 0.8s var(--ease-out-expo);
    will-change: opacity, transform;
}

/* Visible state */
[data-animate].is-visible {
    opacity: 1;
}

/* Fade Up */
[data-animate="fade-up"] {
    transform: translateY(50px);
}

[data-animate="fade-up"].is-visible {
    transform: translateY(0);
}

/* Fade Down */
[data-animate="fade-down"] {
    transform: translateY(-50px);
}

[data-animate="fade-down"].is-visible {
    transform: translateY(0);
}

/* Fade Left (comes from right) */
[data-animate="fade-left"] {
    transform: translateX(50px);
}

[data-animate="fade-left"].is-visible {
    transform: translateX(0);
}

/* Fade Right (comes from left) */
[data-animate="fade-right"] {
    transform: translateX(-50px);
}

[data-animate="fade-right"].is-visible {
    transform: translateX(0);
}

/* Scale Up */
[data-animate="scale"] {
    transform: scale(0.9);
}

[data-animate="scale"].is-visible {
    transform: scale(1);
}

/* Scale Down */
[data-animate="scale-down"] {
    transform: scale(1.1);
}

[data-animate="scale-down"].is-visible {
    transform: scale(1);
}

/* Blur Reveal */
[data-animate="blur"] {
    filter: blur(15px);
    transform: scale(0.95);
}

[data-animate="blur"].is-visible {
    filter: blur(0);
    transform: scale(1);
}

/* Rotate In */
[data-animate="rotate"] {
    transform: rotate(-10deg) scale(0.9);
}

[data-animate="rotate"].is-visible {
    transform: rotate(0) scale(1);
}

/* Flip In */
[data-animate="flip"] {
    transform: perspective(1000px) rotateY(-30deg);
}

[data-animate="flip"].is-visible {
    transform: perspective(1000px) rotateY(0);
}

/* Zoom */
[data-animate="zoom"] {
    transform: scale(0.5);
}

[data-animate="zoom"].is-visible {
    transform: scale(1);
}

/* =============================================
   STAGGER DELAYS
   ============================================= */

[data-delay="100"] { transition-delay: 0.1s; }
[data-delay="200"] { transition-delay: 0.2s; }
[data-delay="300"] { transition-delay: 0.3s; }
[data-delay="400"] { transition-delay: 0.4s; }
[data-delay="500"] { transition-delay: 0.5s; }
[data-delay="600"] { transition-delay: 0.6s; }
[data-delay="700"] { transition-delay: 0.7s; }
[data-delay="800"] { transition-delay: 0.8s; }

/* =============================================
   DURATION MODIFIERS
   ============================================= */

[data-duration="fast"] {
    transition-duration: 0.4s;
}

[data-duration="slow"] {
    transition-duration: 1.2s;
}

[data-duration="slower"] {
    transition-duration: 1.6s;
}

/* =============================================
   KEYFRAME ANIMATIONS
   ============================================= */

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-up {
    animation: fadeInUp 0.8s var(--ease-out-expo) forwards;
}

/* Fade In Down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-down {
    animation: fadeInDown 0.8s var(--ease-out-expo) forwards;
}

/* Fade In Scale */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-scale {
    animation: fadeInScale 0.8s var(--ease-out-expo) forwards;
}

/* Blur In */
@keyframes blurIn {
    from {
        opacity: 0;
        filter: blur(20px);
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        filter: blur(0);
        transform: scale(1);
    }
}

.animate-blur-in {
    animation: blurIn 1s var(--ease-out-expo) forwards;
}

/* Float Animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

.animate-float {
    animation: float 4s ease-in-out infinite;
}

/* Pulse Glow */
@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(212, 175, 55, 0.5);
    }
}

.animate-pulse-glow {
    animation: pulseGlow 3s ease-in-out infinite;
}

/* Bounce */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

.animate-bounce {
    animation: bounce 2s ease infinite;
}

/* Shake */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.animate-shake {
    animation: shake 0.6s ease;
}

/* Spin */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Slide In Left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-left {
    animation: slideInLeft 0.8s var(--ease-out-expo) forwards;
}

/* Slide In Right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-right {
    animation: slideInRight 0.8s var(--ease-out-expo) forwards;
}

/* =============================================
   HOVER ANIMATIONS
   ============================================= */

/* Lift Effect */
.hover-lift {
    transition: transform 0.4s var(--ease-out-expo), box-shadow 0.4s var(--ease-out-expo);
}

.hover-lift:hover {
    transform: translateY(-10px);
    box-shadow: var(--glass-shadow-xl);
}

/* Scale Effect */
.hover-scale {
    transition: transform 0.3s var(--spring);
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Rotate Effect */
.hover-rotate {
    transition: transform 0.4s var(--spring);
}

.hover-rotate:hover {
    transform: rotate(5deg) scale(1.02);
}

/* Glow Effect */
.hover-glow {
    transition: box-shadow 0.4s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.4);
}

/* Tilt 3D Effect */
.hover-tilt {
    transition: transform 0.4s var(--ease-out-expo);
    transform-style: preserve-3d;
}

.hover-tilt:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* =============================================
   PARALLAX ELEMENTS
   ============================================= */

[data-parallax] {
    will-change: transform;
    transition: transform 0.1s linear;
}

/* =============================================
   TEXT ANIMATIONS
   ============================================= */

/* Underline Slide */
.text-underline-slide {
    position: relative;
    display: inline-block;
}

.text-underline-slide::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--gradient-blue-start), var(--gradient-gold-start));
    transition: width 0.4s var(--ease-out-expo);
}

.text-underline-slide:hover::after {
    width: 100%;
}

/* Letter Spacing Effect */
.hover-letter-space {
    transition: letter-spacing 0.3s ease;
}

.hover-letter-space:hover {
    letter-spacing: 2px;
}

/* =============================================
   COUNTER ANIMATION
   ============================================= */

.counter-animate {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* =============================================
   LOADING ANIMATIONS
   ============================================= */

/* Skeleton Loading */
@keyframes skeletonPulse {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 25%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0.1) 75%
    );
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    border-radius: 8px;
}

/* =============================================
   PAGE TRANSITION
   ============================================= */

.page-transition-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.4s var(--ease-out-expo);
}

.page-transition-exit {
    opacity: 1;
}

.page-transition-exit-active {
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* =============================================
   REDUCED MOTION
   ============================================= */

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

    [data-animate] {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }

    .hover-lift:hover,
    .hover-scale:hover,
    .hover-rotate:hover,
    .hover-tilt:hover {
        transform: none;
    }
}

/* =============================================
   MOBILE OPTIMIZATION
   ============================================= */

@media (max-width: 768px) {
    [data-animate] {
        transition-duration: 0.5s;
    }

    [data-animate="fade-up"],
    [data-animate="fade-down"] {
        transform: translateY(30px);
    }

    [data-animate="fade-left"],
    [data-animate="fade-right"] {
        transform: translateX(30px);
    }

    .hover-lift:hover {
        transform: translateY(-5px);
    }

    .animate-float {
        animation-duration: 6s;
    }
}

/* =============================================
   PREMIUM ANIMATIONS - GSAP ENHANCED
   ============================================= */

/* Premium Color Palette Variables */
:root {
    --navy-deep: #0A1628;
    --navy-mid: #1E3A5F;
    --blue-vibrant: #3B82F6;
    --blue-bright: #60A5FA;
    --gold-deep: #B8860B;
    --gold-vibrant: #FFD700;
    --gold-light: #FFF3B0;
}

/* =============================================
   GOLD SHIMMER EFFECT
   ============================================= */

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

/* Gold shimmer - only apply to headings that explicitly use it */
h1.gold-shimmer,
h2.gold-shimmer,
h3.gold-shimmer,
.gold-shimmer-text {
    background: linear-gradient(
        90deg,
        var(--gold-deep) 0%,
        var(--gold-vibrant) 25%,
        var(--gold-light) 50%,
        var(--gold-vibrant) 75%,
        var(--gold-deep) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: goldShimmer 6s linear infinite;
}

/* Simple gold color without shimmer effect (for body text) */
.gold-text {
    color: var(--gold-vibrant) !important;
    -webkit-text-fill-color: var(--gold-vibrant);
}

.shimmer-active h1.gold-shimmer,
.shimmer-active h2.gold-shimmer,
.shimmer-active h3.gold-shimmer,
h1.gold-shimmer.shimmer-active,
h2.gold-shimmer.shimmer-active,
h3.gold-shimmer.shimmer-active {
    animation: goldShimmer 6s linear infinite;
}

/* =============================================
   ANIMATED GRADIENT BORDER
   ============================================= */

@keyframes borderMove {
    0% { background-position: 0% center; }
    100% { background-position: 300% center; }
}

.animated-border {
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    border: none !important;
}

.animated-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 22px;
    background: linear-gradient(
        90deg,
        var(--gold-deep),
        var(--gold-vibrant),
        var(--gold-light),
        var(--gold-vibrant),
        var(--gold-deep)
    );
    background-size: 300% 100%;
    animation: borderMove 10s linear infinite;
    z-index: -1;
    opacity: 0.8;
}

.animated-border::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background: inherit;
    z-index: -1;
}

/* =============================================
   FLOATING ORBS (GSAP ENHANCED)
   ============================================= */

.floating-orbs-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.floating-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.4;
    will-change: transform;
}

.orb-gold {
    background: radial-gradient(circle, var(--gold-vibrant) 0%, transparent 70%);
}

.orb-blue {
    background: radial-gradient(circle, var(--blue-vibrant) 0%, transparent 70%);
}

.orb-1 { width: 400px; height: 400px; top: 10%; left: 10%; }
.orb-2 { width: 300px; height: 300px; top: 60%; right: 10%; }
.orb-3 { width: 250px; height: 250px; bottom: 20%; left: 30%; }
.orb-4 { width: 350px; height: 350px; top: 30%; right: 30%; }
.orb-5 { width: 200px; height: 200px; bottom: 10%; right: 20%; }

/* =============================================
   GOLD PARTICLES
   ============================================= */

.gold-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.gold-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--gold-vibrant);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--gold-vibrant), 0 0 20px rgba(255, 215, 0, 0.5);
    pointer-events: none;
    will-change: transform, opacity;
}

/* Larger particle variants */
.gold-particle.large {
    width: 6px;
    height: 6px;
    box-shadow: 0 0 15px var(--gold-vibrant), 0 0 30px rgba(255, 215, 0, 0.6);
}

.gold-particle.small {
    width: 2px;
    height: 2px;
    box-shadow: 0 0 6px var(--gold-vibrant);
}

/* =============================================
   PARALLAX DEPTH SECTIONS
   ============================================= */

.parallax-section {
    position: relative;
    overflow: hidden;
}

.parallax-bg {
    position: absolute;
    inset: -20%;
    will-change: transform;
}

.parallax-content {
    position: relative;
    z-index: 2;
}

/* =============================================
   GLASS GLOW ON HOVER
   ============================================= */

.glass-glow {
    transition: box-shadow 0.4s ease, border-color 0.4s ease;
}

.glass-glow:hover {
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.35), 0 25px 60px rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 215, 0, 0.5);
}

/* =============================================
   PREMIUM BUTTON EFFECTS
   ============================================= */

@keyframes buttonPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.4);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(255, 215, 0, 0);
    }
}

.btn-gold-pulse {
    animation: buttonPulse 2s ease-in-out infinite;
}

.btn-gold-pulse:hover {
    animation: none;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

/* =============================================
   SPLIT TEXT ANIMATION SUPPORT
   ============================================= */

.split-text {
    overflow: hidden;
}

.split-text .char,
.split-text .word {
    display: inline-block;
    will-change: transform, opacity;
}

/* =============================================
   REVEAL LINE ANIMATION
   ============================================= */

@keyframes revealLine {
    0% { transform: scaleX(0); }
    100% { transform: scaleX(1); }
}

.reveal-line {
    transform-origin: left center;
    animation: revealLine 0.8s var(--ease-out-expo) forwards;
}

.reveal-line.from-right {
    transform-origin: right center;
}

.reveal-line.from-center {
    transform-origin: center center;
}

/* =============================================
   GRADIENT TEXT ANIMATION
   ============================================= */

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

/* Gradient text - only apply to headings */
h1.gradient-text-animated,
h2.gradient-text-animated,
h3.gradient-text-animated,
.gradient-text-animated-heading {
    background: linear-gradient(
        90deg,
        var(--blue-vibrant),
        var(--gold-vibrant),
        var(--blue-bright),
        var(--gold-light)
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientFlow 4s ease infinite;
}

/* =============================================
   CARD REVEAL ANIMATIONS
   ============================================= */

@keyframes cardReveal {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card-reveal {
    animation: cardReveal 0.6s var(--ease-out-expo) forwards;
}

/* Stagger delays for cards */
.card-reveal:nth-child(1) { animation-delay: 0s; }
.card-reveal:nth-child(2) { animation-delay: 0.1s; }
.card-reveal:nth-child(3) { animation-delay: 0.2s; }
.card-reveal:nth-child(4) { animation-delay: 0.3s; }
.card-reveal:nth-child(5) { animation-delay: 0.4s; }
.card-reveal:nth-child(6) { animation-delay: 0.5s; }

/* =============================================
   MAGNETIC HOVER EFFECT
   ============================================= */

.magnetic {
    transition: transform 0.3s ease;
    will-change: transform;
}

/* =============================================
   PREMIUM SECTION TRANSITIONS
   ============================================= */

.section-fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s var(--ease-out-expo);
}

.section-fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* =============================================
   HERO GLASS CARD ENHANCEMENT
   ============================================= */

.hero-glass-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: 40px 60px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
}

/* =============================================
   CTA SECTION SPECIAL EFFECTS
   ============================================= */

.cta-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

/* =============================================
   MOBILE OPTIMIZATIONS FOR PREMIUM EFFECTS
   ============================================= */

@media (max-width: 768px) {
    .floating-orb {
        opacity: 0.25;
        filter: blur(40px);
    }

    .orb-1 { width: 200px; height: 200px; }
    .orb-2 { width: 150px; height: 150px; }
    .orb-3 { width: 120px; height: 120px; }
    .orb-4 { width: 180px; height: 180px; }
    .orb-5 { width: 100px; height: 100px; }

    .gold-particle {
        width: 3px;
        height: 3px;
    }

    .hero-glass-card {
        padding: 25px 30px;
    }

    .animated-border::before {
        animation-duration: 6s;
    }
}

/* Disable premium effects for reduced motion */
@media (prefers-reduced-motion: reduce) {
    .gold-shimmer,
    .animated-border::before,
    .gradient-text-animated {
        animation: none !important;
    }

    .floating-orb,
    .gold-particle {
        display: none;
    }
}
