/*
 * Grid banners: an image card the exact size of a video card.
 *
 * The card is a grid item like any video card, so the row's height comes
 * from its neighbours (align-items: stretch) and the image fills it. The
 * aspect-ratio is only a floor for a row made of banners alone; 4:3 is a
 * little shorter than a video card, so it never makes a mixed row taller.
 */

.gvc-grid-ad {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	overflow: hidden;
	background: var(--gbc-surface, #191919);
	border: 1px solid var(--gbc-border, #333);
	border-radius: var(--gbc-radius, 10px);
}

.gvc-grid-ad__link {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	color: inherit;
	text-decoration: none;
}

.gvc-grid-ad__media {
	position: relative;
	display: block;
	flex: 1 1 auto;
	min-height: 0;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #050505;
}

.gvc-grid-ad__img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	/* Until the script sizes it (and without JavaScript): keep the
	   bottom edge, where banners put their button. */
	object-position: center bottom;
}

.gvc-grid-ad__img[hidden] {
	display: none;
}

/* "Whole banner" mode: the creative is scaled down to fit, and a blurred,
   enlarged copy of itself fills the space around it instead of black bars. */
.gvc-grid-ad--contain .gvc-grid-ad__img {
	object-fit: contain;
}

.gvc-grid-ad--contain .gvc-grid-ad__media::before {
	content: "";
	position: absolute;
	inset: -20px;
	background: var(--gvc-grid-ad-bg, none) center / cover no-repeat;
	filter: blur(18px) brightness(0.55);
}

.gvc-grid-ad__label {
	position: absolute;
	top: 6px;
	left: 6px;
	z-index: 1;
	padding: 1px 6px;
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.7);
	color: #fff;
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: 0.04em;
	line-height: 1.5;
	text-transform: uppercase;
	pointer-events: none;
}

.gvc-grid-ad:hover {
	border-color: var(--gvc-accent, #e60404);
}

/* Rotation: a short fade between two banners. */
.gvc-grid-ad__img {
	transition: opacity 0.25s ease;
}

.gvc-grid-ad__media.is-swapping .gvc-grid-ad__img {
	opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
	.gvc-grid-ad__img {
		transition: none;
	}
}
