/* ==========================================================================
   ACF Video Player — Frontend
   ========================================================================== */

.avp-video {
	--avp-aspect: 9 / 16;
	--avp-aspect-pct: 177.78%; /* fallback for browsers/themes that don't respect aspect-ratio */
	position: relative;
	width: 100% !important;
	max-width: 420px;
	margin: 0 auto;
	aspect-ratio: var(--avp-aspect);
	border-radius: 16px;
	overflow: hidden;
	background: #111;
	cursor: pointer;
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
/* Belt-and-braces sizing: if `aspect-ratio` gets overridden or ignored by
   a theme's global CSS, this padding-top trick still forces real height
   on the box instead of it collapsing to 0px. */
@supports not (aspect-ratio: 1 / 1) {
	.avp-video {
		height: 0;
		padding-top: var(--avp-aspect-pct);
	}
}
.avp-video:focus-visible {
	outline: 3px solid #8B5CF6;
	outline-offset: 3px;
}

.avp-video-media {
	position: absolute;
	inset: 0 !important;
}

.avp-video-el,
.avp-video-thumb {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.avp-video-yt {
	position: absolute;
	inset: 0;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease;
}
.avp-video-yt iframe {
	position: absolute;
	top: 50%;
	left: 50%;
	width: var(--avp-yt-w, 100%);
	height: var(--avp-yt-h, 100%);
	transform: translate(-50%, -50%);
	border: 0;
}
.avp-video.is-previewing .avp-video-yt,
.avp-video.is-engaged .avp-video-yt {
	opacity: 1;
}
.avp-video.is-previewing .avp-video-thumb,
.avp-video.is-engaged .avp-video-thumb {
	opacity: 0;
}

/* Invisible click-catcher directly over the YouTube iframe. Nothing —
   click, tap, or hover — should ever reach YouTube's own player chrome;
   every interaction is handled by our own controls instead. */
.avp-yt-shield {
	position: absolute;
	inset: 0;
	z-index: 2;
	background: transparent;
}

/* YouTube shows its own title card, pause screen, and "more videos"
   suggestions automatically — that can't be turned off via embed
   parameters. Instead we cover the iframe with our own thumbnail
   whenever it isn't in a clean "actively playing" state, and reveal the
   iframe only once we're sure it's just showing the video itself. */
.avp-video.yt-masked .avp-video-thumb {
	opacity: 1 !important;
	z-index: 3;
}

.avp-video-media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.35) 100%);
	pointer-events: none;
	transition: opacity 0.2s ease;
}
.avp-video.is-engaged .avp-video-media::after {
	opacity: 0;
}

.avp-play-btn {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	z-index: 4;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: #1b1523;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	transition: transform 0.2s ease, opacity 0.2s ease;
}
.avp-play-btn svg {
	margin-left: 2px;
}
.avp-video:hover .avp-play-btn {
	transform: translate(-50%, -50%) scale(1.08);
}
.avp-video.is-engaged .avp-play-btn,
.avp-video.hide-center-btn .avp-play-btn {
	opacity: 0;
	pointer-events: none;
}

.avp-notice {
	background: #fff8e5;
	border: 1px solid #f0d98c;
	padding: 12px 16px;
	border-radius: 8px;
	font-size: 13px;
	max-width: 420px;
	margin: 0 auto;
}

/* ---------------- Inline controls (always visible) ---------------- */

.avp-video-progress {
	position: absolute;
	top: 10px;
	left: 10px;
	right: 10px;
	z-index: 5;
	height: 3px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.3);
	overflow: hidden;
}
.avp-video-progress i {
	display: block;
	height: 100%;
	width: 0%;
	background: #fff;
	border-radius: inherit;
	transition: width 0.15s linear;
}

.avp-video-controls {
	position: absolute;
	top: 20px;
	right: 10px;
	z-index: 6;
	display: flex;
	gap: 6px;
}
.avp-video-btn {
	position: relative;
	width: 28px;
	height: 28px;
	min-width: 28px;
	min-height: 28px;
	border-radius: 50%;
	border: none;
	background: rgba(0, 0, 0, 0.5);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	backdrop-filter: blur(3px);
	transition: background 0.15s ease;
	line-height: 1;
}
.avp-video-btn:hover {
	background: rgba(0, 0, 0, 0.7);
}
.avp-video-btn svg {
	display: inline-block !important;
	width: 14px !important;
	height: 14px !important;
	flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
	.avp-play-btn,
	.avp-video-btn {
		transition: none !important;
	}
}
