body.kb-storefront {
    --kb5-inset: 5px;
    --kb5-outer-corner: 9px;
    --kb5-sale: #f7dddd;
    --kb5-sale-ink: #43151d;
    --kb5-sale-rim: #bc7d83;
    --kb5-new: #dcebdd;
    --kb5-new-ink: #173c2b;
    --kb5-new-rim: #87a992;
}
html[data-kb-theme=night] body.kb-storefront {
    --kb5-sale: #edc8cb;
    --kb5-sale-rim: #ad7078;
    --kb5-new: #c8e1cf;
    --kb5-new-rim: #86ad94;
}
body.kb-storefront :is(.kbcs-layout-grid .kbcs-product-media, .product-small .box-image, .kb-recs-card .kb-recs-image-link, .product-main .woocommerce-product-gallery, .kb-qv-gallery .kb-quickview-image) {
    --kb5-inset: 0px;
    /* Match the inside curve of the product card's 16px radius and 1px border. */
    --kb5-outer-corner: 15px;
}
/* The WooCommerce column already owns the card outline and corner clipping. */
html[data-kb-theme] body.kb-storefront #main .products.row > .product-small.col > .col-inner > .product-small.box {
    border: 0;
    border-radius: 0;
}
body.kb-storefront .kb-option5-media { position: relative; }
body.kb-storefront #kb-builder .kb-builder-panel.kb-option5-media {
    padding-top: 42px;
}
/* Leave room above the image for the modal's close button. */
html[data-kb-theme] body.kb-storefront .kb-qv-content.kb-option5-has-new .kb-qv-gallery {
    padding-top: 42px;
}
body.kb-storefront :is(.kb-card-sale,.kb-option5-promo,.kb-option5-new) {
    position: absolute;
    z-index: 4;
    top: var(--kb5-inset);
    left: var(--kb5-inset);
    display: inline-flex;
    align-items: center;
    gap: .28em;
    box-sizing: border-box;
    min-height: 27px;
    max-inline-size: calc(100% - 2 * var(--kb5-inset));
    padding: 5px 8px;
    border: 1px solid var(--kb5-rim);
    border-radius: var(--kb5-outer-corner) 0 7px 0;
    background: var(--kb5-fill);
    color: var(--kb5-ink);
    font-family: inherit;
    font-size: clamp(11px, 0.75vw, 13px);
    font-weight: 700;
    line-height: 1.15;
    overflow-wrap: anywhere;
    white-space: normal;
    pointer-events: none;
}
body.kb-storefront :is(.kb-card-sale,.kb-option5-promo) {
    --kb5-fill: var(--kb5-sale);
    --kb5-ink: var(--kb5-sale-ink);
    --kb5-rim: var(--kb5-sale-rim);
}
body.kb-storefront .kb-option5-new {
    --kb5-fill: var(--kb5-new);
    --kb5-ink: var(--kb5-new-ink);
    --kb5-rim: var(--kb5-new-rim);
    left: auto;
    right: var(--kb5-inset);
    border-radius: 0 var(--kb5-outer-corner) 0 7px;
}
body.kb-storefront .kb-option5-star { font-size: 1.15em; line-height: .9; }

body.kb-storefront :is(.kb-card-sale,.kb-option5-promo,.kb-option5-new)::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 4px;
    width: 5px;
    height: 5px;
    background: var(--kb5-fill);
    border: 1px solid var(--kb5-rim);
    border-top: 0;
    border-radius: 0 0 50% 50%;
}
body.kb-storefront .kb-option5-new::after { left: auto; right: 4px; }

body.kb-storefront .kb-option5-has-promo .badge-container .badge:has(.new-bubble),
body.kb-storefront .kb-option5-has-new .badge-container .badge:has(.new-bubble-auto,.new-bubble) {
    display: none;
}
body.kb-storefront .kb-option5-has-promo.kb-has-sale-badge .kb-option5-promo {
    top: calc(var(--kb5-inset) + 34px);
}
body.kb-storefront .kb-option5-has-new :is(.kb-card-sale,.kb-option5-promo) {
    max-inline-size: calc(100% - 70px);
}

@media (max-width: 700px) {
    body.kb-storefront .kb-qv-content.kb-option5-has-new .kb-quickview-image :is(.kb-card-sale,.kb-option5-promo) {
        max-inline-size: calc(100% - 63px);
    }
}

/* Keep the initial native WooCommerce render in the same corner as the enhanced tile. */
body.kb-storefront .badge-container:has(> .kb-option5-native) {
    inset: 0;
    z-index: 4;
    pointer-events: none;
}
body.kb-storefront .badge-container:has(> .kb-option5-native) > .badge:has(.new-bubble,.new-bubble-auto),
body.kb-storefront .product-small.col:has(.box-image .kb-option5-native) > .col-inner > .badge-container > .badge:has(.new-bubble,.new-bubble-auto) {
    display: none;
}

html[data-kb-theme] body.kb-storefront :is(#main,.mfp-content,.kb-search-host) :is(.kbcs-layout-grid .kbcs-product-image,.products.row > .product-small.col .box-image > div:first-child,.product-small.box .box-image,.kb-recs-image-link,.kb-quickview-image) img[data-kb-photo-fit="crop"] {
    object-fit: cover !important;
    object-position: var(--kb-photo-focus,50% 53%) !important;
}
@media (min-width: 1200px) {
    html[data-kb-theme] body.kb-storefront :is(#main,.mfp-content,.kb-search-host) :is(.kbcs-layout-grid .kbcs-product-image,.products.row > .product-small.col .box-image > div:first-child,.product-small.box .box-image,.kb-recs-image-link,.kb-quickview-image) img[data-kb-photo-fit="responsive"] {
        object-fit: cover !important;
        object-position: var(--kb-photo-focus,50% 50%) !important;
    }
}
body.kb-storefront .kb-photo-fill {
    isolation: isolate;
    overflow: hidden;
}
body.kb-storefront .kb-photo-fill::before {
    content: "";
    position: absolute;
    inset: -6%;
    z-index: -1;
    background: center / cover no-repeat var(--kb-photo-backdrop);
    filter: blur(12px);
    opacity: .57;
    pointer-events: none;
}
