/*
 * MBP Video Hover Preview
 *
 * The preview box sits right after the card's poster image, with the same
 * offset, size and corner radius (set inline by the script). It deliberately
 * has no z-index: positioned elements with z-index auto paint in document
 * order, so everything the theme draws after the poster -- view badges, the
 * gradient, the accent ring, a caption laid over the image -- stays on top,
 * exactly as it does over the still thumbnail.
 *
 * Several rules carry !important because theme rules aimed at "card img"
 * (radius, shadow, height:auto, hover zoom) would otherwise land on the
 * preview's own <img> and <video>.
 */

.mbp-hp {
	position: absolute !important;
	display: block !important;
	overflow: hidden;
	pointer-events: none;
	margin: 0 !important;
	padding: 0 !important;
}

.mbp-hp > .mbp-hp__media {
	position: absolute !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	transform: none !important;
	filter: none !important;
	object-fit: cover !important;
	display: block !important;
	background: transparent;
	opacity: 0;
	transition: opacity .2s ease;
}

.mbp-hp.is-shown > .mbp-hp__media {
	opacity: 1;
}

/* Playback progress along the bottom edge, filled as the clip plays. */
.mbp-hp__bar {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 3px;
	background: var(--mbp-hp-accent, #fff);
	opacity: 0;
	transform: scaleX(0);
	transform-origin: 0 50%;
	transition: opacity .2s ease;
}

.mbp-hp.is-shown .mbp-hp__bar {
	opacity: .9;
}

/* An animated image has no clock to follow. */
.mbp-hp.is-image .mbp-hp__bar {
	display: none;
}

/*
 * While loading: a short sweep along the same edge. Delayed, so a preview
 * that starts quickly never flashes it.
 */
.mbp-hp::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 35%;
	height: 3px;
	background: var(--mbp-hp-accent, #fff);
	opacity: 0;
}

.mbp-hp.is-loading::after {
	animation: mbp-hp-wait 1.2s ease-in-out .4s infinite;
}

@keyframes mbp-hp-wait {
	0%   { transform: translateX(-100%); opacity: .8; }
	100% { transform: translateX(290%); opacity: .8; }
}

@media (prefers-reduced-motion: reduce) {
	.mbp-hp { display: none !important; }
}
