.ws-ai-image {
    position: relative;
    display: inline-block;
    width: fit-content;
    max-width: 100%;
    line-height: 0;
    vertical-align: top;
    container-type: inline-size;
}

.ws-ai-image img {
    display: block;
    max-width: 100%;
    height: auto;
}

.ws-ai-image__label {
    position: absolute;
    z-index: 2;
    left: 12px;
    bottom: 12px;
    max-width: calc(100% - 24px);
    box-sizing: border-box;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.01em;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Kadence sizes the thumbnail with a zero-height ratio box and an absolutely positioned img.
   The label wrapper was the positioning parent, so it collapsed and the image disappeared. */
[class*="kadence-thumbnail-ratio"] .post-thumbnail-inner > .ws-ai-image {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
}

[class*="kadence-thumbnail-ratio"] .post-thumbnail-inner > .ws-ai-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
}

.ws-ai-image:has(img.alignleft) {
    float: left;
    width: auto;
    margin: 0 1em 1em 0;
}

.ws-ai-image:has(img.alignright) {
    float: right;
    width: auto;
    margin: 0 0 1em 1em;
}

.ws-ai-image:has(img.aligncenter),
.ws-ai-image:has(img.aligncenter) img {
    margin-left: auto;
    margin-right: auto;
}

@container (max-width: 280px) {
    .ws-ai-image__label {
        left: 6px;
        bottom: 6px;
        max-width: calc(100% - 12px);
        padding: 3px 7px;
        font-size: 10px;
    }
}
