/* HOME: four-column layout with enough room for readable product text. */
#products #productGrid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  align-items: stretch !important;
  gap: 16px !important;
}
#products #productGrid > .product-card {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  height: 465px !important;
  min-height: 465px !important;
  max-height: 465px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}
#products #productGrid > .product-card > .product-image {
  flex: 0 0 135px !important;
  width: 100% !important;
  height: 135px !important;
  min-height: 135px !important;
  max-height: 135px !important;
}
#products #productGrid > .product-card > .product-info {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: column !important;
  min-height: 0 !important;
  padding: 11px 12px 13px !important;
  gap: 7px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}
#products #productGrid > .product-card > .product-info .product-category {
  flex: 0 0 auto !important;
  font-size: 10px !important;
  line-height: 1.5 !important;
  white-space: normal !important;
}
#products #productGrid > .product-card > .product-info h3 {
  flex: 0 0 auto !important;
  font-size: 14px !important;
  line-height: 1.6 !important;
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 3 !important;
  max-height: 4.8em !important;
  overflow: hidden !important;
  overflow-wrap: anywhere !important;
}
#products #productGrid > .product-card > .product-info > p {
  flex: 0 0 auto !important;
  min-height: 0 !important;
  font-size: 11px !important;
  line-height: 1.65 !important;
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 3 !important;
  max-height: 4.95em !important;
  overflow: hidden !important;
}
#products #productGrid > .product-card > .product-info .product-meta {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 4px 8px !important;
  margin-top: auto !important;
  padding-top: 4px !important;
  flex: 0 0 auto !important;
}
#products #productGrid > .product-card > .product-info .add-cart {
  flex: 0 0 auto !important;
  min-height: 38px !important;
  margin-top: 2px !important;
  padding: 8px 8px !important;
  font-size: 11px !important;
  line-height: 1.4 !important;
  white-space: normal !important;
}
@media (max-width: 1050px) {
  #products #productGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
  }
  #products #productGrid > .product-card {
    height: 475px !important;
    min-height: 475px !important;
    max-height: 475px !important;
  }
  #products #productGrid > .product-card > .product-image {
    flex-basis: 155px !important;
    height: 155px !important;
    min-height: 155px !important;
    max-height: 155px !important;
  }
}
@media (max-width: 640px) {
  #products #productGrid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
  }
  #products #productGrid > .product-card {
    height: 485px !important;
    min-height: 485px !important;
    max-height: 485px !important;
  }
  #products #productGrid > .product-card > .product-image {
    flex-basis: 160px !important;
    height: 160px !important;
    min-height: 160px !important;
    max-height: 160px !important;
  }
  #products #productGrid > .product-card > .product-info {
    padding: 12px 14px 14px !important;
    gap: 7px !important;
  }
  #products #productGrid > .product-card > .product-info h3 {
    font-size: 15px !important;
  }
  #products #productGrid > .product-card > .product-info > p {
    font-size: 12px !important;
  }
}

/* SHOP ONLY: shorter portrait cards. Preserve the catalog's existing grid columns. */
#shopCatalog > #shopGrid > .shop-category-group > .product-grid > .product-card,
#shopCatalog > #shopGrid.product-grid > .product-card {
  display: flex !important;
  flex-direction: column !important;
  width: var(--sarail-card-width, 100%) !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: var(--sarail-card-height, 350px) !important;
  min-height: var(--sarail-card-height, 350px) !important;
  max-height: var(--sarail-card-height, 350px) !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}
#shopCatalog > #shopGrid > .shop-category-group > .product-grid > .product-card > .product-image,
#shopCatalog > #shopGrid.product-grid > .product-card > .product-image {
  flex: 0 0 132px !important;
  width: 100% !important;
  height: 132px !important;
  min-height: 132px !important;
  max-height: 132px !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}
#shopCatalog > #shopGrid > .shop-category-group > .product-grid > .product-card > .product-info,
#shopCatalog > #shopGrid.product-grid > .product-card > .product-info {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: column !important;
  min-height: 0 !important;
  gap: 5px !important;
  padding: 10px 13px 11px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}
#shopCatalog > #shopGrid > .shop-category-group > .product-grid > .product-card > .product-info h3,
#shopCatalog > #shopGrid.product-grid > .product-card > .product-info h3 {
  margin: 0 !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  overflow: hidden !important;
}
#shopCatalog > #shopGrid > .shop-category-group > .product-grid > .product-card > .product-info > p,
#shopCatalog > #shopGrid.product-grid > .product-card > .product-info > p {
  margin: 0 !important;
  min-height: 0 !important;
  font-size: 10px !important;
  line-height: 1.55 !important;
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  overflow: hidden !important;
}
#shopCatalog > #shopGrid > .shop-category-group > .product-grid > .product-card > .product-info .product-meta,
#shopCatalog > #shopGrid.product-grid > .product-card > .product-info .product-meta {
  margin-top: auto !important;
  padding-top: 5px !important;
}
#shopCatalog > #shopGrid > .shop-category-group > .product-grid > .product-card > .product-info .product-detail-link,
#shopCatalog > #shopGrid > .shop-category-group > .product-grid > .product-card > .product-info .add-cart,
#shopCatalog > #shopGrid.product-grid > .product-card > .product-info .product-detail-link,
#shopCatalog > #shopGrid.product-grid > .product-card > .product-info .add-cart {
  flex: 0 0 auto !important;
  min-height: 30px !important;
  margin-top: 2px !important;
  padding: 6px 9px !important;
  font-size: 10px !important;
  line-height: 1.25 !important;
}
@media (max-width: 620px) {
  #shopCatalog > #shopGrid > .shop-category-group > .product-grid > .product-card,
  #shopCatalog > #shopGrid.product-grid > .product-card {
    height: var(--sarail-card-height, 335px) !important;
    min-height: var(--sarail-card-height, 335px) !important;
    max-height: var(--sarail-card-height, 335px) !important;
  }
  #shopCatalog > #shopGrid > .shop-category-group > .product-grid > .product-card > .product-image,
  #shopCatalog > #shopGrid.product-grid > .product-card > .product-image {
    flex-basis: 112px !important;
    height: 112px !important;
    min-height: 112px !important;
    max-height: 112px !important;
  }
  #shopCatalog > #shopGrid > .shop-category-group > .product-grid > .product-card > .product-info,
  #shopCatalog > #shopGrid.product-grid > .product-card > .product-info {
    padding: 9px 10px !important;
    gap: 4px !important;
  }
  #shopCatalog > #shopGrid > .shop-category-group > .product-grid > .product-card > .product-info h3,
  #shopCatalog > #shopGrid.product-grid > .product-card > .product-info h3 {
    font-size: 12px !important;
  }
  #shopCatalog > #shopGrid > .shop-category-group > .product-grid > .product-card > .product-info > p,
  #shopCatalog > #shopGrid.product-grid > .product-card > .product-info > p {
    font-size: 9px !important;
    line-height: 1.5 !important;
  }
}
@media (max-width: 380px) {
  #shopCatalog > #shopGrid > .shop-category-group > .product-grid > .product-card,
  #shopCatalog > #shopGrid.product-grid > .product-card {
    height: var(--sarail-card-height, 350px) !important;
    min-height: var(--sarail-card-height, 350px) !important;
    max-height: var(--sarail-card-height, 350px) !important;
  }
  #shopCatalog > #shopGrid > .shop-category-group > .product-grid > .product-card > .product-image,
  #shopCatalog > #shopGrid.product-grid > .product-card > .product-image {
    flex-basis: 130px !important;
    height: 130px !important;
    min-height: 130px !important;
    max-height: 130px !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  #products #productGrid > .product-card,
  #shopCatalog > #shopGrid .shop-category-group .product-grid > .product-card,
  #shopCatalog > #shopGrid.product-grid > .product-card {
    transition: none !important;
  }
}
