/* ===== RESPONSIVE DESIGN & PERFORMANCE OPTIMIZATIONS ===== */

/* Performance Optimizations */
* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Lazy Loading */
img[data-src] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[data-src].loaded {
    opacity: 1;
}

/* Critical CSS Optimizations */
.above-fold {
    will-change: transform;
}

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

/* Container Queries Support */
@container (max-width: 768px) {
    .container-responsive {
        padding: 10px;
    }
}

/* Mobile First Responsive Design */

/* Extra Small Devices (phones, 320px and up) */
@media (min-width: 320px) {
    .container {
        padding: 0 10px;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .section-description {
        font-size: 0.95rem;
    }
}

/* Small Devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .container {
        padding: 0 15px;
    }
    
    .section-title {
        font-size: 2.2rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-buttons {
        flex-direction: row;
        justify-content: center;
    }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .container {
        padding: 0 20px;
    }
    
    .section-title {
        font-size: 2.8rem;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .about-content {
        grid-template-columns: 1fr 1fr;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .container {
        max-width: 960px;
        margin: 0 auto;
    }
    
    .section-title {
        font-size: 3rem;
    }
    
    .hero-title {
        font-size: 4rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .news-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
    }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
    
    .hero-title {
        font-size: 4.5rem;
    }
}

/* Ultra Wide Screens (1400px and up) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo-image,
    .partner-logo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .hover-lift:hover,
    .modern-card:hover,
    .service-card:hover {
        transform: none;
    }
    
    .btn-modern,
    .hero-btn,
    .service-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .floating-btn {
        width: 56px;
        height: 56px;
    }
    
    .nav-link {
        padding: 15px 10px;
    }
}

/* Landscape Orientation */
@media (orientation: landscape) and (max-height: 500px) {
    .hero-section {
        min-height: 500px;
        height: 100vh;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
}

/* Print Styles */
@media print {
    .modern-header,
    .floating-actions,
    .hero-bg-elements,
    .floating-elements {
        display: none !important;
    }
    
    .hero-section {
        height: auto;
        min-height: auto;
        page-break-after: always;
    }
    
    .section-title {
        color: #000 !important;
    }
    
    .btn-modern {
        border: 2px solid #000;
        color: #000 !important;
        background: transparent !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-dark: #ffffff;
        --text-light: #cccccc;
        --light-color: #1a1a1a;
    }
    
    .about-section,
    .services-section,
    .news-section {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    }
    
    .modern-card,
    .service-card,
    .news-card {
        background: #2d2d2d;
        border-color: rgba(219, 179, 101, 0.2);
    }
}

/* Reduced Motion */
@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;
    }
    
    .parallax {
        background-attachment: scroll;
    }
    
    .floating-element,
    .hero-shape,
    .loading-spinner {
        animation: none !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .btn-modern,
    .hero-btn {
        border: 2px solid currentColor;
    }
    
    .modern-card,
    .service-card {
        border: 2px solid var(--primary-color);
    }
    
    .section-title::after {
        height: 6px;
    }
}

/* Performance Critical Styles */
.critical-path {
    contain: layout style paint;
}

.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* Intersection Observer Fallback */
.no-intersection-observer .fade-in,
.no-intersection-observer .slide-in-left,
.no-intersection-observer .slide-in-right {
    opacity: 1;
    transform: none;
}

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Error States */
.error-state {
    padding: 40px;
    text-align: center;
    color: #e74c3c;
}

.error-state i {
    font-size: 3rem;
    margin-bottom: 20px;
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 10000;
}

.skip-link:focus {
    top: 6px;
}

/* Focus Management */
.focus-trap {
    position: relative;
}

.focus-trap::before,
.focus-trap::after {
    content: '';
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* Performance Monitoring */
.perf-mark {
    display: none;
}

/* Browser Specific Fixes */
@supports (-webkit-appearance: none) {
    .search-input,
    .newsletter-input {
        -webkit-appearance: none;
    }
}

@supports (backdrop-filter: blur(10px)) {
    .modern-header {
        backdrop-filter: blur(20px);
    }
}

/* Container Queries (Future Support) */
@supports (container-type: inline-size) {
    .responsive-container {
        container-type: inline-size;
    }
}
