/*
 * Homepage Woo loops and shop/taxonomy cards only. Loaded after theme style.css
 * when modernization is enabled. Leave the shared Woo price and action hooks
 * untouched: variable sale markup contains del + br + ins, each range contains
 * two native .woocommerce-Price-amount spans separated by a literal dash.
 */
:is(
  body.home.bb-modernization-enabled main.site-main
    :is(.products-slider, .row.products)
    :is(.product.item, li.product),
  body.bb-modernization-enabled:is(.woocommerce-shop, .tax-product_cat, .tax-product_tag)
    .shop-page-wrapper ul.products li.product
) .product-inner-wrapper .woocommerce-loop-product__title {
  /* Preserve the existing Montserrat type and complete, naturally growing title. */
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  min-height: 2.8em !important;
  margin-top: .75rem !important;
  margin-bottom: .5rem !important;
}

:is(
  body.home.bb-modernization-enabled main.site-main
    :is(.products-slider, .row.products)
    :is(.product.item, li.product),
  body.bb-modernization-enabled:is(.woocommerce-shop, .tax-product_cat, .tax-product_tag)
    .shop-page-wrapper ul.products li.product
) .product-inner-wrapper .price {
  --bb-catalog-price-flow: single-line-v1;
  /*
   * Do not make the amount spans flex/grid items: they and the literal dash
   * must participate in one inline context. Each complete range stays on one
   * line; the existing Manager fitter handles measured overflow at all widths.
   * Never fix the price height: old/current remain separate intrinsic rows.
   */
  box-sizing: border-box;
  display: block !important;
  align-content: center;
  flex: 0 0 auto !important;
  width: 100% !important;
  min-width: 0;
  min-height: 7rem !important;
  height: auto !important;
  max-height: none !important;
  margin: auto auto 0 !important;
  padding: .5rem 0 !important;
  color: var(--bb-color-purple);
  font-size: clamp(1.125rem, 1.2vw, 1.25rem) !important;
  line-height: 1.5 !important;
  text-align: center;
  /* The active shared fitter declares these properties on this exact price.
   * With its intentional kill-switch/no-JS fallback, retain native readability
   * rather than leaving an unfitted, clipped nowrap range. */
  white-space: var(--bb-catalog-price-white-space, normal) !important;
  overflow: visible !important;
  overflow-wrap: var(--bb-catalog-price-overflow-wrap, anywhere);
}

:is(
  body.home.bb-modernization-enabled main.site-main
    :is(.products-slider, .row.products)
    :is(.product.item, li.product),
  body.bb-modernization-enabled:is(.woocommerce-shop, .tax-product_cat, .tax-product_tag)
    .shop-page-wrapper ul.products li.product
) .product-inner-wrapper .price > :is(del, ins) {
  /*
   * A sale's complete old and current ranges occupy separate, intrinsic-height
   * rows. Override the earlier inline-flex and mobile grid-row rules;
   * neither the end amount nor the decimals may disappear beyond a card edge.
   */
  box-sizing: border-box;
  display: block !important;
  /* Compiled main.css still floats del left. Reset it explicitly: otherwise
   * ins starts beside the pill and its digits are squeezed around that float. */
  float: none !important;
  clear: both !important;
  flex: none !important;
  width: max-content !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  margin-inline: auto !important;
  font-size: inherit !important;
  line-height: inherit !important;
  text-align: center;
  white-space: var(--bb-catalog-price-white-space, normal) !important;
  overflow-wrap: var(--bb-catalog-price-overflow-wrap, anywhere);
}

:is(
  body.home.bb-modernization-enabled main.site-main
    :is(.products-slider, .row.products)
    :is(.product.item, li.product),
  body.bb-modernization-enabled:is(.woocommerce-shop, .tax-product_cat, .tax-product_tag)
    .shop-page-wrapper ul.products li.product
) .product-inner-wrapper .price :is(.woocommerce-Price-amount, bdi) {
  /* Keep real currency/decimal text, including either endpoint, legible. */
  font-size: inherit !important;
  white-space: var(--bb-catalog-price-white-space, normal) !important;
  overflow-wrap: var(--bb-catalog-price-overflow-wrap, anywhere);
}

:is(
  body.home.bb-modernization-enabled main.site-main
    :is(.products-slider, .row.products)
    :is(.product.item, li.product),
  body.bb-modernization-enabled:is(.woocommerce-shop, .tax-product_cat, .tax-product_tag)
    .shop-page-wrapper ul.products li.product
) .product-inner-wrapper .price:has(> del):has(> ins) > br {
  /* The del and ins are already distinct rows; BR must not create an empty one. */
  display: none !important;
}

:is(
  body.home.bb-modernization-enabled main.site-main
    :is(.products-slider, .row.products)
    :is(.product.item, li.product),
  body.bb-modernization-enabled:is(.woocommerce-shop, .tax-product_cat, .tax-product_tag)
    .shop-page-wrapper ul.products li.product
) .product-inner-wrapper .price + .you_save_price {
  /* Keep the native saving below the price rather than floating into its row. */
  margin-top: .5rem !important;
}

@media (max-width: 767px) {
  :is(
    body.home.bb-modernization-enabled main.site-main
      :is(.products-slider, .row.products)
      :is(.product.item, li.product),
    body.bb-modernization-enabled:is(.woocommerce-shop, .tax-product_cat, .tax-product_tag)
      .shop-page-wrapper ul.products li.product
  ) .product-inner-wrapper .woocommerce-loop-product__title {
    /* Four short lines reserve a common track; longer names still grow. */
    min-height: 5.6em !important;
  }
}