/**
 * Kubota Europe reusable self-hosted video player (KubotaEu\Media\Video).
 *
 * Ported from the reference plugin (kubotagroup, class `kbtg-post-the-solution__video`):
 * a poster-first <video> with, docked to the BOTTOM-RIGHT, a semi-transparent
 * blurred pill holding the subtitle + title (when set) beside a custom play/stop
 * button. While the video plays the pill clears its background and its contents
 * fade out. Only one video plays at a time (see kbeu-video.js). Structural classes
 * are all derived from the `.kbeu-video` base so this single stylesheet covers
 * every place the helper is used.
 */

.kbeu-video {
	position: relative;
	display: inline-block;
	width: 100%;
}

.kbeu-video-item {
	display: block;
	width: 100%;
	overflow: hidden;
	object-fit: cover;
	border-radius: 20px;
	z-index: 0;
}

/* YouTube facade (a div, not a <video>): 16:9 unless the caller sets a ratio;
   the poster, then the embed loaded by the play button, cover it. Scoped with
   the block class so the theme's generic `img` sizing cannot win. */
.kbeu-video-item--youtube {
	position: relative;
	aspect-ratio: 16 / 9;
	background-color: #000;
}

.kbeu-video .kbeu-video-poster,
.kbeu-video-item--youtube iframe {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	border: 0;
	object-fit: cover;
}

/* Bottom-right semi-transparent pill holding the text + play button. */
.kbeu-video-title {
	position: absolute;
	right: clamp( 14px, 5%, 85px );
	bottom: clamp( 14px, 8%, 60px );
	z-index: 1;
	display: flex;
	align-items: center;
	gap: clamp( 16px, 3%, 40px );
	max-width: calc( 100% - 28px );
	padding: clamp( 14px, 3%, 30px ) clamp( 18px, 4%, 50px );
	color: #fff;
	border-radius: 20px;
	background: rgba( 0, 0, 0, 0.2 );
	backdrop-filter: blur( 4px );
	-webkit-backdrop-filter: blur( 4px );
	transition: background-color 0.5s ease;
}

/* While playing the pill background is cleared (see JS toggling this class on the
   title element) and it stops intercepting pointer events, so the native video
   controls stay usable and a click on the video reaches its own pause handler. */
.kbeu-video-title.kbeu-video-title-playing {
	background-color: rgba( 0, 0, 0, 0 ) !important;
	backdrop-filter: unset !important;
	-webkit-backdrop-filter: unset !important;
	pointer-events: none;
}

.kbeu-video-title-container {
	max-width: 597px;
	opacity: 1;
	transform: scale( 1 );
	transition: opacity 0.4s ease, transform 0.4s ease;
}

/* While playing the caption block fades out and stops intercepting clicks. */
.kbeu-video-title-container.kbeu-video-playing {
	opacity: 0;
	transform: scale( 0.95 );
	pointer-events: none;
}

.kbeu-video-subtitle-caption {
	margin: 0 0 10px;
	font-size: 18px;
}

.kbeu-video-title-text {
	margin: 0;
	color: #fff;
	font-family: var( --kbeu-font-principal );
	font-weight: var( --h4-font-weight, 700 );
	font-style: var( --h4-font-style, inherit );
	font-size: clamp( 20px, 2vw, 28px );
	line-height: var( --h4-line-height, 1.2 );
	letter-spacing: var( --h4-letter-spacing, inherit );
	text-transform: var( --h4-text-transform, inherit );
}

.kbeu-video-title-after {
	margin-top: 8px;
	font-size: 16px;
}

.kbeu-video-title-after p {
	margin: 0;
}

.kbeu-video-play-buttons {
	display: flex;
	flex: 0 0 auto;
}

.kbeu-video-play-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 45px;
	padding: 0;
	background: unset;
	border: 0;
	cursor: pointer;
	transition: opacity 0.4s ease;
}

.kbeu-video-play-button svg {
	display: block;
	fill: #fff;
}

/* When the pill is in its playing state the (idle) play button fades out too. */
.kbeu-video-title-playing .kbeu-video-play-button {
	opacity: 0;
}

@media only screen and (max-width: 600px) {
	.kbeu-video-subtitle-caption {
		margin-bottom: 5px;
		font-size: 16px;
	}

	.kbeu-video-play-button {
		width: 32px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.kbeu-video-title,
	.kbeu-video-title-container,
	.kbeu-video-play-button {
		transition: none;
	}
}
