/**
 * Armoury Essentials - Media Embed Styles
 *
 * @package ArmouryEssentials
 * @since 1.0.0
 */

/* Video Link
-------------------------------------------------------------- */
.ae-video-link {
	position: relative;
	display: block;
	cursor: pointer;
	overflow: hidden;
}

/* Focus Styles */
.ae-video-link:focus-visible {
	outline: 3px solid #0073aa;
	outline-offset: 2px;
}

.ae-video-link:focus:not(:focus-visible) {
	outline: none;
}

/* Hover Overlay
-------------------------------------------------------------- */
.ae-video-link::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0);
	transition: background-color 0.3s ease;
	z-index: 1;
	pointer-events: none;
}

.ae-video-link:hover::before,
.ae-video-link:focus-visible::before {
	background: rgba(0, 0, 0, 0.2);
}

/* Play Button
-------------------------------------------------------------- */
.ae-play-button {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 72px;
	height: 72px;
	background: rgba(0, 0, 0, 0.7);
	border-radius: 50%;
	pointer-events: none;
	z-index: 2;
	transition: transform 0.3s ease, background-color 0.3s ease;
}

.ae-play-button::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 54%;
	transform: translate(-50%, -50%);
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 14px 0 14px 24px;
	border-color: transparent transparent transparent #fff;
}

.ae-video-link:hover .ae-play-button,
.ae-video-link:focus-visible .ae-play-button {
	transform: translate(-50%, -50%) scale(1.1);
	background: rgba(0, 0, 0, 0.85);
}

/* Video Wrapper
-------------------------------------------------------------- */
.ae-video-wrapper {
	position: relative;
	width: 100%;
	aspect-ratio: 16/9;
	background: #000;
	line-height: 0;
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 16/9) {
	.ae-video-wrapper {
		padding-top: 56.25%;
		height: 0;
		overflow: hidden;
	}
	
	.ae-video-wrapper iframe {
		position: absolute;
		top: 0;
		left: 0;
	}
}

.ae-video-wrapper iframe {
	width: 100%;
	height: 100%;
	border: 0;
	opacity: 1;
	transition: opacity 0.3s ease;
}

/* Loader
-------------------------------------------------------------- */
.ae-loader {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 1;
	width: 48px;
	height: 48px;
	border: 4px solid rgba(255, 255, 255, 0.2);
	border-top-color: #fff;
	border-radius: 50%;
	transform: translate(-50%, -50%);
	animation: ae-spin 1s linear infinite;
}

.ae-video-wrapper.ae-loading iframe {
	opacity: 0;
}

/* Loading Animation
-------------------------------------------------------------- */
@keyframes ae-spin {
	to {
		transform: translate(-50%, -50%) rotate(360deg);
	}
}

/* Mobile Adjustments
-------------------------------------------------------------- */
@media (max-width: 768px) {
	.ae-play-button {
		width: 60px;
		height: 60px;
	}
	
	.ae-play-button::after {
		border-width: 12px 0 12px 20px;
	}

	.ae-loader {
		width: 40px;
		height: 40px;
		border-width: 3px;
	}
}

/* Reduced Motion
-------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.ae-video-link::before,
	.ae-play-button,
	.ae-video-wrapper iframe,
	.ae-loader {
		transition: none;
	}
	
	.ae-loader {
		animation: none;
		border-color: #fff;
	}
}

/* High Contrast Mode
-------------------------------------------------------------- */
@media (prefers-contrast: high) {
	.ae-play-button {
		background: #000;
		border: 2px solid #fff;
	}
	
	.ae-video-link:focus-visible {
		outline-width: 4px;
	}
}

/* Dark Mode Support
-------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
	.ae-video-wrapper {
		background: #1a1a1a;
	}
}