.ovrform-product-title-svg {
  position: relative;
  display: inline-grid;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  background: transparent !important;
  line-height: 1;
}

.ovrform-product-title-svg :is(img, svg) {
  display: block;
  width: var(--ovrform-product-title-scale, 100%);
  max-width: var(--ovrform-product-title-scale, 100%);
  height: auto;
  max-height: 100%;
  margin: 0;
  padding: 0;
  object-fit: contain;
  object-position: left center;
}

.ovrform-product-title-svg__fallback {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.ovrform-product-title-svg--catalog {
  width: min(100%, 18rem);
  min-height: clamp(1.75rem, 3vw, 2.75rem);
}

.ovrform-product-title-svg--single {
  width: min(100%, 25rem);
  min-height: clamp(2.75rem, 6vw, 4.75rem);
}

.ovrform-product-title-svg--cart,
.ovrform-product-title-svg--checkout,
.ovrform-product-title-svg--drawer {
  width: min(100%, 9.375rem);
  min-height: 1.75rem;
}

.woocommerce ul.products li.product .woocommerce-loop-product__title:has(.ovrform-product-title-svg) {
  min-height: clamp(2.5rem, 4vw, 3.5rem);
}

/*
 * Storefront themes commonly style every image inside the product link as the
 * square catalog photo. Reset those photo-only rules for title artwork while
 * preserving the SVG's intrinsic aspect ratio and the native title footprint.
 */
.woocommerce ul.products li.product
  .woocommerce-loop-product__title
  .ovrform-product-title-svg--catalog {
  display: flex;
  align-items: flex-start;
  width: 100%;
  min-height: 0;
}

.woocommerce ul.products li.product
  .woocommerce-loop-product__title
  .ovrform-product-title-svg--catalog
  :is(img, svg) {
  width: var(--ovrform-product-title-scale, 100%);
  max-width: var(--ovrform-product-title-scale, 100%);
  height: auto;
  max-height: 3.5rem;
  aspect-ratio: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  object-fit: contain;
  object-position: left top;
}

.woocommerce div.product .product_title:has(.ovrform-product-title-svg) {
  line-height: 1;
}

.ovr-cart-name:has(.ovrform-product-title-svg),
.woocommerce .product-name > a:has(.ovrform-product-title-svg) {
  display: block;
  min-width: 0;
}

.ovrform-product-title-svg-row .wc-block-components-product-name {
  display: block;
  box-sizing: border-box;
  width: min(100%, 9.375rem);
  min-height: 1.875rem;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  background-color: transparent !important;
  background-repeat: no-repeat;
  background-position: left center;
  background-size: contain;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
}

table.wc-block-cart-items
  .wc-block-cart-items__row.ovrform-product-title-svg-row
  .wc-block-components-product-name,
.wc-block-components-order-summary-item.ovrform-product-title-svg-row
  .wc-block-components-product-name {
  max-width: min(100%, 9.375rem);
}

.ovrform-product-title-svg-row {
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  background: transparent !important;
}

@media (max-width: 781px) {
  .ovrform-product-title-svg--catalog {
    width: 100%;
    min-height: 2rem;
  }

  .ovrform-product-title-svg--single {
    width: min(100%, 20rem);
    min-height: 3rem;
  }

  .ovrform-product-title-svg--cart,
  .ovrform-product-title-svg--checkout,
  .ovrform-product-title-svg--drawer,
  .ovrform-product-title-svg-row .wc-block-components-product-name {
    width: min(100%, 8rem);
  }

  table.wc-block-cart-items
    .wc-block-cart-items__row.ovrform-product-title-svg-row
    .wc-block-components-product-name,
  .wc-block-components-order-summary-item.ovrform-product-title-svg-row
    .wc-block-components-product-name {
    width: min(100%, 8rem);
    max-width: min(100%, 8rem);
  }
}

@media (max-width: 350px) {
  .ovrform-product-title-svg--catalog {
    min-height: 1.75rem;
  }

  .ovrform-product-title-svg--single {
    min-height: 2.5rem;
  }
}

@media (forced-colors: active), print {
  .ovrform-product-title-svg :is(img, svg) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
  }

  .ovrform-product-title-svg__fallback {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
    white-space: normal !important;
  }

  table.wc-block-cart-items
    .wc-block-cart-items__row.ovrform-product-title-svg-row
    .wc-block-components-product-name,
  .wc-block-components-order-summary-item.ovrform-product-title-svg-row
    .wc-block-components-product-name {
    width: auto;
    max-width: none;
    min-height: 0;
    overflow: visible;
    background-image: none !important;
    color: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
  }
}

/* Names inside sentences and cells follow the surrounding text flow and color. */
.ovrform-product-title-svg--inline {
  display: inline-block;
  width: auto;
  min-height: 0;
  vertical-align: -0.08em;
  line-height: inherit;
}
.ovrform-product-title-svg--inline > svg {
  display: inline-block;
  width: auto;
  max-width: 100%;
  height: 0.82em;
  max-height: none;
  vertical-align: baseline;
}

/* Keep certificate quantities in normal text flow beside responsive artwork. */
.ovr-coa-product:has(.ovrform-product-title-svg--inline) {
  display: inline-block;
  max-width: 100%;
}
