/**
 * Yadongtube Theme - Responsive Breakpoint Overrides & Mobile Optimization
 * Tested Viewports: 320px, 360px, 375px, 390px, 414px, 430px, 768px, 900px, 1024px, 1280px, 1440px, 1920px
 * Enforces WCAG 2.2 AA mobile touch standards, zero horizontal overflow, and fluid typography.
 */

/* 1. Large Displays & Desktops (max-width: 1280px) */
@media screen and (max-width: 1280px) {
    :root {
        --yt-container-width: 100%;
        --yt-container-padding: 24px;
    }

    .yt-video-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .yt-footer-grid {
        grid-template-columns: 1.8fr 1fr 1fr 1.2fr;
        gap: 32px;
    }

    .yt-header-search-wrap {
        max-width: 320px;
    }

    .yt-nav-list {
        gap: 16px;
    }
}

/* 2. Small Desktops & Landscape Tablets (max-width: 1024px) */
@media screen and (max-width: 1024px) {
    :root {
        --yt-container-padding: 20px;
    }

    .yt-header-search-wrap {
        max-width: 200px;
    }

    .yt-nav-list {
        gap: 10px;
    }

    .yt-nav-list a {
        font-size: 13.5px;
        padding: 6px 2px;
    }

    .yt-video-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    .yt-collections-grid,
    .yt-blog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .yt-trust-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .yt-detail-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .yt-detail-sidebar {
        margin-top: 24px;
    }

    .yt-footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
}

/* 3. Tablets & Hybrid Form Factors (max-width: 900px) */
@media screen and (max-width: 900px) {
    /* Collapse 2-column interactive tool cards into vertical stack */
    .yt-tool-grid {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }

    .yt-tool-card-box {
        padding: 24px !important;
    }

    .yt-filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .yt-filter-controls {
        flex-wrap: wrap;
    }

    /* Switch desktop navigation to mobile drawer toggle */
    .yt-main-nav,
    .yt-header-search-wrap {
        display: none !important;
    }

    .yt-mobile-toggle-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: var(--yt-radius-sm);
        background: transparent;
        border: 1px solid var(--yt-border);
        cursor: pointer;
    }
}

/* 4. Mobile & Small Tablets (max-width: 768px) */
@media screen and (max-width: 768px) {
    :root {
        --yt-container-padding: 16px;
        --yt-header-height: 64px;
    }

    .yt-header-inner {
        height: 64px;
        gap: 12px;
    }

    /* Hide desktop navigation and desktop header search */
    .yt-main-nav,
    .yt-header-search-wrap {
        display: none !important;
    }

    /* Show mobile menu toggle button */
    .yt-mobile-toggle-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: var(--yt-radius-sm);
        background: transparent;
        border: 1px solid var(--yt-border);
        cursor: pointer;
    }

    .yt-brand-logo img,
    .yt-brand-logo svg {
        max-height: 34px;
    }

    /* Typography adjustments for mobile */
    .yt-hero-section {
        padding: 40px 0 28px 0;
    }

    .yt-hero-title {
        font-size: 28px;
        letter-spacing: -0.5px;
        line-height: 1.25;
        padding: 0 4px;
    }

    .yt-hero-subtitle {
        font-size: 15px;
        line-height: 1.55;
        margin-bottom: 22px;
        padding: 0 4px;
    }

    /* 2-column video grid on mobile landscape / medium mobile */
    .yt-video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .yt-collections-grid,
    .yt-blog-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .yt-section {
        padding: 36px 0;
    }

    .yt-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 20px;
    }

    .yt-section-title {
        font-size: 20px;
    }

    .yt-catalog-header {
        padding: 24px 0 18px 0;
        margin-bottom: 24px;
    }

    .yt-catalog-title {
        font-size: 26px;
    }

    .yt-page-layout {
        padding: 24px 18px;
        margin: 16px 0 36px 0;
        border-radius: var(--yt-radius-sm);
    }

    .yt-entry-content {
        font-size: 15px;
        line-height: 1.75;
    }

    .yt-entry-content h2 {
        font-size: 21px;
        margin-top: 28px;
    }

    .yt-entry-content h3 {
        font-size: 18px;
        margin-top: 20px;
    }

    .yt-detail-title {
        font-size: 22px;
        line-height: 1.3;
    }

    .yt-detail-meta-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .yt-detail-meta-left {
        flex-wrap: wrap;
        gap: 12px;
    }

    .yt-footer-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .yt-footer-bottom {
        text-align: left;
    }
}

/* 5. Smartphone Displays (max-width: 480px) */
@media screen and (max-width: 480px) {
    :root {
        --yt-container-padding: 14px;
    }

    /* Single column video card feed for perfect readability on mobile */
    .yt-video-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .yt-trust-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .yt-hero-section {
        padding: 32px 0 20px 0;
    }

    .yt-hero-title {
        font-size: 24px;
    }

    .yt-hero-subtitle {
        font-size: 14px;
    }

    .yt-chip {
        padding: 6px 12px;
        font-size: 12px;
    }

    .yt-card-body {
        padding: 14px;
    }

    .yt-card-title {
        font-size: 14px;
    }

    .yt-site-footer {
        padding: 40px 0 24px 0;
        margin-top: 40px;
    }

    /* Prevent mobile browser auto-zoom on input focus (minimum 16px) */
    .yt-form-control,
    input[type="text"],
    input[type="search"],
    input[type="number"],
    input[type="email"],
    input[type="url"],
    select,
    textarea {
        font-size: 16px !important;
    }

    .yt-btn {
        width: 100%;
        justify-content: center;
        min-height: 44px;
    }

    .yt-page-layout {
        padding: 20px 14px;
    }
}

/* 6. Compact Screens (max-width: 360px) */
@media screen and (max-width: 360px) {
    :root {
        --yt-container-padding: 10px;
    }

    .yt-hero-title {
        font-size: 21px;
    }

    .yt-brand-logo img,
    .yt-brand-logo svg {
        max-height: 30px;
    }
}

/* Mobile Drawer Responsive Overrides */
.yt-mobile-drawer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
}

.yt-mobile-drawer-inner {
    width: 320px;
    max-width: 85vw;
    height: 100%;
    background: var(--yt-bg-surface);
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    animation: ytDrawerSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ytDrawerSlideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.yt-mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.yt-mobile-nav-list li a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: var(--yt-radius-sm);
    font-size: 15px;
    font-weight: 600;
    color: var(--yt-text);
    text-decoration: none;
    transition: background var(--yt-transition-fast), color var(--yt-transition-fast);
}

.yt-mobile-nav-list li a:hover,
.yt-mobile-nav-list li a.active {
    background: var(--yt-primary-light);
    color: var(--yt-primary);
}

/* Responsive Table Wrapper Rule */
.yt-table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0;
    border: 1px solid var(--yt-border);
    border-radius: var(--yt-radius-sm);
}

.yt-table-responsive table {
    margin: 0;
    border: none;
    min-width: 560px;
}

/* Responsive Editorial Blog & Single Post Rules */
@media (max-width: 992px) {
    .yt-featured-post-card {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .yt-featured-post-content {
        padding: 24px;
    }

    .yt-featured-post-title {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .yt-blog-hero-title {
        font-size: 24px;
    }

    .yt-single-article {
        padding: 28px 20px;
        border-radius: 12px;
    }

    .yt-article-title {
        font-size: 24px;
        letter-spacing: -0.3px;
    }

    .yt-article-meta-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .yt-article-share-bar {
        width: 100%;
        justify-content: flex-start;
    }

    .yt-author-bio-card {
        flex-direction: column;
        padding: 20px;
    }

    .yt-post-nav {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .yt-post-nav-next {
        text-align: left;
    }

    .yt-form-row {
        grid-template-columns: 1fr;
    }

    .yt-comment-content,
    .yt-comment-reply {
        padding-left: 0;
    }

    .comment-respond {
        padding: 20px 16px;
    }
}

