/**
 * PROJECT: RENIC MANAGEMENT SERVICES
 * FILE: responsive.css
 * DESCRIPTION: Master production-level responsive overrides.
 * Focus: Left-alignment, 60vh Hero Scaling, and Service Card Collision Fixes.
 */

/* ==========================================================================
   1. GLOBAL FLUID SCALING
   ========================================================================== */
html {
    font-size: 15px; /* Base for standard mobile */
    scroll-behavior: smooth;
}

@media (min-width: 1024px) {
    html { font-size: 16px; } /* Base for desktop */
}

@media (min-width: 1536px) {
    .container {
        max-width: 1400px !important; /* Constrain ultra-wide displays */
    }
}

/* ==========================================================================
   2. HERO SECTIONS (Strict 60vh + Left Alignment)
   ========================================================================== */
@media (max-width: 1024px) {
    .services-hero, .about-hero, .contact-hero, .blog-hero {
        min-height: 50vh !important;
        padding-top: 8rem;
        padding-bottom: 4rem;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }
}

@media (max-width: 768px) {
    .services-hero, .about-hero, .contact-hero, .blog-hero {
        min-height: 60vh !important; /* Maintain prestige height on mobile */
        padding-top: 7.5rem;
        align-items: flex-start !important; /* Anchor text to top-left */
        text-align: left !important;
    }

    header h1 {
        font-size: 2.8rem !important; /* Bold, readable, no overflow */
        line-height: 1.1;
        letter-spacing: -0.02em;
    }

    header p {
        font-size: 1.05rem !important;
        line-height: 1.6;
    }

    /* Architectural Left Border for mobile */
    .border-l-4 {
        border-left-width: 3px !important;
        padding-left: 1.25rem !important;
    }
}

/* ==========================================================================
   3. MOBILE NAVIGATION (STRICT LEFT-ALIGN OVERWRITE)
   ========================================================================== */
@media (max-width: 1023px) {
    nav ul.flex-col {
        display: none; /* Visibility controlled by JS toggle */
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        width: 100% !important;
        background: white !important;
        padding: 2.5rem 1.5rem !important; /* Match brand horizontal margin */
        
        /* THE OVERWRITE: Absolute Left Alignment */
        flex-direction: column !important;
        align-items: flex-start !important; 
        justify-content: flex-start !important;
        
        gap: 0.25rem !important; 
        border-bottom: 5px solid var(--renic-orange) !important;
        box-shadow: 0 40px 80px -15px rgba(0, 0, 0, 0.2) !important;
        z-index: 999 !important;
    }

    nav ul.flex-col li {
        width: 100% !important;
        text-align: left !important;
    }

    nav ul.flex-col li a {
        display: block !important;
        width: 100% !important;
        text-align: left !important;
        font-size: 1.2rem !important;
        font-weight: 800 !important;
        color: var(--renic-navy) !important;
        padding: 0.85rem 0 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.05em !important;
        border-bottom: 1px solid #f1f5f9 !important; /* Logical separation */
    }

    nav ul.flex-col li a:active,
    nav ul.flex-col li a:hover {
        color: var(--renic-orange) !important;
        padding-left: 8px !important; /* Kinetic touch feedback */
    }

    /* Mobile Menu CTA Button */
    nav ul.flex-col li:last-child {
        margin-top: 2rem !important;
    }

    nav ul.flex-col li:last-child a {
        background-color: var(--renic-navy) !important;
        color: white !important;
        text-align: center !important; /* Standardized button look */
        padding: 1.25rem !important;
        border-radius: 0.75rem !important;
        border: none !important;
        box-shadow: 0 10px 20px rgba(10, 29, 55, 0.2) !important;
    }

    nav ul.flex-col.flex {
        display: flex !important;
        animation: mobileMenuSlide 0.4s cubic-bezier(0.165, 0.84, 0.44, 1) forwards !important;
    }
}

@keyframes mobileMenuSlide {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   4. SERVICE CARDS: COLLISION & SPACING FIX
   ========================================================================== */
@media (max-width: 1024px) {
    /* Tablet: 2 Columns with breathing room */
    #services .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 5.5rem 2rem !important; /* Extra Row Gap for floating icons */
    }
}

@media (max-width: 640px) {
    /* Mobile: 1 Column */
    #services .grid {
        grid-template-columns: 1fr !important;
        gap: 6.5rem 0 !important; /* CRITICAL: Large vertical gap to prevent Card A hitting Card B */
        padding-top: 2rem !important;
    }

    .service-card {
        padding: 0 !important;
        margin-top: 1rem !important;
    }

    /* Card Interior Content Fix */
    .service-card .p-10 {
        padding: 3rem 1.5rem 2rem 1.5rem !important; /* Top padding (3rem) clears the icon */
    }

    /* Adjust floating icon size and position for mobile */
    .service-icon-box {
        margin-top: -3.8rem !important; /* Adjust depth of overlap */
        width: 4.8rem !important;
        height: 4.8rem !important;
        border-width: 5px !important; /* Maintain premium look */
    }

    .service-card h3 {
        font-size: 1.6rem !important;
        margin-top: 0.5rem !important;
    }
}

/* ==========================================================================
   5. COMPONENT SPECIFIC OVERRIDES
   ========================================================================== */

/* About Us Narrative */
@media (max-width: 768px) {
    .narrative-image-container {
        padding-right: 0 !important;
        margin-bottom: 3.5rem;
    }
    /* Disable decorative offset box on mobile for cleaner look */
    .narrative-image-container::after {
        display: none !important;
    }
}

/* Contact Page Form Positioning */
@media (max-width: 768px) {
    .grid.-mt-24 {
        margin-top: -3rem !important; /* Less aggressive pull-up on mobile */
    }
    #contact-form {
        padding: 2rem 1.25rem !important;
        border-radius: 1.75rem !important;
    }
    .map-container, .relative.h-\[600px\] {
        height: 380px !important;
    }
}

/* ==========================================================================
   6. TOUCH & ACCESSIBILITY REFINEMENTS
   ========================================================================== */
@media (max-width: 768px) {
    /* Increase touch targets for Kenyan mobile users */
    a, button, select, input {
        min-height: 50px;
    }

    /* Standardize input text size to prevent iOS zoom-in glitch */
    input, select, textarea {
        font-size: 16px !important; 
    }

    /* WhatsApp Button positioning */
    .fixed.bottom-8.right-8 {
        bottom: 1.5rem !important;
        right: 1.5rem !important;
    }
    .w-16.h-16 {
        width: 3.8rem !important;
        height: 3.8rem !important;
    }
}

/* Prevent "Sticky" hover states on mobile phones */
@media (hover: none) {
    .service-card:hover, .group:hover, .value-item:hover {
        transform: none !important;
    }
    .nav-link::after {
        display: none !important;
    }
}

/* ==========================================================================
   7. PRINT (Financial Report Optimization)
   ========================================================================== */
@media print {
    nav, footer, .fixed, .contact-hero, .services-hero, .process-progress-bar {
        display: none !important;
    }
    body { color: #000; background: white; }
    .container { width: 100% !important; max-width: none !important; }
}