/* Genesis Mobile Fix - v1.32.0 - 2026-06-16 */
/* Fixes blocks overflowing margins on mobile */
/* v7.5 Constitutional Mission Consolidation */

/* CRITICAL: Prevent horizontal overflow */
html, body { 
    overflow-x: hidden !important; 
    max-width: 100vw !important; 
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

*, *::before, *::after { 
    max-width: 100vw; 
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box !important;
}

/* All sections prevent overflow */
section, .hero, .page-header, .page-hero, .footer,
.genesis-section, .not-section, .solutions-section,
.pricing-section, .cta-section { 
    overflow-x: hidden !important; 
    width: 100% !important; 
}

/* Container mobile padding */
.container { 
    padding-left: 1rem !important; 
    padding-right: 1rem !important; 
    width: 100% !important; 
    box-sizing: border-box !important; 
}

@media (max-width: 768px) {
    /* Typography */
    h1 { font-size: 1.8rem !important; }
    h2 { font-size: 1.5rem !important; }
    h3 { font-size: 1.2rem !important; }
    .title-genesis { font-size: 2rem !important; }
    .title-subtitle { font-size: 1rem !important; }
    
    /* Hero */
    .hero { padding: 6rem 0 2rem !important; }
    .hero-container { padding: 0 1rem !important; }
    .hero-badge { font-size: 0.75rem; flex-wrap: wrap; justify-content: center; }
    .hero-cta { flex-direction: column; gap: 0.75rem; }
    .hero-cta .btn { width: 100%; justify-content: center; }
    .hero-stats { grid-template-columns: 1fr !important; }
    
    /* Navigation */
    .nav-menu { display: none; }
    .nav-menu.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(15, 23, 42, 0.98);
        padding: 1rem;
        z-index: 1000;
    }
    .hamburger { display: block !important; }
    .nav-container { padding: 0 1rem !important; }
    
    /* ALL grids single column */
    .not-grid, .genesis-grid, .quicklinks-grid, .solutions-grid,
    .why-grid, .deployment-grid, .sovereignty-grid, .guarantees-grid,
    .why-now-grid, .moats-grid, .capabilities-grid, .solution-pricing-grid,
    .pricing-cards-grid, .success-fee-grid, .personal-pricing-grid,
    .platform-grid, .philosophy-grid, .research-grid, .demo-speakers,
    .collab-options, .feature-grid, .demo-grid { 
        grid-template-columns: 1fr !important; 
    }
    
    /* Tables scroll horizontally */
    .pricing-table, .comparison-table, .pricing-matrix-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Cards */
    .genesis-card, .not-card, .quicklink-card, .solution-card,
    .pricing-card-new, .platform-card, .research-card {
        padding: 1.25rem !important;
        margin-bottom: 1rem;
    }
    
    /* Footer */
    .footer-grid { grid-template-columns: 1fr !important; text-align: center; }
    .footer-bottom { flex-direction: column; text-align: center; }
    
    /* Forms */
    .contact-grid { grid-template-columns: 1fr !important; }
    .contact-form .form-row { grid-template-columns: 1fr !important; }
    
    /* Calculator */
    .calculator-card { grid-template-columns: 1fr !important; }
    
    /* Demo */
    .demo-main { grid-template-columns: 1fr !important; }
    
    /* Misc */
    .success-guarantee { flex-direction: column; text-align: center; }
    .phase-indicator { flex-wrap: wrap; }
    .market-grid, .sdg-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 480px) {
    .container { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
    .title-genesis { font-size: 1.6rem !important; }
    .btn { padding: 0.6rem 1rem; font-size: 0.85rem; }
    .stat-card { flex-direction: column; text-align: center; }
    .market-grid, .sdg-grid { grid-template-columns: 1fr !important; }
    section { padding: 2.5rem 0 !important; }
    .page-header, .page-hero { padding: 5rem 0 2rem !important; }
}

/* Additional mobile fixes for inline grid styles */
@media (max-width: 768px) {
    /* Fix inline grid styles that use repeat(4, 1fr) or repeat(3, 1fr) */
    [style*="grid-template-columns: repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    [style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
    }
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    /* Fix 5-column grids (Constitutional Objectives) */
    [style*="grid-template-columns: repeat(5"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* Fix any inline max-width that might cause overflow */
    [style*="max-width: 1000px"],
    [style*="max-width: 1100px"],
    [style*="max-width: 900px"],
    [style*="max-width: 800px"] {
        max-width: 100% !important;
        width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    /* Fix inline gap that might be too large */
    [style*="gap: 3rem"] {
        gap: 1.5rem !important;
    }
    [style*="gap: 2rem"] {
        gap: 1rem !important;
    }
    /* Fix inline padding that might be too large */
    [style*="padding: 4rem"] {
        padding: 2rem 1rem !important;
    }
    /* Ensure all divs with inline styles don't overflow */
    div[style] {
        max-width: 100% !important;
    }
}

@media (max-width: 480px) {
    [style*="grid-template-columns: repeat(4"] {
        grid-template-columns: 1fr !important;
    }
    [style*="grid-template-columns: repeat(2"] {
        grid-template-columns: 1fr !important;
    }
    [style*="grid-template-columns: repeat(5"] {
        grid-template-columns: 1fr !important;
    }
    /* Even smaller gaps on very small screens */
    [style*="gap: 1.5rem"] {
        gap: 0.75rem !important;
    }
    [style*="gap: 1rem"] {
        gap: 0.5rem !important;
    }
    /* Reduce font sizes for very small screens */
    [style*="font-size: 1.4rem"] {
        font-size: 1.1rem !important;
    }
    [style*="font-size: 1.2rem"] {
        font-size: 1rem !important;
    }
    [style*="font-size: 1.15rem"] {
        font-size: 0.95rem !important;
    }
    [style*="font-size: 1.1rem"] {
        font-size: 0.9rem !important;
    }
}

/* Ensure all images are responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Fix any absolute positioned elements that might overflow */
[style*="position: absolute"] {
    max-width: 100vw;
}

/* Ensure tables don't overflow */
table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

/* Touch targets for mobile */
@media (max-width: 768px) {
    .btn, button, a {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Fix section headers */
    .section-header {
        padding: 0 1rem !important;
    }
    .section-header h2 {
        font-size: 1.5rem !important;
    }
    .section-header p {
        font-size: 0.9rem !important;
    }
    
    /* Fix hero description */
    .hero-description {
        font-size: 0.95rem !important;
        padding: 0 0.5rem !important;
    }
    
    /* Fix stat cards */
    .stat-card {
        padding: 1rem !important;
    }
    .stat-value {
        font-size: 1rem !important;
    }
    .stat-label {
        font-size: 0.8rem !important;
    }
}
