/*
 * Decoration only: markers are added to the existing product-card badges.
 * Never set display/visibility on those badges: stock automation owns them.
 * The small defaults also protect cards measured while hidden or offscreen.
 */
/* Bundled SIL-OFL script font: no external font service is required. */
@font-face {
    font-family: "MSJ Christmas";
    src: url("fonts/joulukiri.woff?ver=1.3.0") format("woff");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

[data-msj-photo="1"] {
    /* The measured width is a cosmetic custom property set by the script.
     * Size-class fallbacks also cover initially hidden/offscreen cards. */
    --msj-photo-width: 180px;
    --msj-edge: clamp(2px, calc(var(--msj-photo-width) * .01), 4px);
    --msj-status-edge: clamp(1px, calc(var(--msj-photo-width) * .0045), 2px);
    --msj-gap: 5.4px;
    --msj-sale-size: clamp(30.6px, calc(var(--msj-photo-width) * .1485), 59.4px);
    --msj-sale-height: clamp(19.8px, calc(var(--msj-photo-width) * .0918), 36.9px);
    --msj-sale-font: clamp(11.7px, calc(var(--msj-photo-width) * .0504), 20.7px);
    --msj-status-top: var(--msj-status-edge);
    --msj-status-font: clamp(8.1px, calc(var(--msj-photo-width) * .0365625), 14.4px);
    --msj-warehouse-font: clamp(7.65px, calc(var(--msj-photo-width) * .0342), 13.5px);
    --msj-status-min: clamp(68.4px, calc(var(--msj-photo-width) * .2565), 106.2px);
    --msj-pad-y: clamp(1.35px, calc(var(--msj-photo-width) * .00765), 3.15px);
    --msj-pad-left: clamp(4.5px, calc(var(--msj-photo-width) * .0171), 7.2px);
    --msj-pad-right: clamp(10.8px, calc(var(--msj-photo-width) * .0504), 19.8px);
    --msj-caption-font: clamp(9.45px, calc(var(--msj-photo-width) * .036), 14.4px);
    --msj-caption-pad-y: clamp(.9px, calc(var(--msj-photo-width) * .0036), 1.53px);
    --msj-caption-pad-left: calc(var(--msj-pine-width) * .82);
    --msj-caption-pad-right: clamp(3.6px, calc(var(--msj-photo-width) * .0126), 5.4px);
    --msj-caption-inset: calc(var(--msj-pine-width) * .57);
    --msj-caption-overhang: calc(var(--msj-pine-width) * .75);
    --msj-hat-size: clamp(23.4px, calc(var(--msj-photo-width) * .1008), 41.4px);
    --msj-hat-height: calc(var(--msj-hat-size) * .9198276);
    --msj-hat-rise: clamp(9.9px, calc(var(--msj-photo-width) * .045), 18px);
    --msj-pine-width: clamp(16.2px, calc(var(--msj-photo-width) * .0612), 25.2px);
    --msj-pine-height: calc(var(--msj-pine-width) * .6548757);
    --msj-red: #b90d12;
    --msj-ink: #141210;
    --msj-cream: #fff3e5;
    --msj-keyline: #e8d9c8;
}

[data-msj-photo="1"][data-msj-size="compact"] {
    --msj-photo-width: 230px;
}

[data-msj-photo="1"][data-msj-size="regular"] {
    --msj-photo-width: 320px;
}

/* Let the hat cross the photo's top edge, while clipping only the photograph.
 * Match the catalogue's important rule without changing size or aspect ratio.
 */
[data-msj-photo="1"]:not([data-msj-gallery="1"]),
body.tax-product_cat #app .listing .cards .card .cardphoto[data-msj-photo="1"],
#pd-related .ms75-slider .ms67-related .ms77-related-card .cardphoto[data-msj-photo="1"] {
    overflow: visible !important;
}

[data-msj-photo="1"]:not([data-msj-gallery="1"]) > picture,
[data-msj-photo="1"]:not([data-msj-gallery="1"]) > img,
[data-msj-photo="1"]:not([data-msj-gallery="1"]) > picture > img {
    border-radius: inherit !important;
}

[data-msj-photo="1"]:not([data-msj-gallery="1"]) > picture {
    overflow: hidden !important;
}

/* Only a static host is marked by the adapter. The owned overlay sits outside
 * the native clipping layer and takes the photograph's measured rectangle. */
[data-msj-gallery-host="1"] {
    position: relative;
}

/* Keep native clipping, slide transforms, picture ratios and zoom controls.
 * Variable caps keep badges modest even on a very wide product photograph. */
[data-msj-photo="1"][data-msj-gallery="1"] {
    position: absolute !important;
    z-index: 5;
    display: block;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: visible;
    pointer-events: none;
}

/* These are our own overlay nodes, not native stock badges. */
[data-msj-photo="1"][data-msj-gallery="1"][hidden],
[data-msj-gallery="1"] .msj-product-status[hidden],
[data-msj-gallery="1"] .msj-product-discount[hidden] {
    display: none !important;
}

/* Short, warm ivory ovals: vertical padding is smaller than the old circles. */
[data-msj-photo="1"] [data-msj-discount="1"] {
    position: absolute !important;
    top: var(--msj-edge) !important;
    right: auto !important;
    bottom: auto !important;
    left: var(--msj-edge) !important;
    z-index: 4 !important;
    box-sizing: border-box !important;
    width: var(--msj-sale-size) !important;
    min-width: 0 !important;
    max-width: none !important;
    height: var(--msj-sale-height) !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid var(--msj-keyline) !important;
    border-radius: 50% !important;
    background: var(--msj-cream) !important;
    color: var(--msj-red) !important;
    box-shadow: 0 1px 3px rgb(52 32 15 / 12%) !important;
    font-family: inherit !important;
    font-size: var(--msj-sale-font) !important;
    font-style: normal !important;
    font-weight: 400 !important;
    font-variant-numeric: lining-nums tabular-nums !important;
    line-height: calc(var(--msj-sale-height) - 2px) !important;
    letter-spacing: -.045em !important;
    text-align: center !important;
    text-transform: none !important;
    white-space: nowrap !important;
    transform: none !important;
    pointer-events: none !important;
}

/* Keep the availability's real text unchanged for the existing stock logic. */
[data-msj-photo="1"] [data-msj-status] {
    position: absolute !important;
    top: var(--msj-status-top) !important;
    right: var(--msj-status-edge) !important;
    bottom: auto !important;
    left: auto !important;
    z-index: 5 !important;
    box-sizing: border-box !important;
    width: max-content !important;
    min-width: min(var(--msj-status-min), calc(100% - var(--msj-sale-size) - var(--msj-edge) - var(--msj-status-edge) - var(--msj-gap))) !important;
    max-width: calc(100% - var(--msj-sale-size) - var(--msj-edge) - var(--msj-status-edge) - var(--msj-gap)) !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: var(--msj-pad-y) var(--msj-pad-right) var(--msj-pad-y) var(--msj-pad-left) !important;
    border: .5px solid var(--msj-keyline) !important;
    border-radius: 999px !important;
    background: var(--msj-cream) !important;
    color: var(--msj-ink) !important;
    box-shadow: 0 1px 3px rgb(52 32 15 / 10%) !important;
    font-family: inherit !important;
    font-size: var(--msj-status-font) !important;
    font-style: normal !important;
    font-weight: 400 !important;
    line-height: 1.16 !important;
    letter-spacing: -.025em !important;
    text-align: center !important;
    text-transform: none !important;
    white-space: normal !important;
    overflow: visible !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    transform: none !important;
    pointer-events: none !important;
}

[data-msj-photo="1"] [data-msj-status="warehouse"] {
    font-size: var(--msj-warehouse-font) !important;
    letter-spacing: -.035em !important;
}

/* Native renderers may wrap their text in strong/b/span elements. Their
 * weight must follow the requested regular text without touching visibility. */
[data-msj-photo="1"] [data-msj-discount="1"] *,
[data-msj-photo="1"] [data-msj-status] * {
    font-weight: 400 !important;
}

/* The tilted fabric hat rests on the pill's right end. Both decorations stay
 * on the original stock badge, so its native stock hiding hides everything.
 */
[data-msj-photo="1"] [data-msj-status]::before {
    content: "";
    position: absolute;
    top: calc(0px - var(--msj-hat-rise));
    right: calc(0px - var(--msj-status-edge) - 1px);
    bottom: auto;
    left: auto;
    z-index: 2;
    display: block;
    width: var(--msj-hat-size);
    height: var(--msj-hat-height);
    margin: 0;
    padding: 0;
    border: 0;
    background: url("hat.svg?ver=1.3.0") center / contain no-repeat;
    box-shadow: none;
    filter: drop-shadow(0 1px 1px rgb(67 26 19 / 12%));
    pointer-events: none;
}

/* Generated text never changes stockbadge.textContent or its visibility. */
[data-msj-photo="1"] [data-msj-status][data-msj-caption]::after {
    content: attr(data-msj-caption);
    position: absolute;
    top: calc(100% - 1px);
    right: 0;
    bottom: auto;
    left: auto;
    z-index: 1;
    display: block;
    box-sizing: border-box;
    width: max-content;
    min-width: 0;
    max-width: calc(100% + var(--msj-caption-overhang));
    height: auto;
    margin: 0;
    padding: var(--msj-caption-pad-y) var(--msj-caption-pad-right) var(--msj-caption-pad-y) var(--msj-caption-pad-left);
    border: 0;
    border-radius: 0;
    /* The cream backing starts after the sprig, so the green needles project
     * naturally from the caption rather than sitting inside a white box. */
    background:
        url("pine.svg?ver=1.3.0") left center / var(--msj-pine-width) var(--msj-pine-height) no-repeat,
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 36' preserveAspectRatio='none'%3E%3Crect width='160' height='36' rx='18' fill='%23fff3e5' fill-opacity='.78'/%3E%3C/svg%3E") right center / calc(100% - var(--msj-caption-inset)) 100% no-repeat;
    color: var(--msj-red);
    box-shadow: none;
    font-family: "MSJ Christmas", "Lobster", "Brush Script MT", cursive;
    font-size: var(--msj-caption-font);
    font-style: normal;
    font-weight: 400;
    line-height: 1.16;
    letter-spacing: 0;
    text-align: center;
    text-transform: none;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    pointer-events: none;
}

[data-msj-photo="1"] [data-msj-status][data-msj-caption="Jõuludeks koju"] {
    white-space: nowrap !important;
}

[data-msj-photo="1"] [data-msj-status][data-msj-caption="Jõuludeks koju"]::after {
    white-space: nowrap;
}

[data-msj-photo="1"] [data-msj-status][data-msj-caption=""]::after {
    content: none;
}

@media print {
    [data-msj-photo="1"] [data-msj-status]::before {
        filter: none;
    }
}
