/*
 TradesFolks Sprint 998 — Search Product Square Gallery Refinement
 Scope: /search list-view supplier cards only.
 Goal: slightly taller cards + square, clean image presentation inspired by
 premium B2B supplier-search layouts while preserving TradesFolks branding.
*/

@media (min-width: 901px){
  .tf-search-marketplace .tf-supplier-product-list{
    gap:16px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-card-v3{
    min-height:352px!important;
    padding:15px 16px 13px!important;
    border-radius:16px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-head{
    min-height:52px!important;
    align-items:start!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-badges{
    margin:10px 0 12px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-main{
    grid-template-columns:minmax(300px,34%) minmax(0,66%)!important;
    gap:20px!important;
    align-items:stretch!important;
    min-height:258px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-metrics{
    min-height:258px!important;
    justify-content:space-between!important;
    padding:3px 0 2px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-metrics dl{
    gap:12px 22px!important;
  }

  /* Gallery geometry: primary visual and all 4 supporting visuals read as square tiles. */
  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery,
  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery.is-multi{
    width:100%!important;
    max-width:none!important;
    height:258px!important;
    min-height:258px!important;
    grid-template-columns:minmax(250px,1.08fr) repeat(2,minmax(112px,.50fr))!important;
    grid-template-rows:125px 125px!important;
    gap:8px!important;
    align-self:stretch!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery > a{
    height:125px!important;
    min-height:125px!important;
    border-radius:12px!important;
    border:1px solid #d8e2ee!important;
    background:#fff!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery > a.is-primary{
    grid-row:1 / 3!important;
    height:258px!important;
    min-height:258px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery img{
    display:block!important;
    width:100%!important;
    height:100%!important;
    min-height:0!important;
    padding:10px!important;
    object-fit:contain!important;
    object-position:center center!important;
    background:#fff!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery > a.is-primary img{
    padding:18px!important;
    object-fit:contain!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery > a:not(.is-primary) img{
    padding:8px!important;
    object-fit:contain!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery.is-single{
    display:block!important;
    width:min(100%,320px)!important;
    height:258px!important;
    min-height:258px!important;
    justify-self:end!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery.is-single > a.is-primary{
    width:258px!important;
    height:258px!important;
    min-height:258px!important;
    margin-left:auto!important;
    aspect-ratio:1 / 1!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-gallery-count{
    top:10px!important;
    left:10px!important;
    padding:5px 7px!important;
    border-radius:7px!important;
    font-size:8px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery small{
    top:10px!important;
    right:10px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery strong{
    min-height:31px!important;
    display:flex!important;
    align-items:center!important;
    padding:7px 10px!important;
    font-size:11px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-thumb-price{
    left:7px!important;
    right:7px!important;
    bottom:6px!important;
    padding:4px 7px!important;
    border-radius:6px!important;
    font-size:8px!important;
    background:rgba(255,255,255,.94)!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-foot{
    min-height:34px!important;
    margin-top:8px!important;
    align-items:center!important;
  }
}

/* Medium desktop/tablet: retain square-look without forcing overflow. */
@media (min-width: 901px) and (max-width: 1180px){
  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-card-v3{
    min-height:330px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-main{
    grid-template-columns:minmax(250px,34%) minmax(0,66%)!important;
    gap:14px!important;
    min-height:230px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-metrics{
    min-height:230px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery,
  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery.is-multi{
    height:230px!important;
    min-height:230px!important;
    grid-template-columns:minmax(220px,1.08fr) repeat(2,minmax(96px,.50fr))!important;
    grid-template-rows:111px 111px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery > a{
    height:111px!important;
    min-height:111px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery > a.is-primary{
    height:230px!important;
    min-height:230px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery.is-single,
  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery.is-single > a.is-primary{
    height:230px!important;
    min-height:230px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery.is-single > a.is-primary{
    width:230px!important;
  }
}

/* Tablet: image section moves below product facts; tiles stay balanced and clean. */
@media (max-width: 900px){
  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-card-v3{
    min-height:0!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-main{
    grid-template-columns:1fr!important;
    gap:14px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery.is-multi{
    height:auto!important;
    min-height:0!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    grid-template-rows:auto!important;
    gap:8px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery.is-multi > a{
    display:block!important;
    width:100%!important;
    height:auto!important;
    min-height:0!important;
    aspect-ratio:1 / 1!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery.is-multi > a.is-primary{
    grid-row:auto!important;
    grid-column:1 / -1!important;
    width:min(100%,420px)!important;
    justify-self:center!important;
    height:auto!important;
    min-height:0!important;
    aspect-ratio:1 / 1!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery.is-multi img,
  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery.is-single img{
    width:100%!important;
    height:100%!important;
    min-height:0!important;
    object-fit:contain!important;
    padding:10px!important;
    background:#fff!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery.is-single{
    width:min(100%,420px)!important;
    height:auto!important;
    min-height:0!important;
    justify-self:center!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery.is-single > a.is-primary{
    display:block!important;
    width:100%!important;
    height:auto!important;
    min-height:0!important;
    aspect-ratio:1 / 1!important;
  }
}

/* Mobile: primary image remains large; supporting images become clean square thumbnails. */
@media (max-width: 620px){
  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-card-v3{
    padding:11px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-main{
    gap:11px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery.is-multi{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:7px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery.is-multi > a.is-primary{
    width:min(100%,340px)!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery img{
    padding:8px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-supplier-list-gallery > a.is-primary img{
    padding:12px!important;
  }

  .tf-search-marketplace .tf-supplier-product-list .tf-thumb-price{
    font-size:7px!important;
  }
}
