/* Itemize Blog Template
 * Insights carousel cards: the post's featured image.
 *
 * The card HTML comes from the page manifest and has no <img>; the plugin
 * injects one inside .insight-visual (already position:relative in the theme
 * CSS). Everything is scoped to .insight-card: no other block is touched.
 */

.insight-card .insight-visual {
	position: relative;
	overflow: hidden;
	display: block;
}

.insight-card .insight-image {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: cover;
	object-position: center;
	transition: transform .35s ease;
}

/* The same hover gesture the card already has in the theme. */
.insight-card:hover .insight-image {
	transform: scale(1.03);
}

/* The category chip always stays on top and readable over the image. */
.insight-card .insight-type {
	z-index: 2;
}

/* Itemize blog images are light and the chip is white: a minimal veil on top
 * keeps the contrast without darkening the image. */
.insight-card.has-insight-image .insight-visual::after {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 72px;
	z-index: 1;
	background: linear-gradient(180deg, rgba(10, 24, 48, .14), transparent);
	pointer-events: none;
}

/* On the small card the visual is 170px: the veil has to be proportional. */
.insight-card.has-insight-image .insight-visual.small::after {
	height: 56px;
}

/* In case a very small image does not fill the card. */
.insight-card.has-insight-image .insight-visual {
	background: linear-gradient(145deg, #0c2141, #14528c);
}

/* TEMPORARY: cards whose post has not been migrated yet.
 * The theme draws the grid art only on the feature card (dark background); on
 * the small ones the background is nearly white and the box looks empty. While
 * the post does not exist, the same art is used with enough contrast to read as
 * a panel rather than a hole. Once the post is migrated, the real image
 * replaces it on its own. Turn it off with:
 *   add_filter( 'itemize_blog_insight_art_fallback', '__return_false' );
 */
.insight-card:not(.has-insight-image) .insight-visual.small {
	background:
		radial-gradient(circle at 78% 18%, rgba(18, 104, 231, .14), transparent 58%),
		linear-gradient(145deg, #e4f0ff, #cfe3fb);
}

.insight-card:not(.has-insight-image) .insight-visual.small .insight-grid-art {
	background-image:
		linear-gradient(rgba(22, 78, 133, .16) 1px, transparent 1px),
		linear-gradient(90deg, rgba(22, 78, 133, .16) 1px, transparent 1px);
}

@media (prefers-reduced-motion: reduce) {
	.insight-card .insight-image,
	.insight-card:hover .insight-image {
		transition: none;
		transform: none;
	}
}
