/* ============================================
   RESPONSIVE CSS - Cross-Browser Compatible
   Mobile First Approach with Progressive Enhancement
   ============================================ */

/* ============================================
   1. EXTRA SMALL DEVICES (Portrait phones, < 480px)
   ============================================ */
@media (max-width: 479px) {
    /* Container adjustments */
    .container,
    .auto-container {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    /* Header */
    .main-header .header-lower {
        padding: 8px 0;
    }
    
    .main-header .logo img {
        max-width: 180px !important;
        height: 60px !important;
    }
    
    .main-header .phone-pill {
        padding: 10px 14px;
        font-size: 0.8rem;
        min-width: 110px;
        min-height: 44px; /* WCAG touch target */
    }
    
    .main-header .btn-stack {
        gap: 8px;
    }
    
    /* Typography */
    h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    h3 {
        font-size: 1.25rem;
        line-height: 1.4;
    }
    
    .hero-simple h1 {
        font-size: 1.75rem;
        padding: 0 15px;
    }
    
    .hero-simple p {
        font-size: 0.95rem;
        padding: 0 15px;
    }
    
    .btn-primary {
        padding: 12px 20px;
        font-size: 0.95rem;
        min-height: 44px; /* Touch target */
    }
    
    /* Services */
    .section-title h2 {
        font-size: 1.75rem;
        padding: 0 15px;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0 12px;
    }
    
    .service-card {
        margin-bottom: 15px;
    }
    
    .service-image {
        height: 160px;
    }
    
    .service-content {
        padding: 15px;
    }
    
    .service-content h3 {
        font-size: 1.1rem;
        min-height: 44px; /* Touch target */
    }
    
    /* CTA Section */
    .cta-section {
        padding: 40px 0;
        min-height: auto !important;
    }
    
    .cta-content {
        padding: 0 15px;
    }
    
    .cta-content h1 {
        font-size: 1.75rem;
        line-height: 1.25;
        margin-bottom: 18px;
    }
    
    .cta-content h2 {
        font-size: 1.5rem;
        line-height: 1.3;
        margin: 25px 0 15px 0;
    }
    
    .cta-content p {
        font-size: 0.95rem;
        line-height: 1.6;
        margin-bottom: 18px;
    }
    
    .contact-badges {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-top: 20px;
    }
    
    .contact-badge {
        width: 100%;
        max-width: 100%;
        padding: 14px 18px;
        font-size: 0.9rem;
        min-height: 44px; /* Touch target */
        text-align: center;
    }
    
    /* SEO Content */
    .seo-content {
        padding: 35px 0;
    }
    
    .seo-content .container,
    .seo-content .auto-container {
        padding: 0 15px;
    }
    
    .seo-content h1 {
        font-size: 1.6rem;
        line-height: 1.3;
    }
    
    .seo-content h2 {
        font-size: 1.3rem;
        margin: 20px 0 10px 0;
    }
    
    .seo-content h3 {
        font-size: 1.1rem;
        margin: 18px 0 8px 0;
    }
    
    .seo-content p {
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    /* Footer */
    .main-footer {
        padding: 35px 0 15px 0;
    }
    
    .footer-content {
        padding: 0 15px;
    }
    
    .footer-content h3 {
        font-size: 1.2rem;
    }
    
    .footer-content p {
        font-size: 0.85rem;
    }
    
    /* Service blocks */
    .service-block-one {
        margin-bottom: 20px;
    }
    
    .service-block-one .inner-box {
        border-radius: 8px;
    }
    
    /* Images - ensure responsive */
    img {
        max-width: 100%;
        height: auto;
    }
    
    .image-box img {
        width: 100%;
        height: auto;
        object-fit: cover;
    }
}

/* ============================================
   2. SMALL DEVICES (Landscape phones, 480px - 767px)
   ============================================ */
@media (min-width: 480px) and (max-width: 767px) {
    /* Container */
    .container,
    .auto-container {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    /* Header */
    .main-header .header-lower {
        padding: 10px 0;
    }
    
    .main-header .logo img {
        max-width: 200px !important;
        height: 70px !important;
    }
    
    .main-header .phone-pill {
        padding: 10px 18px;
        font-size: 0.875rem;
        min-width: 130px;
        min-height: 44px;
    }
    
    /* Typography */
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    h3 {
        font-size: 1.375rem;
    }
    
    .hero-simple h1 {
        font-size: 2rem;
        padding: 0 20px;
    }
    
    .hero-simple p {
        font-size: 1rem;
        padding: 0 20px;
    }
    
    .btn-primary {
        padding: 12px 25px;
        font-size: 1rem;
        min-height: 44px;
    }
    
    /* Services */
    .section-title h2 {
        font-size: 2rem;
        padding: 0 20px;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 20px;
    }
    
    .service-image {
        height: 180px;
    }
    
    .service-content {
        padding: 20px;
    }
    
    .service-content h3 {
        font-size: 1.2rem;
        min-height: 44px;
    }
    
    /* CTA Section */
    .cta-section {
        padding: 50px 0;
    }
    
    .cta-content {
        padding: 0 20px;
    }
    
    .cta-content h1 {
        font-size: 2rem;
        line-height: 1.25;
    }
    
    .cta-content h2 {
        font-size: 1.75rem;
        line-height: 1.3;
    }
    
    .cta-content p {
        font-size: 1rem;
        line-height: 1.65;
    }
    
    .contact-badges {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
        margin-top: 20px;
    }
    
    .contact-badge {
        flex: 0 1 calc(50% - 6px);
        max-width: 240px;
        padding: 12px 18px;
        font-size: 0.9rem;
        min-height: 44px;
    }
    
    /* SEO Content */
    .seo-content {
        padding: 40px 0;
    }
    
    .seo-content .container,
    .seo-content .auto-container {
        padding: 0 20px;
    }
    
    .seo-content h1 {
        font-size: 1.8rem;
    }
    
    .seo-content h2 {
        font-size: 1.5rem;
        margin: 25px 0 12px 0;
    }
    
    .seo-content h3 {
        font-size: 1.2rem;
        margin: 20px 0 8px 0;
    }
    
    .seo-content p {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    /* Footer */
    .main-footer {
        padding: 40px 0 20px 0;
    }
    
    .footer-content {
        padding: 0 20px;
    }
}

/* ============================================
   3. MOBILE DEVICES (All mobile, < 768px)
   ============================================ */
@media (max-width: 767px) {
    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }
    
    /* Header adjustments */
    .main-header .outer-box {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        align-items: center;
    }
    
    .main-header .brand-title {
        font-size: 1.25rem;
        margin: 10px 0;
        order: 2;
        display: block;
    }
    
    .main-header .btn-box {
        order: 3;
        width: 100%;
        justify-content: center;
        margin: 10px 0;
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        overflow: visible !important;
        flex-wrap: wrap;
    }
    
    .main-header .btn-stack {
        width: 100%;
        align-items: center;
        gap: 10px;
    }
    
    /* Mobile menu - full screen overlay */
    .main-menu {
        display: none;
    }
    
    .main-menu.active {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important; /* Dynamic viewport height for mobile browsers */
        background: #fff;
        z-index: 99999;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        padding: 80px 20px 40px;
    }
    
    .main-menu.active ul {
        display: block !important;
        flex-direction: column !important;
        width: 100%;
        gap: 5px;
        padding: 0;
        margin: 0;
    }
    
    .main-menu.active ul li {
        display: block !important;
        width: 100%;
    }
    
    .main-menu.active ul li a {
        padding: 15px 20px;
        display: block !important;
        text-align: left;
        border-radius: 8px;
        background: #f8f9fa;
        margin-bottom: 5px;
        min-height: 44px; /* Touch target */
        line-height: 1.5;
    }
    
    /* Mobile dropdown menu styling */
    .main-menu.active .dropdown > ul {
        position: static !important;
        transform: none !important;
        left: auto !important;
        box-shadow: none;
        margin: 5px 0;
        padding: 0;
        background: rgba(255,255,255,0.05);
        border-left: 3px solid #dc2626;
        display: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out;
    }
    
    .main-menu.active .dropdown.active > ul {
        display: block !important;
        padding: 5px 0;
        max-height: 1000px;
    }
    
    .main-menu.active .dropdown > ul li a {
        padding-left: 30px;
        font-size: 0.9rem;
        background: transparent;
        min-height: 44px;
    }
    
    /* Dropdown indicator (arrow) */
    .main-menu.active .dropdown > a::after {
        content: '▼';
        margin-left: 8px;
        font-size: 10px;
        display: inline-block;
        transition: transform 0.3s ease;
    }
    
    .main-menu.active .dropdown.active > a::after {
        transform: rotate(180deg);
    }
    
    /* Body scroll lock when menu is open */
    body.menu-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100%;
        height: 100vh;
        height: 100dvh;
    }
    
    /* Hero section */
    .hero-simple {
        padding: 50px 0;
        min-height: auto;
    }
    
    .hero-simple h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-simple p {
        font-size: 1rem;
        padding: 0 20px;
    }
    
    .btn-primary {
        padding: 12px 25px;
        font-size: 1rem;
        min-height: 44px;
    }
    
    /* Services grid */
    .services-section {
        padding: 60px 0;
    }
    
    .section-title h2 {
        font-size: 2rem;
        padding: 0 20px;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 20px;
    }
    
    .service-card {
        margin-bottom: 20px;
    }
    
    .service-image {
        height: 180px;
    }
    
    .service-content {
        padding: 20px;
    }
    
    .service-content h3 {
        font-size: 1.2rem;
        min-height: 44px;
    }
    
    /* CTA section */
    .cta-section {
        padding: 50px 0;
        min-height: auto !important;
    }
    
    .cta-content {
        padding: 0 20px;
    }
    
    .cta-content h2 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .cta-content p {
        font-size: 1rem;
    }
    
    .contact-badges {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        margin-top: 20px;
    }
    
    .contact-badge {
        width: 100%;
        max-width: 280px;
        padding: 12px 20px;
        text-align: center;
        min-height: 44px;
    }
    
    /* SEO content */
    .seo-content {
        padding: 40px 0;
    }
    
    .seo-content .container,
    .seo-content .auto-container {
        padding: 0 20px;
    }
    
    .seo-content h1 {
        font-size: 1.8rem;
        line-height: 1.3;
    }
    
    .seo-content h2 {
        font-size: 1.5rem;
        margin: 25px 0 12px 0;
    }
    
    .seo-content h3 {
        font-size: 1.2rem;
        margin: 20px 0 8px 0;
    }
    
    .seo-content p {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    /* Footer */
    .main-footer {
        padding: 40px 0 20px 0;
        margin-top: 80px;
    }
    
    .footer-content {
        padding: 0 20px;
    }
    
    .footer-content h3 {
        font-size: 1.3rem;
    }
    
    .footer-content p {
        font-size: 0.9rem;
    }
    
    /* Service blocks - responsive images */
    .service-block-one .image-box {
        position: relative;
        width: 100%;
        padding-bottom: 75%; /* 4:3 aspect ratio */
        overflow: hidden;
    }
    
    .service-block-one .image-box img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    /* Row and column adjustments */
    .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .row > [class*="col-"] {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* ============================================
   4. TABLET DEVICES (Portrait, 768px - 1023px)
   ============================================ */
@media (min-width: 768px) and (max-width: 1023px) {
    /* Container */
    .container,
    .auto-container {
        max-width: 100%;
        padding-left: 30px;
        padding-right: 30px;
    }
    
    /* Header */
    .main-header .outer-box {
        flex-wrap: wrap;
        gap: 20px;
    }
    
    .main-header .logo img {
        max-width: 220px !important;
        height: 75px !important;
    }
    
    .main-header .phone-pill {
        padding: 10px 20px;
        font-size: 0.9rem;
        min-height: 44px;
    }
    
    /* Typography */
    .hero-simple h1 {
        font-size: 2.5rem;
    }
    
    .hero-simple p {
        font-size: 1.125rem;
    }
    
    /* Services grid - 2 columns */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    .service-image {
        height: 220px;
    }
    
    /* CTA Section */
    .cta-content h1 {
        font-size: 2.5rem;
    }
    
    .cta-content h2 {
        font-size: 2rem;
    }
    
    .cta-content p {
        font-size: 1.125rem;
    }
    
    .contact-badges {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    
    .contact-badge {
        flex: 0 1 auto;
        max-width: 280px;
        padding: 12px 20px;
        min-height: 44px;
    }
    
    /* SEO Content */
    .seo-content h1 {
        font-size: 2.25rem;
    }
    
    .seo-content h2 {
        font-size: 1.875rem;
    }
    
    .seo-content h3 {
        font-size: 1.5rem;
    }
    
    /* Service blocks grid */
    .service-block-one {
        margin-bottom: 30px;
    }
}

/* ============================================
   5. TABLET LANDSCAPE / SMALL DESKTOP (1024px - 1199px)
   ============================================ */
@media (min-width: 1024px) and (max-width: 1199px) {
    /* Container */
    .container,
    .auto-container {
        max-width: 1200px;
        padding-left: 40px;
        padding-right: 40px;
    }
    
    /* Services grid - 3 columns */
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
    
    .service-image {
        height: 240px;
    }
    
    /* Typography */
    .hero-simple h1 {
        font-size: 3rem;
    }
    
    .cta-content h1 {
        font-size: 3rem;
    }
    
    .cta-content h2 {
        font-size: 2.25rem;
    }
}

/* ============================================
   6. DESKTOP (1200px - 1399px)
   ============================================ */
@media (min-width: 1200px) and (max-width: 1399px) {
    /* Container */
    .container,
    .auto-container {
        max-width: 1320px;
        padding-left: 50px;
        padding-right: 50px;
    }
    
    /* Services grid - 3 columns */
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
    
    /* Typography */
    .hero-simple h1 {
        font-size: 3.25rem;
    }
    
    .cta-content h1 {
        font-size: 3.25rem;
    }
}

/* ============================================
   7. LARGE DESKTOP (1400px and up)
   ============================================ */
@media (min-width: 1400px) {
    /* Container */
    .container,
    .auto-container {
        max-width: 1400px;
        padding-left: 60px;
        padding-right: 60px;
    }
    
    /* Services grid - 4 columns */
    .services-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 35px;
    }
    
    /* Typography */
    .hero-simple h1 {
        font-size: 3.5rem;
    }
    
    .cta-content h1 {
        font-size: 3.5rem;
    }
    
    .cta-content h2 {
        font-size: 2.5rem;
    }
    
    .service-image {
        height: 280px;
    }
}

/* ============================================
   8. ULTRA WIDE SCREENS (1920px and up)
   ============================================ */
@media (min-width: 1920px) {
    .container,
    .auto-container {
        max-width: 1600px;
    }
    
    .services-grid {
        gap: 40px;
    }
}

/* ============================================
   9. LANDSCAPE ORIENTATION ADJUSTMENTS
   ============================================ */
@media (orientation: landscape) and (max-height: 600px) {
    .hero-simple {
        padding: 40px 0;
    }
    
    .main-header .header-lower {
        padding: 8px 0;
    }
    
    .main-menu.active {
        padding: 60px 20px 30px;
    }
}

/* ============================================
   10. PRINT STYLES
   ============================================ */
@media print {
    .main-header,
    .main-footer,
    .btn-box,
    .mobile-nav-toggler,
    .fixed-social {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }
    
    .container,
    .auto-container {
        max-width: 100%;
        padding: 0;
    }
    
    a {
        text-decoration: underline;
        color: #000;
    }
    
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
}

/* ============================================
   11. HIGH DPI / RETINA DISPLAYS
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi),
       (min-resolution: 2dppx) {
    /* Ensure images are crisp on high DPI displays */
    .logo img,
    .service-image img,
    .image-box img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ============================================
   12. REDUCED MOTION (Accessibility)
   ============================================ */
@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;
    }
}

/* ============================================
   13. DARK MODE SUPPORT (Future-proofing)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Currently not implemented, but structure ready */
    /* Can be enabled if dark mode is desired */
}

/* ============================================
   14. TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Touch devices - larger touch targets */
    a,
    button,
    .phone-pill,
    .contact-badge,
    .btn-primary {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .service-card:hover {
        transform: none;
    }
}

/* ============================================
   15. CROSS-BROWSER FIXES
   ============================================ */

/* Safari specific fixes */
@supports (-webkit-appearance: none) {
    .main-menu.active {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Fix for Safari viewport height issues */
    @media (max-width: 767px) {
        .main-menu.active {
            height: -webkit-fill-available;
        }
    }
}

/* Firefox specific fixes */
@-moz-document url-prefix() {
    .main-menu.active {
        scrollbar-width: thin;
    }
}

/* Edge/IE11 fallbacks */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    .services-grid {
        display: -ms-grid;
        -ms-grid-columns: 1fr;
    }
    
    @media (min-width: 768px) {
        .services-grid {
            -ms-grid-columns: 1fr 1fr;
        }
    }
    
    @media (min-width: 1024px) {
        .services-grid {
            -ms-grid-columns: 1fr 1fr 1fr;
        }
    }
}

/* ============================================
   16. UTILITY CLASSES FOR RESPONSIVE DESIGN
   ============================================ */

/* Hide on mobile */
.hide-mobile {
    display: block;
}

@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Show only on mobile */
.show-mobile {
    display: none;
}

@media (max-width: 767px) {
    .show-mobile {
        display: block !important;
    }
}

/* Hide on tablet and below */
.hide-tablet-down {
    display: block;
}

@media (max-width: 1023px) {
    .hide-tablet-down {
        display: none !important;
    }
}

/* Show only on desktop */
.show-desktop {
    display: none;
}

@media (min-width: 1024px) {
    .show-desktop {
        display: block !important;
    }
}
