/**
 * Animation Styles & Keyframes
 * Complementary CSS animations for GSAP-enhanced elements
 */

/* ============================================
   CONTENT VISIBILITY FALLBACKS
   ============================================ */

/* Ensure content is always visible by default */
body {
    opacity: 1 !important;
    visibility: visible !important;
}

body.loaded > *:not(.page-loader) {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Prevent animations from hiding content permanently */
.fade-in,
.fade-in-up,
.fade-in-down,
.scale-in,
.slide-in {
    opacity: 1;
    visibility: visible;
}

/* Only hide if animation hasn't started */
.fade-in:not(.animated),
.fade-in-up:not(.animated),
.fade-in-down:not(.animated),
.scale-in:not(.animated),
.slide-in:not(.animated) {
    opacity: 1;
    visibility: visible;
}

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

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Slide Up */
@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Slide Down */
@keyframes slideDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Slide Left */
@keyframes slideLeft {
    from {
        transform: translateX(30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide Right */
@keyframes slideRight {
    from {
        transform: translateX(-30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Rotate In */
@keyframes rotateIn {
    from {
        transform: rotate(-180deg) scale(0.8);
        opacity: 0;
    }
    to {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
}

/* Bounce In */
@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Pulse */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

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

/* Shimmer */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Glow */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(26, 95, 60, 0.5),
                    0 0 10px rgba(26, 95, 60, 0.3),
                    0 0 15px rgba(26, 95, 60, 0.2);
    }
    50% {
        box-shadow: 0 0 10px rgba(26, 95, 60, 0.8),
                    0 0 20px rgba(26, 95, 60, 0.5),
                    0 0 30px rgba(26, 95, 60, 0.3);
    }
}

/* Gradient Shift */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Morphing Blob */
@keyframes morphBlob {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

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

/* Wobble */
@keyframes wobble {
    0%, 100% {
        transform: translateX(0%);
    }
    15% {
        transform: translateX(-25%) rotate(-5deg);
    }
    30% {
        transform: translateX(20%) rotate(3deg);
    }
    45% {
        transform: translateX(-15%) rotate(-3deg);
    }
    60% {
        transform: translateX(10%) rotate(2deg);
    }
    75% {
        transform: translateX(-5%) rotate(-1deg);
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Animation Utility Classes */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-slide-up {
    animation: slideUp 0.8s ease-out forwards;
}

.animate-slide-down {
    animation: slideDown 0.8s ease-out forwards;
}

.animate-slide-left {
    animation: slideLeft 0.8s ease-out forwards;
}

.animate-slide-right {
    animation: slideRight 0.8s ease-out forwards;
}

.animate-scale-in {
    animation: scaleIn 0.6s ease-out forwards;
}

.animate-bounce-in {
    animation: bounceIn 0.8s ease-out forwards;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

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

/* ============================================
   SCROLL REVEAL HELPERS
   ============================================ */

.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

.fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.scale-in {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

.rotate-in {
    opacity: 0;
    transform: rotate(-10deg) scale(0.9);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.rotate-in.visible {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ============================================
   PARALLAX CONTAINERS
   ============================================ */

.parallax-bg {
    will-change: transform;
    transform: translateZ(0);
}

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

/* ============================================
   HOVER EFFECTS
   ============================================ */

.hover-lift {
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.hover-glow {
    transition: box-shadow 0.3s ease-out;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(26, 95, 60, 0.5);
}

.hover-scale {
    transition: transform 0.3s ease-out;
}

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

.hover-rotate {
    transition: transform 0.3s ease-out;
}

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

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

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(26, 95, 60, 0.2);
    border-top-color: var(--green-medium, #28A745);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green-medium, #28A745);
    animation: pulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ============================================
   SCROLL PROGRESS BAR
   ============================================ */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #1A5F3C, #0066CC);
    transform-origin: left;
    z-index: 10000;
    pointer-events: none;
}

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

.animate-text {
    display: inline-block;
}

.text-reveal {
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    opacity: 0;
    transform: translateY(100%);
}

/* ============================================
   IMAGE ANIMATIONS
   ============================================ */

.image-reveal {
    overflow: hidden;
    position: relative;
}

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

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

.image-zoom {
    overflow: hidden;
}

.image-zoom img {
    transition: transform 0.6s ease-out;
}

.image-zoom:hover img {
    transform: scale(1.15);
}

/* ============================================
   BUTTON ANIMATIONS
   ============================================ */

.btn-animated {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease-out;
}

.btn-animated::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-animated:hover::before {
    width: 300px;
    height: 300px;
}

.btn-animated:active {
    transform: scale(0.95);
}

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

.card-animated {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-animated:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* ============================================
   CUSTOM CURSOR (Optional)
   ============================================ */

.custom-cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    border: 2px solid var(--green-medium, #28A745);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: transform 0.3s ease-out, background-color 0.3s ease-out;
}

.custom-cursor.active {
    transform: translate(-50%, -50%) scale(1.5);
    background-color: rgba(26, 95, 60, 0.2);
}

/* ============================================
   RESPONSIVE ANIMATIONS
   ============================================ */

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

    .parallax-bg,
    .parallax-section {
        transform: none !important;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

.will-animate {
    will-change: transform, opacity;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

