/* Mobile First Approach - Base styles for mobile devices */

/* Extra Small Devices (phones, 480px and down) */
@media (max-width: 480px) {
    /* Prevent post title or extra text from appearing after FlashNews logo in mobile header */
    .nav-logo {
        max-width: 120px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .nav-container {
        overflow: hidden;
    }
    /* Make 'Stay Updated' text blue in mobile view */
    .newsletter-content h2 {
        color: #2563eb !important; /* Tailwind blue-600 */
    }
    .newsletter-content p {
        color: #2563eb !important;
    }
    .container {
        padding: 0 0.75rem;
    }
  
    /* Navigation */
    .nav-container {
        padding: 0 0.75rem;
    }
    
    .nav-logo {
        font-size: 1.25rem;
    }
    
    .nav-logo i {
        font-size: 1.5rem;
    }
    
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--bg-white);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow-medium);
        padding: 2rem 0;
        gap: 0;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-item {
        margin: 1rem 0;
    }
    
    .nav-link {
        padding: 1rem;
        display: block;
        font-size: 1.1rem;
    }
    
    .hamburger {
        display: flex;
    }
    
    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    
    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
    
    /* Hero Section */
    .hero {
        padding: 6rem 0 3rem;
        text-align: center;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 0.75rem;
    }
    
    .hero-text h1 {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }
    
    .hero-text p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .hero-image i {
        font-size: 6rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .btn-small {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Section Titles */
    .section-title {
        font-size: 1.75rem;
        margin-bottom: 2rem;
    }
    
    /* Featured Posts */
    .featured-section {
        padding: 3rem 0;
    }
    
    .featured-posts {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .featured-post .post-content {
        padding: 1rem;
    }
    
    .post-actions {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .post-stats {
        display: flex;
        justify-content: center;
        gap: 1rem;
    }
    
    /* Categories */
    .categories-section {
        padding: 3rem 0;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .category-card {
        padding: 1.5rem;
    }
    
    .category-card i {
        font-size: 2.5rem;
    }
    
    /* Posts Section */
    .posts-section {
        padding: 3rem 0;
    }
    
    .posts-filter {
        gap: 0.5rem;
        margin-bottom: 2rem;
    }
    
    .filter-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-bottom: 2rem;
    }
    
    .post-card .post-content {
        padding: 1rem;
    }
    
    .post-card h3 {
        font-size: 1.1rem;
    }
    
    /* Newsletter */
    .newsletter-section {
        padding: 3rem 0;
    }
    
    .newsletter-content h2 {
        font-size: 1.5rem;
    }
    
    .newsletter-form {
        flex-direction: column;
        gap: 0.75rem;
        max-width: 100%;
    }
    
    .newsletter-form input {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    /* Footer */
    .footer {
        padding: 2rem 0 1rem;
        background: #111827 !important; /* dark background */
        color: #fff !important; /* white text */
    }
    
    .footer-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1.25rem;
        text-align: center;
        background: transparent !important;
        color: #fff !important;
        width: 100%;
        box-sizing: border-box;
        padding: 0 1rem;
        overflow-x: hidden;
    }
    .footer-logo,
    .footer-section,
    .footer-links,
    .footer-social,
    .footer-copyright {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-bottom: 0.5rem;
    }
    .footer-links {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .footer-social {
        gap: 0.75rem;
    }
    
    .footer-logo {
        justify-content: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    /* Notifications */
    .notification {
        right: 10px !important;
        left: 10px !important;
        transform: translateY(-100%) !important;
        top: 80px !important;
    }
    
    .notification.show {
        transform: translateY(0) !important;
    }
    
    html {
        font-size: 13px;
    }
    
    .hide-mobile {
        display: none;
    }
    
    .show-mobile {
        display: block;
    }
}

/* Small Devices (tablets, 768px and down) */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    /* Navigation adjustments for tablets */
    .nav-menu {
        gap: 1.5rem;
    }
    
    .hamburger {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--bg-white);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow-medium);
        padding: 2rem 0;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    /* Hero adjustments */
    .hero {
        padding: 7rem 0 3rem;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
    }
    
    .hero-text h1 {
        font-size: 2.5rem;
    }
    
    .hero-text p {
        font-size: 1.1rem;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    .hero-image i {
        font-size: 8rem;
    }
    
    /* Featured posts for tablets */
    .featured-posts {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    
    /* Categories for tablets */
    .categories-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1.5rem;
    }
    
    /* Posts grid for tablets */
    .posts-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    
    /* Newsletter for tablets */
    .newsletter-form {
        flex-direction: row;
        max-width: 500px;
    }
    
    /* Footer adjustments */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
        max-width: 100vw;
        overflow-x: hidden;
    }
    .footer, .footer-content, .footer-content > * {
        max-width: 100vw;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    html, body {
        overflow-x: hidden;
    }
    
    html {
        font-size: 14px;
    }
    
    .hide-mobile {
        display: none;
    }
    
    .show-mobile {
        display: block;
    }
}

/* Medium Devices (small laptops, 992px and down) */
@media (max-width: 992px) {
    .container {
        max-width: 960px;
    }
    
    /* Navigation for medium screens */
    .nav-menu {
        gap: 1.5rem;
    }
    
    /* Hero for medium screens */
    .hero-text h1 {
        font-size: 2.75rem;
    }
    
    .hero-image i {
        font-size: 10rem;
    }
    
    /* Adjust grid layouts */
    .featured-posts {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .posts-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    /* Footer for medium screens */
    .footer-content {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Large Devices (desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
    
    /* Enhanced spacing for large screens */
    .hero {
        padding: 10rem 0 5rem;
    }
    
    .hero-text h1 {
        font-size: 3.5rem;
    }
    
    .hero-text p {
        font-size: 1.3rem;
    }
    
    .section-title {
        font-size: 3rem;
    }
    
    /* Optimize grids for large screens */
    .featured-posts {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
    }
    
    .categories-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
    
    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    
    /* Enhanced post cards */
    .post-card .post-content {
        padding: 2rem;
    }
    
    .featured-post .post-content {
        padding: 2rem;
    }
}

/* Extra Large Devices (large desktops, 1400px and up) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero-text h1 {
        font-size: 4rem;
    }
    
    .hero-image i {
        font-size: 14rem;
    }
    
    .section-title {
        font-size: 3.5rem;
    }
    
    /* Larger grid layouts */
    .posts-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .categories-grid {
        gap: 2.5rem;
    }
}

/* High DPI Display Adjustments */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Ensure crisp text and icons on high DPI displays */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    .nav-logo i,
    .hero-image i,
    .category-card i {
        transform: translateZ(0);
    }
}

/* Landscape Orientation for Mobile Devices */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 5rem 0 2rem;
    }
    
    .hero-content {
        gap: 1.5rem;
    }
    
    .hero-text h1 {
        font-size: 2rem;
    }
    
    .hero-image i {
        font-size: 5rem;
    }
    
    .featured-section,
    .categories-section,
    .posts-section {
        padding: 2.5rem 0;
    }
}

/* Print Styles */
@media print {
    .header,
    .hamburger,
    .hero-buttons,
    .newsletter-section,
    .footer {
        display: none;
    }
    
    .hero {
        background: none;
        color: var(--text-dark);
        padding: 2rem 0;
    }
    
    .post-card,
    .featured-post {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
    
    body {
        background: rgb(0, 14, 15);
        color: rgb(247, 246, 246);
        font-size: 12pt;
        line-height: 1.4;
    }
    
    h1, h2, h3 {
        color: black;
    }
    
    .section-title {
        font-size: 18pt;
        margin-bottom: 1rem;
    }
}

/* Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .loading-placeholder {
        animation: none;
        background: #f0f0f0;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Dark Mode Support (if implementing dark mode) */
@media (prefers-color-scheme: dark) {
    :root {
        --text-dark: #f8fafc;
        --text-light: #cbd5e1;
        --bg-light: #0f172a;
        --bg-white: #1e293b;
        --border-color: #334155;
    }
    
    body {
        background-color: var(--bg-light);
        color: var(--text-dark);
    }
    
    .header {
        background: var(--bg-white);
    }
    
    .post-card,
    .featured-post,
    .category-card {
        background: var(--bg-white);
        border: 1px solid var(--border-color);
    }
    
    .nav-menu {
        background-color: var(--bg-white);
    }
    
    .bar {
        background: var(--text-dark);
    }
    
    .newsletter-form input {
        background: var(--bg-white);
        color: var(--text-dark);
        border: 1px solid var(--border-color);
    }
}

/* Focus and Accessibility Improvements */
@media (prefers-reduced-motion: no-preference) {
    .nav-link:focus,
    .btn:focus,
    .filter-btn:focus,
    .category-card:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
        transition: outline-offset 0.2s ease;
    }
}

/* Hover effects for touch devices */
@media (hover: none) and (pointer: coarse) {
    .post-card:hover,
    .featured-post:hover,
    .category-card:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    /* Add tap highlights for better mobile interaction */
    .post-card,
    .featured-post,
    .category-card,
    .btn,
    .nav-link {
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.1);
    }
}

/* Very small screens (Galaxy Fold, etc.) */
@media (max-width: 320px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .nav-container {
        padding: 0 0.5rem;
    }
    
    .hero-content {
        padding: 0 0.5rem;
    }
    
    .hero-text h1 {
        font-size: 1.75rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .featured-posts,
    .posts-grid {
        gap: 1rem;
    }
    
    .post-card .post-content,
    .featured-post .post-content {
        padding: 0.75rem;
    }
    
    .category-card {
        padding: 1rem;
    }
    
    .newsletter-form {
        gap: 0.5rem;
    }
    
    .footer-content {
        gap: 1rem;
    }
}

/* Container queries support (for modern browsers) */
@supports (container-type: inline-size) {
    .posts-grid {
        container-type: inline-size;
    }
    
    @container (max-width: 600px) {
        .post-card {
            font-size: 0.9rem;
        }
        
        .post-card h3 {
            font-size: 1rem;
        }
    }
}