/*
 * GAINVO Storefront v0.10.14 — Home Merchandising Rail Correction
 * Restores compact multi-card mobile discovery while preserving the native
 * typography, touch-target, safe-area and accessibility foundation.
 *
 * UX intent:
 * - Home is a discovery surface, not a one-product-at-a-time catalogue.
 * - Phones show two complete cards (plus a peek of the next card where room
 *   allows) and use natural horizontal swipe.
 * - Larger phones/tablets naturally expose three or more cards.
 * - Search/category result pages keep their existing grid/list behaviour.
 */

/* Mobile Home product sections are horizontal merchandising rails. This final
   layer intentionally overrides the <=320px single-column accessibility
   fallback for Home only; card dimensions stay readable without becoming
   oversized. */
@media (max-width:699px){
  .home-v0911 .home-product-grid{
    display:grid!important;
    grid-auto-flow:column!important;
    grid-template-columns:none!important;
    grid-template-rows:1fr!important;
    grid-auto-columns:clamp(132px,43vw,184px)!important;
    gap:10px!important;
    width:auto!important;
    max-width:none!important;
    margin:0 -12px!important;
    padding:2px 12px 10px!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    scroll-snap-type:x proximity!important;
    scroll-padding-inline:12px!important;
    overscroll-behavior-inline:contain!important;
    -webkit-overflow-scrolling:touch!important;
    scrollbar-width:none!important;
    -ms-overflow-style:none!important;
    contain:layout paint!important;
  }

  .home-v0911 .home-product-grid::-webkit-scrollbar{
    display:none!important;
    width:0!important;
    height:0!important;
  }

  .home-v0911 .home-product-grid::before,
  .home-v0911 .home-product-grid::after{
    content:none!important;
    display:none!important;
  }

  .home-v0911 .home-product-grid > .product-card,
  .home-v0911 .home-product-grid > .product-card-v7{
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    height:100%!important;
    margin:0!important;
    scroll-snap-align:start!important;
    scroll-snap-stop:normal!important;
    contain:layout paint!important;
  }

  .home-v0911 .home-product-grid .product-media-wrap,
  .home-v0911 .home-product-grid .product-image{
    width:100%!important;
    min-width:0!important;
  }

  .home-v0911 .home-product-grid .product-image{
    aspect-ratio:1.08 / 1!important;
  }

  .home-v0911 .home-product-grid .product-body{
    min-height:132px!important;
    padding:10px!important;
  }

  .home-v0911 .home-product-grid .product-title{
    min-height:34px!important;
    max-height:36px!important;
    margin:0 0 5px!important;
    font-size:clamp(.8125rem,.78rem + .13vw,.9rem)!important;
    line-height:1.28!important;
  }

  .home-v0911 .home-product-grid .product-shop-row{
    min-height:16px!important;
    margin:0 0 6px!important;
    font-size:clamp(.72rem,.69rem + .1vw,.78rem)!important;
  }

  .home-v0911 .home-product-grid .product-meta-line{
    min-height:15px!important;
    margin:0 0 7px!important;
    font-size:clamp(.7rem,.68rem + .08vw,.75rem)!important;
  }

  .home-v0911 .home-product-grid .product-price-row{
    margin-top:auto!important;
    gap:6px!important;
    align-items:center!important;
  }

  .home-v0911 .home-product-grid .product-price{
    min-width:0!important;
    font-size:clamp(.94rem,.9rem + .16vw,1.04rem)!important;
    line-height:1.05!important;
    white-space:nowrap!important;
  }

  .home-v0911 .home-product-grid .product-price small{
    font-size:.7rem!important;
  }

  .home-v0911 .home-product-grid .product-price-sale del{
    font-size:.7rem!important;
  }

  .home-v0911 .home-product-grid .mini-add{
    flex:0 0 44px!important;
    width:44px!important;
    min-width:44px!important;
    height:44px!important;
    min-height:44px!important;
    border-radius:13px!important;
  }

  .home-v0911 .home-product-grid .product-save-card{
    width:40px!important;
    height:40px!important;
    min-width:40px!important;
    min-height:40px!important;
  }

  /* Empty/error states remain full-width rather than adopting product width. */
  .home-v0911 .home-product-grid > .empty-state,
  .home-v0911 .home-product-grid > .quiet-empty{
    width:calc(100vw - 24px)!important;
    max-width:100%!important;
    grid-column:auto!important;
  }
}

/* Small phones still keep two browseable cards rather than collapsing to one
   huge card. The slightly tighter rail keeps price + native add target usable. */
@media (max-width:350px){
  .home-v0911 .home-product-grid{
    grid-auto-columns:clamp(128px,43vw,146px)!important;
    gap:8px!important;
    margin:0 -10px!important;
    padding-left:10px!important;
    padding-right:10px!important;
    scroll-padding-inline:10px!important;
  }
  .home-v0911 .home-product-grid .product-body{padding:9px!important;min-height:128px!important}
  .home-v0911 .home-product-grid .product-title{font-size:.8125rem!important}
  .home-v0911 .home-product-grid .product-price{font-size:.9375rem!important}
}

/* Wide phones and small tablets naturally expose ~3 cards before the desktop
   rail rules take over at 700px. */
@media (min-width:520px) and (max-width:699px){
  .home-v0911 .home-product-grid{
    grid-auto-columns:clamp(164px,30.5vw,188px)!important;
    gap:12px!important;
  }
}

/* In dark mode geometry remains exactly the same; only existing theme colours
   apply. This prevents theme changes from affecting card count or width. */
html[data-theme="dark"] .home-v0911 .home-product-grid,
html[data-theme="light"] .home-v0911 .home-product-grid{
  grid-template-columns:none!important;
  grid-template-rows:1fr!important;
}

@media (prefers-reduced-motion:reduce){
  .home-v0911 .home-product-grid{scroll-behavior:auto!important}
}
