/* ============================================
   PERFORMANCE OPTIMIZATIONS
   Critical CSS for faster rendering
   ============================================ */

/* Optimize will-change for animations */
.hero-modern,
.profile-card,
.tech-stack-section {
    will-change: auto;
    /* Only set to specific properties when animating */
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .scanner-line,
    .orbital-ring,
    .marquee-row {
        animation: none !important;
    }

    .profile-card,
    .glass-card,
    .project-card-modern {
        transition: none !important;
    }
}

/* GPU acceleration for smooth animations */
.profile-card,
.scanner-line,
.orbital-ring,
.marquee-row,
.glass-card:hover,
.project-card-modern:hover {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Optimize backdrop-filter rendering */
.glass-card,
.profile-card,
.about-card,
.project-card-modern {
    transform: translateZ(0);
    /* Create new composite layer */
    -webkit-font-smoothing: antialiased;
}

/* Lazy load images optimization */
img[loading="lazy"] {
    min-height: 200px;
    /* Prevent layout shift */
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Optimize font rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Contain layout for better performance */
.project-card-modern,
.glass-card,
.about-card {
    contain: layout style paint;
}

.hero-modern {
    contain: layout style;
}

/* Optimize marquee for better performance */
.marquee-row {
    will-change: transform;
    contain: layout style paint;
}

.marquee-row:hover {
    will-change: auto;
}

/* Reduce repaints */
.tech-icon-item,
.skill-pill,
.tech-tag {
    will-change: transform, opacity, filter;
}

.tech-icon-item:not(:hover),
.skill-pill:not(:hover),
.tech-tag:not(:hover) {
    will-change: auto;
}

/* Optimize button interactions */
.btn-holographic,
.btn-gradient-primary,
.btn-glass {
    will-change: transform, box-shadow;
}

.btn-holographic:not(:hover):not(:active),
.btn-gradient-primary:not(:hover):not(:active),
.btn-glass:not(:hover):not(:active) {
    will-change: auto;
}

/* Content visibility removed — was hiding sections and causing rendering delays */

/* Optimize shadow rendering */
.profile-card,
.project-card-modern:hover,
.glass-card:hover {
    filter: drop-shadow(0 0 0 transparent);
    transition: filter 0.3s ease, transform 0.3s ease;
}

.profile-card:hover,
.project-card-modern:hover,
.glass-card:hover {
    filter: drop-shadow(0 20px 40px rgba(14, 165, 233, 0.2));
}

/* Prevent CLS (Cumulative Layout Shift) */
.hero-modern {
    min-height: 100vh;
}

.profile-card {
    min-height: 450px;
}

/* Optimize gradient rendering */
.hero-title-gradient,
.gradient-text {
    will-change: auto;
    transform: translateZ(0);
}

/* Performance hints for browser */
.neural-background-canvas {
    image-rendering: auto;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

/* Optimize loading states */
.loading {
    /* Removed content-visibility: hidden; as it was causing issues with loader dismissal */
}

/* Critical rendering path optimization */
@media (max-width: 768px) {

    /* Disable expensive effects on mobile */
    .orbital-ring,
    .scanner-line {
        animation-duration: 8s;
        /* Slower animations save battery */
    }

    .profile-card::before,
    .glass-card::before {
        backdrop-filter: blur(8px);
        /* Less blur on mobile */
        -webkit-backdrop-filter: blur(8px);
    }

    /* Reduce particle count handled in JS */
    #neural-background {
        opacity: 0.7;
        /* Lighter effect on mobile */
    }
}

/* Optimize initial paint */
:root {
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Optimize reflows */
* {
    box-sizing: border-box;
}

/* Font display handled by Google Fonts */

/* ============================================
   FORCE ALL AOS ELEMENTS VISIBLE
   Prevents content from being stuck at opacity:0
   when IntersectionObserver or GSAP fails to trigger.
   ============================================ */
[data-aos] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}