.aiim-badge {
	position: absolute;
	right: 8px;
	bottom: 8px;
	z-index: 2;
	background: rgba(20, 20, 20, .62);
	color: #fff;
	font-size: 11px;
	line-height: 1;
	letter-spacing: .02em;
	padding: 4px 7px;
	border-radius: 4px;
	pointer-events: none;
	white-space: nowrap;
}

/* The wrapper encloses exactly the image area (not the figcaption), so the
   badge anchors to the image and never sits on top of the caption */
.aiim-imgwrap {
	position: relative;
	display: inline-block;
	max-width: 100%;
	line-height: 0;
	vertical-align: top;
}

.aiim-thumbwrap {
	position: relative;
	display: block;
}

/* Mini variant for small images (e.g. 72px sidebar teasers): shows only the
   short label ("AI"/"KI") taken from the data attribute. The full text stays
   in the DOM (screen readers) and appears as a tooltip. Applied via JS based
   on the rendered image width. */
.aiim-badge--mini {
	font-size: 0;
	right: 3px;
	bottom: 3px;
	padding: 2px 4px;
	border-radius: 3px;
	pointer-events: auto;
}

.aiim-badge--mini::after {
	content: attr(data-aiim-short);
	/* Empty alternative text: screen readers read the full label only */
	content: attr(data-aiim-short) / "";
	font-size: 9px;
	line-height: 1;
	font-weight: 600;
	letter-spacing: .03em;
}

/* Badge on a container that shows an AI-generated image as background
   (marked with the class "ai-image"), and next to images that fill their
   container (cover block). The badge is a child of that container. :where()
   keeps the specificity at zero, so a position set by the theme or page
   builder wins. */
:where([data-aiim-bg]) {
	position: relative;
}

.aiim-badge.aiim-badge--bg {
	--aiim-gap: 8px;
	position: absolute !important;
	top: auto;
	right: var(--aiim-gap);
	bottom: var(--aiim-gap);
	left: auto;
	z-index: 3;
	display: inline-block;
	float: none;
	width: auto;
	height: auto;
	max-width: calc(100% - 2 * var(--aiim-gap));
	margin: 0 !important;
	font-size: 11px;
	font-style: normal;
	font-weight: 400;
	line-height: 1;
	text-align: left;
	text-decoration: none;
	text-indent: 0;
	text-shadow: none;
	text-transform: none;
}

.aiim-badge.aiim-badge--bg.aiim-badge--mini {
	--aiim-gap: 3px;
	font-size: 0;
}

/* Hint for screen readers that the label refers to the background image */
.aiim-sr {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* Safety net for wrapped images that are absolutely positioned inside their
   container: the wrapper generates no box, image and badge anchor to the
   container */
.aiim-imgwrap--fill {
	display: contents;
}
