/*
 * SDB Video element (SDB One Foundation): a video under a cover with a play button.
 * See bricks/element-video.php. Colours and radius come from the brand's ACSS tokens.
 */

.sdb-video {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: var(--radius, 0);
	background-color: var(--black, #000);
}

.sdb-video > video,
.sdb-video > iframe,
.sdb-video__cover,
.sdb-video__poster {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.sdb-video > video {
	object-fit: cover;
}

/* Playing: the player's own frame, letterboxed rather than cropped. */
.sdb-video.is-playing > video {
	object-fit: contain;
}

/* An oEmbed fallback brings its own sizes. */
.sdb-video > :not(video, template, .sdb-video__cover) {
	position: absolute;
	inset: 0;
}

.sdb-video > :not(video, template, .sdb-video__cover) iframe {
	width: 100%;
	height: 100%;
}

.sdb-video__cover {
	display: grid;
	place-items: center;
	padding: 0;
	margin: 0;
	background: none;
	color: inherit;
	cursor: pointer;
	text-decoration: none;
}

.sdb-video__cover[hidden] {
	display: none;
}

.sdb-video__poster {
	object-fit: cover;
	transition: transform 0.4s ease;
}

.sdb-video__play {
	position: relative;
	display: grid;
	place-items: center;
	width: 4.8rem;
	height: 4.8rem;
	border-radius: 50%;
	background-color: var(--primary, #1e5aa8);
	color: var(--white, #fff);
	box-shadow: 0 0.4rem 1.6rem rgb(0 0 0 / 0.25);
	transition: transform 0.2s ease, background-color 0.2s ease;
}

.sdb-video__play svg {
	width: 2.2rem;
	height: 2.2rem;
	margin-left: 0.2rem;
}

.sdb-video__cover:hover .sdb-video__play,
.sdb-video__cover:focus-visible .sdb-video__play {
	transform: scale(1.08);
	background-color: var(--primary-hover, var(--primary, #1e5aa8));
}

.sdb-video__cover:hover .sdb-video__poster {
	transform: scale(1.02);
}

.sdb-video__cover:focus-visible {
	outline: 3px solid var(--focus-color, var(--primary, #1e5aa8));
	outline-offset: -3px;
}

@media (min-width: 768px) {
	.sdb-video__play {
		width: 6.4rem;
		height: 6.4rem;
	}

	.sdb-video__play svg {
		width: 2.8rem;
		height: 2.8rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sdb-video__poster,
	.sdb-video__play {
		transition: none;
	}
}
