/*
 * Product grid cards: name and price on the first line, swatches below.
 *
 * TheGem gives the name column (.product-info, which also holds the swatches)
 * and the price (.list-right) each a fixed half of the card. Long names were cut
 * off at half width even next to a short price, a price wider than its half was
 * drawn over the end of the name, and swatches wrapped at half the card width.
 *
 * The name column is dissolved into the card's flex row: the name takes the
 * width the price leaves and wraps to at most two lines (with cards side by side
 * every card reserves the two lines, so prices and swatches stay aligned across a
 * row), and the swatches get a full-width line of their own.
 */
.products .caption.product {
  flex-wrap: wrap !important;
}

.products .caption.product > .product-info {
  display: contents !important;
}

.products .caption.product > .product-info > .title {
  order: 1;
  flex: 1 1 0;
  min-width: 0;
  white-space: normal !important;
  text-overflow: clip !important;
  line-height: 19px !important;
  max-height: 38px;
  overflow: hidden !important;
  display: -webkit-box !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* Cards side by side (two per row from 601 px, three from 768 px): reserve both
   lines on every card, so prices and swatches align across a row. One card per
   row up to 600 px: nothing to align with, so a name takes only the lines it needs. */
@media (min-width: 601px) {
  .products .caption.product > .product-info > .title {
    height: 38px;
  }
}

.products .caption.product > .list-right {
  order: 2;
  flex: 0 0 auto !important;
  width: auto !important;
  margin-left: 12px;
}

.products .caption.product > .product-info > .actions,
.products .caption.product > .product-info > .categories {
  order: 3;
  flex: 0 0 100%;
}
