/**
 * Performance Optimization CSS
 * PT Teknindo Geosistem Unggul - Lazy Loading & WebP Support
 */

/* Lazy Loading Styles */
.lazy-load {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    background-color: #f5f5f5;
    background-image: linear-gradient(90deg, #f5f5f5 25%, #e0e0e0 50%, #f5f5f5 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

.lazy-loaded {
    opacity: 1;
    background: none;
    animation: none;
}

@keyframes loading-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* WebP Support Styles */
.webp-support .hero-image {
    background-image: url('../images/hero-bg.webp');
}

.no-webp-support .hero-image {
    background-image: url('../images/hero-bg.jpg');
}

/* Responsive Images */
.responsive-image {
    width: 100%;
    height: auto;
    display: block;
}

/* Partner Carousel Optimization */
.partner-carousel {
    overflow: hidden;
}

.partner-carousel .owl-item {
    display: flex;
    align-items: center;
    justify-content: center;
}

.partner-carousel img {
    max-width: 100%;
    max-height: 80px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: grayscale(100%);
    transition: filter 0.3s ease, transform 0.3s ease;
}

.partner-carousel img:hover {
    filter: grayscale(0%);
    transform: scale(1.05);
}

/* Critical CSS - Above the fold content */
.header-critical {
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
}

.hero-content {
    position: relative;
    z-index: 2;
    color: white;
    text-align: center;
    padding: 2rem;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(11, 102, 35, 0.8), rgba(230, 115, 0, 0.6));
    z-index: 1;
}

/* Performance Optimizations */
.container-fluid {
    max-width: 1400px;
    margin: 0 auto;
}

/* Reduce layout shifts */
.logo-container {
    width: 200px;
    height: 60px;
    display: flex;
    align-items: center;
}

.logo-container img {
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
}

/* Optimize button styles */
.btn-primary {
    background: linear-gradient(135deg, #0B6623, #e67300);
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(11, 102, 35, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(11, 102, 35, 0.4);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .hero-section {
        background-attachment: scroll; /* Better performance on mobile */
    }
    
    .partner-carousel img {
        max-height: 60px;
    }
    
    .lazy-load {
        min-height: 200px; /* Prevent layout shift on mobile */
    }
}

/* Print Styles */
@media print {
    .lazy-load {
        opacity: 1;
        background: none;
    }
    
    .hero-section {
        background: none !important;
        color: black !important;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .lazy-load,
    .btn-primary,
    .partner-carousel img {
        transition: none;
        animation: none;
    }
}

/* Focus styles for keyboard navigation */
.btn:focus,
a:focus {
    outline: 2px solid #0B6623;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hero-overlay {
        background: rgba(0, 0, 0, 0.8);
    }
    
    .btn-primary {
        background: #0B6623;
        border: 2px solid white;
    }
}