/* Product tag badges on the shop's product images (loop and single product), SWMH_TE_Frontend_Tags.
   A badge's own colour is inlined per tag; #e53935 is SWMH_TE_Tag_Badges::DEFAULT_COLOR.
   The look for the whole site (unset = the defaults below): the theme's swmh_te_badge_config look, put on each stack
   by SWMH_TE_Tag_Badges::look_style() (Puzzle: product-card options badges_*), or the theme's own CSS:
   --swmh-te-badge-padding (4px 10px), --swmh-te-badge-font-size (11px), --swmh-te-badge-font-weight (600),
   --swmh-te-badge-gap (4px, between stacked badges), --swmh-te-badge-radius (3px), --swmh-te-badge-border
   (0; 1px = a line inside the edge in the tag's colour made darker, inlined per tag as --swmh-te-badge-border-c). */
.swmh-te-product-image-wrapper {
    position: relative;
    /* Own low stacking context: the badge overlay is trapped here at
       this level, so it can never rise above theme hover UI (add-to-cart
       bar, wishlist/quick-view icons) no matter how the card nests. */
    z-index: 0;
}

.swmh-te-product-tags {
    position: absolute;
    display: flex;
    flex-direction: column;
    /* Each badge hugs its own text - the column's default
       `stretch` would widen all badges to match the longest. */
    align-items: flex-start;
    gap: var(--swmh-te-badge-gap, 4px);
    /* Catalog/loop overlay sits low so theme UI (quick-view, sale
       flashes, wishlist icons) can layer above it. */
    z-index: 5;
    /* Overlay only - never intercept clicks meant for the product
       link or the gallery lightbox underneath. */
    pointer-events: none;
    --swmh-te-badge-offset: 8px;
    /* Largest height of an image badge (a smaller image keeps its own); its width
       follows the image. A theme may override. */
    --swmh-te-badge-img-h: 36px;
    /* Square badges (a group's shape): text or image in a square box - 48px in the catalog
       (40px on mobile), 80px on the product page. */
    --swmh-te-badge-sq: 48px;
}

.swmh-te-product-tags--single {
    z-index: 100;
    --swmh-te-badge-offset: 12px;
    --swmh-te-badge-img-h: 48px;
    --swmh-te-badge-sq: 80px;
}

/* Under the product name (the theme's badges_place): one row in the flow, at the catalog's sizes. */
.swmh-te-product-tags--title {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    margin: 4px 0 12px;
    z-index: auto;
}

@media (max-width: 600px) {
    .swmh-te-product-tags--loop,
    .swmh-te-product-tags--title {
        --swmh-te-badge-img-h: 28px;
        --swmh-te-badge-sq: 40px;
    }
}

.swmh-te-product-tags--pos-top-left {
    top: var(--swmh-te-badge-offset);
    left: var(--swmh-te-badge-offset);
}

.swmh-te-product-tags--pos-top-right {
    top: var(--swmh-te-badge-offset);
    right: var(--swmh-te-badge-offset);
    align-items: flex-end;
}

.swmh-te-product-tags--pos-bottom-left {
    bottom: var(--swmh-te-badge-offset);
    left: var(--swmh-te-badge-offset);
    flex-direction: column-reverse;
}

.swmh-te-product-tags--pos-bottom-right {
    bottom: var(--swmh-te-badge-offset);
    right: var(--swmh-te-badge-offset);
    flex-direction: column-reverse;
    align-items: flex-end;
}

.swmh-te-product-tag {
    display: inline-block;
    padding: var(--swmh-te-badge-padding, 4px 10px);
    font-size: var(--swmh-te-badge-font-size, 11px);
    font-weight: var(--swmh-te-badge-font-weight, 600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    background: #e53935;
    border-radius: var(--swmh-te-badge-radius, 3px);
    /* Inside the edge, so a border does not make the badge bigger. */
    box-shadow: inset 0 0 0 var(--swmh-te-badge-border, 0px) var(--swmh-te-badge-border-c, transparent);
}

/* Positioning anchors for the relocated single-product overlay:
   the first gallery image when present, the gallery otherwise. */
.woocommerce-product-gallery,
.woocommerce-product-gallery__image {
    position: relative;
}

/* An image badge: the image alone, no chip around it. Its size is !important:
   theme gallery rules (.rfx-gallery-main .swiper-slide img { width: 100% })
   are more specific and would stretch it to the slide. */
.swmh-te-product-tag--image {
    padding: 0;
    background: none;
    border-radius: 0;
    box-shadow: none;
    line-height: 0;
}

.swmh-te-product-tag--image img {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: var(--swmh-te-badge-img-h) !important;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.swmh-te-product-tag--square {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: var(--swmh-te-badge-sq);
    height: var(--swmh-te-badge-sq);
    padding: 2px;
    /* Sized so a 7-letter word (NOVINKA) fits one line; longer text wraps only between words,
       2-3 lines (3 at 1.1 fill 40px), never inside one. */
    font-size: calc(var(--swmh-te-badge-sq) * 0.17);
    line-height: 1.1;
    letter-spacing: 0;
    text-align: center;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: manual;
    overflow: hidden;
}

.swmh-te-product-tag--square.swmh-te-product-tag--image {
    padding: 0;
}

.swmh-te-product-tag--square.swmh-te-product-tag--image img {
    max-width: var(--swmh-te-badge-sq) !important;
    max-height: var(--swmh-te-badge-sq) !important;
}

/* The sale badge on a picked variation that is not on sale (frontend-tags.js). */
.swmh-te-product-tag.swmh-te-product-tag--off { display: none !important; }
