/* MOBILE OPTIMIZATION & BUG FIXES */
/* Add this to your existing style.css or include as separate file */

/* ================================
   MOBILE MENU (HAMBURGER)
   ================================ */

/* Hide desktop menu on mobile, show hamburger */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.menu-toggle span {
    width: 28px;
    height: 3px;
    background: var(--text-dark);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ================================
   TABLET & MOBILE RESPONSIVE
   ================================ */

@media (max-width: 1024px) {
    /* Adjust container padding */
    .container {
        padding: 0 30px;
    }
    
    /* Hero adjustments */
    .hero {
        padding: 60px 0;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero p {
        font-size: 1.1rem;
    }
    
    /* Articles grid */
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    /* Show hamburger menu */
    .menu-toggle {
        display: flex;
    }
    
    /* Hide desktop nav */
    nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--white);
        box-shadow: -5px 0 20px rgba(0,0,0,0.1);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        padding-top: 80px;
    }
    
    nav.active {
        right: 0;
    }
    
    nav ul {
        flex-direction: column;
        gap: 0;
        padding: 20px;
    }
    
    nav li {
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }
    
    nav a {
        display: block;
        padding: 15px 10px;
        font-size: 1rem;
    }
    
    nav a::before {
        display: none;
    }
    
    .cta-button {
        margin-top: 10px;
        text-align: center;
        border-radius: 8px;
    }
    
    /* Overlay when menu is open */
    body.menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    /* Header adjustments */
    .header-content {
        padding: 1.2rem 0;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    /* Hero */
    .hero {
        padding: 50px 0;
    }
    
    .hero h1 {
        font-size: 2rem;
        line-height: 1.3;
    }
    
    .hero p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    /* Newsletter form */
    .newsletter-form {
        flex-direction: column;
        gap: 12px;
        max-width: 100%;
    }
    
    .newsletter-form input {
        width: 100%;
        padding: 14px 18px;
        font-size: 15px;
    }
    
    .newsletter-form button {
        width: 100%;
        padding: 14px 20px;
    }
    
    /* Articles grid */
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .article-card {
        border-radius: 12px;
    }
    
    .article-image {
        height: 200px;
    }
    
    .article-content {
        padding: 1.25rem;
    }
    
    .article-meta {
        flex-wrap: wrap;
        gap: 1rem;
        font-size: 0.8rem;
    }
    
    .article-title {
        font-size: 1.25rem;
    }
    
    .article-excerpt {
        font-size: 0.9rem;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .pagination a,
    .pagination span {
        min-width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    
    .footer-section {
        text-align: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .footer-links {
        text-align: center;
    }
}

@media (max-width: 480px) {
    /* Extra small phones */
    .container {
        padding: 0 20px;
    }
    
    .header-content {
        padding: 1rem 0;
    }
    
    .logo {
        font-size: 1.3rem;
    }
    
    .hero {
        padding: 40px 0;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero p {
        font-size: 0.95rem;
    }
    
    .section-header {
        margin-bottom: 2.5rem;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    .article-image {
        height: 180px;
    }
    
    .article-content {
        padding: 1rem;
    }
    
    .article-title {
        font-size: 1.15rem;
    }
    
    .pagination a,
    .pagination span {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
}

/* ================================
   BUG FIXES
   ================================ */

/* Fix: Images not loading properly */
.article-image {
    background-color: var(--light-yellow);
    background-size: cover;
    background-position: center;
}

/* Fix: Clickable card area */
.article-card {
    text-decoration: none;
    display: block;
}

.article-card * {
    pointer-events: none;
}

/* Fix: Newsletter form submission */
.newsletter-form {
    position: relative;
}

.newsletter-form input:focus,
.newsletter-form button:focus {
    outline: 2px solid var(--primary-yellow);
    outline-offset: 2px;
}

/* Fix: Footer newsletter form spacing */
.footer-section .newsletter-form {
    margin-top: 1rem;
}

.footer-section .newsletter-form input {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: white;
}

.footer-section .newsletter-form input::placeholder {
    color: rgba(255,255,255,0.5);
}

.footer-section .newsletter-form button {
    background: var(--primary-yellow);
    color: var(--text-dark);
}

.footer-section .newsletter-form button:hover {
    background: var(--white);
}

/* Fix: Pagination ellipsis styling */
.pagination span:not(.active) {
    border: none;
    background: none;
    cursor: default;
}

/* Fix: Section padding consistency */
.articles-section {
    padding: 60px 0;
}

@media (max-width: 768px) {
    .articles-section {
        padding: 40px 0;
    }
}

/* ================================
   ACCESSIBILITY IMPROVEMENTS
   ================================ */

/* Focus states */
a:focus,
button:focus,
input:focus,
textarea:focus {
    outline: 2px solid var(--primary-yellow);
    outline-offset: 2px;
}

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-yellow);
    color: var(--text-dark);
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}

/* ================================
   TOUCH OPTIMIZATIONS
   ================================ */

/* Larger touch targets for mobile */
@media (max-width: 768px) {
    nav a,
    .cta-button,
    .read-more,
    .pagination a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Prevent text selection on cards */
    .article-card {
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }
    
    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
    }
}

/* ================================
   LOADING STATES
   ================================ */

/* Image loading placeholder */
.article-image.loading {
    background: linear-gradient(90deg, 
        var(--light-yellow) 0%, 
        var(--border-color) 50%, 
        var(--light-yellow) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

/* ================================
   PRINT STYLES
   ================================ */

@media print {
    header,
    .newsletter-form,
    footer,
    .pagination {
        display: none;
    }
    
    .article-card {
        break-inside: avoid;
    }
}
