/* WEBHUB adds its reference line both directly to home cards and inside .price.
   Give either markup a full-width row, including AJAX and variation updates. */
body :is(.cp-shop-card__price, .price, .product__price):has(> .scwh-anchor-price),
body .cp-shop-card .cp-shop-card__price:has(.scwh-anchor-price)
  .price.price:has(> .scwh-anchor-price) {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  justify-content: flex-start !important;
  align-items: baseline !important;
  gap: 6px 10px !important;
  width: 100% !important;
  min-width: 0;
  max-width: 100%;
  line-height: 1.4;
}

body .cp-shop-card .cp-shop-card__price:has(.scwh-anchor-price) {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

/* Keep the current and crossed-out card prices consistent. The reference
   line below has its own smaller size. */
body .cp-shop-card .cp-shop-card__price:has(.scwh-anchor-price),
body .cp-shop-card .cp-shop-card__price:has(.scwh-anchor-price)
  .price.price:has(> .scwh-anchor-price) {
  font-size: 16px !important;
  font-weight: 400 !important;
}

body .cp-product__summary-card .price:has(> .scwh-anchor-price) {
  font-size: clamp(1.5rem, 2.6vw, 28px) !important;
  font-weight: 400 !important;
}

/* Repeated classes beat the theme's specific related-product/mobile rules
   and WEBHUB's optional fixed-size setting without changing either source. */
body .scwh-anchor-price.scwh-anchor-price {
  flex: 0 0 100% !important;
  order: 1;
  width: 100% !important;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  font-family: inherit !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
  letter-spacing: normal;
  text-align: left !important;
  white-space: normal;
  opacity: 1;
}

body :is(.cp-shop-card__price, .price, .product__price, .cp-cart__metric-value--price):has(> .scwh-anchor-price)
  :is(del, ins, .amount, bdi, .woocommerce-Price-currencySymbol),
body .cp-shop-card .cp-shop-card__price:has(.scwh-anchor-price)
  .price.price:has(> .scwh-anchor-price)
  :is(del, ins, .woocommerce-Price-amount.amount, bdi, .scwh-anchor-label, .woocommerce-Price-currencySymbol),
body .scwh-anchor-price.scwh-anchor-price
  :is(.scwh-anchor-label, .amount, bdi, .woocommerce-Price-currencySymbol) {
  font-family: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  line-height: inherit !important;
  letter-spacing: inherit !important;
}

body .scwh-anchor-price.scwh-anchor-price
  :is(.scwh-anchor-label, .amount, bdi, .woocommerce-Price-currencySymbol) {
  color: inherit !important;
}

body .scwh-anchor-price.scwh-anchor-price .amount {
  display: inline !important;
  white-space: nowrap;
}

/* Checkout's original single-price pill cannot contain a reference line. */
body .checkout .woocommerce-checkout-review-order-table .product__price:has(> .scwh-anchor-price) {
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-weight: 400;
}

/* Let the cart reference span the price/quantity/total grid, rather than
   squeezing a dated label into the narrow unit-price column. */
body .cp-cart__metric--price:has(.scwh-anchor-price),
body .cp-cart__metric-value--price:has(> .scwh-anchor-price) {
  display: contents !important;
}

body .cp-cart__metric--price:has(.scwh-anchor-price) > .cp-cart__metric-label {
  display: none;
}

body .cp-cart__metric-value--price:has(> .scwh-anchor-price) > :not(.scwh-anchor-price):not(.screen-reader-text) {
  grid-column: 1;
  grid-row: 1;
}

body .cp-cart__item-side:has(.scwh-anchor-price) .cp-cart__metric--quantity {
  grid-column: 2;
  grid-row: 1;
}

body .cp-cart__item-side:has(.scwh-anchor-price) .cp-cart__metric--total {
  grid-column: 3;
  grid-row: 1;
}

body .cp-cart__metric-value--price > .scwh-anchor-price {
  grid-column: 1 / -1;
  grid-row: auto;
  padding-top: 8px;
}

body .cp-cart__metric-value--price:has(> .scwh-anchor-price) {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
}
