.aicft-wrap {
	position: relative;
	display: inline-block;
	max-width: 100%;
	line-height: 0;
	vertical-align: middle;
	overflow: visible;
}

.aicft-wrap:hover,
.aicft-wrap:focus-within {
	z-index: 8;
}

.aicft-wrap img:not(.aicft-badge__icon) {
	display: block;
	line-height: normal;
	height: auto;
	max-width: 100%;
	margin-top: 0;
	margin-bottom: 0;
}

/*
 * Fallback when a figure is still the wrap child (block image/video).
 * inline-block includes the figure's bottom margin, so bottom badges sit off the media.
 */
.aicft-wrap:has(> figure) {
	display: block;
	max-width: 100%;
	line-height: normal;
}

.aicft-wrap--video {
	display: block;
	width: 100%;
	line-height: normal;
}

.aicft-wrap--video video {
	width: 100%;
	height: auto;
	max-width: 100%;
}

.aicft-badge {
	position: absolute;
	top: 0.5rem;
	left: 0.5rem;
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.02em;
	padding: 0.35em 0.65em;
	border-radius: 2px;
	background: #111;
	color: #fff;
	z-index: 5;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
	pointer-events: none;
}

.aicft-badge--top-left {
	top: 0.5rem;
	left: 0.5rem;
	right: auto;
	bottom: auto;
}

.aicft-badge--top-right {
	top: 0.5rem;
	right: 0.5rem;
	left: auto;
	bottom: auto;
}

.aicft-badge--bottom-left {
	top: auto;
	left: 0.5rem;
	right: auto;
	bottom: 0.5rem;
}

.aicft-badge--bottom-right {
	top: auto;
	left: auto;
	right: 0.5rem;
	bottom: 0.5rem;
}

.aicft-badge--icon {
	background: transparent;
	box-shadow: none;
	padding: 0;
	line-height: 0;
}

.aicft-badge img.aicft-badge__icon {
	display: block;
	height: 32px;
	width: auto;
	max-width: none;
	margin: 0 !important;
}

.aicft-badge--generated img.aicft-badge__icon,
.aicft-badge--modified img.aicft-badge__icon {
	height: 28px;
}

.aicft-column-badge {
	display: inline-block;
	padding: 0.15em 0.45em;
	border-radius: 2px;
	background: #111;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.02em;
}

/* WooCommerce product gallery / shop tiles */
.woocommerce-product-gallery__image {
	position: relative;
}

.woocommerce-product-gallery__image .aicft-wrap {
	display: block;
	width: 100%;
	max-width: 100%;
	line-height: normal;
}

.woocommerce-product-gallery__image .aicft-badge,
.woocommerce div.product div.images .aicft-badge {
	z-index: 6;
}

.woocommerce-product-gallery__image .aicft-wrap:hover,
.woocommerce-product-gallery__image .aicft-wrap:focus-within,
.woocommerce div.product div.images .aicft-wrap:hover,
.woocommerce div.product div.images .aicft-wrap:focus-within {
	z-index: 10;
}

/*
 * Shop / related tiles: WooCommerce puts margin-bottom on the <img> (gap before the title).
 * That extra height sits on .aicft-wrap, so bottom badges land in the gutter, not on the photo.
 */
.woocommerce ul.products li.product a .aicft-wrap,
.woocommerce ul.products li.product .aicft-wrap {
	display: block;
	width: 100%;
	max-width: 100%;
	line-height: inherit;
	margin-bottom: 1.618em;
	margin-bottom: 1lh;
}

.woocommerce ul.products li.product a .aicft-wrap img:not(.aicft-badge__icon),
.woocommerce ul.products li.product .aicft-wrap img:not(.aicft-badge__icon) {
	margin-bottom: 0;
}

/* PhotoSwipe: badge sits in an image-sized host, not on the viewport-tall .pswp__zoom-wrap */
.aicft-pswp-host {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 20;
	display: block;
	overflow: visible;
	pointer-events: none;
	box-sizing: border-box;
}

.pswp__zoom-wrap > .aicft-badge,
.pswp__content > .aicft-badge,
.pswp__item > .aicft-badge,
.aicft-pswp-host > .aicft-badge,
#photoswipe-fullscreen-dialog .aicft-badge {
	z-index: 20;
	pointer-events: none;
}

/* Elementor / builders: keep badge above image widgets */
.elementor-widget-image .aicft-wrap,
.elementor-image .aicft-wrap,
.fl-photo .aicft-wrap,
.et_pb_image .aicft-wrap {
	display: block;
	max-width: 100%;
}

/* CSS background-image hosts (blog cards, covers, sections) */
.aicft-bg-host {
	position: relative;
}

.aicft-bg-host > .aicft-badge--bg,
.aicft-badge--bg {
	z-index: 6;
	pointer-events: none;
}

/* Article-level disclosure: compact mark plus the sentence for assistive tech */
.aicft-disclosure {
	position: relative;
	display: inline-flex;
	align-items: center;
	margin: 1.25em 0;
	max-width: 100%;
	cursor: help;
	outline: none;
}

.aicft-disclosure:focus-visible {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111;
	border-radius: 4px;
}

.aicft-disclosure--no-tooltip {
	cursor: default;
}

.aicft-disclosure__icon {
	display: block;
	height: 36px;
	width: auto;
	flex: 0 0 auto;
	max-width: 100%;
}

.aicft-disclosure__badge {
	display: inline-block;
	padding: 0.35em 0.65em;
	border-radius: 2px;
	background: #111;
	color: #fff;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.02em;
	line-height: 1.2;
}

.aicft-badge .screen-reader-text,
.aicft-disclosure .screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}
