/*
 * The video facade: a poster, a play button and a caption, all inside the
 * link that becomes the player.
 */

.sx-video {
	margin: 0 auto;
	/* Capped rather than full-bleed: at the full width of the content column
	   the player is 700px tall and pushes everything after it off the
	   screen, which is a poor trade for a three-minute aside. */
	max-width: 840px;
}

.sx-video__frame {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var( --sx-radius-lg );
	background: var( --sx-text );
	aspect-ratio: 16 / 9;
	text-decoration: none;
	color: var( --sx-white );
}

.sx-video__frame img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var( --sx-transition-slow ) var( --sx-ease );
}

/* A scrim, so the white caption stays readable over whatever frame YouTube
   picked, and the poster reads as a player rather than a screenshot. */
.sx-video__frame::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to top,
		color-mix( in srgb, var( --sx-text ) 72%, transparent ) 0%,
		color-mix( in srgb, var( --sx-text ) 24%, transparent ) 38%,
		transparent 62%
	);
	pointer-events: none;
}

.sx-video__play {
	position: absolute;
	inset: 0;
	margin: auto;
	display: grid;
	place-items: center;
	width: 76px;
	height: 76px;
	border-radius: 50%;
	background: var( --sx-brand );
	color: var( --sx-white );
	box-shadow: 0 10px 30px rgba( 0, 0, 0, 0.35 );
	transition: transform var( --sx-transition-base ) var( --sx-ease );
	z-index: 1;
}

.sx-video__play svg {
	width: 34px;
	height: 34px;
	/* The triangle's own mass sits left of centre; nudge it back. */
	margin-left: 3px;
}

.sx-video__label {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1;
	padding: 20px 24px;
	font-family: var( --wp--preset--font-family--manrope, inherit );
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.3;
	text-shadow: 0 1px 12px rgba( 0, 0, 0, 0.5 );
	overflow-wrap: break-word;
}

@media ( hover: hover ) {
	.sx-video__frame:hover img {
		transform: scale( 1.03 );
	}

	.sx-video__frame:hover .sx-video__play {
		transform: scale( 1.08 );
	}
}

.sx-video__frame:focus-visible {
	outline: 3px solid var( --sx-brand );
	outline-offset: 3px;
}

/* What replaces the link once it is clicked. */
.sx-video iframe {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	border: 0;
	border-radius: var( --sx-radius-lg );
	background: var( --sx-text );
}

.sx-video__note {
	margin: 12px 0 0;
	color: var( --sx-text-muted );
	font-size: 0.9rem;
	line-height: 1.5;
}

@media ( max-width: 600px ) {
	.sx-video__play {
		width: 60px;
		height: 60px;
	}

	.sx-video__play svg {
		width: 26px;
		height: 26px;
	}

	.sx-video__label {
		padding: 14px 16px;
		font-size: 0.95rem;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.sx-video__frame img,
	.sx-video__play {
		transition: none;
	}

	.sx-video__frame:hover img,
	.sx-video__frame:hover .sx-video__play {
		transform: none;
	}
}
