/* Mobile-Specific Optimizations for Locally Swift */

/* ========================================
   MOBILE-FIRST ENHANCEMENTS
   ======================================== */

/* Mobile Typography Improvements */
@media (max-width: 640px) {
    /* Prevent text overflow on small screens */
    h1 {
        font-size: 2.5rem !important;
        line-height: 1.2;
        word-wrap: break-word;
    }

    h2 {
        font-size: 2rem !important;
        line-height: 1.3;
    }

    h3 {
        font-size: 1.5rem !important;
        line-height: 1.4;
    }

    /* Better readability on mobile */
    body {
        font-size: 16px;
        line-height: 1.6;
    }

    p {
        font-size: 1rem;
        line-height: 1.6;
    }
}

/* Touch-Friendly Buttons */
@media (max-width: 768px) {
    .btn-primary,
    .btn-secondary,
    .btn-outline,
    a[class*="btn-"] {
        min-height: 48px;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        /* Larger touch targets (minimum 44x44px recommended) */
    }

    /* Mobile navigation links */
    #mobile-menu a {
        min-height: 48px;
        display: flex;
        align-items: center;
        font-size: 1.125rem;
    }
}

/* Mobile Navigation Improvements */
@media (max-width: 768px) {
    /* Smooth mobile menu transition */
    #mobile-menu {
        transition: max-height 0.3s ease-in-out;
        max-height: 0;
        overflow: hidden;
    }

    #mobile-menu:not(.hidden) {
        max-height: 500px;
    }

    /* Fixed navigation on mobile */
    nav {
        position: sticky;
        top: 0;
        background: white;
        z-index: 1000;
    }
}

/* Mobile Hero Section Optimization */
@media (max-width: 768px) {
    /* Reduce hero padding on mobile */
    section[class*="pt-24"] {
        padding-top: 6rem;
        padding-bottom: 2rem;
    }

    /* Better image presentation on mobile */
    .hero-image-mobile {
        max-height: 300px;
        object-fit: cover;
        width: 100%;
    }

    /* Stack CTA buttons on mobile */
    .cta-buttons-mobile {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .cta-buttons-mobile a {
        width: 100%;
        text-align: center;
    }
}

/* Mobile Card Layouts */
@media (max-width: 768px) {
    .card {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }

    /* Single column on mobile */
    .mobile-single-column {
        grid-template-columns: 1fr !important;
    }
}

/* Mobile Services Page Optimization */
@media (max-width: 768px) {
    /* Services grid adjustments */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Equipment highlights */
    .equipment-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: left;
    }
}

/* Mobile Form Optimization */
@media (max-width: 640px) {
    /* Full-width form inputs on mobile */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px; /* Prevents zoom on iOS */
        width: 100%;
    }

    /* Better form spacing */
    form > div {
        margin-bottom: 1.25rem;
    }
}

/* Mobile Image Optimization */
@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
        display: block;
    }

    /* Prevent image overflow */
    .image-overlay,
    .hero-image-container {
        overflow: hidden;
        border-radius: 0.75rem;
    }
}

/* Mobile Footer Optimization */
@media (max-width: 768px) {
    footer .grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    footer ul {
        list-style: none;
        padding: 0;
    }
}

/* Mobile Spacing Adjustments */
@media (max-width: 640px) {
    /* Reduce section padding on mobile */
    section {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .py-20 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }

    .py-12 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
}

/* Improve tap targets */
@media (max-width: 768px) {
    a, button {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Navigation links exception (already have padding) */
    nav a {
        min-height: auto;
        min-width: auto;
    }
}

/* Mobile Text Alignment */
@media (max-width: 640px) {
    /* Center headings on mobile */
    h1, h2 {
        text-align: center;
    }

    /* Keep body text left-aligned for readability */
    p, li {
        text-align: left;
    }
}

/* Prevent horizontal scroll */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    * {
        max-width: 100%;
    }
}

/* Mobile-specific animations */
@media (max-width: 768px) {
    /* Reduce animation intensity on mobile */
    .animate-slide-up,
    .animate-fade-in,
    .animate-scale-in {
        animation-duration: 0.5s !important;
    }

    /* Disable hover effects on mobile (touch devices) */
    @media (hover: none) {
        .hover-lift:hover {
            transform: none;
        }

        .hover-glow:hover {
            box-shadow: none;
        }
    }
}

/* Mobile CTA Sections */
@media (max-width: 640px) {
    .cta-section {
        padding: 2rem 1rem;
    }

    .cta-section h2 {
        font-size: 1.875rem;
    }

    .cta-section p {
        font-size: 1.125rem;
    }
}

/* Mobile Blog Grid */
@media (max-width: 768px) {
    .blog-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Landscape Phone Optimization */
@media (max-width: 896px) and (orientation: landscape) {
    /* Reduce vertical padding in landscape */
    section {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }

    /* Smaller headings in landscape */
    h1 {
        font-size: 2rem !important;
    }

    h2 {
        font-size: 1.75rem !important;
    }
}

/* Very Small Screens (320px) */
@media (max-width: 374px) {
    /* iPhone SE and smaller */
    h1 {
        font-size: 2rem !important;
    }

    .btn-primary,
    .btn-secondary,
    .btn-outline {
        font-size: 0.875rem;
        padding: 0.75rem 1.25rem;
    }

    /* Tighter spacing on very small screens */
    section {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* Tablet Optimization (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Two-column layouts on tablets */
    .tablet-two-col {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Adjust container width for tablets */
    .max-w-7xl {
        max-width: 90%;
    }
}

/* Performance: Reduce animations on low-end devices */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support (if device prefers) */
@media (prefers-color-scheme: dark) {
    /* Optional: Add dark mode styles if needed in future */
}
