/**
 * Zwei-Klick-Video und Mini-Player. Grundgestaltung im Plugin, damit Videos
 * unabhängig vom Theme funktionieren; das Theme kann Farben überschreiben.
 */

.video {
	margin-inline: 0;
}

.video-embed {
	--etos-video-accent: var(--wp--preset--color--brand, #9f1918);
	position: relative;
	aspect-ratio: 16 / 9;
	border-radius: 4px;
	background: #101010;
}

.video-embed__stage {
	position: absolute;
	inset: 0;
	overflow: hidden;
	border-radius: inherit;
	background: #101010;
}

.video-embed__poster,
.video-embed .featured-media__image,
.video-embed__frame {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100% !important;
	margin: 0;
	border: 0;
	object-fit: cover;
}

.video-embed__play {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	width: 100%;
	padding: 0;
	border: 0;
	background: rgb(16 16 16 / 0.15);
	cursor: pointer;
}

.video-embed__icon {
	width: 4.25rem;
	fill: var(--etos-video-accent);
	filter: drop-shadow(0 2px 8px rgb(0 0 0 / 0.35));
	transition: transform 0.2s ease;
}

.video-embed__triangle {
	fill: #fff;
}

.video-embed__play:hover .video-embed__icon,
.video-embed__play:focus-visible .video-embed__icon {
	transform: scale(1.08);
}

.video-embed__play:focus-visible {
	outline: 3px solid var(--etos-video-accent);
	outline-offset: -6px;
}

.video-embed__close {
	display: none;
}

.video__caption {
	margin-top: 0.5rem;
	font-family: var(--wp--preset--font-family--sans, system-ui, sans-serif);
	font-size: var(--wp--preset--font-size--xs, 0.8125rem);
	line-height: 1.5;
	color: var(--wp--preset--color--muted, #5e5858);
}

/* Mini-Player: Bühne schwebt, der Platz im Text bleibt (das iframe lädt nicht neu). */
.video-embed.is-floating .video-embed__stage {
	position: fixed;
	inset: auto 1rem calc(1rem + var(--etos-dock, 0px)) auto; /* über einer angedockten Vorlese-Leiste */
	z-index: 1000;
	width: min(22rem, calc(100vw - 2rem));
	height: auto;
	aspect-ratio: 16 / 9;
	box-shadow: 0 10px 30px rgb(0 0 0 / 0.35);
	animation: etos-video-float 0.2s ease-out;
}

.video-embed.is-floating .video-embed__close {
	position: absolute;
	top: 0.35rem;
	right: 0.35rem;
	z-index: 1;
	display: grid;
	place-items: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgb(16 16 16 / 0.8);
	color: #fff;
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
}

.video-embed.is-floating::after {
	content: "Video läuft unten rechts weiter";
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	font-family: var(--wp--preset--font-family--sans, system-ui, sans-serif);
	font-size: var(--wp--preset--font-size--s, 0.9375rem);
	color: #f9f5f5;
}

@keyframes etos-video-float {
	from {
		opacity: 0;
		transform: translateY(1rem);
	}
}

@media (max-width: 40rem) {
	.video-embed.is-floating .video-embed__stage {
		inset: auto 0.5rem calc(0.5rem + var(--etos-dock, 0px)) auto;
		width: min(16rem, calc(100vw - 1rem));
	}
}

@media (prefers-reduced-motion: reduce) {
	.video-embed__icon,
	.video-embed.is-floating .video-embed__stage {
		transition: none;
		animation: none;
	}
}
