/*
 * Shared lightweight YouTube facade for native Gutenberg embeds.
 *
 * The real YouTube iframe is not present in the initial HTML. It is created
 * only after an explicit click, avoiding the heavy YouTube player request on
 * Composition and Event single pages.
 */

/* Disable Gutenberg's responsive embed spacer; the facade owns aspect ratio. */
.composition-single__content .wp-block-embed-youtube .wp-block-embed__wrapper::before,
.event-single__content .wp-block-embed-youtube .wp-block-embed__wrapper::before {
	content: none !important;
	display: none !important;
	padding-top: 0 !important;
}

.thymotheus-youtube-facade {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 0;
	background: #000;
	cursor: pointer;
}

.wp-embed-aspect-4-3 .thymotheus-youtube-facade {
	aspect-ratio: 4 / 3;
}

.wp-embed-aspect-16-9 .thymotheus-youtube-facade {
	aspect-ratio: 16 / 9;
}

.thymotheus-youtube-facade__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	transition: transform 180ms ease, opacity 180ms ease;
}

.thymotheus-youtube-facade:hover .thymotheus-youtube-facade__image,
.thymotheus-youtube-facade:focus-visible .thymotheus-youtube-facade__image {
	transform: scale(1.015);
	opacity: 0.92;
}

.thymotheus-youtube-facade__play {
	position: absolute;
	left: 50%;
	top: 50%;
	z-index: 2;
	width: clamp(62px, 7vw, 86px);
	aspect-ratio: 1.35 / 1;
	transform: translate(-50%, -50%);
	border-radius: 20%;
	background: #ff0033;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
	pointer-events: none;
}

.thymotheus-youtube-facade__play::after {
	content: "";
	position: absolute;
	left: 52%;
	top: 50%;
	width: 0;
	height: 0;
	transform: translate(-42%, -50%);
	border-top: 12px solid transparent;
	border-bottom: 12px solid transparent;
	border-left: 20px solid #fff;
}

.thymotheus-youtube-facade iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

@media (prefers-reduced-motion: reduce) {
	.thymotheus-youtube-facade__image {
		transition: none;
	}
}

/* APP-01: thumbnail and iframe fill the existing 16:9 / 4:3 ratio box.
 * Explicit Composition specificity defeats generic img/iframe height:auto.
 * Ordinary images outside this component are not affected. */
.thymotheus-youtube-facade > .thymotheus-youtube-facade__image,
.thymotheus-youtube-facade > iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.composition-single__content .thymotheus-youtube-facade > .thymotheus-youtube-facade__image,
.composition-single__content .thymotheus-youtube-facade > iframe {
	height: 100%;
}
