/* Mobile Optimizations for Laty's Foundation */

/* ============================================
   CORE MOBILE IMPROVEMENTS
   ============================================ */

/* Improve text readability on mobile */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        line-height: 1.6;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    /* Container adjustments */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* ============================================
   TYPOGRAPHY OPTIMIZATIONS
   ============================================ */

@media (max-width: 640px) {
    /* Scale down large headings for mobile */
    h1 {
        font-size: 2rem !important;
        line-height: 1.2 !important;
        margin-bottom: 1rem;
    }

    h2 {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
        margin-bottom: 0.875rem;
    }

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

    /* Improve paragraph readability */
    p {
        font-size: 1rem;
        line-height: 1.7;
        margin-bottom: 1rem;
    }
}

/* ============================================
   TOUCH TARGET IMPROVEMENTS
   ============================================ */

@media (max-width: 768px) {
    /* Ensure all buttons meet minimum touch target size (44x44px) */
    button,
    a.btn,
    .btn-primary,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 24px;
        font-size: 1rem;
    }

    /* Navigation links */
    .mobile-nav-link {
        min-height: 48px;
        display: flex;
        align-items: center;
        padding: 12px 16px !important;
        font-size: 1.125rem;
    }

    /* Icon buttons */
    .mobile-menu-button {
        min-width: 48px;
        min-height: 48px;
        padding: 12px;
    }

    /* Social media icons */
    .social-icon {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ============================================
   NAVIGATION OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    /* Mobile menu improvements */
    #mobile-menu {
        background-color: #1a1a1a;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Sticky header adjustment */
    header {
        backdrop-filter: blur(10px);
    }

    /* Logo sizing for mobile */
    header img {
        max-height: 48px;
        width: auto;
    }
}

/* ============================================
   HERO SECTION OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    .hero-section {
        min-height: 100vh;
        background-attachment: scroll !important;
        padding: 2rem 1rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .hero-content {
        padding: 1.5rem;
        text-align: center;
    }

    /* Hero buttons stack on mobile */
    .hero-content .flex {
        flex-direction: column;
        gap: 1rem;
    }

    .hero-content a {
        width: 100%;
        text-align: center;
        white-space: nowrap;
    }
}

/* ============================================
   IMAGE OPTIMIZATIONS
   ============================================ */

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

    /* Board member images */
    .board-member img,
    .team-member img {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
        border-radius: 8px;
    }

    /* Feature images */
    .feature-image {
        margin-bottom: 2rem;
        border-radius: 12px;
        overflow: hidden;
    }
}

/* ============================================
   CARD & SECTION OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    /* Card spacing */
    .card-hover,
    .card {
        margin-bottom: 1.5rem;
        padding: 1.5rem;
    }

    /* Section padding */
    section {
        padding: 3rem 0 !important;
    }

    /* Grid improvements */
    .grid {
        gap: 1.5rem;
    }

    /* Remove hover effects on mobile */
    .card-hover:hover {
        transform: none;
    }
}

/* ============================================
   FORM OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    /* Form inputs */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        width: 100%;
        min-height: 48px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 16px;
        border-radius: 8px;
        -webkit-appearance: none;
        appearance: none;
    }

    textarea {
        min-height: 120px;
        resize: vertical;
    }

    /* Form labels */
    label {
        font-size: 1rem;
        margin-bottom: 0.5rem;
        display: block;
    }

    /* Form spacing */
    .form-group,
    .mb-4,
    .mb-6 {
        margin-bottom: 1.25rem;
    }
}

/* ============================================
   TABLE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    /* Make tables scrollable */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    /* Responsive table alternative */
    .responsive-table {
        display: block;
        width: 100%;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid rgba(200, 16, 46, 0.3);
        border-radius: 8px;
        padding: 1rem;
    }

    .responsive-table td {
        display: block;
        text-align: left;
        padding: 0.5rem 0;
    }

    .responsive-table td::before {
        content: attr(data-label);
        font-weight: bold;
        display: inline-block;
        width: 40%;
        color: #c8102e;
    }
}

/* ============================================
   FOOTER OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    footer {
        padding: 2rem 0;
    }

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

    footer ul {
        padding-left: 0;
    }

    footer .social-links {
        justify-content: center;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    /* Reduce animations on mobile for better performance */
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.2s !important;
    }

    /* Disable parallax effects on mobile */
    [style*="background-attachment: fixed"] {
        background-attachment: scroll !important;
    }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

@media (max-width: 768px) {
    /* Focus states for keyboard navigation */
    a:focus,
    button:focus,
    input:focus,
    textarea:focus,
    select:focus {
        outline: 3px solid #c8102e;
        outline-offset: 2px;
    }

    /* Skip to content link */
    .skip-to-content {
        position: absolute;
        top: -40px;
        left: 0;
        background: #c8102e;
        color: white;
        padding: 8px 16px;
        text-decoration: none;
        z-index: 100;
    }

    .skip-to-content:focus {
        top: 0;
    }
}

/* ============================================
   MODAL & POPUP OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    .modal,
    .popup {
        width: 95vw;
        max-width: 95vw;
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ============================================
   LANDSCAPE ORIENTATION FIXES
   ============================================ */

@media (max-width: 896px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: 4rem 1rem;
    }

    header {
        position: relative;
    }
}

/* ============================================
   PRINT OPTIMIZATIONS
   ============================================ */

@media print {
    /* Hide navigation, footer, and interactive elements */
    header,
    footer,
    #mobile-menu,
    button,
    .btn-primary {
        display: none !important;
    }

    /* Optimize for printing */
    body {
        background: white;
        color: black;
    }

    a {
        text-decoration: underline;
    }

    a[href]::after {
        content: " (" attr(href) ")";
    }
}

/* ============================================
   SMALL MOBILE DEVICES (< 375px)
   ============================================ */

@media (max-width: 374px) {
    h1 {
        font-size: 1.75rem !important;
    }

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

    .btn-primary {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* ============================================
   TABLET OPTIMIZATIONS (768px - 1024px)
   ============================================ */

@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        max-width: 720px;
    }

    /* Two-column grid for tablets */
    .grid-cols-1 {
        grid-template-columns: repeat(2, 1fr);
    }
}
