/* Shafaq 1.5.37 — stable product gallery + horizontally scrolling related products. */

/* Product gallery: use featured image + WooCommerce product gallery without depending on FlexSlider. */
body.single-product .woocommerce div.product div.images.ts-product-media-gallery{
  display:grid!important;
  grid-template-columns:1fr!important;
  gap:12px!important;
  width:100%!important;
  min-width:0!important;
  min-height:0!important;
  margin:0!important;
  opacity:1!important;
  visibility:visible!important;
  overflow:visible!important;
}
body.single-product .ts-product-gallery-stage{
  display:grid;
  place-items:center;
  width:100%;
  min-height:420px;
  aspect-ratio:1/1;
  padding:20px;
  border:1px solid #e6edf3;
  border-radius:20px;
  background:linear-gradient(180deg,#fff,#f8fafc);
  overflow:hidden;
}
body.single-product .ts-product-gallery-main-image{
  display:block!important;
  width:100%!important;
  height:100%!important;
  max-width:100%!important;
  max-height:500px!important;
  object-fit:contain!important;
  margin:auto!important;
  opacity:1!important;
  visibility:visible!important;
  transition:opacity .18s ease,transform .18s ease;
}
body.single-product .ts-product-media-gallery.is-changing .ts-product-gallery-main-image{opacity:.45!important;transform:scale(.985)}
body.single-product .ts-product-gallery-thumbs{
  display:flex!important;
  align-items:center;
  gap:9px;
  width:100%;
  max-width:100%;
  padding:2px 1px 6px;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  overscroll-behavior-inline:contain;
  scroll-snap-type:x proximity;
  scrollbar-width:thin;
}
body.single-product .ts-product-gallery-thumb{
  appearance:none;
  flex:0 0 76px;
  width:76px;
  height:76px;
  padding:5px;
  border:1px solid #dfe7ee;
  border-radius:12px;
  background:#fff;
  cursor:pointer;
  scroll-snap-align:start;
  transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease;
}
body.single-product .ts-product-gallery-thumb:hover{transform:translateY(-1px);border-color:#b8c9d8}
body.single-product .ts-product-gallery-thumb.is-active{border-color:var(--ts-accent,#0b95c9);box-shadow:0 0 0 2px color-mix(in srgb,var(--ts-accent,#0b95c9) 16%,transparent)}
body.single-product .ts-product-gallery-thumb img{display:block!important;width:100%!important;height:100%!important;object-fit:contain!important;margin:0!important;border-radius:8px;background:#f8fafc}

/* Related products are a genuine horizontal rail. Only the rail scrolls; the page never does. */
body.single-product .ts-related-products.ts-products-wrap{
  grid-column:1/-1!important;
  width:100%!important;
  min-width:0!important;
  position:relative!important;
  overflow:hidden!important;
  margin-top:20px!important;
  padding:20px!important;
  border:1px solid #e4ebf1!important;
  border-radius:20px!important;
  background:#fff!important;
  box-shadow:0 10px 28px rgba(30,48,68,.045);
}
body.single-product .ts-related-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px;padding-bottom:12px;border-bottom:1px solid #edf1f4}
body.single-product .ts-related-head-actions{display:flex;align-items:center;gap:7px}
body.single-product .ts-related-head-actions>span{font-size:10px;color:#738194;background:#f5f7f9;border:1px solid #e6ebf0;border-radius:999px;padding:5px 9px;white-space:nowrap}
body.single-product .ts-related-head .ts-carousel-btn{position:static!important;inset:auto!important;display:grid!important;place-items:center;width:32px;height:32px;border-radius:10px;border:1px solid #dfe7ee;background:#fff;color:#31475d;box-shadow:none;transform:none!important}
body.single-product .ts-related-head .ts-carousel-btn:hover{border-color:#c8d5df;background:#f8fafc}
body.single-product .ts-related-grid.ts-products{
  display:flex!important;
  grid-template-columns:none!important;
  grid-auto-flow:initial!important;
  gap:12px!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  margin:0!important;
  padding:2px 1px 10px!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  overscroll-behavior-inline:contain!important;
  scroll-snap-type:x mandatory!important;
  scrollbar-width:thin;
  -webkit-overflow-scrolling:touch;
}
body.single-product .ts-related-grid.ts-products::before,
body.single-product .ts-related-grid.ts-products::after{display:none!important;content:none!important}
body.single-product .ts-related-grid.ts-products .ts-related-card{
  flex:0 0 calc((100% - 48px)/5)!important;
  width:auto!important;
  min-width:0!important;
  max-width:none!important;
  margin:0!important;
  scroll-snap-align:start;
}
body.single-product .ts-related-card .ts-card-actions{margin-top:auto}

@media(max-width:1180px){
  body.single-product .ts-related-grid.ts-products .ts-related-card{flex-basis:calc((100% - 36px)/4)!important}
}
@media(max-width:900px){
  body.single-product .ts-related-grid.ts-products .ts-related-card{flex-basis:calc((100% - 24px)/3)!important}
  body.single-product .ts-product-gallery-stage{min-height:360px}
}
@media(max-width:700px){
  body.single-product .ts-product-gallery-stage{min-height:300px;aspect-ratio:1/1;padding:10px;border-radius:16px}
  body.single-product .ts-product-gallery-main-image{max-height:330px!important}
  body.single-product .ts-product-gallery-thumb{flex-basis:64px;width:64px;height:64px;border-radius:10px}
  body.single-product .ts-related-products.ts-products-wrap{padding:13px!important;border-radius:16px!important}
  body.single-product .ts-related-head{margin-bottom:10px;padding-bottom:9px}
  body.single-product .ts-related-head h2{font-size:15px!important}
  body.single-product .ts-related-head-actions>span{display:none}
  body.single-product .ts-related-head .ts-carousel-btn{width:30px;height:30px}
  body.single-product .ts-related-grid.ts-products{gap:9px!important;padding-bottom:8px!important}
  body.single-product .ts-related-grid.ts-products .ts-related-card{flex:0 0 calc((100% - 9px)/2)!important}
}
@media(max-width:380px){
  body.single-product .ts-related-grid.ts-products .ts-related-card{flex-basis:72%!important}
}
@media(prefers-reduced-motion:reduce){
  body.single-product .ts-product-gallery-main-image,
  body.single-product .ts-product-gallery-thumb{transition:none!important}
}
