/* =========================================================
   PGP v266 — Homepage product image/name spacing
   المطلوب:
   - بالموبايل: رفع الصورة والاسم حتى السطر الثاني لا ينزل تحت السعر.
   - باللابتوب/الديسكتوب: رفع الصورة والاسم وفتح مجال للسطر الثاني.
   - لا يغير السعر ولا القلب ولا عدد الكارتات.
   ========================================================= */

/* Home product cards only, not garage cards */
html body #home .pgp-most-product:not(.pgp-most-garage){
  position:relative!important;
  overflow:hidden!important;
}

/* Desktop / wide screens:
   image ends earlier, giving clean space for 2-line name above price */
html body #home .pgp-most-product:not(.pgp-most-garage) > .pgp-most-media{
  top:0!important;
  left:0!important;
  right:0!important;
  height:calc(100% - 72px)!important;
  bottom:auto!important;
  border:0!important;
  outline:0!important;
  box-shadow:none!important;
  background:#ffffff!important;
}

html body #home .pgp-most-product:not(.pgp-most-garage) > .pgp-most-media img{
  width:100%!important;
  height:100%!important;
  object-fit:contain!important;
  object-position:center top!important;
  transform:none!important;
  background:#ffffff!important;
}

/* Name directly under image, raised above price */
html body #home .pgp-most-product:not(.pgp-most-garage) > .pgp-most-info{
  position:absolute!important;
  left:8px!important;
  right:8px!important;
  top:calc(100% - 66px)!important;
  bottom:auto!important;
  z-index:80!important;

  display:block!important;
  visibility:visible!important;
  opacity:1!important;

  max-height:32px!important;
  overflow:hidden!important;
  background:transparent!important;
  border:0!important;
  box-shadow:none!important;
  padding:0!important;
  margin:0!important;
  pointer-events:none!important;
}

/* Plain black name, max two lines */
html body #home .pgp-most-product:not(.pgp-most-garage) > .pgp-most-info > strong,
html body #home .pgp-most-product:not(.pgp-most-garage) :is(
  .pgp-v260-name-badges,
  .pgp-v261-name-badges,
  .pgp-v262-name-badges,
  .pgp-v260-name-line,
  .pgp-v261-name-line,
  .pgp-v262-name-line
){
  display:-webkit-box!important;
  width:100%!important;
  max-width:100%!important;
  color:#111111!important;
  background:transparent!important;
  background-image:none!important;
  border:0!important;
  outline:0!important;
  box-shadow:none!important;
  clip-path:none!important;
  border-radius:0!important;

  font-size:8.8px!important;
  line-height:1.18!important;
  font-weight:850!important;
  text-shadow:none!important;

  white-space:normal!important;
  word-break:normal!important;
  overflow:hidden!important;
  text-overflow:clip!important;
  -webkit-line-clamp:2!important;
  -webkit-box-orient:vertical!important;
  margin:0!important;
  padding:0!important;
}

/* remove any old pseudo badge edges */
html body #home .pgp-most-product:not(.pgp-most-garage) :is(
  .pgp-v260-name-line,
  .pgp-v261-name-line,
  .pgp-v262-name-line
)::before,
html body #home .pgp-most-product:not(.pgp-most-garage) :is(
  .pgp-v260-name-line,
  .pgp-v261-name-line,
  .pgp-v262-name-line
)::after{
  content:none!important;
  display:none!important;
}

/* hide source/details only */
html body #home .pgp-most-product:not(.pgp-most-garage) > .pgp-most-info > span:not(.pgp-v260-name-line):not(.pgp-v261-name-line):not(.pgp-v262-name-line){
  display:none!important;
  visibility:hidden!important;
  opacity:0!important;
  height:0!important;
  max-height:0!important;
  overflow:hidden!important;
}

/* keep price/heart untouched */
html body #home .pgp-most-product:not(.pgp-most-garage) > .pgp-most-price{
  z-index:90!important;
}

html body #home .pgp-most-product:not(.pgp-most-garage) :is(
  .heart-btn,
  .pgp-heart-btn,
  .pgp-card-heart,
  .pgp-home-card-heart,
  .wishlist-btn,
  .save-btn,
  .favorite-btn,
  button[data-pgp-heart],
  button[data-heart]
){
  z-index:95!important;
}

/* Laptop / medium desktop */
@media(min-width:769px) and (max-width:1366px){
  html body #home .pgp-most-product:not(.pgp-most-garage) > .pgp-most-media{
    height:calc(100% - 66px)!important;
  }

  html body #home .pgp-most-product:not(.pgp-most-garage) > .pgp-most-info{
    top:calc(100% - 61px)!important;
    max-height:30px!important;
  }

  html body #home .pgp-most-product:not(.pgp-most-garage) > .pgp-most-info > strong,
  html body #home .pgp-most-product:not(.pgp-most-garage) :is(
    .pgp-v260-name-badges,
    .pgp-v261-name-badges,
    .pgp-v262-name-badges,
    .pgp-v260-name-line,
    .pgp-v261-name-line,
    .pgp-v262-name-line
  ){
    font-size:7.9px!important;
    line-height:1.16!important;
  }
}

/* Mobile: image and name raised significantly to keep 2 lines above price */
@media(max-width:768px){
  html body #home .pgp-most-product:not(.pgp-most-garage) > .pgp-most-media{
    height:calc(100% - 54px)!important;
  }

  html body #home .pgp-most-product:not(.pgp-most-garage) > .pgp-most-media img{
    object-position:center top!important;
  }

  html body #home .pgp-most-product:not(.pgp-most-garage) > .pgp-most-info{
    left:6px!important;
    right:6px!important;
    top:calc(100% - 50px)!important;
    max-height:24px!important;
  }

  html body #home .pgp-most-product:not(.pgp-most-garage) > .pgp-most-info > strong,
  html body #home .pgp-most-product:not(.pgp-most-garage) :is(
    .pgp-v260-name-badges,
    .pgp-v261-name-badges,
    .pgp-v262-name-badges,
    .pgp-v260-name-line,
    .pgp-v261-name-line,
    .pgp-v262-name-line
  ){
    font-size:6.7px!important;
    line-height:1.14!important;
  }
}

/* Very small phones */
@media(max-width:390px){
  html body #home .pgp-most-product:not(.pgp-most-garage) > .pgp-most-media{
    height:calc(100% - 52px)!important;
  }

  html body #home .pgp-most-product:not(.pgp-most-garage) > .pgp-most-info{
    left:5px!important;
    right:5px!important;
    top:calc(100% - 48px)!important;
    max-height:23px!important;
  }

  html body #home .pgp-most-product:not(.pgp-most-garage) > .pgp-most-info > strong,
  html body #home .pgp-most-product:not(.pgp-most-garage) :is(
    .pgp-v260-name-badges,
    .pgp-v261-name-badges,
    .pgp-v262-name-badges,
    .pgp-v260-name-line,
    .pgp-v261-name-line,
    .pgp-v262-name-line
  ){
    font-size:6.3px!important;
    line-height:1.12!important;
  }
}
