/* Mobile-First CSS Fixes */

/* Reset and base */
* {
    box-sizing: border-box;
}

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

/* Container fixes for mobile */
@media (max-width: 767px) {
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        width: 100%;
        max-width: 100%;
    }

    /* Hero section mobile fix */
    .hero {
        padding: 2rem 1rem !important;
        min-height: auto;
    }

    .hero h1 {
        font-size: 1.75rem !important;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    .hero p {
        font-size: 0.95rem !important;
        line-height: 1.6;
        margin-bottom: 1.5rem;
    }

    /* Search section mobile */
    .search-section {
        padding: 1rem 0 !important;
    }

    .search-form {
        flex-direction: column !important;
        width: 100%;
        padding: 0 !important;
        gap: 0.75rem;
    }

    .search-input-wrapper,
    .category-select,
    .search-button,
    .clear-button {
        width: 100% !important;
        max-width: 100%;
    }

    .search-input {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }

    .category-select {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }

    /* Stories grid mobile */
    .stories-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .story-card {
        width: 100%;
        margin-bottom: 0;
    }

    .story-image {
        height: 200px !important;
    }

    .story-content {
        padding: 1rem !important;
    }

    .story-title {
        font-size: 1.125rem !important;
    }

    .story-excerpt {
        font-size: 0.875rem !important;
    }

    /* Section spacing */
    .section {
        padding: 2rem 0 !important;
    }

    .section-title {
        font-size: 1.5rem !important;
    }

    .section-subtitle {
        font-size: 0.95rem !important;
        padding: 0 1rem;
    }

    /* Categories grid mobile */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .category-card {
        padding: 1rem !important;
    }

    .category-icon {
        font-size: 2rem !important;
    }

    /* Footer mobile */
    .footer-links {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    /* Pagination mobile */
    .pagination-wrapper nav {
        width: 100%;
        overflow-x: auto;
    }

    /* Mobile bottom nav spacing */
    body {
        padding-bottom: 70px !important;
    }
}

/* Small mobile devices (< 375px) */
@media (max-width: 374px) {
    .hero h1 {
        font-size: 1.5rem !important;
    }

    .hero p {
        font-size: 0.875rem !important;
    }

    .story-title {
        font-size: 1rem !important;
    }

    .category-icon {
        font-size: 1.75rem !important;
    }

    .categories-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Large mobile (375px - 767px) */
@media (min-width: 375px) and (max-width: 767px) {
    .hero h1 {
        font-size: 1.85rem !important;
    }

    .story-image {
        height: 220px !important;
    }
}

/* Tablet portrait (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }

    .stories-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem !important;
    }

    .categories-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}
