/* Mobile Optimization CSS - Include this in pages that need enhanced mobile support */

/* Touch-friendly sizing */
* {
    box-sizing: border-box;
}

/* Ensure minimum touch target sizes (44px minimum recommended by WCAG) */
button,
a,
input[type="button"],
input[type="submit"],
.touchable,
.mobile-menu-toggle {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Prevent text selection on touch devices for UI elements */
button,
.mobile-menu-toggle,
nav a {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Improve tap highlighting */
a,
button,
input,
textarea,
select {
    -webkit-tap-highlight-color: rgba(255, 0, 102, 0.3);
}

/* Prevent zoom on form inputs (iOS Safari) */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
textarea,
select {
    font-size: 16px; /* Prevents zoom on iOS */
}

/* Smooth scrolling for all devices */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Improve loading performance on mobile */
img {
    max-width: 100%;
    height: auto;
    loading: lazy;
}

/* Better font rendering on mobile */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Enhanced mobile navigation */
@media (max-width: 768px) {
    /* Increase spacing for touch targets */
    nav ul li a {
        padding: 15px 20px;
        margin: 2px 0;
    }
    
    /* Improve form usability */
    form {
        padding: 0 10px;
    }
    
    form label {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    form input,
    form textarea,
    form select {
        padding: 15px;
        border-radius: 8px;
        margin-bottom: 20px;
    }
    
    form button {
        padding: 15px 20px;
        font-size: 1.1rem;
        border-radius: 8px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    /* Reduce margins for better space utilization */
    section {
        margin: 5px;
        padding: 15px;
    }
    
    /* Adjust font sizes for readability */
    h1 {
        font-size: 1.5rem;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.3rem;
        line-height: 1.3;
    }
    
    p, li {
        font-size: 1rem;
        line-height: 1.5;
    }
}

/* Very small devices */
@media (max-width: 360px) {
    section {
        margin: 2px;
        padding: 10px;
    }
    
    h1 {
        font-size: 1.3rem;
    }
    
    h2 {
        font-size: 1.2rem;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    header {
        padding: 5px 0;
    }
    
    .mobile-menu-toggle {
        top: 8px;
    }
    
    nav ul li a {
        padding: 10px 15px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper borders and shadows */
    .mobile-menu-toggle span {
        border-radius: 1px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #ffffff;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Print styles */
@media print {
    .mobile-menu-toggle,
    nav {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    a {
        text-decoration: underline;
    }
}