/* ==========================================================================
   YouTube Privacy Embed
   Renders a static thumbnail + play button until the user consciously clicks.
   All YouTube resources are blocked until that moment (GDPR-friendly).
   ========================================================================== */

.yt-embed {
	--yt-radius: 8px;
	--yt-primary: var(--color-primary, #662766);

	position: relative;
	display: block;
	width: 100%;
	border-radius: var(--yt-radius);
	overflow: hidden;
	cursor: pointer;
	background: #000;
	/* 16:9 aspect ratio — no padding hack needed in modern browsers */
	aspect-ratio: 16 / 9;
}

/* ── Thumbnail ──────────────────────────────────────────────────────────── */

.yt-embed__thumb {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100% !important; /* override global img { height: auto } reset */
	margin: 0 !important;    /* override .wysiwyg img { margin: 1.5em 0 } */
	object-fit: cover;
	object-position: center;
	display: block;
	transition: transform 0.4s ease, filter 0.4s ease;
	/* Slight letterbox blur to hide any hard black bars on maxresdefault */
	filter: brightness(0.9);
}

.yt-embed:hover .yt-embed__thumb,
.yt-embed:focus-visible .yt-embed__thumb {
	transform: scale(1.03);
	filter: brightness(0.75);
}

/* ── Gradient overlay ───────────────────────────────────────────────────── */

.yt-embed::before {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to top,
		rgba(0, 0, 0, 0.70) 0%,
		rgba(0, 0, 0, 0.10) 45%,
		transparent 65%
	);
	z-index: 1;
	border-radius: inherit;
}

/* ── Play button ────────────────────────────────────────────────────────── */

.yt-embed__play {
	position: absolute;
	top: 50%;
	left: 50%;
	/* Offset slightly upward so it reads as centred above the notice */
	transform: translate(-50%, calc(-50% - 18px));
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background: var(--yt-primary);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
	transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.yt-embed:hover .yt-embed__play,
.yt-embed:focus-visible .yt-embed__play {
	transform: translate(-50%, calc(-50% - 18px)) scale(1.12);
	background: color-mix(in srgb, var(--yt-primary) 80%, #000);
	box-shadow: 0 6px 28px rgba(0, 0, 0, 0.55);
}

/* The triangle is drawn with CSS — no external image needed */
.yt-embed__play::after {
	content: '';
	display: block;
	/* Triangle pointing right */
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 11px 0 11px 20px;
	border-color: transparent transparent transparent #fff;
	/* Optical correction — triangles look left-heavy without this */
	margin-left: 4px;
}

/* ── GDPR / Privacy notice ──────────────────────────────────────────────── */

.yt-embed__notice {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 2;
	padding: 14px 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	text-align: center;
}

.yt-embed__notice-icon {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	opacity: 0.8;
}

.yt-embed__notice p {
	margin: 0;
	font-size: 0.72rem;
	line-height: 1.45;
	color: rgba(255, 255, 255, 0.85);
}

.yt-embed__notice a {
	color: #fff;
	text-decoration: underline;
	text-underline-offset: 2px;
	white-space: nowrap;
}

.yt-embed__notice a:hover {
	color: rgba(255, 255, 255, 0.75);
}

/* ── iframe (injected on click) ─────────────────────────────────────────── */

.yt-embed iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* ── Loaded state — hide all preview chrome ─────────────────────────────── */

.yt-embed.is-loaded::before,
.yt-embed.is-loaded .yt-embed__thumb,
.yt-embed.is-loaded .yt-embed__play,
.yt-embed.is-loaded .yt-embed__notice {
	display: none;
}

.yt-embed.is-loaded {
	cursor: default;
}

/* ── Accessibility ──────────────────────────────────────────────────────── */

.yt-embed:focus-visible {
	outline: 3px solid var(--yt-primary);
	outline-offset: 3px;
}

/* ── Responsive tweaks ──────────────────────────────────────────────────── */

@media (max-width: 480px) {
	.yt-embed__play {
		width: 56px;
		height: 56px;
		transform: translate(-50%, calc(-50% - 12px));
	}

	.yt-embed:hover .yt-embed__play,
	.yt-embed:focus-visible .yt-embed__play {
		transform: translate(-50%, calc(-50% - 12px)) scale(1.1);
	}

	.yt-embed__play::after {
		border-width: 8px 0 8px 15px;
		margin-left: 3px;
	}

	.yt-embed__notice p {
		font-size: 0.65rem;
	}
}
