/**
 * DOYIL Theme - Responsive Styles
 *
 * Tablet and mobile breakpoint adaptations.
 */

/* ========== Tablet: 768px - 1024px ========== */
@media (max-width: 1024px) {
    :root {
        --text-5xl: 2.5rem;
        --text-6xl: 3rem;
    }

    /* Container */
    .container {
        padding-left: var(--space-5);
        padding-right: var(--space-5);
    }

    /* Section spacing */
    .section {
        padding: var(--space-16) 0;
    }

    /* Hero */
    .hero {
        min-height: 70vh;
    }

    .hero__title {
        font-size: var(--text-5xl);
    }

    .hero__subtitle {
        font-size: var(--text-lg);
    }

    /* Categories grid: 5 -> 3 */
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Products grid: 4 -> 2 */
    .products-grid--4 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Home about */
    .home-about__grid {
        grid-template-columns: 1fr;
        gap: var(--space-10);
    }

    .home-about__image {
        max-width: 500px;
        margin: 0 auto;
    }

    /* Values grid: 4 -> 2 */
    .values-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Stats grid: 4 -> 2 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Blog layout: sidebar below */
    .blog-layout {
        grid-template-columns: 1fr;
    }

    .blog-layout__sidebar {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-6);
    }

    .blog-grid--3 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Product detail */
    .product-detail {
        grid-template-columns: 1fr;
        gap: var(--space-10);
    }

    .product-detail__gallery {
        max-width: 600px;
    }

    /* Contact layout */
    .contact-layout {
        grid-template-columns: 1fr;
        gap: var(--space-12);
    }

    /* Footer grid: 4 -> 2 */
    .site-footer__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Page banner */
    .page-banner {
        height: 280px;
    }

    .page-banner__title {
        font-size: var(--text-4xl);
    }
}

/* ========== Mobile: < 768px ========== */
@media (max-width: 768px) {
    :root {
        --text-3xl: 1.5rem;
        --text-4xl: 1.75rem;
        --text-5xl: 2rem;
        --text-6xl: 2.5rem;
        --header-height: var(--header-height-mobile);
    }

    /* Section spacing */
    .section {
        padding: var(--space-12) 0;
    }

    .section__header {
        margin-bottom: var(--space-8);
    }

    .section__title {
        font-size: var(--text-3xl);
    }

    /* ===== Header / Mobile Menu ===== */
    .menu-toggle {
        display: flex;
    }

    .main-navigation__wrap {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 300px;
        max-width: 80vw;
        background: var(--color-bg-primary);
        flex-direction: column;
        align-items: stretch;
        padding: calc(var(--header-height-mobile) + var(--space-6)) var(--space-6) var(--space-6);
        transform: translateX(100%);
        transition: transform var(--transition-base);
        z-index: var(--z-offcanvas);
        box-shadow: var(--shadow-xl);
        overflow-y: auto;
    }

    .main-navigation__wrap--open {
        transform: translateX(0);
    }

    .main-navigation__menu {
        flex-direction: column;
        gap: 0;
    }

    .main-navigation__menu a {
        padding: var(--space-3) 0;
        font-size: var(--text-base);
        border-bottom: 1px solid var(--color-border-light);
    }

    .main-navigation__menu .sub-menu {
        position: static;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        padding: 0 0 0 var(--space-4);
        display: none;
    }

    .main-navigation__menu .submenu-open > .sub-menu {
        display: block;
    }

    /* Menu open overlay */
    body.menu-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: calc(var(--z-offcanvas) - 1);
    }

    /* Hero */
    .hero {
        min-height: 60vh;
    }

    .hero__title {
        font-size: var(--text-5xl);
    }

    .hero__actions {
        flex-direction: column;
        align-items: center;
    }

    .hero__actions .btn {
        width: 100%;
        max-width: 280px;
    }

    .hero__scroll {
        display: none;
    }

    /* Categories: 3 -> 2 */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }

    .category-card {
        padding: var(--space-6) var(--space-4);
    }

    /* Products grid: 2 -> 1 */
    .products-grid--3,
    .products-grid--4 {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }

    /* Blog grid: 2 -> 1 */
    .blog-grid--2,
    .blog-grid--3 {
        grid-template-columns: 1fr;
    }

    /* Blog sidebar: 2 -> 1 */
    .blog-layout__sidebar {
        grid-template-columns: 1fr;
    }

    /* Values grid: 2 -> 1 */
    .values-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    /* Services grid: 2 -> 1 */
    .services-grid {
        grid-template-columns: 1fr;
    }

    /* Stats grid: 2 -> 1 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card__number {
        font-size: var(--text-4xl);
    }

    /* Product filter tabs */
    .product-filter__tabs {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: var(--space-2);
        -webkit-overflow-scrolling: touch;
    }

    .filter-tab {
        flex-shrink: 0;
    }

    /* Contact form rows */
    .form-row {
        grid-template-columns: 1fr;
    }

    /* CTA section */
    .home-cta__title {
        font-size: var(--text-3xl);
    }

    .home-cta__actions {
        flex-direction: column;
        align-items: center;
    }

    .home-cta__actions .btn {
        width: 100%;
        max-width: 280px;
    }

    /* Footer: 2 -> 1 */
    .site-footer__grid {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .site-footer__bottom {
        flex-direction: column;
        gap: var(--space-4);
        text-align: center;
    }

    /* Page banner */
    .page-banner__title {
        font-size: var(--text-3xl);
    }

    .page-banner__subtitle {
        font-size: var(--text-base);
    }

    /* Single post */
    .single-post__title {
        font-size: var(--text-3xl);
    }

    .single-post__nav {
        grid-template-columns: 1fr;
    }

    /* Product detail */
    .product-detail {
        gap: var(--space-8);
    }

    .product-info__title {
        font-size: var(--text-3xl);
    }

    .product-specs__item {
        flex-direction: column;
        gap: var(--space-1);
    }

    .product-specs__value {
        text-align: left;
    }

    /* 404 */
    .error-404__code {
        font-size: 5rem;
    }

    .error-404__actions {
        flex-direction: column;
        align-items: center;
    }
}

/* ========== Small Mobile: < 480px ========== */
@media (max-width: 480px) {
    :root {
        --text-5xl: 1.75rem;
        --text-6xl: 2rem;
    }

    /* Categories: 2 -> 1 */
    .categories-grid {
        grid-template-columns: 1fr;
    }

    /* Products: 2 -> 1 */
    .products-grid--3,
    .products-grid--4 {
        grid-template-columns: 1fr;
    }

    /* Stats: 2 -> 1 */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .product-card__info {
        padding: var(--space-3);
    }

    .blog-card__content {
        padding: var(--space-4);
    }
}
