/* Rochester Cards — catalogue refinements v1.2.0
 * Applies only to product archives, related/upsell cards and the homepage featured grid.
 * Blocksy owns the product-card structure, image ratio, column count and category toggles.
 * No WooCommerce options are modified. No checkout/cart selectors.
 */

/* Named card contexts: not the single-product gallery or cart thumbnails. */
:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) ul.products li.product,
body.single-product :is(.related, .up-sells, .upsells) ul.products li.product,
.rc-home .rc-featured ul.products li.product {
  min-width: 0;
}

/* Keep full artwork visible, even when some products are portrait and others landscape.
   Blocksy controls the source ratio; Original is currently preferred to avoid cropping. */
:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) ul.products li.product .ct-media-container,
body.single-product :is(.related, .up-sells, .upsells) ul.products li.product .ct-media-container,
.rc-home .rc-featured ul.products li.product .ct-media-container {
  background-color: #f7f3ea;
  overflow: hidden;
  border-radius: 3px;
}

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) ul.products li.product .ct-media-container img,
body.single-product :is(.related, .up-sells, .upsells) ul.products li.product .ct-media-container img,
.rc-home .rc-featured ul.products li.product .ct-media-container img {
  object-fit: contain !important; /* Preserve every edge of the illustrations. */
}

/* Blocksy's image output normally uses .ct-media-container. This fallback helps
   native WooCommerce shortcode image markup without modifying its aspect ratio. */
:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) ul.products li.product img.attachment-woocommerce_thumbnail,
body.single-product :is(.related, .up-sells, .upsells) ul.products li.product img.attachment-woocommerce_thumbnail {
  object-fit: contain;
}

/* Allow complete readable product names, without their bulky default spacing. */
:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) ul.products li.product .woocommerce-loop-product__title,
body.single-product :is(.related, .up-sells, .upsells) ul.products li.product .woocommerce-loop-product__title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(15px, 1.22vw, 18px);
  font-weight: 400;
  line-height: 1.35;
  color: #292823;
  letter-spacing: -.012em;
  margin-block: 12px 7px;
  overflow-wrap: anywhere;
}

/* Product categories are important in site structure, but the repeated uppercase
   lists add no useful information in every card. Also turn off the Categories
   element in Blocksy -> Product Archives, which is preferable to CSS alone. */
:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) ul.products li.product :is(.entry-meta, .ct-product-categories, .ct-woo-meta, .product-category),
body.single-product :is(.related, .up-sells, .upsells) ul.products li.product :is(.entry-meta, .ct-product-categories, .ct-woo-meta, .product-category),
.rc-home .rc-featured ul.products li.product :is(.entry-meta, .ct-product-categories, .ct-woo-meta, .product-category) {
  display: none !important;
}

/* Consistent, calm price and button treatments on archive/related cards only. */
:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) ul.products li.product .price,
body.single-product :is(.related, .up-sells, .upsells) ul.products li.product .price,
.rc-home .rc-featured ul.products li.product .price {
  color: #45635a;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
}

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) ul.products li.product :is(a.button, .button),
body.single-product :is(.related, .up-sells, .upsells) ul.products li.product :is(a.button, .button) {
  min-height: 38px;
  padding: 11px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  background: #45635a;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: normal;
}

:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) ul.products li.product :is(a.button, .button):hover,
body.single-product :is(.related, .up-sells, .upsells) ul.products li.product :is(a.button, .button):hover {
  background: #2d493f;
  color: #fff;
}

/* Align card actions without moving an add-to-basket button on single products. */
:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) ul.products li.product .ct-woo-card-actions,
body.single-product :is(.related, .up-sells, .upsells) ul.products li.product .ct-woo-card-actions {
  margin-top: auto;
  padding-top: 13px;
}

/* Clear visible keyboard focus for product links and buttons. */
:is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) ul.products li.product a:focus-visible,
body.single-product :is(.related, .up-sells, .upsells) ul.products li.product a:focus-visible,
.rc-home .rc-featured ul.products li.product a:focus-visible {
  outline: 3px solid #a35c53;
  outline-offset: 3px;
}

/* Homepage: preserve v1.1 image grid and use only modest action spacing. */
.rc-home .rc-featured ul.products li.product .ct-woo-card-actions {
  margin-top: auto;
  padding-top: 10px;
}

@media (max-width: 767px) {
  :is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) ul.products li.product .woocommerce-loop-product__title,
  body.single-product :is(.related, .up-sells, .upsells) ul.products li.product .woocommerce-loop-product__title {
    font-size: 15px;
    line-height: 1.35;
  }
  :is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) ul.products li.product :is(a.button, .button),
  body.single-product :is(.related, .up-sells, .upsells) ul.products li.product :is(a.button, .button) {
    padding: 10px 12px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  :is(body.post-type-archive-product, body.tax-product_cat, body.tax-product_tag) ul.products li.product a,
  body.single-product :is(.related, .up-sells, .upsells) ul.products li.product a {
    transition: none;
  }
}
