/* Category / list: photo link is position:relative */
.product-item-photo.relative {
    position: relative;
}

/* PLP: slot is transparent to layout; badge positions vs .product-item-photo */
.mh-sp-badge-slot--category {
    display: contents;
}

/*
 * PDP: overlay the photo box (not the full gallery column), so the tag sits
 * on the image corners instead of in the left/right white gutter.
 */
.mh-sp-pdp-media {
    position: relative;
    display: inline-block;
    width: fit-content;
    max-width: 100%;
    vertical-align: top;
}

.mh-sp-pdp-media > img {
    display: block;
}

.mh-sp-badge-slot--pdp {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 20;
    pointer-events: none;
    overflow: visible;
}

.mh-sp-badge {
    position: absolute;
    z-index: 5;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    pointer-events: none;
    max-width: calc(100% - 1rem);
    /* Default: Bottom-Right (overridden by --pos-* when set) */
    top: auto;
    left: auto;
    bottom: 0.5rem;
    right: 0.5rem;
}

.mh-sp-badge-slot--pdp .mh-sp-badge {
    z-index: 1;
}

.mh-sp-badge--pos-top-left {
    top: 0.5rem;
    left: 0.5rem;
    right: auto;
    bottom: auto;
}

.mh-sp-badge--pos-top-right {
    top: 0.5rem;
    right: 0.5rem;
    left: auto;
    bottom: auto;
}

.mh-sp-badge--pos-bottom-left {
    top: auto;
    right: auto;
    bottom: 0.5rem;
    left: 0.5rem;
}

.mh-sp-badge--pos-bottom-right {
    top: auto;
    left: auto;
    bottom: 0.5rem;
    right: 0.5rem;
}

.mh-sp-badge--pdp {
    z-index: 7;
}

/* Several promotions (brand + category) share one corner without covering each other */
.mh-sp-badge-stack {
    position: absolute;
    z-index: 6;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    pointer-events: none;
    max-width: calc(100% - 1rem);
}

.mh-sp-badge-stack.mh-sp-badge--pos-top-right,
.mh-sp-badge-stack.mh-sp-badge--pos-bottom-right {
    align-items: flex-end;
}

.mh-sp-badge-stack.mh-sp-badge--pos-top-left,
.mh-sp-badge-stack.mh-sp-badge--pos-bottom-left {
    align-items: flex-start;
}

.mh-sp-badge-slot--pdp .mh-sp-badge-stack,
.mh-sp-badge-stack .mh-sp-badge {
    position: static;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    max-width: 100%;
}

.mh-sp-badge-slot--pdp .mh-sp-badge-stack {
    position: absolute;
    top: 0.5rem !important;
    right: 0.5rem !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.mh-sp-badge--pdp.mh-sp-badge--pos-top-left {
    top: 1rem;
    left: 1rem;
}

.mh-sp-badge--pdp.mh-sp-badge--pos-top-right {
    top: 1rem;
    right: 1rem;
}

.mh-sp-badge--pdp.mh-sp-badge--pos-bottom-left {
    bottom: 1rem;
    left: 1rem;
}

.mh-sp-badge--pdp.mh-sp-badge--pos-bottom-right {
    bottom: 1rem;
    right: 1rem;
}

.mh-sp-label {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    font-size: 0.6875rem;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-radius: 0;
    white-space: nowrap;
}

.mh-sp-graphic {
    display: block;
    max-width: 5.5rem;
    height: auto;
    max-height: 3.5rem;
    object-fit: contain;
}

.mh-sp-badge--pdp .mh-sp-graphic {
    max-height: 4.5rem;
    max-width: 6.5rem;
}

.mh-sp-badge--cart {
    position: static;
    max-width: none;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
}

.mh-sp-cart-badge .mh-sp-badge {
    position: static;
    max-width: none;
}

.mh-sp-cart-badge .mh-sp-label {
    text-transform: none;
    font-size: 0.75rem;
}
