/* Mobile Optimizations CSS */
/* Comprehensive responsive design for tablets, phones, and touch devices */

/* ==========================================================================
   BREAKPOINTS
   ========================================================================== */
/*
   - Desktop: 1200px and above
   - Tablet Landscape (iPad): 1024px - 1199px
   - Tablet Portrait (iPad): 768px - 1023px
   - Phone Landscape: 576px - 767px
   - Phone Portrait: up to 575px
*/

/* ==========================================================================
   TABLET LANDSCAPE (iPad, 1024px - 1199px)
   ========================================================================== */
@media (max-width: 1199px) and (min-width: 1024px) {
    .container {
        max-width: 960px;
        padding: 0 2rem;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-content p {
        font-size: 1.1rem;
    }

    /* Hero slider adjustments */
    .hero-slider {
        height: 500px;
    }

    /* Grid layouts */
    .grid-3-cols,
    .grid-4-cols {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================================================
   TABLET PORTRAIT & SMALLER (iPad, < 1024px)
   ========================================================================== */
@media (max-width: 1023px) {
    /* Container adjustments */
    .container {
        max-width: 100%;
        padding: 0 1.5rem;
    }

    /* Typography scaling */
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    /* Hero section */
    .hero-content {
        padding: 3rem 1rem;
    }

    .hero-content h1 {
        font-size: 2.25rem;
        line-height: 1.2;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .hero-slider {
        height: 450px;
    }

    .hero-slide {
        padding: 2rem 1rem;
    }

    /* Navigation */
    nav .nav-links {
        flex-direction: column;
        width: 100%;
    }

    /* Grid layouts */
    .grid-3-cols,
    .grid-4-cols {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    /* Contact section */
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Cards */
    .card {
        padding: 1.5rem;
    }
}

/* ==========================================================================
   PHONE LANDSCAPE & SMALLER (< 768px)
   ========================================================================== */
@media (max-width: 767px) {
    /* Base typography */
    body {
        font-size: 14px;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    /* Container */
    .container {
        padding: 0 1rem;
    }

    /* Navigation mobile menu */
    .navbar {
        padding: 1rem;
    }

    .nav-menu-toggle {
        display: block;
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 1.5rem;
        cursor: pointer;
        z-index: 1001;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--navbar-bg);
        backdrop-filter: blur(10px);
        flex-direction: column;
        padding: 5rem 2rem 2rem;
        transition: right 0.3s ease;
        z-index: 1000;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links a {
        padding: 1rem 0;
        border-bottom: 1px solid var(--border);
        width: 100%;
    }

    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .nav-overlay.active {
        display: block;
    }

    /* Hero section */
    .hero-content {
        padding: 2rem 1rem;
        min-height: auto;
    }

    .hero-content h1 {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }

    .hero-content p {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }

    .hero-slider {
        height: 400px;
    }

    .hero-slide {
        padding: 1.5rem 1rem;
    }

    .hero-slide h3 {
        font-size: 1.25rem;
    }

    .hero-controls {
        bottom: 1rem;
    }

    .hero-dots {
        gap: 0.5rem;
    }

    /* Buttons */
    .btn,
    .cta-button {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    .btn-group {
        flex-direction: column;
        gap: 1rem;
    }

    .btn-group .btn {
        width: 100%;
    }

    /* Grid layouts - single column */
    .grid-2-cols,
    .grid-3-cols,
    .grid-4-cols {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Cards */
    .card {
        padding: 1.25rem;
    }

    .card-title {
        font-size: 1.1rem;
    }

    /* Services section */
    .services-grid {
        grid-template-columns: 1fr;
    }

    .service-card {
        padding: 1.5rem;
    }

    /* Contact section */
    .contact-section {
        padding: 3rem 0;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .contact-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .contact-item i {
        font-size: 1.25rem;
    }

    /* Contact reveal buttons */
    .reveal-contact-btn {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    .reveal-contact-btn-inline {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }

    /* OpenStreetMap */
    .map-container {
        height: 300px;
        margin-top: 1rem;
    }

    .map-container iframe {
        height: 300px;
    }

    /* Experience/Timeline section */
    .timeline-item {
        padding-left: 2rem;
    }

    .timeline-item::before {
        left: 0;
    }

    /* Certification cards */
    .certification-grid {
        grid-template-columns: 1fr;
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .footer-section {
        padding: 1rem 0;
    }

    /* Legal pages */
    .legal-page {
        padding: 2rem 0;
    }

    .legal-content {
        font-size: 0.9rem;
    }

    /* Tables */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Forms */
    .form-group {
        margin-bottom: 1rem;
    }

    input,
    textarea,
    select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* ==========================================================================
   PHONE PORTRAIT (< 576px)
   ========================================================================== */
@media (max-width: 575px) {
    /* Extra small screens */
    .container {
        padding: 0 0.75rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    /* Hero */
    .hero-content h1 {
        font-size: 1.5rem;
    }

    .hero-slider {
        height: 350px;
    }

    .hero-slide {
        padding: 1rem;
    }

    /* Buttons */
    .btn,
    .cta-button {
        padding: 0.65rem 1.25rem;
        font-size: 0.85rem;
    }

    /* Map */
    .map-container iframe {
        height: 250px;
    }

    /* Cards */
    .card {
        padding: 1rem;
    }

    /* Spacing */
    section {
        padding: 2rem 0;
    }
}

/* ==========================================================================
   iPAD SPECIFIC (768px - 1024px)
   ========================================================================== */
@media (min-width: 768px) and (max-width: 1024px) {
    /* iPad optimizations */
    .hero-slider {
        height: 480px;
    }

    .grid-3-cols {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-4-cols {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Two-column layout for cards on iPad */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .certification-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================================================
   iPhone SPECIFIC OPTIMIZATIONS
   ========================================================================== */
@media (max-width: 428px) {
    /* iPhone 14 Pro Max and similar */
    .hero-content {
        padding: 1.5rem 1rem;
    }

    .nav-links {
        width: 85%;
    }

    /* Optimize touch targets */
    .btn,
    a,
    button {
        min-height: 44px; /* Apple's recommended touch target */
        min-width: 44px;
    }

    /* Font size optimization for readability */
    body {
        font-size: 15px;
    }
}

/* ==========================================================================
   TOUCH DEVICE OPTIMIZATIONS
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .btn:hover,
    .card:hover,
    .service-card:hover {
        transform: none;
    }

    /* Increase touch target sizes */
    .btn,
    .reveal-contact-btn,
    .nav-links a {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
    }

    /* Improve tap feedback */
    .btn:active,
    .card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Remove hover-dependent features */
    .tooltip:hover::after {
        display: none;
    }
}

/* ==========================================================================
   LANDSCAPE MODE OPTIMIZATIONS (Mobile)
   ========================================================================== */
@media (max-height: 500px) and (orientation: landscape) {
    /* Reduce vertical spacing in landscape */
    .hero-content {
        padding: 1rem;
        min-height: auto;
    }

    .hero-slider {
        height: 90vh;
    }

    section {
        padding: 1.5rem 0;
    }

    .navbar {
        padding: 0.5rem 1rem;
    }

    /* Make nav menu full height in landscape */
    .nav-links {
        height: 100vh;
        padding: 3rem 2rem 2rem;
    }
}

/* ==========================================================================
   ACCESSIBILITY & REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .hero-slider,
    .carousel {
        scroll-behavior: auto;
    }
}

/* ==========================================================================
   HIGH DPI SCREENS (Retina)
   ========================================================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize images and borders for retina displays */
    img {
        image-rendering: -webkit-optimize-contrast;
    }

    .border,
    .card {
        border-width: 0.5px;
    }
}

/* ==========================================================================
   SAFE AREA INSETS (iPhone X and newer)
   ========================================================================== */
@supports (padding: env(safe-area-inset-bottom)) {
    .navbar,
    .footer {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .footer {
        padding-bottom: calc(2rem + env(safe-area-inset-bottom));
    }

    .nav-links {
        padding-top: calc(5rem + env(safe-area-inset-top));
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ==========================================================================
   PRINT OPTIMIZATIONS
   ========================================================================== */
@media print {
    .navbar,
    .footer,
    .hero-controls,
    .btn,
    button {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    a {
        text-decoration: underline;
    }
}
