/* Malhi Clean video (YouTube) element */
.mcv {
	position: relative;
	width: 100%;
	--mcv-accent: var(--primary, #ffffff);
}

.mcv-frame {
	position: relative;
	overflow: hidden;
	aspect-ratio: 16 / 9;
	background: #000;
	isolation: isolate;
}

.mcv-media {
	position: absolute;
	inset: 0;
	transform: scale(calc(1 + var(--mcv-zoom, 0) / 100));
}

.mcv-media iframe {
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	border: 0;
	pointer-events: none; /* YouTube hover UI can never appear */
}

/* Poster cover */
.mcv-cover {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: block;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	background: #000;
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
}

.mcv--covershown .mcv-cover {
	opacity: 1;
	pointer-events: auto;
}

.mcv-poster {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.mcv-playbtn {
	position: absolute;
	top: 50%;
	left: 50%;
	translate: -50% -50%;
	width: var(--mcv-play-size, 72px);
	aspect-ratio: 1;
	border-radius: 50%;
	background: var(--mcv-accent);
	display: grid;
	place-items: center;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
	transition: transform 0.2s ease;
}

.mcv-cover:hover .mcv-playbtn,
.mcv-cover:focus-visible .mcv-playbtn {
	transform: scale(1.07);
}

.mcv-playbtn svg {
	width: 40%;
	height: 40%;
	fill: #fff;
	transform: translateX(7%);
}

/* Controls bar */
.mcv-controls {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 3;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.6));
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease;
}

.mcv:hover .mcv-controls,
.mcv:focus-within .mcv-controls {
	opacity: 1;
	pointer-events: auto;
}

.mcv--covershown .mcv-controls {
	opacity: 0 !important;
	pointer-events: none !important;
}

@media (hover: none) {
	.mcv:not(.mcv--covershown) .mcv-controls {
		opacity: 1;
		pointer-events: auto;
	}
}

.mcv--nocontrols .mcv-controls {
	display: none;
}

.mcv-btn {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: 0;
	background: rgba(20, 20, 20, 0.55);
	color: #fff;
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: background 0.2s ease;
}

.mcv-btn:hover,
.mcv-btn:focus-visible {
	background: var(--mcv-accent);
}

.mcv-btn svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
}

.mcv-btn .ico-b {
	display: none;
}

.mcv--playing .mcv-play .ico-a {
	display: none;
}

.mcv--playing .mcv-play .ico-b {
	display: block;
}

.mcv--muted .mcv-mute .ico-a {
	display: none;
}

.mcv--muted .mcv-mute .ico-b {
	display: block;
}

/* Seek bar */
.mcv-seek {
	flex: 1 1 auto;
	min-width: 40px;
	-webkit-appearance: none;
	appearance: none;
	height: 5px;
	border-radius: 3px;
	background: linear-gradient(
		to right,
		var(--mcv-accent) calc(var(--mcv-progress, 0) * 1%),
		rgba(255, 255, 255, 0.3) calc(var(--mcv-progress, 0) * 1%)
	);
	cursor: pointer;
	margin: 0;
}

.mcv-seek::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #fff;
	border: 0;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.mcv-seek::-moz-range-thumb {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #fff;
	border: 0;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.mcv-time {
	flex: 0 0 auto;
	color: #fff;
	font-size: 12px;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* Fullscreen */
.mcv:fullscreen {
	width: 100%;
	height: 100%;
	background: #000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.mcv:fullscreen .mcv-frame {
	width: 100%;
	height: 100%;
	aspect-ratio: auto;
	border-radius: 0;
}

/* Mobile */
@media (max-width: 640px) {
	.mcv-controls {
		gap: 8px;
		padding: 10px 12px;
	}

	.mcv-btn {
		width: 34px;
		height: 34px;
	}

	.mcv-time {
		font-size: 11px;
	}
}
