/**
 * GSAP Animation Styles
 * Supporting styles for scroll animations
 */

/* Prevent flash of unstyled content */
[data-scroll-animate],
[data-hero-animate] {
    will-change: transform, opacity;
}

/* Smooth scrolling for better animation experience */
html {
    scroll-behavior: smooth;
}

/* Performance optimizations */
.gsap-animated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Animation states for debugging */
.gsap-debug .gsap-animated {
    outline: 2px dashed rgba(255, 0, 0, 0.3);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    [data-scroll-animate],
    [data-hero-animate] {
        animation: none !important;
        transition: none !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Hero section specific styles */
.hero-section {
    position: relative;
    overflow: hidden;
}

.hero-section [data-hero-animate] {
    opacity: 0;
}

/* Hide hero elements immediately to prevent flash before JavaScript loads */
.hero-animate {
    opacity: 0;
}

.hero-nav {
    opacity: 0;
    transform: translateY(-30px);
}

.hero-bg {
    opacity: 0;
}

.hero-content {
    opacity: 0;
    transform: translateY(50px);
}

/* Hide stagger items in hero */
.hero-content .stagger-item {
    opacity: 0;
    transform: translateY(100px);
}

.hero-deco {
    opacity: 0;
    transform: scale(0.8);
}

/* Override when animations are ready */
.hero-animate.gsap-ready {
    opacity: 1;
}

.hero-nav.gsap-ready {
    opacity: 1;
    transform: translateY(0);
}

.hero-bg.gsap-ready {
    opacity: 1;
}

.hero-content.gsap-ready {
    opacity: 1;
    transform: translateY(0);
}

/* Show stagger items when ready */
.hero-content .stagger-item.gsap-ready {
    opacity: 1;
    transform: translateY(0);
}

.hero-deco.gsap-ready {
    opacity: 1;
    transform: scale(1);
}

/* Staggered animation groups */
.animation-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.animation-group [data-scroll-group] {
    flex: 1;
    min-width: 200px;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    [data-scroll-animate],
    [data-hero-animate] {
        /* Reduce animation intensity on mobile */
        transform: translateZ(0);
    }
}

/* Loading state */
.page-loading [data-scroll-animate],
.page-loading [data-hero-animate] {
    opacity: 0;
    pointer-events: none;
}

/* Animation completion state */
.animation-complete [data-scroll-animate],
.animation-complete [data-hero-animate] {
    opacity: 1;
    transform: none;
}

/* Custom animation classes for common patterns */
.fade-in-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Parallax container */
.parallax-container {
    overflow: hidden;
    position: relative;
}

.parallax-element {
    will-change: transform;
}

/* Text reveal animations */
.text-reveal {
    overflow: hidden;
}

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

/* Image reveal animations */
.image-reveal {
    overflow: hidden;
    position: relative;
}

.image-reveal img {
    transform: scale(1.1);
    transition: transform 0.8s ease;
}

.image-reveal.visible img {
    transform: scale(1);
}

/* Button hover animations */
.animated-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.animated-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.animated-button:hover::before {
    left: 100%;
}

/* Card animations */
.animated-card {
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.6s ease;
}

.animated-card.visible {
    transform: translateY(0);
    opacity: 1;
}

.animated-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Loading spinner for dynamic content */
.gsap-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scroll indicator */
.scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    z-index: 9999;
}

.scroll-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1);
    width: 0%;
    transition: width 0.1s ease;
}

/* Animation performance monitoring */
.gsap-performance-warning {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #ff6b6b;
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-size: 12px;
    z-index: 10000;
    display: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    [data-scroll-animate],
    [data-hero-animate] {
        border: 1px solid currentColor;
    }
}

/* Print styles - disable animations */
@media print {
    [data-scroll-animate],
    [data-hero-animate] {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
        transition: none !important;
    }
}
