/**
 * Enhanced Mobile Experience
 *
 * @package NEWTIV
 * @since 1.0.0
 */

/* ============================================
   Mobile-First Improvements
   ============================================ */
@media (max-width: 768px) {
    /* Touch-friendly targets */
    a,
    button,
    .button,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Improved spacing */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Better typography */
    h1 {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
    }
    
    h2 {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }
    
    h3 {
        font-size: clamp(1.25rem, 4vw, 1.75rem);
    }
    
    /* Optimized cards */
    .entry,
    .product-card,
    .card {
        margin-bottom: 1.5rem;
    }
    
    /* Better forms */
    input,
    textarea,
    select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }
    
    /* Improved navigation */
    .main-navigation {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: #fff;
        z-index: 9999;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
    }
    
    .main-navigation.active {
        left: 0;
    }
    
    /* Mobile menu overlay */
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }
    
    .menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Better product grid */
    .products-grid,
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* Improved hero sections */
    .archive-hero-section,
    .shop-hero-section {
        padding: 2rem 0;
        margin-bottom: 2rem;
    }
    
    .archive-hero-title,
    .shop-hero-title {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
    }
    
    /* Better single post */
    .single-post-hero {
        min-height: 250px;
    }
    
    .single-post-body {
        font-size: 1rem;
        line-height: 1.8;
    }
    
    /* Optimized sidebar */
    .sidebar {
        margin-top: 2rem;
    }
    
    /* Better pagination */
    .posts-navigation {
        flex-direction: column;
    }
    
    .nav-previous,
    .nav-next {
        width: 100%;
    }
    
    /* Improved buttons */
    .button,
    button {
        width: 100%;
        justify-content: center;
    }
    
    .no-results-actions {
        flex-direction: column;
    }
    
    .no-results-actions .button {
        width: 100%;
    }
}

/* ============================================
   Tablet Optimizations
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .container {
        max-width: 960px;
    }
}

/* ============================================
   Touch Gestures
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .entry:hover,
    .product-card:hover,
    .card:hover {
        transform: none;
    }
    
    /* Better tap targets */
    a,
    button {
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.2);
    }
}

/* ============================================
   Landscape Mobile
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .archive-hero-section,
    .shop-hero-section {
        padding: 1.5rem 0;
    }
    
    .single-post-hero {
        min-height: 200px;
    }
}

/* ============================================
   High DPI Displays
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ============================================
   Dark Mode Support
   ============================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --color-white: #1f2937;
        --color-gray-50: #111827;
        --color-gray-100: #1f2937;
        --color-gray-900: #f9fafb;
        --color-text: #f9fafb;
    }
    
    body {
        background-color: #111827;
        color: #f9fafb;
    }
    
    .entry,
    .card,
    .product-card {
        background: #1f2937;
        color: #f9fafb;
    }
}

