/**
 * CCC External Video Preview
 *
 * All sizes and colours are CSS custom properties on .cccyt-wrapper, so a template can restyle the
 * placeholder without overriding rules, e.g.:
 *
 *   .cccyt-wrapper { --cccyt-radius: 12px; --cccyt-privacy-bg: #eef3f8; }
 */

.cccyt-wrapper {
	--cccyt-ratio: 16 / 9;
	--cccyt-radius: 4px;
	--cccyt-play-size: 80px;
	--cccyt-privacy-bg: #f4f4f4;
	--cccyt-privacy-color: inherit;
	--cccyt-privacy-padding: 1rem;
	--cccyt-privacy-border: none;
	--cccyt-focus-color: currentColor;
	position: relative;
	width: 100%;
	max-width: 100%;
}

.cccyt-placeholder {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	position: relative;
	cursor: pointer;
}

.cccyt-thumb {
	display: block;
	position: relative;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--cccyt-radius);
	aspect-ratio: var(--cccyt-ratio);
	overflow: hidden;
	background: #000;
	color: inherit;
	font: inherit;
	cursor: pointer;
	appearance: none;
}

.cccyt-thumb:focus-visible {
	outline: 2px solid var(--cccyt-focus-color);
	outline-offset: 4px;
}

.cccyt-thumb > img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform 200ms ease, filter 200ms ease;
}

.cccyt-thumb > img.cccyt-blur {
	filter: blur(8px);
	transform: scale(1.05);
}

.cccyt-placeholder:hover .cccyt-thumb > img {
	transform: scale(1.02);
}

.cccyt-placeholder:hover .cccyt-thumb > img.cccyt-blur {
	transform: scale(1.07);
}

.cccyt-playbutton {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.cccyt-playbutton img {
	width: var(--cccyt-play-size);
	height: var(--cccyt-play-size);
	max-width: 35%;
	object-fit: contain;
	filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.25));
}

.cccyt-overlay-text {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	padding: var(--cccyt-privacy-padding);
	border: var(--cccyt-privacy-border);
	border-radius: var(--cccyt-radius);
	background: var(--cccyt-privacy-bg);
	color: var(--cccyt-privacy-color);
	line-height: 1.5;
}

.cccyt-placeholder-text {
	font-weight: 600;
}

.cccyt-privacy-text {
	display: block;
	font-size: 0.9rem;
}

.cccyt-privacy-text a {
	color: inherit;
	text-decoration: underline;
}

/*
 * Text on top of the thumbnail instead of below it. Only where the video is wide enough:
 * on a narrow video the notice would hide the whole image, so there it stays below.
 */
.cccyt-text-overlay {
	container-type: inline-size;
}

@container (min-width: 560px) {
	.cccyt-text-overlay .cccyt-placeholder {
		display: grid;
		gap: 0;
	}

	.cccyt-text-overlay .cccyt-thumb,
	.cccyt-text-overlay .cccyt-overlay-text {
		grid-area: 1 / 1;
	}

	.cccyt-text-overlay .cccyt-overlay-text {
		align-self: end;
		z-index: 1;
		margin: 0.75rem;
	}
}

.cccyt-iframe {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: var(--cccyt-ratio);
	border: 0;
	border-radius: var(--cccyt-radius);
}

.cccyt-connection-info {
	margin-top: 0.5rem;
	font-size: 0.9rem;
	line-height: 1.4;
}

.cccyt-reset {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
	appearance: none;
}

.cccyt-wrapper noscript a {
	display: inline-block;
	margin-top: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
	.cccyt-thumb > img {
		transition: none;
	}

	.cccyt-placeholder:hover .cccyt-thumb > img {
		transform: none;
	}
}
