/**
 * SyTechZone - Optimized Animations CSS
 * Performance-focused with preserved visual effects
 * @version 4.1.0
 */

/* ============================================
   CSS CUSTOM PROPERTIES
   ============================================ */
:root {
    --anim-fast: 0.3s;
    --anim-normal: 0.5s;
    --anim-slow: 0.7s;
    --ease-out: cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-smooth: cubic-bezier(0.19, 1, 0.22, 1);
    --translate-sm: 20px;
    --translate-md: 30px;
}

/* ============================================
   IMMEDIATE VISIBILITY - Critical for LCP/Speed Index
   ============================================ */
body {
    opacity: 1;
}

/* Cards start visible - animations happen on scroll only */
.hot-featured,
.hot-small-card,
.spotlight-featured,
.exclusive-card,
.news-card,
.post-card,
.news-horizontal-card,
.sidebar-mini-card,
.section-title-wrapper,
.section-title {
    opacity: 1;
    transform: none;
}

/* ============================================
   SCROLL REVEAL - Bidirectional
   ============================================ */
.sr-hidden {
    opacity: 0;
    transform: translateY(var(--translate-md));
    transition: opacity var(--anim-slow) var(--ease-smooth), 
                transform var(--anim-slow) var(--ease-smooth);
}

.sr-visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Staggered delays for children */
.sr-visible:nth-child(1) { transition-delay: 0s; }
.sr-visible:nth-child(2) { transition-delay: 0.06s; }
.sr-visible:nth-child(3) { transition-delay: 0.12s; }
.sr-visible:nth-child(4) { transition-delay: 0.18s; }
.sr-visible:nth-child(5) { transition-delay: 0.24s; }
.sr-visible:nth-child(6) { transition-delay: 0.30s; }

/* Reset delay on fade-out */
.sr-hidden:nth-child(n) { transition-delay: 0s; }

/* ============================================
   SECTION TITLES
   ============================================ */
.section-title,
.section-title-wrapper {
    transition: opacity 0.6s var(--ease-smooth),
                transform 0.6s var(--ease-smooth);
}

.section-underline {
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s var(--ease-smooth) 0.2s;
}

.sr-visible .section-underline,
.section-title.sr-visible + .section-underline {
    transform: scaleX(1);
}

/* ============================================
   CARD HOVER EFFECTS
   ============================================ */
.hot-featured,
.hot-small-card,
.spotlight-featured,
.exclusive-card,
.news-card,
.post-card,
.news-horizontal-card {
    transition: transform var(--anim-fast) var(--ease-out),
                box-shadow var(--anim-fast) var(--ease-out);
}

.hot-featured:hover,
.hot-small-card:hover,
.spotlight-featured:hover,
.exclusive-card:hover,
.news-card:hover,
.post-card:hover,
.news-horizontal-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(255, 13, 13, 0.1);
}

/* Image zoom on hover */
.hot-featured img,
.hot-small-card img,
.spotlight-featured img,
.exclusive-card img,
.news-card img,
.post-card img {
    transition: transform 0.6s var(--ease-smooth);
}

.hot-featured:hover img,
.hot-small-card:hover img,
.spotlight-featured:hover img,
.exclusive-card:hover img,
.news-card:hover img,
.post-card:hover img {
    transform: scale(1.06);
}

/* Overlay animation */
.hot-featured .overlay,
.hot-small-card .overlay,
.spotlight-featured .overlay,
.exclusive-card .overlay {
    transition: background var(--anim-normal) var(--ease-out);
}

.hot-featured:hover .overlay,
.hot-small-card:hover .overlay,
.spotlight-featured:hover .overlay,
.exclusive-card:hover .overlay {
    background: linear-gradient(
        0deg, 
        rgba(0, 0, 0, 0.95) 0%, 
        rgba(0, 0, 0, 0.6) 40%, 
        rgba(0, 0, 0, 0.2) 70%,
        transparent 100%
    );
}

/* ============================================
   GRID STAGGER ANIMATIONS
   ============================================ */
.hot-grid.sr-visible > *,
.exclusives-grid.sr-visible > * {
    animation: fadeSlideUp 0.6s var(--ease-smooth) forwards;
}

.hot-grid.sr-visible > *:nth-child(1) { animation-delay: 0ms; }
.hot-grid.sr-visible > *:nth-child(2) { animation-delay: 80ms; }
.hot-grid.sr-visible > *:nth-child(3) { animation-delay: 160ms; }
.hot-grid.sr-visible > *:nth-child(4) { animation-delay: 240ms; }
.hot-grid.sr-visible > *:nth-child(5) { animation-delay: 320ms; }

.exclusives-grid.sr-visible > *:nth-child(1) { animation-delay: 0ms; }
.exclusives-grid.sr-visible > *:nth-child(2) { animation-delay: 60ms; }
.exclusives-grid.sr-visible > *:nth-child(3) { animation-delay: 120ms; }
.exclusives-grid.sr-visible > *:nth-child(4) { animation-delay: 180ms; }

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(var(--translate-md));
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   CAROUSEL FADE
   ============================================ */
.fading-out {
    opacity: 0 !important;
    transform: scale(0.98) translateY(8px);
    transition: opacity 0.4s var(--ease-out),
                transform 0.4s var(--ease-out);
}

.fading-in {
    opacity: 1 !important;
    transform: scale(1) translateY(0);
    transition: opacity 0.4s var(--ease-out),
                transform 0.4s var(--ease-out);
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
    transition: background 0.3s var(--ease-out),
                box-shadow 0.3s var(--ease-out),
                backdrop-filter 0.3s var(--ease-out);
}

.site-header.scrolled {
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ============================================
   MOBILE MENU
   ============================================ */
.mobile-nav-overlay {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s var(--ease-out), visibility 0.35s;
}

.mobile-nav-overlay.open {
    opacity: 1;
    visibility: visible;
}

.mobile-nav-overlay .mobile-nav-links li {
    opacity: 0;
    transform: translateX(25px);
}

.mobile-nav-overlay.open .mobile-nav-links li {
    animation: fadeSlideLeft 0.35s var(--ease-smooth) forwards;
}

.mobile-nav-overlay.open .mobile-nav-links li:nth-child(1) { animation-delay: 0.04s; }
.mobile-nav-overlay.open .mobile-nav-links li:nth-child(2) { animation-delay: 0.08s; }
.mobile-nav-overlay.open .mobile-nav-links li:nth-child(3) { animation-delay: 0.12s; }
.mobile-nav-overlay.open .mobile-nav-links li:nth-child(4) { animation-delay: 0.16s; }
.mobile-nav-overlay.open .mobile-nav-links li:nth-child(5) { animation-delay: 0.20s; }
.mobile-nav-overlay.open .mobile-nav-links li:nth-child(6) { animation-delay: 0.24s; }

@keyframes fadeSlideLeft {
    from {
        opacity: 0;
        transform: translateX(25px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Hamburger */
.hamburger .hamburger-line {
    transition: all 0.25s var(--ease-out);
}

.hamburger.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

.hamburger.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ============================================
   BUTTONS & INTERACTIONS
   ============================================ */
.btn,
.submit-btn,
.contact-submit-btn {
    transition: transform var(--anim-fast) var(--ease-out),
                box-shadow var(--anim-fast) var(--ease-out);
}

.btn:hover,
.submit-btn:hover,
.contact-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 13, 13, 0.25);
}

.social-icon {
    transition: transform var(--anim-fast) var(--ease-out),
                color var(--anim-fast) var(--ease-out);
}

.social-icon:hover {
    transform: translateY(-2px) scale(1.08);
    color: var(--accent, #ff0d0d);
}

.theme-toggle {
    transition: transform var(--anim-fast) var(--ease-out);
}

.theme-toggle:hover {
    transform: rotate(12deg) scale(1.08);
}

/* ============================================
   FOOTER & PAGE SECTIONS
   ============================================ */
.simple-legal-header,
.simple-legal-section,
.contact-form-column,
.contact-info-column,
.single-post-header,
.post-content,
.author-box,
.comments-section,
.sidebar-widget,
.sidebar-posts {
    transition: opacity var(--anim-slow) var(--ease-smooth),
                transform var(--anim-slow) var(--ease-smooth);
}

/* Footer - NO animations, always visible immediately */
.site-footer {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */
@media (max-width: 768px) {
    :root {
        --translate-sm: 15px;
        --translate-md: 20px;
    }
    
    .sr-hidden {
        transition-duration: 0.4s;
    }
    
    /* Disable hover transforms on touch */
    .hot-featured:hover,
    .hot-small-card:hover,
    .spotlight-featured:hover,
    .exclusive-card:hover,
    .news-card:hover,
    .post-card:hover {
        transform: none;
    }
    
    .hot-featured:active img,
    .hot-small-card:active img {
        transform: scale(1.02);
    }
}

/* ============================================
   REDUCED MOTION - Accessibility
   ============================================ */
@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;
    }
    
    body {
        opacity: 1;
    }
    
    .sr-hidden {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ============================================
   FOCUS STATES - Accessibility
   ============================================ */
:focus-visible {
    outline: 2px solid var(--accent, #ff0d0d);
    outline-offset: 2px;
    transition: outline-offset 0.15s var(--ease-out);
}

a:focus-visible,
button:focus-visible {
    outline-offset: 3px;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}
