/* ============================================
   Responsive Styles
   Mobile-first approach with desktop overrides
   ============================================ */

/* ============================================
   Large devices (desktops, 1200px and up)
   ============================================ */
@media (min-width: 1200px) {
    :root {
        --container-padding: 2rem;
    }

    .badges-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   Medium devices (tablets, 992px and up)
   ============================================ */
@media (min-width: 992px) and (max-width: 1199.98px) {
    :root {
        --container-padding: 1.5rem;
    }

    .hero-title {
        font-size: var(--font-size-5xl);
    }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr 1fr;
        gap: var(--space-8);
    }

    .footer-grid .footer-about {
        grid-column: span 3;
    }
}

/* ============================================
   Small devices (landscape phones, 768px and up)
   ============================================ */
@media (min-width: 768px) and (max-width: 991.98px) {
    .container {
        --container-padding: 1.25rem;
    }

    .nav-links {
        gap: var(--space-6);
    }

    .hero-title {
        font-size: var(--font-size-4xl);
    }

    .hero-subtitle {
        font-size: var(--font-size-base);
    }

    .badges-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-6);
    }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .about-image {
        max-width: 500px;
        margin: 0 auto;
    }

    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .areas-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: var(--space-12);
    }

    .faq-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-8);
    }

    .values-grid {
        grid-template-columns: 1fr;
    }

    .benefits-grid {
        gap: var(--space-4);
    }

    .service-detail-grid,
    .service-detail-grid.reverse {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .project-detail-card {
        grid-template-columns: 1fr;
    }

    .project-detail-image img {
        min-height: 300px;
    }

    .team-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-8);
    }

    .footer-grid .footer-about {
        grid-column: span 2;
    }
}

/* ============================================
   Small devices (phones, 576px and up)
   ============================================ */
@media (min-width: 576px) and (max-width: 767.98px) {
    .hero-title {
        font-size: var(--font-size-3xl);
    }

    .section-title {
        font-size: var(--font-size-3xl);
    }

    .page-title {
        font-size: var(--font-size-4xl);
    }

    .badges-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .areas-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .testimonials-grid {
        grid-template-columns: 1fr;
    }

    .faq-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .values-grid {
        grid-template-columns: 1fr;
    }

    .team-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .footer-grid .footer-about {
        grid-column: span 1;
    }

    .cta-content h2 {
        font-size: var(--font-size-3xl);
    }

    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }

    .cta-buttons .btn {
        width: 100%;
        max-width: 300px;
    }
}

/* ============================================
   Mobile first (default styles for mobile)
   Navigation becomes hamburger menu
   ============================================ */

/* Mobile Navigation */
.mobile-menu-toggle {
    display: flex;
}

.nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    height: 100vh;
    background-color: white;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: var(--space-6);
    padding: var(--space-8);
    box-shadow: var(--shadow-xl);
    transition: right var(--transition-base);
    z-index: var(--z-fixed);
}

.nav-links.active {
    right: 0;
}

.nav-link {
    font-size: var(--font-size-xl);
    padding: var(--space-3) 0;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
}

/* Overlay when menu is open */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-fixed) - 1);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Adjust sticky phone button for mobile */
@media (max-width: 575.98px) {
    .sticky-phone-button {
        width: 50px;
        height: 50px;
        bottom: var(--space-4);
        right: var(--space-4);
    }

    .sticky-phone-button:hover {
        width: auto;
        padding: 0 var(--space-3);
    }
}

/* ============================================
   Tablet and below adjustments (max-width: 767.98px)
   ============================================ */
@media (max-width: 767.98px) {
    /* Header adjustments */
    .nav {
        height: 70px;
    }

    .logo-img {
        height: 40px;
    }

    /* Hero adjustments */
    .hero {
        min-height: 70vh;
    }

    .hero-content {
        padding: var(--space-6) 0;
    }

    .hero-title {
        font-size: var(--font-size-3xl);
    }

    .hero-subtitle {
        font-size: var(--font-size-base);
    }

    .hero-buttons {
        flex-direction: column;
        gap: var(--space-3);
    }

    .hero-buttons .btn {
        width: 100%;
    }

    /* Section padding reduction */
    .trust-badges,
    .services,
    .about-preview,
    .projects-preview,
    .areas-cover,
    .testimonials,
    .cta,
    .contact-section,
    .faq-section,
    .stats-section,
    .values-section {
        padding: var(--space-12) 0;
    }

    /* Badge adjustments */
    .badge-item {
        padding: var(--space-3);
    }

    .badge-icon {
        width: 50px;
        height: 50px;
        font-size: var(--font-size-xl);
    }

    .badge-text strong {
        font-size: var(--font-size-base);
    }

    /* Service card adjustments */
    .service-card {
        padding: var(--space-6);
    }

    .service-icon {
        width: 60px;
        height: 60px;
    }

    /* Project card adjustments */
    .project-image {
        height: 220px;
    }

    .project-info {
        padding: var(--space-4);
    }

    /* Contact form adjustments */
    .contact-form-container,
    .contact-info-container {
        padding: var(--space-6);
    }

    /* Team member adjustments */
    .member-image {
        height: 220px;
    }

    /* Service detail page */
    .service-detail-content h2 {
        font-size: var(--font-size-3xl);
    }

    .project-detail-image img {
        min-height: 250px;
    }

    .project-detail-content {
        padding: var(--space-6);
    }

    .project-detail-content h3 {
        font-size: var(--font-size-2xl);
    }

    /* CTA adjustments */
    .cta-content h2 {
        font-size: var(--font-size-3xl);
    }

    .cta-content p {
        font-size: var(--font-size-lg);
    }
}

/* ============================================
   Mobile only (max-width: 575.98px)
   ============================================ */
@media (max-width: 575.98px) {
    .container {
        --container-padding: 1rem;
    }

    /* All headings smaller */
    .section-title,
    .page-title,
    .service-detail-content h2,
    .cta-content h2 {
        font-size: var(--font-size-2xl);
    }

    .hero-title {
        font-size: var(--font-size-2xl);
    }

    .hero-subtitle {
        font-size: var(--font-size-sm);
    }

    /* Grid collapses to single column */
    .badges-grid,
    .services-grid,
    .projects-grid,
    .areas-grid,
    .testimonials-grid,
    .faq-grid,
    .stats-grid,
    .values-grid,
    .team-grid {
        grid-template-columns: 1fr;
    }

    /* Adjust stat numbers */
    .stat-number {
        font-size: var(--font-size-4xl);
    }

    /* Stack benefit items */
    .benefit-item {
        flex-direction: column;
        text-align: center;
    }

    .benefit-icon {
        margin: 0 auto;
    }

    /* Team member */
    .member-info {
        padding: var(--space-4);
    }

    /* Project detail card */
    .project-detail-card {
        grid-template-columns: 1fr;
    }

    .project-detail-image img {
        min-height: 200px;
    }

    .project-meta {
        flex-direction: column;
        gap: var(--space-1);
    }

    .project-meta strong {
        display: inline;
    }

    /* Footer adjustments */
    .footer-grid {
        gap: var(--space-6);
        margin-bottom: var(--space-8);
    }

    .social-links {
        justify-content: center;
    }

    .footer-grid .footer-about {
        grid-column: span 1;
        text-align: center;
    }

    .footer-links ul {
        text-align: center;
    }

    .footer-contact {
        text-align: center;
    }

    .contact-info-item {
        justify-content: center;
    }

    .footer-bottom {
        padding-top: var(--space-4);
    }

    /* Contact form - full width on mobile */
    .contact-form-container,
    .contact-info-container {
        padding: var(--space-4);
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: var(--space-3);
        font-size: var(--font-size-base);
    }

    .btn-submit {
        width: 100%;
    }

    /* Contact info items */
    .info-item {
        flex-direction: column;
        text-align: center;
    }

    .info-icon {
        margin: 0 auto;
    }

    /* Page header */
    .page-header {
        padding: var(--space-10) 0;
    }

    .page-title {
        font-size: var(--font-size-3xl);
    }

    .page-subtitle {
        font-size: var(--font-size-base);
    }

    /* About page */
    .about-story-grid {
        grid-template-columns: 1fr;
    }

    .about-features li {
        padding-left: var(--space-4);
    }

    /* Services detail */
    .service-detail-grid,
    .service-detail-grid.reverse {
        gap: var(--space-6);
    }

    .service-detail-content h2 {
        font-size: var(--font-size-2xl);
    }

    .service-features li {
        font-size: var(--font-size-sm);
    }
}

/* ============================================
   Very small devices (max-width: 400px)
   ============================================ */
@media (max-width: 400px) {
    .hero-title {
        font-size: var(--font-size-xl);
    }

    .section-title,
    .page-title {
        font-size: var(--font-size-xl);
    }

    .btn {
        padding: var(--space-2) var(--space-4);
        font-size: var(--font-size-sm);
    }

    .nav-links {
        width: 100%;
    }

    /* Mobile menu items */
    .nav-link {
        font-size: var(--font-size-lg);
    }
}

/* ============================================
   High DPI screens & Retina displays
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Ensure sharp images */
    .logo-img,
    .project-image img,
    .member-image img,
    .about-image img,
    .service-detail-image img,
    .project-detail-image img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ============================================
   Reduced 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;
    }

    .sticky-phone-button {
        animation: none;
    }
}

/* ============================================
   Dark mode support (optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode */
    /*
    :root {
        --color-text: #E0E0E0;
        --color-text-light: #B0B0B0;
        --color-text-muted: #888888;
        --color-background: #121212;
        --color-background-alt: #1E1E1E;
        --color-border: #333333;
        --color-border-light: #2A2A2A;
    }

    .header {
        background-color: rgba(18, 18, 18, 0.98);
    }

    .nav-link {
        color: #E0E0E0;
    }
    */
}

/* ============================================
   Landscape orientation for tablets
   ============================================ */
@media (max-height: 768px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
    }

    .hero-title {
        font-size: var(--font-size-3xl);
    }
}

/* ============================================
   Print specific styles
   ============================================ */
@media print {
    .sticky-phone-button,
    .mobile-menu-toggle,
    .nav-overlay {
        display: none !important;
    }

    body {
        font-size: 12pt;
    }

    .container {
        max-width: 100%;
    }

    .hero,
    .cta {
        background: none !important;
        color: black !important;
    }

    a {
        text-decoration: underline;
    }

    .btn {
        border: 1px solid #000;
        background: none !important;
        color: #000 !important;
    }
}