/* Tablet */
@media (max-width: 992px) {
    .hero h2 {
        font-size: 36px;
    }
    
    .hero .subtitle {
        font-size: 20px;
    }
    
    .science-content {
        flex-direction: column;
    }
    
    .science-image {
        order: 1;
        margin: 0 auto;
    }
    
    .science-text {
        order: 2;
    }
}

/* Mobile */
@media (max-width: 768px) {
    /* Better touchable sizes for mobile */
    html {
        font-size: 16px; /* Base font size for mobile */
        -webkit-text-size-adjust: 100%; /* Prevent iOS font size adjustments */
    }
    
    body {
        overflow-x: hidden; /* Prevent horizontal scroll */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        /* For Android - smoother scrolling */
        scroll-behavior: smooth;
    }
    
    /* Global improvements for touch devices */
    * {
        /* Faster taps on mobile */
        touch-action: manipulation;
    }
    
    /* Add padding to improve touch targets */
    button, 
    .app-store-btn,
    .learn-more-btn,
    nav ul li a,
    .feature-card,
    .faq-question {
        padding: 12px 16px;
        min-height: 48px; /* Android recommended touch target */
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Touch active states */
    .touch-active {
        background-color: rgba(0, 0, 0, 0.05) !important;
        transform: scale(0.98) !important;
        transition: all 0.1s ease-in-out !important;
    }
    
    /* Improved spacing for readability */
    p, li {
        line-height: 1.7;
        font-size: 16px; /* Ensure readable text on small screens */
    }
    
    /* Base layout improvements */
    .container {
        width: 92%; /* Slightly less padding on mobile */
        padding: 0 10px;
        max-width: 600px; /* Cap width for better readability */
    }
    
    /* Reduced vertical spacing */
    section {
        padding: 40px 0;
    }
    
    /* Improved spacings on feature cards */
    .feature-card {
        margin-bottom: 15px;
        /* Add tactile feedback on touch */
        transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
    }
    
    /* Header improvements */
    .header-container {
        padding: 10px 0;
    }
    
    /* Enhanced mobile menu button */
    .mobile-menu-btn {
        display: block;
        width: 48px;
        height: 48px;
        font-size: 24px;
        border-radius: 8px;
        background-color: transparent;
        transition: background-color 0.2s;
        z-index: 1001;
    }
    
    .mobile-menu-btn:active {
        background-color: rgba(0, 0, 0, 0.1);
    }

    /* Improved mobile navigation */
    nav {
        display: none;
        position: fixed; /* Fixed position for better UX */
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(255, 255, 255, 0.98);
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        padding-top: 80px; /* Space for header */
        overflow-y: auto; /* Allow scrolling for many menu items */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling for iOS */
    }

    nav.active {
        display: block;
        animation: fadeIn 0.3s ease-out;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    nav ul {
        flex-direction: column;
        padding: 20px 0;
    }

    nav ul li {
        margin: 0;
        text-align: center;
        padding: 0;
        width: 100%;
    }
    
    nav ul li a {
        display: block;
        width: 100%;
        padding: 16px;
        margin: 4px 0;
        font-size: 18px;
        border-radius: 8px;
    }
    
    nav ul li a:active,
    nav ul li a.touch-active {
        background-color: rgba(41, 121, 255, 0.1);
    }

    /* Hero section improvements */
    .hero {
        padding: 60px 0 40px;
    }

    .hero h2 {
        font-size: 32px;
        margin-bottom: 15px;
    }

    .hero .subtitle {
        font-size: 18px;
        margin-bottom: 15px;
    }

    .hero-text {
        font-size: 16px;
        padding: 0 15px;
    }
    
    /* App preview adjustments */
    .app-preview {
        margin: 30px auto;
        max-width: 280px; /* Smaller on mobile */
    }
    
    .phone-mockup {
        width: 100%;
    }

    /* App store buttons */
    .app-stores {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .app-store-btn {
        width: 100%;
        max-width: 220px;
        justify-content: center;
    }

    /* Section titles */
    .section-title h3 {
        font-size: 28px;
        margin-bottom: 15px;
    }
    
    .section-title p {
        font-size: 16px;
        padding: 0 10px;
    }

    /* Features grid */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .feature-card {
        padding: 20px;
    }
    
    /* Tables */
    .comparison-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        font-size: 14px; /* Smaller font for tables */
    }
    
    .comparison-table th, .comparison-table td {
        padding: 12px 15px;
    }

    /* Science section */
    .science-list li .text h4 {
        font-size: 18px;
    }
    
    /* Better mobile section content layout */
    .difference-text, .feature-text, .science-text, .daily-text, .privacy-text {
        text-align: center;
        padding: 0 15px;
    }
    
    /* Better handling of long content sections */
    .science-list, .feature-benefits, .daily-benefits, .privacy-features {
        text-align: left;
    }
    
    /* Allow buttons to center properly */
    .learn-more-btn {
        display: block;
        margin: 30px auto 0;
        max-width: 200px;
        text-align: center;
    }
    
    /* Pulse animation adjustments */
    .pulse-animation {
        height: 40px; /* Smaller height */
        margin: 30px auto;
    }
    
    /* FAQ Improvements */
    .faq-item {
        margin-bottom: 15px;
    }
    
    .faq-question {
        padding: 15px;
        font-size: 16px;
    }
    
    .faq-answer {
        padding: 0 15px 15px;
        font-size: 15px;
    }
    
    /* Footer improvements */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .footer-column {
        text-align: center;
    }
    
    .footer-column h4 {
        margin-bottom: 15px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    /* Extremely small screens */
    html {
        font-size: 15px;
    }
    
    .container {
        width: 95%;
        padding: 0 8px;
    }
    
    .hero h2 {
        font-size: 28px;
    }

    .hero .subtitle {
        font-size: 16px;
    }

    .logo h1 {
        font-size: 20px;
    }

    .logo img {
        height: 30px;
    }
    
    /* Stack all columns to single column */
    .feature-icon {
        width: 60px;
        height: 60px;
    }

    .feature-card h4 {
        font-size: 20px;
    }
    
    /* Even tighter layouts */
    section {
        padding: 30px 0;
    }
    
    .section-title {
        margin-bottom: 40px;
    }
    
    /* Reduce imagery size */
    .app-preview {
        max-width: 240px;
    }
    
    /* CTA section */
    .cta h3 {
        font-size: 24px;
    }
    
    .cta p {
        font-size: 16px;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .footer-bottom {
        font-size: 12px;
    }
}

/* Special adjustments specifically for Android devices */
@media screen and (max-width: 480px) and (-webkit-min-device-pixel-ratio: 2), 
       screen and (max-width: 480px) and (min-resolution: 192dpi) {
    /* Android-specific touch improvements */
    button, 
    .app-store-btn,
    .learn-more-btn,
    nav ul li a,
    .feature-card,
    .faq-question {
        min-height: 52px; /* Slightly larger touch targets for Android */
    }
    
    /* Fix for Android font rendering */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Fix for Android button rendering */
    button, .app-store-btn, .learn-more-btn {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Fix for Android scrolling jank */
    .comparison-table, nav {
        -webkit-backface-visibility: hidden;
        -webkit-perspective: 1000;
    }
}