/* ========================================
   COMPLETE RESPONSIVE DESIGN
======================================== */

/* Large screens - reduce excessive spacing */
@media (max-width: 1600px) {
    .container {
        max-width: 1200px;
    }
    
    .hero-content {
        max-width: 1300px;
    }
}

/* Base responsive adjustments for larger laptops */
@media (max-width: 1440px) {
    .container {
        max-width: 1100px;
        padding: 0 var(--spacing-lg);
    }
    
    .hero-content {
        max-width: 1200px;
        gap: var(--spacing-2xl);
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-lg);
    }
    
    .floating-card {
        width: 180px;
        height: 90px;
    }
    
    .service-card {
        padding: var(--spacing-xl);
    }
    
    .report-image {
        height: 220px;
    }
}

/* Laptop screens (1024px - 1366px) - Critical for laptop optimization */
@media (max-width: 1366px) {
    :root {
        --spacing-xs: 0.2rem;
        --spacing-sm: 0.4rem;
        --spacing-md: 0.8rem;
        --spacing-lg: 1.2rem;
        --spacing-xl: 1.6rem;
        --spacing-2xl: 2.4rem;
        --spacing-3xl: 3.2rem;
    }
    
    .hero {
        padding: var(--spacing-2xl) 0;
    }
    
    .hero-title {
        font-size: clamp(2rem, 4vw, 3.2rem);
        margin-bottom: var(--spacing-md);
    }
    
    .hero-subtitle {
        font-size: clamp(0.9rem, 1.8vw, 1.1rem);
        margin-bottom: var(--spacing-lg);
    }
    
    .screen-frame {
        transform: rotateY(-10deg) rotateX(3deg);
    }
    
    .metric-card {
        padding: var(--spacing-md);
    }
    
    .metric-value {
        font-size: 1.4rem;
    }
    
    .service-card {
        padding: var(--spacing-lg);
    }
    
    .service-icon {
        width: 70px;
        height: 70px;
    }
    
    .service-icon svg {
        width: 35px;
        height: 35px;
        margin: 17.5px;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-lg);
    }
    
    .section-header h2 {
        font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    }
    
    .floating-elements {
        display: none; /* Remove on smaller laptops for performance */
    }
}

/* Standard laptop/desktop screens */
@media (max-width: 1200px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--spacing-xl);
        padding: var(--spacing-lg);
    }
    
    .dashboard-preview {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
    
    .service-card {
        padding: var(--spacing-md);
    }
    
    .service-icon {
        width: 60px;
        height: 60px;
        margin-bottom: var(--spacing-md);
    }
    
    .service-icon svg {
        width: 30px;
        height: 30px;
        margin: 15px;
    }
    
    .features-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }
    
    .tech-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .services-detailed {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    
    .services-detailed::before {
        display: none;
    }
    
    .reports-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    
    .footer-main {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-lg);
    }
    
    .footer-contact {
        grid-column: 1 / -1;
    }
    
    .cta-content {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-lg);
    }
    
    .cta-text {
        text-align: center;
    }
    
    .dual-carousel-container {
        gap: var(--spacing-xl);
    }
    
    .clients-carousel {
        height: 120px;
    }
}

/* Tablet landscape and small laptops */
@media (max-width: 1024px) {
    .nav-container {
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .logo-img {
        height: 40px;
    }
    
    .hero {
        padding: var(--spacing-xl) 0;
    }
    
    .hero-title {
        font-size: clamp(1.8rem, 3.5vw, 2.8rem);
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: clamp(0.85rem, 1.6vw, 1rem);
        max-width: 450px;
    }
    
    .hero-buttons {
        flex-direction: row;
        gap: var(--spacing-sm);
        justify-content: center;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.9rem;
        min-height: 40px;
    }
    
    .hero-stats {
        gap: var(--spacing-md);
        justify-content: center;
    }
    
    .stat-item {
        min-width: 100px;
    }
    
    .stat-number {
        font-size: clamp(1.4rem, 2.5vw, 2rem);
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .screen-content {
        padding: var(--spacing-md);
    }
    
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }
    
    .metric-card {
        padding: var(--spacing-sm);
    }
    
    .metric-value {
        font-size: 1.2rem;
        margin-bottom: 2px;
    }
    
    .metric-label {
        font-size: 0.65rem;
        margin-bottom: var(--spacing-sm);
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
    
    .service-card h3 {
        font-size: 1.1rem;
        margin-bottom: var(--spacing-sm);
    }
    
    .service-card p {
        font-size: 0.85rem;
        line-height: 1.5;
    }
    
    .section-header h2 {
        font-size: clamp(1.6rem, 3vw, 2.2rem);
        margin-bottom: var(--spacing-sm);
    }
    
    .section-header p {
        font-size: clamp(0.9rem, 1.6vw, 1rem);
        max-width: 600px;
    }
    
    .service-detail {
        padding: var(--spacing-md);
        gap: var(--spacing-md);
    }
    
    .service-number {
        width: 50px;
        height: 50px;
        font-size: 1.1rem;
    }
    
    .service-detail h3 {
        font-size: 1.1rem;
        margin-bottom: 4px;
    }
    
    .service-detail p {
        font-size: 0.85rem;
        line-height: 1.5;
    }
    
    .cta-content {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }
    
    .cta-text h2 {
        font-size: clamp(1.6rem, 3vw, 2rem);
        margin-bottom: var(--spacing-sm);
    }
    
    .rotating-text {
        height: clamp(40px, 8vw, 60px);
    }
    
    .text-item {
        font-size: clamp(1.2rem, 3vw, 1.8rem);
    }
    
    .cta-button {
        padding: var(--spacing-md) var(--spacing-lg);
        font-size: 1rem;
    }
    
    .report-image {
        height: 180px;
    }
    
    .report-overlay {
        padding: var(--spacing-md);
    }
    
    .report-overlay h3 {
        font-size: 1.2rem;
        margin-bottom: 6px;
    }
    
    .report-overlay p {
        font-size: 0.85rem;
        margin-bottom: var(--spacing-md);
    }
    
    .view-report {
        padding: var(--spacing-xs) var(--spacing-md);
        font-size: 0.85rem;
    }
    
    .clients-carousel {
        height: 100px;
    }
    
    .client-logo {
        height: 80px;
        min-width: 120px;
        padding: var(--spacing-md);
    }
    
    .client-logo img {
        height: 50px;
        max-width: 100px;
    }
    
    .carousel-top .carousel-track {
        animation-duration: 30s;
    }
    
    .carousel-bottom .carousel-track {
        animation-duration: 25s;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        display: none;
        position: fixed;
        top: 80px;
        left: 0;
        width: 100%;
        height: calc(100vh - 80px);
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: var(--spacing-lg);
        border-top: 1px solid rgba(193, 0, 1, 0.2);
        z-index: 999;
        gap: var(--spacing-lg);
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    [data-theme="light"] .nav-menu {
        background: rgba(255, 255, 255, 0.98);
    }
    
    .mobile-toggle {
        display: flex;
    }
    
    .mobile-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    
    .mobile-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
    
    .hero {
        min-height: 70vh;
        padding: var(--spacing-lg) 0;
    }
    
    .hero-content {
        padding: var(--spacing-md);
        gap: var(--spacing-lg);
    }
    
    .hero-title {
        font-size: clamp(1.6rem, 5vw, 2.4rem);
        margin-bottom: var(--spacing-sm);
    }
    
    .hero-subtitle {
        font-size: clamp(0.8rem, 2vw, 1rem);
        margin-bottom: var(--spacing-md);
        max-width: 400px;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: var(--spacing-sm);
        width: 100%;
        max-width: 300px;
        margin: 0 auto var(--spacing-lg);
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.9rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: var(--spacing-sm);
        max-width: 300px;
        margin: 0 auto;
    }
    
    .stat-item {
        display: flex;
        align-items: center;
        gap: var(--spacing-md);
        min-width: auto;
        text-align: left;
    }
    
    .stat-number {
        font-size: 1.4rem;
        min-width: 60px;
    }
    
    .stat-label {
        font-size: 0.8rem;
        margin: 0;
    }
    
    .dashboard-preview {
        max-width: 500px;
    }
    
    .screen-frame {
        transform: rotateY(0deg) rotateX(0deg);
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .service-card {
        padding: var(--spacing-lg);
        max-width: 400px;
        margin: 0 auto;
    }
    
    .service-icon {
        width: 60px;
        height: 60px;
        margin-bottom: var(--spacing-md);
    }
    
    .service-icon svg {
        width: 30px;
        height: 30px;
        margin: 15px;
    }
    
    .service-card h3 {
        font-size: 1.1rem;
    }
    
    .service-card p {
        font-size: 0.9rem;
    }
    
    .tech-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .tech-card {
        padding: var(--spacing-md);
        max-width: 400px;
        margin: 0 auto;
    }
    
    .service-detail {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: var(--spacing-lg);
        max-width: 400px;
        margin: 0 auto;
    }
    
    .reports-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    
    .report-card {
        max-width: 400px;
        margin: 0 auto;
    }
    
    .clients-carousel {
        height: 90px;
    }
    
    .client-logo {
        height: 70px;
        min-width: 100px;
        padding: var(--spacing-sm);
    }
    
    .client-logo img {
        height: 40px;
        max-width: 80px;
    }
    
    .footer-main {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
        text-align: center;
    }
    
    .footer-stats {
        flex-direction: column;
        gap: var(--spacing-sm);
        max-width: 300px;
        margin: 0 auto;
    }
    
    .footer-stats .stat-item {
        justify-content: center;
    }
    
    .footer-links {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    
    .contact-item {
        flex-direction: column;
        text-align: center;
    }
    
    .contact-icon {
        align-self: center;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-lg);
    }
    
    .footer-badges {
        justify-content: center;
    }
    
    .video-container {
        padding-bottom: 65%; 
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0 var(--spacing-md);
    }
    
    .nav-container {
        padding: var(--spacing-xs) var(--spacing-md);
    }
    
    .logo-img {
        height: 38px;
    }
    
    .hero {
        min-height: 60vh;
        padding: var(--spacing-md) 0;
    }
    
    .hero-content {
        gap: var(--spacing-md);
    }
    
    .hero-title {
        font-size: clamp(1.4rem, 6vw, 2rem);
        line-height: 1.3;
    }
    
    .hero-subtitle {
        font-size: clamp(0.8rem, 2.2vw, 0.95rem);
        max-width: 350px;
    }
    
    .dashboard-preview {
        max-width: 400px;
    }
    
    .screen-content {
        padding: var(--spacing-sm);
    }
    
    .metric-card {
        padding: var(--spacing-sm);
    }
    
    .metric-value {
        font-size: 1rem;
    }
    
    .metric-label {
        font-size: 0.6rem;
    }
    
    .section-header h2 {
        font-size: clamp(1.4rem, 4vw, 1.8rem);
        margin-bottom: var(--spacing-sm);
    }
    
    .section-header p {
        font-size: clamp(0.8rem, 2vw, 0.9rem);
        max-width: 500px;
    }
    
    .service-card,
    .tech-card,
    .service-detail,
    .report-card {
        max-width: 350px;
    }
    
    .cta-text h2 {
        font-size: clamp(1.4rem, 4vw, 1.8rem);
    }
    
    .text-item {
        font-size: clamp(1rem, 4vw, 1.4rem);
    }
    
    .cta-button {
        padding: var(--spacing-sm) var(--spacing-lg);
        font-size: 0.95rem;
    }
    
    .report-image {
        height: 160px;
    }
    
    .report-features {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-xs);
    }
    
    .report-badge {
        position: static;
        margin-bottom: var(--spacing-sm);
        align-self: flex-end;
    }
    
    .report-info {
        padding: var(--spacing-md);
        text-align: center;
    }
}

@media (max-width: 480px) {
    :root {
        --spacing-xs: 0.15rem;
        --spacing-sm: 0.3rem;
        --spacing-md: 0.6rem;
        --spacing-lg: 1rem;
        --spacing-xl: 1.4rem;
        --spacing-2xl: 2rem;
        --spacing-3xl: 2.8rem;
    }
    
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    .nav-container {
        padding: var(--spacing-sm);
    }
    
    .logo-img {
        height: 35px;
    }
    
    .hero {
        min-height: 50vh;
        padding: var(--spacing-sm) 0;
        margin-top: 10vh;
    }
    
    .hero-content {
        padding: var(--spacing-sm);
        gap: var(--spacing-sm);
    }
    
    .hero-title {
        font-size: clamp(1.2rem, 7vw, 1.8rem);
        margin-bottom: 6px;
    }
    
    .hero-subtitle {
        font-size: clamp(0.75rem, 2.5vw, 0.85rem);
        margin-bottom: var(--spacing-sm);
        max-width: 300px;
    }
    
    .hero-buttons {
        max-width: 280px;
        gap: 6px;
        margin-bottom: var(--spacing-sm);
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 8px var(--spacing-sm);
        font-size: 0.8rem;
        min-height: 36px;
    }
    
    .hero-stats {
        max-width: 280px;
        gap: 6px;
    }
    
    .stat-item {
        gap: var(--spacing-sm);
    }
    
    .stat-number {
        font-size: 1.2rem;
        min-width: 50px;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .dashboard-preview {
        max-width: 320px;
    }
    
    .screen-content {
        padding: 6px;
    }
    
    .metric-card {
        padding: 6px;
    }
    
    .metric-value {
        font-size: 0.9rem;
    }
    
    .metric-label {
        font-size: 0.55rem;
        margin-bottom: 4px;
    }
    
    .metric-chart {
        height: 20px;
        gap: 2px;
    }
    
    .chart-bar {
        width: 4px;
    }
    
    .section-header h2 {
        font-size: clamp(1.2rem, 5vw, 1.6rem);
        margin-bottom: 22px;
    }
    
    .section-header p {
        font-size: clamp(0.75rem, 2.2vw, 0.85rem);
        max-width: 400px;
    }
    
    .service-card,
    .tech-card,
    .service-detail,
    .report-card {
        max-width: 300px;
        padding: var(--spacing-sm);
    }
    
    .service-icon {
        width: 50px;
        height: 50px;
        margin-bottom: var(--spacing-sm);
    }
    
    .service-icon svg {
        width: 25px;
        height: 25px;
        margin: 12.5px;
    }
    
    .service-card h3 {
        font-size: 1rem;
        margin-bottom: 4px;
    }
    
    .service-card p {
        font-size: 0.8rem;
        line-height: 1.4;
    }
    
    .service-number {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
    
    .service-detail h3 {
        font-size: 1rem;
    }
    
    .service-detail p {
        font-size: 0.8rem;
    }
    
    .cta-text h2 {
        font-size: clamp(1.2rem, 5vw, 1.6rem);
    }
    
    .text-item {
        font-size: clamp(0.9rem, 5vw, 1.2rem);
    }
    
    .cta-button {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.9rem;
    }
    
    .report-image {
        height: 150px;
    }
    
    .report-overlay {
        padding: var(--spacing-sm);
    }
    
    .report-overlay h3 {
        font-size: 1rem;
        margin-bottom: 4px;
    }
    
    .report-overlay p {
        font-size: 0.8rem;
        margin-bottom: var(--spacing-sm);
    }
    
    .view-report {
        padding: 4px var(--spacing-sm);
        font-size: 0.8rem;
    }
    
    .clients-carousel {
        height: 70px;
    }
    
    .client-logo {
        height: 60px;
        min-width: 80px;
        padding: 4px;
    }
    
    .client-logo img {
        height: 35px;
        max-width: 70px;
    }
    
    .footer-main {
        gap: var(--spacing-md);
    }
    
    .footer-stats {
        max-width: 280px;
        gap: 4px;
    }
    
    .footer-stats .stat-item {
        text-align: left;
        display: flex;
        align-items: center;
        gap: var(--spacing-md);
    }
    
    .footer-stats .stat-number,
    .footer-stats .stat-label {
        margin: 0;
    }
    
    .social-links {
        justify-content: center;
        gap: var(--spacing-sm);
    }
    
    .social-link {
        width: 35px;
        height: 35px;
    }
    
    .social-link svg {
        width: 16px;
        height: 16px;
    }
    
    .footer-badges {
        flex-direction: column;
        align-items: center;
    }
    
    .badge {
        text-align: center;
        min-width: 120px;
    }
    
    .newsletter {
        flex-direction: column;
    }
    
    .newsletter input,
    .newsletter button {
        width: 100%;
    }
}

@media (max-width: 360px) {
    .hero-title {
        font-size: clamp(1rem, 8vw, 1.4rem);
    }
    
    .hero-subtitle {
        font-size: clamp(0.7rem, 2.8vw, 0.8rem);
        max-width: 250px;
    }
    
    .dashboard-preview {
        max-width: 280px;
    }
    
    .service-card,
    .tech-card,
    .service-detail,
    .report-card {
        max-width: 260px;
    }
    
    .section-header h2 {
        font-size: clamp(1rem, 6vw, 1.4rem);
        margin-bottom: 18px;
    }
    
    .section-header p {
        font-size: clamp(0.7rem, 2.5vw, 0.8rem);
    }
    
    .report-card {
        border-radius: var(--radius-lg);
    }
}

/* ========================================
   ACCESSIBILITY & MOTION PREFERENCES
======================================== */
@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;
    }
    
    .grid-overlay {
        animation: none;
    }
    
    .clients-section::before,
    .carousel-track {
        animation: none;
    }
    
    .clients-carousel {
        overflow-x: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--primary-red) transparent;
        mask: none;
        -webkit-mask: none;
    }
    
    .clients-carousel::-webkit-scrollbar {
        height: 4px;
    }
    
    .clients-carousel::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-sm);
    }
    
    .clients-carousel::-webkit-scrollbar-thumb {
        background: var(--primary-red);
        border-radius: var(--radius-sm);
    }
    
    .floating-elements {
        display: none;
    }
}

@media (prefers-contrast: high) {
    :root {
        --primary-red: #ff0000;
        --bg-dark: #000000;
        --bg-secondary: #1a1a1a;
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
    }
}

/* ========================================
   PRINT STYLES
======================================== */
@media print {
    .header,
    .mobile-toggle,
    .theme-toggle,
    .floating-elements,
    .cta-button,
    .newsletter,
    .social-links,
    .carousel-track {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .hero {
        min-height: auto;
        padding: var(--spacing-xl) 0;
    }
    
    .section-header h2::after {
        display: none;
    }
    
    .service-card,
    .tech-card,
    .report-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .services-grid,
    .tech-grid,
    .reports-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-md);
    }
    
    .footer {
        page-break-before: always;
    }
    
    .footer-main {
        grid-template-columns: 1fr;
    }
    
    .footer-stats {
        display: none;
    }
    
    .social-section {
        display: none;
    }
}

/* ========================================
   ANIMATION UTILITIES
======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

[data-aos="fade-up"] {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

[data-aos="fade-up"].animate-in {
    opacity: 1;
    transform: translateY(0);
}

[data-aos="slide-left"] {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.8s ease;
}

[data-aos="slide-left"].animate-in {
    opacity: 1;
    transform: translateX(0);
}

[data-aos="slide-right"] {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.8s ease;
}

[data-aos="slide-right"].animate-in {
    opacity: 1;
    transform: translateX(0);
}

[data-aos="scale-in"] {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s ease;
}

[data-aos="scale-in"].animate-in {
    opacity: 1;
    transform: scale(1);
}

/* ========================================
   PROGRESSIVE ENHANCEMENT
======================================== */
@supports not (backdrop-filter: blur(20px)) {
    .header {
        background: rgba(10, 10, 10, 0.95);
    }
    
    [data-theme="light"] .header {
        background: rgba(255, 255, 255, 0.95);
    }
}

@supports not ((mask: linear-gradient) or (-webkit-mask: linear-gradient)) {
    .clients-carousel {
        mask: none;
        -webkit-mask: none;
        overflow-x: auto;
        padding: 0 var(--spacing-lg);
    }
}

@supports not (grid-template-columns: subgrid) {
    .services-grid,
    .tech-grid,
    .reports-grid {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .service-card,
    .tech-card,
    .report-card {
        flex: 1 1 300px;
        max-width: 400px;
    }
}

/* ========================================
   HIGH DENSITY DISPLAYS
======================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo-img,
    .client-logo img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    .service-icon svg,
    .contact-icon svg,
    .social-link svg {
        image-rendering: auto;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
======================================== */
@media (hover: none) and (pointer: coarse) {
    .btn-primary,
    .btn-secondary,
    .cta-button,
    .view-report,
    .theme-toggle,
    .mobile-toggle {
        min-height: 44px;
        min-width: 44px;
    }
    
    .service-card:hover,
    .tech-card:hover,
    .report-card:hover,
    .client-logo:hover {
        transform: none;
    }
    
    .service-card:active,
    .tech-card:active,
    .report-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    .nav-link:hover,
    .login-btn:hover {
        transform: none;
    }
    
    .social-link {
        min-height: 44px;
        min-width: 44px;
    }
    
    .metric-card:hover,
    .feature-item:hover,
    .service-detail:hover {
        transform: none;
        border-color: initial;
        box-shadow: initial;
    }
    
    .link-section ul li a,
    .contact-details a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* ========================================
   DARK MODE MEDIA QUERY SUPPORT
======================================== */
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
    }
}

@media (prefers-color-scheme: light) {
    :root {
        color-scheme: light;
    }
}

/* ========================================
   LANDSCAPE ORIENTATION SPECIFIC
======================================== */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .hero {
        min-height: 100vh;
        padding: var(--spacing-lg) 0;
    }
    
    .hero-content {
        gap: var(--spacing-lg);
    }
    
    .hero-title {
        font-size: clamp(1.4rem, 4vw, 2rem);
        margin-bottom: var(--spacing-sm);
    }
    
    .hero-subtitle {
        margin-bottom: var(--spacing-md);
    }
    
    .hero-buttons {
        margin-bottom: var(--spacing-md);
    }
    
    .dashboard-preview {
        max-width: 450px;
    }
}

/* ========================================
   PORTRAIT ORIENTATION SPECIFIC
======================================== */
@media screen and (orientation: portrait) and (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .tech-grid {
        grid-template-columns: 1fr;
    }
    
    .reports-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-links {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   SPECIFIC DEVICE OPTIMIZATIONS
======================================== */

/* iPhone SE and similar small devices */
@media screen and (max-width: 375px) and (max-height: 667px) {
    .hero {
        min-height: 85vh;
    }
    
    .hero-title {
        font-size: clamp(1.1rem, 6vw, 1.5rem);
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 10px var(--spacing-md);
        font-size: 0.85rem;
    }
}

@media screen and (min-width: 768px) and (max-width: 1024px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-lg);
    }
    
    .tech-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .reports-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-main {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-contact {
        grid-column: 1 / -1;
    }
}

@media screen and (min-width: 1024px) and (max-width: 1200px) and (orientation: landscape) {
    .hero-content {
        grid-template-columns: 1fr 1fr;
        text-align: left;
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   CONTAINER QUERIES (FUTURE-PROOFING)
======================================== */
@supports (container-type: inline-size) {
    .service-card,
    .tech-card,
    .report-card {
        container-type: inline-size;
    }
    
    @container (max-width: 300px) {
        .service-card h3 {
            font-size: 1rem;
        }
        
        .service-card p {
            font-size: 0.85rem;
        }
    }
}

/* ========================================
   CUSTOM SCROLLBAR FOR ALL BROWSERS
======================================== */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-red) transparent;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: var(--primary-red);
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--dark-red);
}

/* ========================================
   FOCUS MANAGEMENT FOR ACCESSIBILITY
======================================== */
.nav-link:focus,
.btn-primary:focus,
.btn-secondary:focus,
.cta-button:focus,
.view-report:focus,
.theme-toggle:focus,
.social-link:focus {
    outline: 2px solid var(--primary-red);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(193, 0, 1, 0.2);
}

.mobile-toggle:focus {
    outline: 2px solid var(--primary-red);
    outline-offset: 2px;
}

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

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

/* ========================================
   REDUCED TRANSPARENCY FOR ACCESSIBILITY
======================================== */
@media (prefers-reduced-transparency: reduce) {
    .header,
    .nav-menu,
    .service-card,
    .tech-card,
    .report-card,
    .client-logo {
        backdrop-filter: none;
    }
    
    .header {
        background: var(--bg-dark);
    }
    
    [data-theme="light"] .header {
        background: #ffffff;
    }
}

/* ========================================
   ERROR HANDLING & FALLBACKS
======================================== */

/* Fallback for unsupported CSS Grid */
@supports not (display: grid) {
    .services-grid,
    .tech-grid,
    .reports-grid,
    .footer-main {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .service-card,
    .tech-card,
    .report-card {
        flex: 1 1 300px;
        margin: var(--spacing-md);
    }
}

@supports not (color: var(--primary-red)) {
    .service-card {
        border-color: #c10001;
    }
    
    .btn-primary {
        background: #c10001;
    }
    
    .hero-title .highlight {
        color: #c10001;
    }
}

/* ========================================
   FIXED GRID LAYOUTS FOR MOBILE
======================================== */

@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
        max-width: none;
        padding: 0 var(--spacing-md);
    }
    
    .service-card {
        padding: var(--spacing-xl);
        max-width: 100%;
        min-width: 280px;
        margin: 0 auto;
        width: 100%;
        box-sizing: border-box;
    }
    
    .tech-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
        max-width: none;
        padding: 0 var(--spacing-md);
    }
    
    .tech-card {
        padding: var(--spacing-xl);
        max-width: 100%;
        min-width: 280px;
        margin: 0 auto;
        width: 100%;
        box-sizing: border-box;
    }
    
    .reports-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
        max-width: none;
        padding: 0 var(--spacing-md);
    }
    
    .report-card {
        max-width: 100%;
        min-width: 280px;
        margin: 0 auto;
        width: 100%;
        box-sizing: border-box;
    }
    
    .service-detail {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: var(--spacing-xl);
        max-width: 100%;
        min-width: 280px;
        margin: 0 auto;
        width: 100%;
        box-sizing: border-box;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
        max-width: none;
    }
    
    .metric-card {
        padding: var(--spacing-lg);
        min-width: 200px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .footer-main {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
        max-width: none;
        padding: 0 var(--spacing-md);
    }
    
    .footer-links {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }
    
    .container {
        padding: 0 var(--spacing-lg);
        max-width: 100%;
        margin: 0 auto;
    }
    
    .services-overview,
    .features-section,
    .what-we-do,
    .reports-section {
        padding: var(--spacing-2xl) 0;
    }
}

/* Mobile landscape and small tablets */
@media (max-width: 640px) {
    .container {
        padding: 0 var(--spacing-md);
    }
    
    .services-grid,
    .tech-grid,
    .reports-grid {
        gap: var(--spacing-lg);
        padding: 0;
    }
    
    .service-card,
    .tech-card,
    .service-detail,
    .report-card {
        max-width: 100%;
        min-width: 260px;
        padding: var(--spacing-lg);
        margin: 0;
        width: 100%;
    }
    
    .metric-card {
        padding: var(--spacing-md);
        min-width: 180px;
    }
    
    .report-image {
        height: 160px;
        min-height: 140px;
    }
    
    .report-info {
        padding: var(--spacing-lg);
        min-height: 80px;
    }
}

/* Mobile portrait */
@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    .services-grid,
    .tech-grid,
    .reports-grid {
        gap: var(--spacing-md);
        padding: 0;
        margin: 0;
    }
    
    .service-card,
    .tech-card,
    .service-detail,
    .report-card {
        max-width: 100%;
        min-width: 240px;
        padding: var(--spacing-lg);
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .service-icon {
        width: 60px;
        height: 60px;
        margin-bottom: var(--spacing-md);
        flex-shrink: 0;
    }
    
    .service-icon svg {
        width: 30px;
        height: 30px;
        margin: 15px;
    }
    
    .service-card h3 {
        font-size: 1.1rem;
        margin-bottom: var(--spacing-sm);
        line-height: 1.3;
    }
    
    .service-card p {
        font-size: 0.9rem;
        line-height: 1.5;
        margin: 0;
    }
    
    /* Tech card specific */
    .tech-card h4 {
        font-size: 1.1rem;
        margin-bottom: var(--spacing-sm);
    }
    
    .tech-card p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    .tech-icon {
        font-size: 1.8rem;
        margin-bottom: var(--spacing-md);
    }
    
    /* Report card specific */
    .report-image {
        height: 150px;
        min-height: 120px;
    }
    
    .report-info {
        padding: var(--spacing-md);
        min-height: 60px;
    }
    
    .report-info h4 {
        font-size: 1.1rem;
        margin-bottom: 4px;
    }
    
    .report-type {
        font-size: 0.8rem;
    }
    
    /* Service detail specific */
    .service-number {
        width: 50px;
        height: 50px;
        font-size: 1rem;
        margin-bottom: var(--spacing-md);
        flex-shrink: 0;
    }
    
    .service-detail h3 {
        font-size: 1.1rem;
        margin-bottom: var(--spacing-sm);
    }
    
    .service-detail p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    /* Metric card adjustments */
    .metric-card {
        padding: var(--spacing-md);
        min-width: 160px;
        min-height: 120px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    
    .metric-value {
        font-size: 1.2rem;
        margin-bottom: 4px;
    }
    
    .metric-label {
        font-size: 0.7rem;
        margin-bottom: var(--spacing-sm);
    }
    
    .metric-chart {
        height: 25px;
        margin-top: auto;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .container {
        padding: 0 var(--spacing-xs);
    }
    
    .service-card,
    .tech-card,
    .service-detail,
    .report-card {
        max-width: 100%;
        min-width: 220px;
        padding: var(--spacing-md);
        margin: 0;
        width: 100%;
    }
    
    .service-icon {
        width: 50px;
        height: 50px;
    }
    
    .service-icon svg {
        width: 25px;
        height: 25px;
        margin: 12.5px;
    }
    
    .service-card h3,
    .tech-card h4 {
        font-size: 1rem;
    }
    
    .service-card p,
    .tech-card p {
        font-size: 0.85rem;
    }
    
    .report-image {
        height: 130px;
        min-height: 100px;
    }
    
    .metric-card {
        min-width: 140px;
        min-height: 100px;
        padding: var(--spacing-sm);
    }
    
    .metric-value {
        font-size: 1rem;
    }
    
    .metric-label {
        font-size: 0.65rem;
    }
}

/* ========================================
   GRID FALLBACK FOR OLDER BROWSERS
======================================== */
@supports not (display: grid) {
    .services-grid,
    .tech-grid,
    .reports-grid,
    .metrics-grid {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-lg);
    }
    
    .service-card,
    .tech-card,
    .report-card,
    .metric-card {
        width: 100%;
        max-width: 400px;
        margin-bottom: var(--spacing-lg);
    }
}

/* ========================================
   FLEXBOX ALTERNATIVE FOR PROBLEM GRIDS
======================================== */
@media (max-width: 768px) {
    .services-grid-flex {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-lg);
        padding: 0 var(--spacing-md);
    }
    
    .tech-grid-flex {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-lg);
        padding: 0 var(--spacing-md);
    }
    
    .reports-grid-flex {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-xl);
        padding: 0 var(--spacing-md);
    }
}

/* ========================================
   FORCE MINIMUM WIDTHS TO PREVENT SQUISHING
======================================== */
.service-card,
.tech-card,
.report-card,
.service-detail {
    min-width: 280px;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .service-card,
    .tech-card,
    .report-card,
    .service-detail {
        min-width: 240px;
    }
}

@media (max-width: 360px) {
    .service-card,
    .tech-card,
    .report-card,
    .service-detail {
        min-width: 220px;
    }
}

/* ========================================
   ENSURE PROPER CONTENT FLOW
======================================== */
.service-card *,
.tech-card *,
.report-card *,
.service-detail * {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

