/* ══════════════════════════════════════════════════════════
   031 — Product image box
   Loaded by 031-bs-product-image-box.php on every front-end page,
   at wp_enqueue_scripts priority 10050, after every other BlackSpace
   stylesheet.

   One rule wherever a product photo appears: a square box, a white
   background, and the whole photo fitted inside it, centered, never
   cropped. This replaces what WP Smart Image Resize does by padding
   files to 600 × 600 (November 20, 2026, backlog O91).

   Every photo SIR has processed is already a white 600 × 600 square,
   so on those this file changes nothing a visitor can see: a square
   fitted into a square box fills it either way. It matters for photos
   that are not square.

   Specificity: each selector starts with html body:not(#bs-pib-none),
   which adds one ID's weight, so it outranks the class-only rules in
   bs-product-archive.css, 090, 100, 245, and the Algolia stylesheets
   whatever order a combiner puts them in. The checkout thumbnail rule
   in 240 carries an ID, so its override names #order_review too.

   Not touched: zoom (img.zoomImg, which WooCommerce puts inside the
   same figure) and the lightbox. They keep showing the full image.
   ══════════════════════════════════════════════════════════ */

/* Grids: shop, category, tag, search, seller store, related, upsells,
   cross-sells, the hover image, and Algolia's category grid. The box
   is the image itself, square at the container's width. */
html body:not(#bs-pib-none) .wd-product-thumb img {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: contain !important;
  object-position: center !important;
  background-color: #ffffff !important;
}

/* Single product page and quick view: the main image. 600px wide (the
   woocommerce_single width every square photo already renders at), never
   wider than its slide, so a tall or wide photo gets the same square box
   as a square one. 100-bs-single-product-layout.css sets width: auto,
   which made the box the file's width (1.0.1, November 20, 2026). The
   slide is untouched: WoodMart's carousel sets its width inline. Height
   stays capped at 635px, 350px on mobile, by that file. */
html body:not(#bs-pib-none) .woocommerce-product-gallery__image img:not(.zoomImg) {
  width: 600px !important;
  max-width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: contain !important;
  object-position: center !important;
  background-color: #ffffff !important;
}

/* Single product page: the thumbnail strip. */
html body:not(#bs-pib-none) .wd-gallery-thumb img {
  aspect-ratio: 1 / 1 !important;
  object-fit: contain !important;
  object-position: center !important;
  background-color: #ffffff !important;
}

/* Algolia: search results page hits and the seller store search grid. */
html body:not(#bs-pib-none) .bs-hit-image img,
html body:not(#bs-pib-none) .bs-store-product__img-link img {
  object-fit: contain !important;
  object-position: center !important;
  background-color: #ffffff !important;
}

/* Cart page table: square at the width WooCommerce gives it. */
html body:not(#bs-pib-none) .woocommerce-cart-form .product-thumbnail img {
  aspect-ratio: 1 / 1 !important;
  height: auto !important;
  object-fit: contain !important;
  object-position: center !important;
  background-color: #ffffff !important;
}

/* Mini-cart drawer and checkout order summary: 245 and 240 already
   size these as fixed squares (72, 64, or 56px; 56px). Only the fit
   and the background change. */
html body:not(#bs-pib-none) .woocommerce-mini-cart-item img,
html body:not(#bs-pib-none) #order_review .wd-checkout-prod-img img {
  object-fit: contain !important;
  object-position: center !important;
  background-color: #ffffff !important;
}
