/* css/pages/home.css - Smooth Subtle Animations */

/* ====================
   RESET & BASE ANIMATIONS
   ==================== */

/* Prevent initial flash of unstyled content */
main {
    opacity: 0;
    animation: fadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.1s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ====================
   HERO CAROUSEL - SMOOTH TRANSITIONS
   ==================== */

.hero-carousel {
    position: relative;
    overflow: hidden;
}

.carousel-slides {
    position: relative;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.carousel-slide.active {
    position: relative;
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
    transition-delay: 0.2s;
}

/* Progress bar with smoother animation */
.carousel-progress-bar {
    transition: width 4.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-progress-bar.active {
    animation: progressGlow 3s infinite ease-in-out;
}

@keyframes progressGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(var(--primary-color-rgb, 0, 122, 255), 0.5);
    }
    50% {
        box-shadow: 0 0 15px rgba(var(--primary-color-rgb, 0, 122, 255), 0.8);
    }
}


/* ====================
   FILTER BAR - STAGGERED ENTRANCE
   ==================== */

.bar {
    opacity: 0;
    animation: slideUpFade 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.3s;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger children with CSS instead of nth-child */
.filter-field {
    opacity: 0;
    transform: translateY(10px);
    animation: filterFieldAppear 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Use data attributes or classes for better control */
.filter-field[data-delay="1"] { animation-delay: 0.4s; }
.filter-field[data-delay="2"] { animation-delay: 0.5s; }
.filter-field[data-delay="3"] { animation-delay: 0.6s; }
.filter-field[data-delay="4"] { animation-delay: 0.7s; }
.filter-field[data-delay="5"] { animation-delay: 0.8s; }

@keyframes filterFieldAppear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth form element interactions */
.filter-dropdown, .filter-input {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, box-shadow;
}

.filter-dropdown:hover, .filter-input:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.filter-dropdown:focus, .filter-input:focus {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    outline: none;
}

.bar-button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, box-shadow;
}

.bar-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.bar-button:active {
    transform: translateY(-1px) scale(0.98);
    transition-duration: 0.1s;
}

/* ====================
   SECTIONS - SCROLL ANIMATIONS
   ==================== */

/* Base section styling for scroll animations */
.video-section,
.quote-section,
.admin-updates-section {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

/* When section comes into view */
.section-in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Section headers with smooth underline */
.video-header,
.quote-header,
.admin-updates-header {
    position: relative;
    display: inline-block;
}

.video-header::after,
.quote-header::after,
.admin-updates-header::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 0;
    height: 3px;
    border-radius: 2px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: 0.3s;
}

.section-in-view .video-header::after,
.section-in-view .quote-header::after,
.section-in-view .admin-updates-header::after {
    width: 100%;
}

/* ====================
   ADMIN UPDATES CAROUSEL
   ==================== */

.admin-updates-carousel .carousel-slide {
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-updates-carousel .carousel-slide:not(.active) {
    opacity: 0;
    transform: translateX(15px);
}

.admin-updates-carousel .carousel-slide.active {
    opacity: 1;
    transform: translateX(0);
}

.admin-update-item {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.admin-update-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

/* ====================
   CONTENT CARDS
   ==================== */

.card {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    animation: cardReveal 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardReveal {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

/* Stagger card animations */
.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }




/* ====================
   OPTIMIZATION & PERFORMANCE
   ==================== */

/* Use will-change sparingly for important animations */
.carousel-slide,
.filter-field,
.card,
.admin-update-item {
    will-change: transform, opacity;
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    main,
    .bar,
    footer,
    .section-in-view {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
        transition: none !important;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .carousel-slide {
        transition-duration: 0.5s;
    }
    
    .filter-field {
        animation-duration: 0.3s;
    }
    
    .section-in-view {
        transition-duration: 0.6s;
    }
}

/* ====================
   LOADING STATES
   ==================== */

.loading-shimmer {
    animation: shimmer 2s infinite linear;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 400% 100%;
}

@keyframes shimmer {
    0% {
        background-position: -400% 0;
    }
    100% {
        background-position: 400% 0;
    }
}