/* Koschmieder Autoplay Video – Frontend-Styles */

.kf-avp {
	--kf-avp-accent: #2c9ec9; /* Blau wie koschmiederfilm.de, per Attribut/Widget überschreibbar */
	--kf-avp-btn-size: 84px;

	position: relative;
	display: block;
	width: 100%;
	margin-inline: auto;
	overflow: hidden;
	background: #000;
	line-height: 0;
}

/* Feste Seitenverhältnisse: Video füllt den Rahmen */
.kf-avp--has-ratio .kf-avp__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

/* Natürliches Verhältnis: Video bestimmt die Höhe selbst */
.kf-avp--natural .kf-avp__video {
	position: relative;
	width: 100%;
	height: auto;
	display: block;
}

.kf-avp--fit-cover .kf-avp__video {
	object-fit: cover;
}

.kf-avp--fit-contain .kf-avp__video {
	object-fit: contain;
	background: #000;
}

.kf-avp__video {
	display: block;
	border: 0;
	outline: none;
}

/* Untertitel dezent stylen */
.kf-avp__video::cue {
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	line-height: 1.3;
}

/* ---------- Poster-Layer (sanftes Einblenden) ---------- */

.kf-avp__poster {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 1;
	transition: opacity 0.5s ease;
	pointer-events: none;
}

.kf-avp--fit-contain .kf-avp__poster {
	object-fit: contain;
	background-color: #000;
}

.kf-avp.is-playing .kf-avp__poster {
	opacity: 0;
}

/* ---------- Lade-Spinner ---------- */

.kf-avp__spinner {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 42px;
	height: 42px;
	margin: -21px 0 0 -21px;
	z-index: 2;
	border: 3px solid rgba(255, 255, 255, 0.35);
	border-top-color: var(--kf-avp-accent);
	border-radius: 50%;
	opacity: 0;
	pointer-events: none;
	animation: kf-avp-spin 0.8s linear infinite;
	transition: opacity 0.2s ease;
}

.kf-avp.is-loading .kf-avp__spinner {
	opacity: 1;
}

/* Während des Ladens den Button ausblenden */
.kf-avp.is-loading .kf-avp__btn {
	opacity: 0;
}

@keyframes kf-avp-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ---------- Play-/Sound-Button ---------- */

.kf-avp__btn {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: var(--kf-avp-btn-size);
	height: var(--kf-avp-btn-size);
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: var(--kf-avp-accent);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	z-index: 3;
	box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
	transition: transform 0.25s ease, background 0.25s ease, opacity 0.35s ease;
	-webkit-appearance: none;
	appearance: none;
}

/* Keep the standard button circular even when themes style all button elements. */
.kf-avp.kf-avp--button-round > .kf-avp__btn,
.kf-avp.kf-avp--button-round > .kf-avp__btn > .kf-avp__pulse {
	border-radius: 50% !important;
}


.kf-avp__btn:hover {
	transform: translate(-50%, -50%) scale(1.06);
}

.kf-avp__btn:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 3px;
}

/* Pulsierender blauer Ring – exakt wie koschmiederfilm.de (btnIconRipple) */
.kf-avp__pulse {
	position: absolute;
	inset: -2px;
	border-radius: inherit;
	border: 4px solid var(--kf-avp-accent);
	box-sizing: border-box;
	pointer-events: none;
	animation: kf-avp-ripple 2s cubic-bezier(0.23, 1, 0.32, 1) infinite;
}

@keyframes kf-avp-ripple {
	0% {
		border-width: 4px;
		transform: scale(1);
		opacity: 1;
	}
	80% {
		border-width: 1px;
		transform: scale(1.35);
		opacity: 1;
	}
	100% {
		transform: scale(1.35);
		opacity: 0;
	}
}

/* Icons: je nach Zustand eines sichtbar */
.kf-avp__icon {
	position: absolute;
	width: 46%;
	height: 46%;
	display: none;
	align-items: center;
	justify-content: center;
}

/* Zustand: Autoplay aus / pausiert -> Play zeigen */
.kf-avp:not(.is-playing) .kf-avp__icon--play {
	display: flex;
}

/* Zustand: läuft & stumm -> "Ton an"-Icon (durchgestrichen) */
.kf-avp.is-playing.is-muted .kf-avp__icon--mute {
	display: flex;
}

/* Zustand: läuft & Ton an -> Lautsprecher-Icon */
.kf-avp.is-playing:not(.is-muted) .kf-avp__icon--unmute {
	display: flex;
}

/* Wenn Ton an ist, pulsieren stoppen und Button dezenter */
.kf-avp.is-playing:not(.is-muted) .kf-avp__pulse {
	display: none;
}

.kf-avp.is-playing:not(.is-muted) .kf-avp__btn {
	opacity: 0;
}

.kf-avp.is-playing:not(.is-muted):hover .kf-avp__btn {
	opacity: 1;
}

/* Eigenes Button-Bild statt des runden Standardbuttons */
.kf-avp--button-custom .kf-avp__btn {
	border-radius: 0 !important;
	background: transparent;
	box-shadow: none;
}

.kf-avp__button-image {
	position: relative;
	z-index: 2;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.kf-avp--button-custom .kf-avp__pulse,
.kf-avp--button-custom .kf-avp__icon {
	display: none !important;
}

/* Optionaler Regler zum direkten Springen im Video */
.kf-avp__seek {
	position: absolute;
	left: 18px;
	right: 18px;
	bottom: 14px;
	z-index: 4;
	width: calc(100% - 36px);
	height: 24px;
	margin: 0;
	opacity: 0;
	pointer-events: none;
	cursor: pointer;
	accent-color: var(--kf-avp-accent);
	transition: opacity 0.2s ease;
}

.kf-avp.has-seek-duration .kf-avp__seek {
	opacity: 1;
	pointer-events: auto;
}

.kf-avp.is-teaser .kf-avp__seek {
	opacity: 0;
	pointer-events: none;
}

/* Reduzierte Bewegung respektieren */
@media (prefers-reduced-motion: reduce) {
	.kf-avp__pulse {
		animation: none;
		opacity: 0.6;
		border-width: 2px;
	}
	.kf-avp__btn {
		transition: none;
	}
}

/* Editor-Hinweis */
.kf-avp-notice {
	padding: 12px 16px;
	border: 1px dashed #1a73ff;
	border-radius: 6px;
	background: #f0f6ff;
	color: #1a3a6b;
	font-size: 14px;
	line-height: 1.4;
}
