/* UI/UX enhancements for the "Latest Videos" block (data-type="46").
   Scoped to .block-videos so nothing here touches other media players. */

.block-videos .block-piece-1 .mask,
.block-videos .videos-mini-wrap .mask {
	overflow: hidden;
}

.block-videos .block-piece-1 .mask img,
.block-videos .videos-mini-wrap .mask img {
	transition: transform 0.5s ease, opacity 0.3s ease;
}

.block-videos article:hover .mask img,
.block-videos article:focus-within .mask img {
	transform: scale(1.045);
}

/* Play button: a touch of motion so it reads as interactive rather than
   a static icon sitting on a thumbnail. */
.block-videos .media-icon .icon-bg {
	transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

.block-videos .block-piece-1 .media-icon {
	animation: iv-pulse 2.4s ease-out infinite;
}

.block-videos .block-piece-1 .media-icon:hover,
.block-videos .block-piece-1 .media-icon:focus-visible {
	animation-play-state: paused;
}

@keyframes iv-pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35);
	}
	70% {
		box-shadow: 0 0 0 14px rgba(220, 38, 38, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
	}
}

.block-videos .media-icon:focus-visible {
	outline: 2px solid #dc2626;
	outline-offset: 3px;
	border-radius: 50%;
}

/* Now-playing state on the mini list, kept independent of the parent
   theme's own .playing class so our JS-driven state always renders even
   if that class gets toggled elsewhere. */
.block-videos .videos-mini-wrap article.is-playing {
	background: rgba(220, 38, 38, 0.08);
	border-radius: 8px;
	margin-left: -8px;
	margin-right: -8px;
	padding-left: 8px;
	padding-right: 8px;
}

.block-videos .videos-mini-wrap article.is-playing .title a {
	color: #f87171;
}

.block-videos .videos-mini-wrap article.is-playing .mask::after {
	content: '';
	position: absolute;
	inset: 0;
	border: 2px solid #dc2626;
	border-radius: 4px;
	pointer-events: none;
}

/* Loading state while the iframe swaps in: a subtle shimmer instead of a
   flash of empty black. */
.block-videos .block-piece-1 .loading-embed .frame-wrap-46::before {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(
		100deg,
		rgba(255, 255, 255, 0.02) 30%,
		rgba(255, 255, 255, 0.08) 50%,
		rgba(255, 255, 255, 0.02) 70%
	);
	background-size: 200% 100%;
	animation: iv-shimmer 1.3s ease-in-out infinite;
	z-index: 1;
}

@keyframes iv-shimmer {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

.block-videos .block-piece-1 .frame-wrap-46 iframe {
	opacity: 0;
	transition: opacity 0.35s ease;
}

.block-videos .block-piece-1.active-embed .frame-wrap-46 iframe {
	opacity: 1;
}

/* The block absolutely positions the title and duration over the
   thumbnail, which leaves them sitting on top of the player once a video
   starts. They come back when the video is closed. */
.block-videos .block-piece-1.loading-embed .meta,
.block-videos .block-piece-1.active-embed .meta {
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

/* "3 days ago", added by js/video-embeds.js from the REST lookup in
   inc/frontend-widgets.php. */
.block-videos .iv-ago::before {
	content: '';
	display: inline-block;
	width: 3px;
	height: 3px;
	border-radius: 50%;
	background: currentColor;
	vertical-align: middle;
	margin-right: 8px;
	opacity: 0.6;
}

.block-videos .videos-mini-wrap .iv-ago {
	margin-left: 8px;
}

/* Close control added by js/video-embeds.js so a viewer can back out of
   the inline player without needing to click a different video. */
.block-videos .frame-wrap-46 .iv-video-close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	width: 32px;
	height: 32px;
	line-height: 1;
	border: none;
	border-radius: 50%;
	background: rgba(17, 17, 17, 0.65);
	color: #fff;
	font-size: 20px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease, transform 0.2s ease;
}

.block-videos .frame-wrap-46 .iv-video-close:hover,
.block-videos .frame-wrap-46 .iv-video-close:focus-visible {
	background: #dc2626;
	transform: scale(1.08);
	outline: none;
}

@media (prefers-reduced-motion: reduce) {
	.block-videos .block-piece-1 .media-icon,
	.block-videos .block-piece-1 .frame-wrap-46::before,
	.block-videos .mask img {
		animation: none !important;
		transition: none !important;
	}
}
