/* ==========================================================================
   Freshly — Responsive Rules
   Breakpoints: 1440 / 1200 / 992 / 768 / 576 / 360
   ========================================================================== */

@media (max-width: 1440px) {
  .container { padding-inline: var(--space-6); }
  .product-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 1200px) {
  .container { padding-inline: var(--space-5); }
  .category-strip { grid-template-columns: repeat(4, 1fr); }
  .perks-strip { grid-template-columns: repeat(2, 1fr); }
  .perk-item:nth-child(2) { border-right: none; }
  .perk-item { border-bottom: 1px solid var(--color-border); }
  .perk-item:nth-child(3), .perk-item:nth-child(4) { border-bottom: none; }
  .footer-main { grid-template-columns: 1.4fr 1fr 1fr; row-gap: var(--space-6); }
}

@media (max-width: 992px) {
  .hero-grid { grid-template-columns: 1fr; padding: var(--space-6); text-align: center; }
  .hero-copy p { margin-inline: auto; }
  .hero-cta { justify-content: center; }
  .hero-social-proof { justify-content: center; }
  .hero-visual { order: -1; }
  .floating-card.discount-badge { left: 4%; }
  .floating-card.delivery-time { right: 4%; }

  .header-search { max-width: 320px; }
  .delivery-picker .label { display: none; }

  .main-nav { display: none; }
  .header-lang { display: none; }

  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .promo-grid { grid-template-columns: 1fr; }
  .app-cta { grid-template-columns: 1fr; }
  .app-cta-visual { display: none; }
}

@media (max-width: 768px) {
  :root { --header-h: 64px; }
  .container { padding-inline: var(--space-4); }

  /* Header row: stop overflow, tighten gaps, let search flex to fill space */
  .header-top {
    gap: var(--space-2);
    flex-wrap: nowrap;
  }
  .logo-text small { display: none; }
  .logo { gap: 8px; flex-shrink: 0; }
  .logo-mark { width: 36px; height: 36px; font-size: 1rem; }

  .delivery-picker {
    flex-shrink: 1; min-width: 0; padding: 8px 10px; max-width: 120px;
  }
  .delivery-picker strong {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
  }
  .delivery-picker strong i { display: none; }

  .header-search { flex: 1 1 auto; max-width: none; min-width: 0; }
  .header-search input { padding: 11px 14px 11px 40px; }

  .header-actions { gap: var(--space-2); flex-shrink: 0; }
  .mobile-menu-toggle { display: flex; flex-shrink: 0; }
  .header-actions .action-link span,
  .header-actions .action-link.notif-link,
  .header-actions .action-link.offers-link { display: none; }
  .cart-link span { display: none; }
  .cart-link { padding: 10px; }

  .header-bottom { display: none; }
  .header-bottom.mobile-open {
    display: flex; flex-direction: column; align-items: stretch; height: auto;
    position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0;
    background: #fff; z-index: 1001; padding: var(--space-5); gap: var(--space-4);
    overflow-y: auto;
  }
  .header-bottom.mobile-open .category-menu {
    width: 100%;
  }
  .header-bottom.mobile-open .category-trigger {
    width: 100%; justify-content: center;
  }
  .header-bottom.mobile-open .category-dropdown {
    position: static; box-shadow: none; border: none; width: 100%;
    margin-top: 8px; padding: 0;
  }
  .header-bottom.mobile-open .main-nav {
    display: flex; flex-direction: column; align-items: stretch; gap: 0;
  }
  .header-bottom.mobile-open .main-nav a { padding: 14px 0; border-bottom: 1px solid var(--color-border); }
  .header-bottom.mobile-open .main-nav a::after { display: none; }
  .header-bottom.mobile-open .header-lang {
    display: flex; justify-content: center; padding-top: var(--space-2);
  }

  .hero-copy h1 { font-size: var(--fs-3xl); }
  .category-strip { grid-template-columns: repeat(3, 1fr); }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .section-head { flex-direction: column; align-items: flex-start; gap: 4px; }

  .perks-strip { grid-template-columns: 1fr; }
  .perk-item { border-right: none !important; border-bottom: 1px solid var(--color-border); }
  .perk-item:last-child { border-bottom: none; }

  .footer-newsletter { flex-direction: column; align-items: flex-start; }
  .newsletter-form { width: 100%; }
  .newsletter-form input { flex: 1; min-width: 0; }
  .footer-main { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; gap: var(--space-3); text-align: center; }
}

@media (max-width: 576px) {
  .delivery-picker { display: none; }
  .header-search { order: 1; }

  .hero-copy h1 { font-size: var(--fs-2xl); }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-social-proof { flex-wrap: wrap; }
  .rating-pill { margin-left: 0; }

  .category-strip { grid-template-columns: repeat(2, 1fr); }
  .category-icon { width: 56px; height: 56px; font-size: 1.2rem; }

  .product-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
  .product-info { padding: var(--space-3); }

  .promo-banner { flex-direction: column; align-items: flex-start; text-align: left; }
  .promo-banner img { width: 55%; align-self: center; }

  .app-cta-copy { padding: var(--space-6); }
  .store-badges { flex-direction: column; align-items: flex-start; gap: var(--space-3); }

  .footer-main { grid-template-columns: 1fr; }
  .back-to-top { bottom: 16px; right: 16px; width: 42px; height: 42px; }
}

@media (max-width: 360px) {
  .container { padding-inline: var(--space-3); }
  .header-top { gap: 6px; }
  .header-search input { padding: 10px 10px 10px 36px; font-size: var(--fs-xs); }
  .header-search i { left: 12px; }
  .logo-mark { width: 32px; height: 32px; font-size: 0.9rem; }
  .header-actions { gap: 4px; }
  .btn-icon { width: 36px; height: 36px; }
  .cart-link { padding: 8px; }

  .category-strip { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
  .product-grid { grid-template-columns: 1fr 1fr; }
  .hero-copy h1 { font-size: 1.65rem; }
}

/* Touch-friendly tap targets on coarse pointers */
@media (pointer: coarse) {
  .btn, .add-to-cart-btn, .action-link, .btn-icon { min-height: 44px; }
}

/* ==========================================================================
   Shop / Product / Cart responsive rules
   ========================================================================== */
@media (max-width: 1200px) {
  .shop-layout { grid-template-columns: 240px 1fr; }
  .shop-product-grid { grid-template-columns: repeat(2, 1fr); }
  .product-detail-grid { gap: var(--space-5); }
}

@media (max-width: 992px) {
  .shop-layout { grid-template-columns: 1fr; }
  .filters-panel {
    position: fixed; top: 0; left: -320px; bottom: 0; width: 300px; z-index: 1050;
    border-radius: 0; overflow-y: auto; transition: left 280ms ease; height: 100vh;
  }
  .filters-panel.open { left: 0; box-shadow: var(--shadow-lg); }
  .filter-drawer-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 16px; border-radius: var(--radius-full); border: 1px solid var(--color-border);
    font-size: var(--fs-sm); font-weight: 600;
  }
  .filter-drawer-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(17,24,39,0.5); z-index: 1040;
  }
  .filter-drawer-backdrop.open { display: block; }

  .product-detail-grid { grid-template-columns: 1fr; }
  .cart-layout { grid-template-columns: 1fr; }
  .order-summary-card { position: static; }
}

@media (max-width: 768px) {
  .shop-product-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
  .shop-toolbar { gap: var(--space-2); }
  .toolbar-left span:not(.result-count) { display: none; }

  .cart-table-head { display: none; }
  .cart-row {
    grid-template-columns: 1fr; gap: var(--space-3); position: relative;
  }
  .cart-remove { position: absolute; top: var(--space-5); right: var(--space-5); justify-self: auto; }
  .cart-row .cart-line-total { font-size: var(--fs-md); }

  .pd-title { font-size: var(--fs-2xl); }
  .pd-price-row .price-current { font-size: var(--fs-2xl); }
  .pd-actions .btn { min-width: 140px; }
}

@media (max-width: 576px) {
  .shop-product-grid { grid-template-columns: 1fr 1fr; }
  .gallery-thumbs button { width: 60px; height: 60px; }
  .pd-actions { flex-direction: column; align-items: stretch; }
  .pd-actions .btn { width: 100%; }
  .filters-panel { width: 86%; left: -100%; }
}

/* ==========================================================================
   Checkout responsive rules
   ========================================================================== */
@media (max-width: 992px) {
  .checkout-layout { grid-template-columns: 1fr; }
  .order-summary-card.checkout-summary { position: static; }
}

@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .delivery-slot-grid { grid-template-columns: 1fr 1fr; }
  .checkout-header-bar { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 576px) {
  .delivery-slot-grid { grid-template-columns: 1fr; }
  .payment-option-head .card-icons { display: none; }
}

/* ==========================================================================
   About / Contact / Wishlist / Payment / 404 responsive rules
   ========================================================================== */
@media (max-width: 1200px) {
  .team-grid { grid-template-columns: repeat(3, 1fr); }
  .wishlist-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 992px) {
  .split-block, .split-block.reverse { grid-template-columns: 1fr; direction: ltr; }
  .split-block img { order: -1; }
  .mission-vision-grid { grid-template-columns: 1fr; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); row-gap: var(--space-5); }
  .stat-item:nth-child(2) { border-right: none; }
  .testimonial-grid { grid-template-columns: 1fr 1fr; }
  .contact-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .team-grid { grid-template-columns: repeat(2, 1fr); }
  .wishlist-grid { grid-template-columns: repeat(2, 1fr); }
  .testimonial-grid { grid-template-columns: 1fr; }
  .stats-strip { grid-template-columns: 1fr 1fr; }
  .page-hero h1 { font-size: var(--fs-2xl); }
  .error-code { font-size: 5rem; }
  .live-chat-fab span { display: none; }
  .live-chat-fab { padding: 14px; }
}

@media (max-width: 576px) {
  .team-grid { grid-template-columns: 1fr 1fr; }
  .wishlist-grid { grid-template-columns: 1fr 1fr; }
  .stats-strip { grid-template-columns: 1fr 1fr; padding: var(--space-4); }
  .stat-item strong { font-size: var(--fs-2xl); }
}

/* ==========================================================================
   Ultra-wide screens — fluid container means grids need more columns
   so cards don't stretch too large
   ========================================================================== */
@media (min-width: 1600px) {
  .container { padding-inline: var(--space-8); }
  .product-grid { grid-template-columns: repeat(7, 1fr); }
  .shop-product-grid { grid-template-columns: repeat(4, 1fr); }
  .team-grid { grid-template-columns: repeat(5, 1fr); }
  .wishlist-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (min-width: 1920px) {
  .container { padding-inline: var(--space-9); }
  .product-grid { grid-template-columns: repeat(8, 1fr); }
}
