/*
 * sKal Mobile Optimization Framework v2.0
 * Automatically applied to all Smart Landing Pages & AI Landing Page Transformer outputs
 * Professional mobile experience matching industry standards
 */

:root {
    /* Mobile-first spacing system */
    --mobile-header-height: 64px;
    --mobile-safe-area: max(env(safe-area-inset-top, 0px), 8px);
    --mobile-padding: 16px;
    --mobile-section-spacing: 48px;
    --mobile-element-spacing: 24px;
    
    /* Typography scaling */
    --mobile-h1-size: clamp(24px, 6vw, 36px);
    --mobile-h2-size: clamp(20px, 5vw, 28px);
    --mobile-h3-size: clamp(18px, 4vw, 24px);
    --mobile-body-size: clamp(14px, 3.5vw, 16px);
    
    /* Interaction targets */
    --mobile-tap-target: 44px;
    --mobile-button-padding: 12px 24px;
}

/* ====== CORE RESPONSIVE FOUNDATION ====== */

/* Images - Universal responsive behavior */
img, video, picture {
    max-width: 100%;
    height: auto;
}

/* Logos - Consistent sizing */
.logo img, 
.header-logo img,
[class*="logo"] img {
    max-height: 40px;
    width: auto;
    object-fit: contain;
}

/* ====== LAYOUT OPTIMIZATION ====== */

/* Container system */
.container {
    max-width: 100%;
    padding: 0 var(--mobile-padding);
}

/* Header fixes - prevent content overlap - Only when has-fixed-header class */
body.has-fixed-header .header, 
body.has-fixed-header .navbar,
body.has-fixed-header [class*="header"],
body.has-fixed-header [class*="nav"] {
    height: var(--mobile-header-height);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

/* Body offset for fixed header - Only when has-fixed-header class */
body.has-fixed-header {
    padding-top: var(--mobile-header-height);
}

/* Hero section - proper spacing from header */
.hero-section,
.hero,
[class*="hero"] {
    padding-top: calc(var(--mobile-safe-area) + var(--mobile-element-spacing)) !important;
    min-height: auto;
}

/* ====== GRID SYSTEMS ====== */

/* Standard feature grids - maintain usability */
.features-grid,
.feature-grid,
[class*="feature"] {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--mobile-element-spacing);
}

/* Compact transformation features - 2 columns max */
.transformation-features,
.stats-grid,
[class*="transformation"],
[class*="stats"] {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* Benefits and testimonials - single column for readability */
.benefits-grid,
.testimonials-grid,
[class*="benefit"],
[class*="testimonial"] {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--mobile-element-spacing);
}

/* ====== TYPOGRAPHY OPTIMIZATION ====== */

/* Headings - fluid scaling */
h1, .h1, [class*="title"] {
    font-size: var(--mobile-h1-size);
    line-height: 1.2;
    margin-bottom: var(--mobile-element-spacing);
}

h2, .h2, [class*="subtitle"] {
    font-size: var(--mobile-h2-size);
    line-height: 1.25;
    margin-bottom: 16px;
}

h3, .h3 {
    font-size: var(--mobile-h3-size);
    line-height: 1.3;
    margin-bottom: 12px;
}

p, .body-text {
    font-size: var(--mobile-body-size);
    line-height: 1.6;
    margin-bottom: 16px;
}

/* ====== INTERACTIVE ELEMENTS ====== */

/* Buttons - touch-friendly sizing */
.btn,
.button,
.cta-button,
[class*="btn"],
[class*="button"] {
    min-height: var(--mobile-tap-target);
    padding: var(--mobile-button-padding);
    font-size: var(--mobile-body-size);
    border-radius: 8px;
    margin: 8px 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Links - adequate spacing */
a {
    min-height: var(--mobile-tap-target);
    display: inline-flex;
    align-items: center;
}

/* ====== ANIMATION CONTROLS ====== */

/* Disable problematic animations on mobile */
@media (max-width: 768px) {
    /* 3D animations - disable completely */
    [class*="3d"],
    [class*="rotate"],
    [class*="spin"] {
        animation: none !important;
        transform: none !important;
    }
    
    /* Orbit animations - static on mobile */
    [class*="orbit"],
    [class*="floating"] {
        animation: none !important;
    }
    
    /* Parallax effects - disable */
    [class*="parallax"] {
        transform: none !important;
    }
    
    /* Reduce motion intensity */
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.3s !important;
    }
}

/* ====== MOBILE-SPECIFIC RESPONSIVE RULES ====== */

@media (max-width: 768px) {
    /* Container improvements */
    .container {
        padding: 0 var(--mobile-padding);
    }
    
    /* Section spacing */
    section,
    .section {
        padding: var(--mobile-section-spacing) 0;
    }
    
    /* Hero improvements */
    .hero-section,
    .hero {
        padding: calc(var(--mobile-header-height) + 32px) 0 var(--mobile-section-spacing);
        text-align: center;
    }
    
    /* Feature cards */
    .feature-card,
    .card,
    [class*="card"] {
        padding: 20px;
        margin-bottom: 16px;
        border-radius: 12px;
    }
    
    /* Form elements */
    input,
    textarea,
    select {
        min-height: var(--mobile-tap-target);
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px 16px;
        border-radius: 8px;
    }
    
    /* Navigation improvements */
    .nav-menu,
    .menu {
        position: fixed;
        top: var(--mobile-header-height);
        left: 0;
        right: 0;
        background: white;
        z-index: 999;
    }
}

/* ====== ACCESSIBILITY & PERFORMANCE ====== */

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

/* High contrast support */
@media (prefers-contrast: high) {
    .btn,
    .button {
        border: 2px solid currentColor;
    }
}

/* ====== COUNTDOWN TIMER FIXES ====== */

.countdown-timer,
.countdown,
[class*="countdown"] {
    font-size: 1.1rem !important;
    padding: 12px 16px !important;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* ====== CRITICAL OVERRIDES FOR COMMON ISSUES ====== */

@media (max-width: 768px) {
    /* Force single column for problematic multi-column layouts */
    [style*="repeat(4, 1fr)"] {
        grid-template-columns: 1fr 1fr !important;
    }
    
    [style*="repeat(3, 1fr)"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Fix overflow issues */
    .overflow-hidden {
        overflow-x: hidden;
    }
    
    /* Ensure proper scroll behavior */
    html {
        scroll-behavior: smooth;
    }
    
    /* Fix sticky elements */
    [class*="sticky"],
    [class*="fixed"] {
        position: relative;
    }
}

/* ====== LANDING PAGE SPECIFIC OPTIMIZATIONS ====== */

/* CTA sections */
.cta-section,
[class*="cta"] {
    padding: var(--mobile-section-spacing) var(--mobile-padding);
    text-align: center;
}

/* Pricing tables */
.pricing-grid,
[class*="pricing"] {
    grid-template-columns: 1fr;
    gap: var(--mobile-element-spacing);
}

/* Footer optimization */
.footer,
footer {
    padding: var(--mobile-section-spacing) var(--mobile-padding);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: var(--mobile-element-spacing);
    text-align: center;
}

/* ====== VERSION TRACKING ====== */
.mobile-optimized::after {
    content: "Mobile Optimized v2.0";
    display: none;
}