@media screen and (max-width: 767px) {
    /* General */
    /*
     * نکتهٔ مهم: استفاده از overflow-x: hidden روی container/body باعث می‌شد
     * در iOS Safari مومنتوم اسکرول کاروسل دسته‌بندی منو قفل شود.
     * overflow-x: clip از overflow-x: hidden سازگارتر است (یک scroll container
     * نمی‌سازد) و اسکرول لمسی فرزند را بلوکه نمی‌کند. در مرورگرهای قدیمی‌تر
     * fallback به overflow-x: hidden می‌شود.
     */
    .container { padding: 0 15px; max-width: 100%; overflow-x: hidden; overflow-x: clip; }
    body { overflow-x: hidden; overflow-x: clip; }

    /* روی موبایل: کاروسل تب‌ها از لبه تا لبه برای فضای swipe بیشتر */
    .menu-filter-tabs {
        margin-inline: -15px;
        padding-inline: 15px;
        scroll-padding-inline: 15px;
    }
    h1 { font-size: 2rem; } h2 { font-size: 1.75rem; } h3 { font-size: 1.5rem; }
    .site-main { padding: 1rem 0; }

    /* ── Header ── */
    .header-inner { flex-wrap: wrap; gap: 0; padding: 0.75rem 0; }
    .site-branding { flex: 1; }
    .header-actions { gap: 0.5rem; }
    .header-phone { display: none; }
    .menu-toggle { display: flex; }
    .main-navigation {
        width: 100%; order: 3; margin-top: 0;
        border-top: 1px solid var(--border-color);
        max-height: 0; overflow: hidden; transition: max-height 0.35s ease;
    }
    .main-navigation.open { max-height: 400px; }
    .nav-menu { flex-direction: column; gap: 0; padding: 0.5rem 0; }
    .nav-menu li { border-bottom: 1px solid var(--border-color); }
    .nav-menu li:last-child { border-bottom: none; }
    .nav-menu a { padding: 0.85rem 1rem; }

    /* ── Footer ── */
    .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
    .footer-socials { flex-direction: row; flex-wrap: wrap; }

    /* ── Homepage hero ── */
    .homepage-hero {
        padding: 1.5rem 1rem 1.25rem;
        margin-bottom: 1.5rem;
        border-radius: 14px;
    }
    /* انیمیشن روی موبایل کوچک‌تر شود تا حواس‌پرتی کمتر باشد */
    .homepage-hero::before { width: 180px; height: 180px; top: -40px; left: -40px; }
    .homepage-hero::after  { width: 240px; height: 240px; bottom: -50px; right: -50px; }
    .hero-title    { font-size: 1.65rem; margin-bottom: 0.5rem; }
    .hero-subtitle { font-size: 0.9rem; margin-bottom: 1.25rem; line-height: 1.7; }
    .hero-cta      { gap: 0.6rem; }
    .hero-btn-primary, .hero-btn-secondary { padding: 0.6rem 1.4rem; font-size: 0.9rem; }
    .section-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    /* ── Menu grid ── */
    .menu-cards-grid { grid-template-columns: 1fr; gap: 1rem; }
    /* ── Tables ── */
    .tables-preview { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
    .tables-cards-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
    .tables-grid { grid-template-columns: 1fr; gap: 1rem; }

    /* ── Single menu item (smi) ── */
    .smi-hero { height: 220px; }
    .smi-card { grid-template-columns: 1fr; margin-top: -40px; }
    .smi-image-col { order: -1; }
    .smi-main-image, .smi-no-image { min-height: 210px; }
    .smi-info { padding: 1.5rem 1.25rem; }
    .smi-title { font-size: 1.5rem; }
    .smi-price-badge { display: none; }
    .smi-price-row { display: flex; }  /* show price inside info on mobile */
    .smi-gallery-grid { grid-template-columns: repeat(2, 1fr); }

    /* ── Table single (td-) ── */
    .td-hero { height: 280px; }
    .td-hero-title { font-size: 1.75rem; }
    .td-hero-title-wrap { padding: 1.25rem 1rem; }
    .td-main-card {
        grid-template-columns: 1fr;
        margin-top: -50px;
        border-radius: 16px 16px 0 0;
    }
    .td-info-col { border-left: none; border-bottom: 1px solid var(--border-color); padding: 1.5rem 1.25rem; }
    .td-qr-col { padding: 1.5rem 1.25rem; }
    .td-qr-card { max-width: 260px; margin: 0 auto; }
    .td-gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .td-more-card { flex: 0 0 120px; }
    .td-more-img { width: 120px; height: 85px; }

    /* ── Lightbox ── */
    .lightbox-prev { right: 0.75rem; }
    .lightbox-next { left: 0.75rem; }
}

@media screen and (min-width: 768px) and (max-width: 1024px) {
    .menu-cards-grid { grid-template-columns: repeat(2, 1fr); }
    .tables-preview { grid-template-columns: repeat(3, 1fr); }
    .tables-cards-grid { grid-template-columns: repeat(3, 1fr); }
    .tables-grid { grid-template-columns: repeat(2, 1fr); }
    .homepage-hero { padding: 3rem 1.5rem 2.5rem; margin-bottom: 2.5rem; }
    .hero-title { font-size: 2.2rem; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-brand { grid-column: 1 / -1; }
    /* table single tablet */
    .td-hero { height: 360px; }
    .td-main-card { grid-template-columns: 1fr 240px; }
    .td-gallery-grid { grid-template-columns: repeat(3, 1fr); }
    .smi-gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── احترام به تنظیم کاهش حرکت (accessibility) ── */
@media (prefers-reduced-motion: reduce) {
    .homepage-hero::before,
    .homepage-hero::after { animation: none; }
}