/* ===== שיפורי תגובתיות ===== */

/* מכשירים קטנים מאוד (טלפונים, פחות מ-480px) */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    header {
        padding: 12px 0;
    }

    .header-inner {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .logo img {
        height: 44px;
    }

    .nav {
        display: flex;
        flex-wrap: wrap;
        gap: 6px 10px;
        justify-content: flex-end;
        width: auto;
        max-width: min(70vw, 300px);
        margin-inline-start: auto;
    }

    .nav a {
        margin: 0;
        font-size: 0.88rem;
    }
    
    .section-title {
        font-size: var(--text-2xl);
        margin: 30px 0 20px;
        text-align: center;
    }
    
    .section-title::after {
        right: 50%;
        transform: translateX(50%);
    }
    
    .content-wrapper {
        flex-direction: column;
        gap: 30px;
    }
    
    .sidebar {
        width: 100%;
        order: 2;
    }
    
    .sidebar.collapsed {
        width: 100%;
        height: auto;
    }
    
    .sidebar.collapsed .sidebar-content {
        opacity: 1;
        pointer-events: auto;
    }
    
    .sidebar.collapsed::after {
        display: none;
    }
    
    .main-content {
        order: 1;
    }
    
    .hot-grid,
    .items-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* קטגוריה/חיפוש במובייל: לשמור 2 עמודות גם במסכים קטנים */
    body.page-category-items .storefront-list .items-grid,
    body.page-search-results .storefront-list .items-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
    }
    
    .hot-card,
    .item-card {
        margin-bottom: 0;
    }
    
    footer {
        padding: 20px 0;
        font-size: 0.9rem;
    }
    
    .footer-brand {
        flex-direction: column;
        gap: 10px;
    }
}

/* טלפונים גדולים וטאבלטים קטנים (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .container {
        padding: 0 20px;
    }
    
    .header-inner {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .nav {
        order: 0;
        width: auto;
        max-width: min(70vw, 300px);
        margin-top: 0;
        margin-inline-start: auto;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
    
    .section-title {
        font-size: var(--text-2xl);
        margin: 35px 0 25px;
    }
    
    .content-wrapper {
        flex-direction: column;
        gap: 30px;
    }
    
    .sidebar {
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }
    
    .hot-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    .items-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* טאבלטים (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 95%;
    }
    
    .content-wrapper {
        gap: 30px;
    }
    
    .sidebar {
        width: 250px;
    }
    
    .hot-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .items-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* מחשבים ניידים (1025px - 1440px) */
@media (min-width: 1025px) and (max-width: 1440px) {
    .container {
        max-width: 1200px;
    }
    
    .hot-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* התאמות לטקסט */
@media (max-width: 768px) {
    h1, .h1 { font-size: var(--text-3xl); }
    h2, .h2 { font-size: var(--text-2xl); }
    h3, .h3 { font-size: var(--text-xl); }
    
    .lead-text {
        font-size: var(--text-base);
    }
    
    .hero-caption h3 {
        font-size: 1.2rem;
    }
    
    .hero-caption p {
        font-size: 0.9rem;
    }
}

/* התאמות לטאבלטים בפריסה אנכית */
@media (max-width: 1024px) and (orientation: portrait) {
    .premium-hero {
        grid-template-columns: 1fr;
        grid-auto-rows: minmax(200px, auto);
    }
    
    .hero-item {
        max-height: 250px;
    }
}

/* התאמות לטאבלטים בפריסה אופקית */
@media (max-width: 1024px) and (orientation: landscape) {
    .premium-hero {
        grid-template-columns: repeat(2, 1fr);
    }
}

/*
 * דפים עם <header role="banner"> (public_header + item.php) - אותן התאמות כמו ל־header הכללי,
 * עם ספציפיות גבוהה כדי לנצח את item-page.css ודומיו.
 */
@media (max-width: 480px) {
    header[role="banner"] {
        padding: 12px 0;
    }

    header[role="banner"] .header-inner {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    header[role="banner"] .logo img {
        height: 44px;
    }

    header[role="banner"] .nav {
        display: flex;
        flex-wrap: wrap;
        gap: 6px 10px;
        justify-content: flex-end;
        width: auto;
        max-width: min(70vw, 300px);
        margin-inline-start: auto;
    }

    header[role="banner"] .nav a {
        margin: 0;
        font-size: 0.88rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    header[role="banner"] .header-inner {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    header[role="banner"] .nav {
        order: 0;
        width: auto;
        max-width: min(70vw, 300px);
        margin-top: 0;
        margin-inline-start: auto;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}

/* התאמות למצב כף יד (handheld) - ממוקד לרכיבי פעולה, בלי לשבור כרטיסים/גריד */
@media (hover: none) and (pointer: coarse) {
    .hot-card:hover,
    .item-card:hover,
    .card:hover,
    .deal-card:hover {
        transform: none;
    }

    .nav a::after {
        display: none;
    }

    .mobile-quick-btn,
    .mobile-sheet-close,
    .mobile-tab-btn,
    .nav a,
    header[role="banner"] .nav a,
    button,
    .product-external-cta,
    .share-btn,
    .pin-button {
        min-height: 44px;
        box-sizing: border-box;
    }

    .nav a {
        display: inline-flex;
        align-items: center;
        padding: 8px 12px;
    }

    header[role="banner"] .nav a::after {
        display: none;
    }

    header[role="banner"] .nav a {
        display: inline-flex;
        align-items: center;
        padding: 8px 12px;
    }

    .lang-switcher__select {
        min-height: 44px;
        box-sizing: border-box;
    }

}

/* תמיכה במצב חיסכון בסוללה */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* תמיכה בקונטרסט גבוה */
@media (prefers-contrast: high) {
    :root {
        --color-primary-500: #8f3e23;
        --color-secondary-500: #2d6159;
    }
    
    .section-title::after {
        height: 4px;
    }
}

/* תמיכה במצב קריאה */
@media (prefers-reduced-transparency: reduce) {
    .hero-item::before,
    .hero-caption {
        background: rgba(0, 0, 0, 0.9);
    }
}

/* התאמות להדפסה */
@media print {
    .nav,
    .sidebar,
    .hero-item,
    footer {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
    }
    
    a {
        color: black !important;
        text-decoration: underline;
    }
    
    .hot-card,
    .item-card {
        break-inside: avoid;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
}