/*
 * Product image normalization
 *
 * Product uploads use mixed portrait, landscape and square source ratios.
 * Every storefront surface gets a stable frame while the image itself keeps
 * its intrinsic proportions.
 */

/* Standard product cards: home slider, shop grid and related products. */
.product-image-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #fff;
}

.product-image-frame__link {
  position: relative;
  display: flex !important;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-image-frame__image,
.product-image-frame img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
}

.product-image-frame img.second-img {
  inset: 0;
}

/* Native WooCommerce loop fallback (upsells, cross-sells and extensions). */
.woocommerce ul.products li.product .woocommerce-loop-product__link img,
.woocommerce ul.products li.product img.wp-post-image {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  aspect-ratio: 1 / 1;
  object-fit: contain !important;
  object-position: center !important;
  background: #fff;
}

/* Compact product rows on the home page. */
.featured-init2 .product-card .media {
  align-items: center;
  min-width: 0;
}

.featured-init2 .product-thumbnail {
  flex: 0 0 120px !important;
  width: 120px !important;
  height: 120px !important;
  min-width: 120px !important;
  max-width: 120px !important;
  overflow: hidden;
  background: #fff;
}

.featured-init2 .product-thumbnail > a {
  position: relative;
  display: flex !important;
  width: 120px !important;
  height: 120px !important;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.featured-init2 .product-thumbnail img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
}

.featured-init2 .media-body {
  min-width: 0;
}

/* Custom single-product slider. */
.product-single .product-sync-init .product-gallery-frame,
.product-single .product-sync-init .product-thumb {
  position: relative;
  display: flex;
  width: 100%;
  aspect-ratio: 1 / 1;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
}

.product-single .product-sync-init .product-gallery-frame__image,
.product-single .product-sync-init .product-thumb > img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
}

/* WooCommerce's standard gallery remains safe if it is used by an extension. */
.woocommerce-product-gallery__image,
.woocommerce-product-gallery__image > a {
  position: relative;
  display: flex !important;
  width: 100%;
  aspect-ratio: 1 / 1;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
}

.woocommerce-product-gallery__image img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
}

.flex-control-thumbs img,
.product-sync-nav .product-thumb img {
  display: block;
  width: 100% !important;
  aspect-ratio: 1 / 1;
  object-fit: contain !important;
  object-position: center !important;
}

/* Shop category thumbnails. */
.product-category > a > img,
.woocommerce-loop-category__link > img {
  display: block;
  width: 100% !important;
  aspect-ratio: 1 / 1;
  object-fit: contain !important;
  object-position: center !important;
  background: #fff;
}

/* Mini cart. */
.minicart-product-list li .image {
  display: block;
  flex: 0 0 100px !important;
  width: 100px;
  height: 100px;
  overflow: hidden;
  background: #fff;
}

.minicart-product-list li .image img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
}

/* Full cart. */
.modern-cart-wrapper .cart-col.image {
  flex: 0 0 80px;
  width: 80px;
  height: 80px;
  overflow: hidden;
  background: #fff;
}

.modern-cart-wrapper .cart-col.image > a {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.modern-cart-wrapper .cart-col.image img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
}

/* Native cart tables and WooCommerce product widgets. */
.woocommerce-cart-form .product-thumbnail,
.woocommerce table.shop_table .product-thumbnail {
  width: 80px;
}

.woocommerce-cart-form .product-thumbnail > a,
.woocommerce table.shop_table .product-thumbnail > a {
  display: flex;
  width: 80px;
  height: 80px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.woocommerce-cart-form .product-thumbnail img,
.woocommerce table.shop_table .product-thumbnail img,
.woocommerce ul.product_list_widget li img {
  display: block;
  width: 80px !important;
  height: 80px !important;
  max-width: 80px !important;
  object-fit: contain !important;
  object-position: center !important;
}

@media screen and (max-width: 767px) {
  .featured-init2 .product-thumbnail {
    flex-basis: 100px !important;
    width: 100px !important;
    height: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
  }

  .featured-init2 .product-thumbnail > a {
    width: 100px !important;
    height: 100px !important;
  }
}
