/**
 * Media Styles - Images, Videos, and Carousels
 * Responsive, accessible media components with captions
 */

/* ===== Video Embeds ===== */
.video-embed {
	margin: 2rem 0;
	max-width: 100%;
}

.video-container {
	position: relative;
	width: 100%;
	padding-bottom: 56.25%; /* 16:9 aspect ratio */
	height: 0;
	overflow: hidden;
	background: #000;
	border-radius: 8px;
}

.video-container iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: none;
}

.video-caption {
	margin-top: 0.75rem;
	text-align: center;
	font-size: 0.9rem;
	color: var(--text-muted, #666);
	font-style: italic;
}

/* ===== Video Facade (lite embed) ===== */
.video-facade {
	cursor: pointer;
}

.video-facade-thumb {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.video-facade-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	opacity: 0.8;
	transition:
		opacity 0.2s,
		transform 0.2s;
}

.video-facade:hover .video-facade-play {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1.1);
}

.video-facade-play:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 4px;
	border-radius: 4px;
}

/* ===== Images with Captions ===== */
.image-with-caption {
	margin: 2rem 0;
	max-width: 100%;
}

.image-with-caption img {
	width: 100%;
	height: auto;
	display: block;
	border-radius: 8px;
}

.image-caption {
	margin-top: 0.75rem;
	text-align: center;
	font-size: 0.9rem;
	color: var(--text-muted, #666);
	font-style: italic;
}

/* ===== Carousel ===== */
.carousel {
	position: relative;
	margin: 2rem 0;
	max-width: 100%;
	overflow: hidden;
	border-radius: 8px;
	background: #000;
}

.carousel-inner {
	position: relative;
	width: 100%;
	padding-bottom: 66.67%; /* 3:2 aspect ratio */
	overflow: hidden;
}

.carousel-slide {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	transition: opacity 0.3s ease-in-out;
	pointer-events: none;
}

.carousel-slide.active {
	opacity: 1;
	pointer-events: auto;
}

.carousel-slide img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.carousel-caption {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 1rem;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
	color: #fff;
	text-align: center;
	font-size: 0.9rem;
}

.carousel-control {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(0, 0, 0, 0.5);
	color: #fff;
	border: none;
	padding: 1rem;
	cursor: pointer;
	transition: background 0.2s;
	z-index: 10;
	border-radius: 4px;
}

.carousel-control:hover {
	background: rgba(0, 0, 0, 0.8);
}

.carousel-control:focus {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.carousel-control.prev {
	left: 1rem;
}

.carousel-control.next {
	right: 1rem;
}

.carousel-control svg {
	display: block;
	width: 24px;
	height: 24px;
}

.carousel-dots {
	position: absolute;
	bottom: 1rem;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 0.5rem;
	z-index: 10;
}

.carousel-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.5);
	border: none;
	cursor: pointer;
	transition: background 0.2s;
	padding: 0;
}

.carousel-dot.active,
.carousel-dot:hover {
	background: rgba(255, 255, 255, 1);
}

.carousel-dot:focus {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 768px) {
	.video-embed,
	.image-with-caption,
	.carousel {
		margin: 1.5rem 0;
	}

	.carousel-control {
		padding: 0.75rem;
	}

	.carousel-control svg {
		width: 20px;
		height: 20px;
	}

	.carousel-caption {
		padding: 0.75rem;
		font-size: 0.85rem;
	}

	.video-caption,
	.image-caption {
		font-size: 0.85rem;
	}
}

@media (max-width: 480px) {
	.carousel-control.prev {
		left: 0.5rem;
	}

	.carousel-control.next {
		right: 0.5rem;
	}

	.carousel-dots {
		bottom: 0.5rem;
		gap: 0.35rem;
	}

	.carousel-dot {
		width: 8px;
		height: 8px;
	}
}

/* ===== Dark Mode Support ===== */
[data-color-scheme='dark'] .video-caption,
[data-color-scheme='dark'] .image-caption {
	color: var(--color-text-muted, #94a3b8);
}

@media (prefers-color-scheme: dark) {
	.video-caption,
	.image-caption {
		color: var(--color-text-muted, #94a3b8);
	}
}

/* ===== Print Styles ===== */
@media print {
	.carousel-control,
	.carousel-dots {
		display: none;
	}

	.carousel-slide {
		position: relative;
		opacity: 1;
		page-break-inside: avoid;
	}

	.carousel-inner {
		padding-bottom: 0;
		height: auto;
	}
}
