/* ==========================================================================
   ARO Performance — Animation Utilities
   ========================================================================== */

/* ==========================================================================
   PAGE TRANSITIONS (Barba.js)
   ========================================================================== */

/*
 * Simple fade transitions - only <main> transitions.
 * Header and footer stay fixed throughout.
 * will-change is set dynamically by JS during transitions.
 */

/* Container base styles */
[data-barba="container"] {
    /* will-change set by JS only during transition for performance */
}

/* Ensure leaving container doesn't affect layout during fade */
.barba-leave-active {
    pointer-events: none;
}

/* ==========================================================================
   HERO ANIMATION
   ========================================================================== */

/* Hero word spans - created by JS for staggered animation */
.hero-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    will-change: transform, opacity;
}

/* Hero elements animate with GSAP */
.hero-subtitle,
.hero-cta-row {
    will-change: transform, opacity;
}

/* Reduced motion: show everything immediately, no animation */
@media (prefers-reduced-motion: reduce) {
    .hero-word {
        opacity: 1 !important;
        transform: none !important;
    }

    .hero-title,
    .hero-subtitle,
    .hero-cta-row {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ==========================================================================
   SCROLL PROGRESS INDICATOR
   ========================================================================== */

/* Wrapper - positioned at top of viewport */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    z-index: 19; /* Below header (20), below modals (100+), above content */
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Hidden state for short pages */
.scroll-progress--hidden {
    opacity: 0;
}

/* The actual progress bar */
.scroll-progress-bar {
    width: 100%;
    height: 100%;
    background: var(--aro-seafoam);
    transform: scaleX(0);
    transform-origin: left center;
    will-change: transform;
}

/* Reduced motion: instant updates, no fade transition */
@media (prefers-reduced-motion: reduce) {
    .scroll-progress {
        transition: none;
    }

    .scroll-progress-bar {
        will-change: auto; /* Don't hint at animation */
    }
}

/* ==========================================================================
   RIPPLE CLICK EFFECT
   ========================================================================== */

/* Container for ripple effect - added by JS */
.ripple-container {
    position: relative;
    overflow: hidden;
}

/* The ripple element itself */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(190, 219, 223, 0.3) 0%,
        rgba(190, 219, 223, 0.1) 50%,
        transparent 70%
    );
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
    will-change: transform, opacity;
}

/* Fallback CSS animation when GSAP not available */
.ripple--animate {
    animation: ripple-expand 0.4s ease-out forwards;
}

@keyframes ripple-expand {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.2;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

/* Reduced motion: disable ripples */
@media (prefers-reduced-motion: reduce) {
    .ripple {
        display: none !important;
    }
}

/* ==========================================================================
   SCROLL-TRIGGERED CONTENT REVEALS (Phase 3.1)
   ========================================================================== */

/*
 * Initial states for reveal elements
 * GSAP handles the actual animation, these are fallbacks
 */

/* All reveal types start hidden - GSAP sets inline styles */
[data-reveal] {
    will-change: transform, opacity;
}

/* Revealed state (added after animation completes) */
[data-reveal].is-revealed {
    opacity: 1 !important;
    transform: none !important;
}

/* Reduced motion: simple opacity fade, no transform animation */
@media (prefers-reduced-motion: reduce) {
    [data-reveal] {
        transform: none !important;
        transition: opacity 0.3s ease-out;
    }

    [data-reveal].is-revealed {
        opacity: 1 !important;
    }
}

/* No-JS fallback: show all content */
.no-js [data-reveal] {
    opacity: 1;
    transform: none;
}
