/* AvvalStock Product System v24.6 — archive loop placement only.
 * Card visuals are owned by the skin files.
 */
body.avs-catalog-enabled.avs-product-system{
  --avs-catalog-columns:4;
  --avs-catalog-gap:11px;
}
body.avs-catalog-enabled.avs-product-system.avs-catalog-columns-3{--avs-catalog-columns:3}

body.avs-catalog-enabled .avs-catalog-flow-sentinel{display:none!important}
body.avs-catalog-enabled .products-box,
body.avs-catalog-enabled .archive-list-products{
  position:relative!important;
  overflow:visible!important;
  height:auto!important;
  min-height:0!important;
  margin-top:0!important;
  padding-top:0!important;
  background:transparent!important;
  box-shadow:none!important;
}

body.avs-catalog-enabled.avs-product-system ul.products:not(.avs-ew-products__track),
body.woocommerce.avs-catalog-enabled.avs-product-system .products-box>ul.products,
body.woocommerce.avs-catalog-enabled.avs-product-system .archive-list-products>ul.products{
  display:grid!important;
  grid-auto-flow:row!important;
  align-items:stretch!important;
  justify-items:stretch!important;
  width:100%!important;
  max-width:none!important;
  min-height:0!important;
  margin:0!important;
  padding:0!important;
  list-style:none!important;
  transform:none!important;
  container-type:inline-size;
  container-name:avs-products;
}
body.avs-catalog-enabled.avs-product-system ul.products:not(.avs-ew-products__track)::before,
body.avs-catalog-enabled.avs-product-system ul.products:not(.avs-ew-products__track)::after{display:none!important;content:none!important}

/* Wide desktop: configurable Grid, single-column List. */
@media (min-width:1024px){
  body.avs-catalog-enabled.avs-product-system.avs-catalog-view-grid ul.products:not(.avs-ew-products__track){
    grid-template-columns:repeat(var(--avs-catalog-columns),minmax(0,1fr))!important;
    gap:var(--avs-catalog-gap)!important;
  }
  body.avs-catalog-enabled.avs-product-system.avs-catalog-view-list ul.products:not(.avs-ew-products__track){
    grid-template-columns:1fr!important;
    gap:14px!important;
  }
}

/* Desktop Master Width Contract ------------------------------------------------
 * Homepage displays six cards. Category archives display five, but a category
 * card must NOT stretch to consume the sixth slot. Its width is calculated from
 * the same six-slot lattice and the five cards are centered as a group.
 */
@media (min-width:1200px){
  body.avs-catalog-enabled.avs-product-system.avs-catalog-view-grid ul.products:not(.avs-ew-products__track){
    --avs-home-master-gap:10px;
    --avs-home-master-card-width:min(258px,calc((100% - (5 * var(--avs-home-master-gap))) / 6));
    grid-template-columns:repeat(var(--avs-catalog-columns),minmax(0,var(--avs-home-master-card-width)))!important;
    justify-content:center!important;
    justify-items:stretch!important;
    align-items:stretch!important;
    gap:var(--avs-home-master-gap)!important;
  }
}

/* Native non-Hub categories become denser on wide desktop, as before. */
@media (min-width:1360px){
  body.avs-catalog-enabled.avs-product-system.avs-native-category-default,
  body.avs-catalog-enabled.avs-product-system.avs-native-archive-default{--avs-catalog-columns:5;--avs-catalog-gap:11px}
}

/* Tablet is an adaptation layer, not a fifth skin. */
@media (min-width:768px) and (max-width:1023px){
  body.avs-catalog-enabled.avs-product-system{--avs-catalog-columns:3;--avs-catalog-gap:10px}
  body.avs-catalog-enabled.avs-product-system.avs-catalog-view-grid ul.products:not(.avs-ew-products__track){
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:10px!important;
  }
  body.avs-catalog-enabled.avs-product-system.avs-catalog-view-list ul.products:not(.avs-ew-products__track){
    grid-template-columns:1fr!important;
    gap:12px!important;
  }
}

/* Mobile Grid/List placement. */
@media (max-width:767px){
  body.avs-catalog-enabled.avs-product-system{--avs-catalog-columns:2;--avs-catalog-gap:8px}
  body.avs-catalog-enabled.avs-product-system .products-box,
  body.avs-catalog-enabled.avs-product-system .archive-list-products{padding-bottom:74px!important}
  body.avs-catalog-enabled.avs-product-system.avs-catalog-view-grid ul.products:not(.avs-ew-products__track){
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
  }
  body.avs-catalog-enabled.avs-product-system.avs-catalog-view-list ul.products:not(.avs-ew-products__track){
    grid-template-columns:1fr!important;
    gap:10px!important;
  }
  body.avs-catalog-enabled.avs-product-system ul.products:not(.avs-ew-products__track)>li.product.avs-product-card--catalog{min-width:0!important}
}
@media (max-width:329px){
  body.avs-catalog-enabled.avs-product-system.avs-catalog-view-grid ul.products:not(.avs-ew-products__track){grid-template-columns:1fr!important}
}

/* v24-owned view selector for ordinary WooCommerce categories. */
body.avs-catalog-enabled.avs-card-architecture-v24 .archive-list-view .type_view{display:none!important}
body.avs-catalog-enabled.avs-card-architecture-v24 .avs-catalog-viewbar{
  display:flex;align-items:center;justify-content:space-between;gap:14px;width:100%;margin:0 0 14px;padding:9px 11px;
  border:1px solid #e5eaf1;border-radius:12px;background:#fff;box-shadow:0 4px 14px rgba(23,32,51,.035);direction:rtl;
}
body.avs-catalog-enabled.avs-card-architecture-v24 .avs-catalog-viewbar__label{display:flex;flex-direction:column;gap:3px;min-width:0}
body.avs-catalog-enabled.avs-card-architecture-v24 .avs-catalog-viewbar__label strong{color:#202b3d;font-size:12px;line-height:1.2;font-weight:900}
body.avs-catalog-enabled.avs-card-architecture-v24 .avs-catalog-viewbar__label span{color:#7a8595;font-size:9px;line-height:1.2;font-weight:700}
body.avs-catalog-enabled.avs-card-architecture-v24 .avs-catalog-viewbar .avs-catalog-view{display:flex;align-items:center;gap:4px;flex:0 0 auto;padding:3px;border:1px solid #e4e9f0;border-radius:10px;background:#f7f9fb;direction:rtl}
body.avs-catalog-enabled.avs-card-architecture-v24 .avs-catalog-viewbar .avs-catalog-view button{display:flex;align-items:center;justify-content:center;gap:5px;height:32px;margin:0;padding:0 9px;border:0;border-radius:7px;background:transparent;color:#667085;box-shadow:none;cursor:pointer;font:inherit;font-size:9px;line-height:1;font-weight:850;white-space:nowrap}
body.avs-catalog-enabled.avs-card-architecture-v24 .avs-catalog-viewbar .avs-catalog-view button svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.8}
body.avs-catalog-enabled.avs-card-architecture-v24 .avs-catalog-viewbar .avs-catalog-view button.is-active{background:#fff;color:#ff4967;box-shadow:0 2px 7px rgba(23,32,51,.07)}
@media (max-width:767px){
  body.avs-catalog-enabled.avs-card-architecture-v24 .avs-catalog-viewbar{margin-bottom:10px;padding:7px 8px;border-radius:10px}
  body.avs-catalog-enabled.avs-card-architecture-v24 .avs-catalog-viewbar__label span{display:none}
  body.avs-catalog-enabled.avs-card-architecture-v24 .avs-catalog-viewbar__label strong{font-size:10px}
  body.avs-catalog-enabled.avs-card-architecture-v24 .avs-catalog-viewbar .avs-catalog-view button{height:30px;padding:0 7px;font-size:8.5px}
  body.avs-catalog-enabled.avs-card-architecture-v24 .avs-catalog-viewbar .avs-catalog-view button svg{width:14px;height:14px}
}
