/* ============================================================
   SPICESVILLE — Responsive Breakpoints
   ============================================================ */

/* ---- Breakpoints ----
   xl:   > 1280px  (default — all above styles)
   lg:   > 1024px
   md:   > 768px
   sm:   > 480px
   xs:   < 480px
*/

/* ============================================================
   LARGE (1024-1279px)
   ============================================================ */
@media (max-width: 1279px) {
  :root {
    --container-max: 1100px;
  }

  /* Desktop: 4 cols is default (set in components.css), keep at 4 */
  .product-grid { grid-template-columns: repeat(4, 1fr); }
  .product-grid--5 { grid-template-columns: repeat(4, 1fr); }

  .footer-top {
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--sp-2xl);
  }

  .footer-newsletter {
    grid-column: span 3;
  }

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

  .hero-content {
    margin-left: 5%;
  }

  .gift-grid {
    grid-template-columns: 1fr 1fr;
  }

  .gift-card--featured .gift-card-image { height: 380px; }
  .gift-card-image { height: 220px; }
}

/* ============================================================
   MEDIUM (768-1023px) — Tablet
   ============================================================ */
@media (max-width: 1023px) {
  /* Nav → hidden */
  .main-nav { display: none; }
  .mobile-menu-btn { display: flex; }

  /* Header */
  .header-inner { gap: var(--sp-lg); }

  /* Collection layout → single column */
  .collection-layout {
    grid-template-columns: 1fr;
  }

  .filter-sidebar { display: none; }
  .mobile-filter-btn { display: flex; }

  /* PDP → stacked */
  .pdp-layout {
    grid-template-columns: 1fr;
  }

  .pdp-gallery { position: static; }

  /* Cart Page */
  .cart-page-layout {
    grid-template-columns: 1fr;
  }

  .cart-order-summary { position: static; }

  /* Checkout */
  .checkout-layout {
    grid-template-columns: 1fr;
  }

  /* Admin */
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

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

  /* Product Grid — tablet: 3 cols */
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .product-grid--5 { grid-template-columns: repeat(3, 1fr); }

  /* Image height on tablet */
  .product-card-image-wrap { height: 180px; }

  /* Category Grid */
  .category-grid { grid-template-columns: repeat(2, 1fr); }

  /* Hero */
  .hero { min-height: 80vh; }
  .hero-content { margin: 0; padding: var(--sp-3xl) var(--sp-xl); }

  /* Editorial */
  .editorial-split {
    grid-template-columns: 1fr;
  }

  .editorial-content {
    padding: var(--sp-2xl);
  }

  /* Testimonials */
  .testimonials-grid { grid-template-columns: repeat(2, 1fr); }

  /* Quick View */
  .quick-view-inner { grid-template-columns: 1fr; }

  /* Footer */
  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-2xl);
  }

  .footer-brand { grid-column: span 2; }
  .footer-newsletter { grid-column: span 2; }

  /* Gift Grid */
  .gift-grid {
    grid-template-columns: 1fr;
  }

  .gift-card--featured .gift-card-image,
  .gift-card-image { height: 260px; }

  /* PDP Thumbnails */
  .pdp-thumbnails { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================
   SMALL (480-767px) — Large Mobile
   ============================================================ */
@media (max-width: 767px) {
  :root {
    --sp-4xl: 3.5rem;
    --sp-5xl: 5rem;
    --header-height: 64px;
  }

  .container { padding: 0 12px; }

  /* ── PRODUCT GRID — FORCE 2 COLUMNS, no override possible ── */
  .product-grid,
  .product-grid--3,
  .product-grid--5 {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  /* Product card — tight, premium, fitted */
  .product-card {
    border-radius: 12px !important;
    overflow: hidden !important;
    min-width: 0 !important;   /* prevent card from overflowing */
  }

  /* Image wrap — override fixed height for mobile */
  .product-card-image-wrap,
  .premium-img-wrap {
    height: 150px !important;
    aspect-ratio: unset !important;
    border-radius: 12px 12px 0 0 !important;
    overflow: hidden !important;
    background: #f8f6f2 !important;
  }

  /* Images — contain with small padding */
  .product-card-image-wrap img,
  .product-card-image,
  .premium-img-wrap img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    padding: 12px !important;
    transform: none !important;
  }

  /* Card body — compact */
  .product-card-body { padding: 8px 10px 4px !important; }
  .product-card-footer { padding: 6px 10px 10px !important; }

  /* Product name — 2-line clamp */
  .product-card-name,
  .premium-card-name {
    font-size: 0.78rem !important;
    line-height: 1.3 !important;
    margin-bottom: 3px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }

  /* Price */
  .price-current, .premium-price { font-size: 0.88rem !important; }
  .price-was { font-size: 0.7rem !important; }

  /* Badges — smaller */
  .card-badges { top: 6px !important; left: 6px !important; }
  .badge { font-size: 0.58rem !important; padding: 2px 5px !important; }

  /* Add to cart button on card — compact */
  .premium-add-btn {
    font-size: 0.68rem !important;
    padding: 5px 8px !important;
    border-radius: 20px !important;
  }

  /* Hide description text on mobile cards */
  .product-card-desc { display: none !important; }

  /* Category Grid */
  .category-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .category-card-image { height: 110px; }
  .category-card-label { font-size: 0.8rem; padding: 6px; }

  /* Hero */
  .hero { min-height: 85vh; }
  .hero-title { font-size: clamp(2rem, 7vw, 3rem); }
  .hero-stats { gap: var(--sp-xl); }
  .hero-actions { flex-direction: column; gap: 10px; }
  .hero-actions .btn { width: 100%; text-align: center; }

  /* Section */
  .section { padding: var(--sp-2xl) 0; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .section-header--center { align-items: center; }

  /* Collection Hero */
  .collection-hero { height: 220px; }
  .collection-hero-content { padding: var(--sp-xl); }

  /* Testimonials */
  .testimonials-grid { grid-template-columns: 1fr; }

  /* PDP */
  .pdp-thumbnails { grid-template-columns: repeat(4, 1fr); }
  .pdp-cta-group { grid-template-columns: 1fr; }
  .pdp-features { grid-template-columns: 1fr; }

  /* Cart Drawer */
  .cart-drawer { width: 100vw; }
  .cart-page-item { grid-template-columns: 80px 1fr; gap: var(--sp-md); }

  /* Checkout */
  .checkout-form-grid { grid-template-columns: 1fr; }
  .checkout-steps { gap: var(--sp-sm); }

  /* Admin */
  .admin-form-grid { grid-template-columns: 1fr; }
  .admin-form-group.span-2 { grid-column: span 1; }
  .admin-stats { grid-template-columns: 1fr 1fr; }

  /* Footer */
  .footer-top {
    grid-template-columns: 1fr;
    padding: var(--sp-2xl) var(--sp-lg);
    gap: var(--sp-xl);
  }
  .footer-brand { grid-column: span 1; }
  .footer-newsletter { grid-column: span 1; }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: var(--sp-md);
    padding: var(--sp-lg);
  }
  .footer-bottom-links { justify-content: center; }

  /* Newsletter */
  .newsletter-form { flex-direction: column; }
  .newsletter-btn { width: 100%; }

  /* Announcement */
  .announcement-inner { font-size: 10px; }
}

/* ============================================================
   XS (< 480px) — Small Mobile
   ============================================================ */
@media (max-width: 479px) {
  .container { padding: 0 10px; }

  .header-actions .header-btn:not(#cart-toggle-btn):not(#mobile-menu-btn):not(#search-toggle-btn) {
    display: none;
  }

  /* 2-column grid on very small screens too — FORCE */
  .product-grid,
  .product-grid--3,
  .product-grid--5,
  .category-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .product-card-image-wrap,
  .premium-img-wrap {
    height: 130px !important;
    aspect-ratio: unset !important;
  }

  .product-card-image,
  .product-card-image-wrap img {
    padding: 10px !important;
  }

  .product-card-name,
  .premium-card-name {
    font-size: 0.74rem !important;
  }

  .hero-title { font-size: 1.9rem; }
  .hero-stats { display: none; }

  .pdp-tab-btn { padding: var(--sp-sm) var(--sp-md); font-size: var(--fs-xs); }
  .mega-menu { display: none; }
  .admin-stats { grid-template-columns: 1fr; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .site-header,
  .announcement-bar,
  .site-footer,
  .cart-drawer,
  .search-modal,
  .toast-container { display: none !important; }

  body { background: white; color: black; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .hero-bg img { opacity: 0.4; }
  .announcement-inner { animation: none; }
  .marquee-inner { animation: none; }
}

/* ============================================================
   GLOBAL MOBILE UX OVERRIDES (Base scaling & Touch targets)
   ============================================================ */
@media (max-width: 767px) {
  :root {
    --fs-base: 0.875rem;   /* 14px for delicate premium look */
    --fs-sm: 0.8125rem;    /* 13px */
    --fs-xs: 0.75rem;      /* 12px */
  }

  /* Enhance touch targets for premium usability */
  button, 
  .btn,
  .qty-btn,
  .filter-option {
    min-height: 44px;
  }

  /* Increase general line heights for readability */
  p, li {
    line-height: 1.6;
  }

  /* ── MOBILE-SPECIFIC ANIMATIONS ── */
  /* Remove hover zoom on mobile, replace with fade/slide up */
  .hover-zoom-img {
    transition: opacity 0.5s ease;
  }
  .product-card:active .product-card-image-wrap img,
  .gift-card:active .gift-card-image img,
  .hover-zoom-img:active {
    transform: none !important;
    opacity: 0.8;
  }
  
  /* Make cards fade up slightly as they appear */
  .premium-hover-card {
    animation: fadeInUp 0.6s ease-out both;
  }
  
  /* Sticky Action Bar for Mobile — only on product pages */
  .pdp-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: hsla(220, 15%, 5%, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 100;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(212, 175, 55, 0.2);
    margin: 0;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.6);
    height: auto !important;
    align-items: center;
  }

  /* Ensure content above the sticky bar has enough bottom padding */
  .product-page .container {
    padding-bottom: 90px;
  }

  /* ── HOMEPAGE V21 RESPONSIVENESS ── */
  .hero-slider-section {
    height: 80vh;
    min-height: 500px;
  }
  
  .hero-title {
    font-size: clamp(2.5rem, 8vw, 3.5rem);
  }
  
  .hero-subtitle {
    font-size: var(--fs-sm);
  }
  
  .hero-stats-bar {
    flex-wrap: wrap;
    gap: var(--sp-md);
    padding: var(--sp-sm) var(--sp-md);
  }
  
  .hero-stat {
    flex: 1 1 40%;
    text-align: center;
  }
  
  .hero-stat-divider {
    display: none;
  }
  
  /* Delivery Banner — 2x2 Grid on Mobile */
  .delivery-banner-inner {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 14px 10px !important;
    padding: 18px 12px !important;
  }

  .delivery-banner-item {
    gap: 10px !important;
    align-items: center !important;
  }

  .delivery-banner-icon {
    font-size: 1.3rem !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

  .delivery-banner-item strong {
    font-size: 0.82rem !important;
    display: block !important;
    line-height: 1.2 !important;
  }

  .delivery-banner-item span {
    font-size: 0.68rem !important;
    display: block !important;
    line-height: 1.2 !important;
    color: var(--text-muted) !important;
  }

  .delivery-banner-divider {
    display: none !important;
  }
  
  .trust-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-lg);
  }
  
  .trust-item {
    padding: var(--sp-lg) var(--sp-md);
    background: var(--bg-elevated);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
  }
  
  .trust-icon-wrap {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
  }
  
  .deals-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .countdown-wrap {
    width: 100%;
    justify-content: center;
  }
  
  .social-gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .social-gallery-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-md);
  }

  /* ── B2B STATS GRID (MOBILE 3 COLUMNS IN 1 ROW) ── */
  .b2b-stats-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    margin-bottom: var(--sp-xl) !important;
  }
  .b2b-stats-grid .glass-panel {
    padding: 10px 4px !important;
    border-radius: 10px !important;
  }
  .b2b-stats-grid .glass-panel div:nth-child(1) {
    font-size: 1.15rem !important;
    margin-bottom: 2px !important;
  }
  .b2b-stats-grid .glass-panel div:nth-child(2) {
    font-size: 0.68rem !important;
    line-height: 1.2 !important;
    font-weight: 600 !important;
  }
  .b2b-stats-grid .glass-panel div:nth-child(3) {
    font-size: 0.58rem !important;
    line-height: 1.1 !important;
  }

  /* ── FOOTER TRUST BADGES (MOBILE 2 COLUMNS) ── */
  footer div[style*="display: flex; gap: 0.75rem"],
  footer div[style*="display:flex;gap:0.75rem"] {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .footer-trust-badge {
    padding: 8px 10px !important;
    font-size: 0.72rem !important;
    text-align: center !important;
    width: 100% !important;
  }

  /* ── HORIZONTAL SCROLL CARDS (MOBILE SLIDERS) ── */
  .products-scroll {
    gap: 12px !important;
    padding-left: 2px !important;
    padding-right: 2px !important;
  }

  .products-scroll .product-card {
    min-width: 165px !important;
    max-width: 175px !important;
    width: 170px !important;
    flex-shrink: 0 !important;
    border-radius: 12px !important;
  }

  .products-scroll .product-card-image-wrap,
  .products-scroll .premium-img-wrap {
    height: 135px !important;
    background: #f8f6f2 !important;
  }

  .products-scroll .product-card-image-wrap img {
    padding: 10px !important;
    object-fit: contain !important;
  }

  /* ── DIETARY PREFERENCES / SHOP BY LIFESTYLE (MOBILE 4-COL ROW) ── */
  .dietary-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
    max-width: 100% !important;
    margin-top: var(--sp-lg) !important;
  }

  .dietary-card {
    text-align: center !important;
  }

  .dietary-card div {
    width: 68px !important;
    height: 68px !important;
    font-size: 1.3rem !important;
    margin: 0 auto 6px auto !important;
    border-width: 1.5px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
  }

  .dietary-card h3 {
    font-size: 0.76rem !important;
    line-height: 1.2 !important;
    font-weight: 500 !important;
  }

  /* ── SHOP BY CATEGORY BENTO (MOBILE 2 COLUMNS) ── */
  .category-editorial-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    grid-auto-rows: 155px !important;
    gap: 10px !important;
  }
  .category-editorial-grid > a {
    grid-column: span 1 !important;
    grid-row: span 1 !important;
  }
}

/* ============================================================
   PREMIUM MICRO-ANIMATIONS & EFFECTS
   ============================================================ */
@keyframes shimmerGold {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.text-shimmer {
  background: linear-gradient(90deg, var(--gold) 0%, #fff 50%, var(--gold) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmerGold 4s linear infinite;
}

.glass-panel {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 175, 55, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
