@media (max-width: 1024px) {
    .hero h1 {
        font-size: 3rem;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background-color: var(--bg-primary);
        flex-direction: column;
        align-items: center;
        padding: 2rem 0;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .btn-paste {
        top: 25px;
        right: 15px;
    }
    
    .btn-submit {
        width: 100%;
        padding: 1.2rem;
    }
    
    .tool-interface {
        padding: 2rem 1.5rem;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .result-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================
   EXPERT MOBILE-FIRST OPTIMIZATION & UX
   ========================================= */

/* 1. Viewport & Overflow Safety */
html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

/* 2. Fluid Typography & Spacing Foundations */
h1 {
    font-size: clamp(2rem, 5vw + 1rem, 3.5rem) !important;
    line-height: 1.2;
}

h2 {
    font-size: clamp(1.5rem, 4vw + 1rem, 2.5rem) !important;
    line-height: 1.3;
}

/* 3. Inputs & Forms (Min 48px height, 16px font to stop iOS zoom) */
input, textarea, select {
    font-size: 16px !important;
    min-height: 52px;
    border-radius: 12px;
}

button, .btn {
    min-height: 48px;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Ensure downloader input groups stack correctly on small screens */
@media (max-width: 768px) {
    .input-group, .hh3-input-wrapper {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }
    
    .url-input, .hh3-link-input {
        width: 100%;
        min-height: 52px;
        padding-right: 16px !important;
    }
    
    .btn-paste {
        display: none !important;
    }
    
    .btn-submit, .hh3-submit-btn, .action-btn {
        width: 100%;
        min-height: 52px;
        margin: 0 !important;
    }
    
    /* Hero specific */
    .hero, .home-hero-v3, .ed-page-hero, .premium-hero {
        padding: 2rem 1rem !important;
    }
    
    .hero h1, .hh3-hero-title, .premium-hero h1 {
        font-size: clamp(1.8rem, 6vw, 2.5rem) !important;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle, .hh3-hero-desc, .ed-page-hero p, .premium-hero p {
        font-size: 1rem !important;
        padding: 0 1rem;
    }
    
    /* Cards and Grids */
    .tools-grid, .ed-tools-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
        padding: 0 1rem;
    }
    
    .tool-card {
        padding: 1.5rem !important;
    }
    
    /* Creator tools specific stacking */
    .cr-layout, .ed-tools-layout {
        flex-direction: column;
    }
    .cr-sidebar, .ed-sidebar {
        width: 100% !important;
        margin-bottom: 2rem;
    }
    .cr-tool-header h1 {
        font-size: 1.8rem !important;
    }
    
    /* Result actions */
    #hero-result-card > div, .result-actions {
        flex-direction: column;
        gap: 12px !important;
    }
    #hero-result-card button, #hero-result-card a, .result-actions button, .result-actions a {
        width: 100%;
        min-height: 48px;
    }
    
    /* FAQ Mobile fixes */
    .ed-faq, .faq-list {
        padding: 0 1rem;
    }
    .ed-faq-header, .faq-item h4 {
        padding: 16px !important;
        font-size: 16px !important;
    }
    .ed-faq-content {
        padding: 0 16px 16px 16px !important;
    }
    
    /* Mobile Header adjustments */
    .ed-header-v3-container, .nav-container {
        padding: 0 1rem !important;
    }
    
    /* Footer */
    .ed-footer-grid, .footer-content {
        grid-template-columns: 1fr !important;
        text-align: left;
        gap: 2rem;
        padding: 2rem 1.5rem !important;
    }
    .ed-footer-brand p {
        max-width: 100%;
    }
}

/* 4. Safe Area Support (Notches) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mob-bookmark-cta {
        padding-bottom: env(safe-area-inset-bottom);
    }
    .ed-footer, footer {
        padding-bottom: calc(2rem + env(safe-area-inset-bottom)) !important;
    }
}

/* 5. Image & Video bounds */
img, video {
    max-width: 100%;
    height: auto;
}

/* 6. Accessibility & Focus States */
input:focus, button:focus, textarea:focus, select:focus {
    outline: 2px solid var(--purple, #7A38E8) !important;
    outline-offset: 2px;
}
