/* YouTube embeds: our poster and play button first; YouTube's player only loads after a click. */
.nffat-video.wp-block-embed {
	width: 100%;
	max-width: var(--wp--style--global--wide-size, 1392px);
	margin-inline: auto;
}

.nffat-video__stage {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: var(--nffat-radius-card);
	background: var(--wp--preset--color--teal-900);
	isolation: isolate;
}

.nffat-video__stage:fullscreen {
	border-radius: 0;
}

.nffat-video__poster,
.nffat-video__stage iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.nffat-video__poster {
	object-fit: cover;
	transition: scale 600ms var(--nffat-ease-out), opacity 300ms var(--nffat-ease-out);
}

/* The whole poster is the button, so it's one big target. */
.nffat-video__start {
	position: absolute;
	inset: 0;
	display: flex;
	align-content: flex-end;
	align-items: center;
	flex-wrap: wrap;
	gap: 18px;
	padding: clamp(20px, 4vw, 48px);
	border: 0;
	background: linear-gradient(to top, rgb(4 41 39 / 0.85), rgb(4 41 39 / 0) 65%);
	color: var(--wp--preset--color--white);
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.nffat-video__start-icon {
	display: grid;
	flex: none;
	place-items: center;
	width: clamp(64px, 8vw, 96px);
	aspect-ratio: 1;
	border-radius: 50%;
	background: var(--wp--preset--color--magenta);
	box-shadow: 0 10px 30px rgb(4 41 39 / 0.35);
	transition: transform 200ms var(--nffat-ease-out), background-color 200ms var(--nffat-ease-out);
}

.nffat-video__start-icon .nffat-icon {
	width: 38%;
	height: 38%;
	margin-left: 6%;
}

.nffat-video__start-text {
	display: grid;
	flex: 1;
	gap: 8px;
	max-width: 760px;
}

.nffat-video__title {
	font-size: clamp(18px, 2.2vw, 28px);
	font-weight: 700;
	line-height: 1.2;
	text-wrap: balance;
}

.nffat-video__start .nffat-video__description {
	color: rgb(255 255 255 / 0.88);
	font-size: 16px;
	line-height: 1.5;
}

.nffat-video__description--below {
	display: none;
}

.nffat-video__start:active .nffat-video__start-icon {
	transform: scale(0.94);
}

.nffat-video__start:focus-visible {
	outline: 4px solid var(--wp--preset--color--magenta);
	outline-offset: -4px;
}

@media (hover: hover) and (pointer: fine) {
	.nffat-video__start:hover .nffat-video__start-icon {
		transform: scale(1.06);
		background: var(--wp--preset--color--magenta-600);
	}

	.nffat-video__stage:has(.nffat-video__start:hover) .nffat-video__poster {
		scale: 1.02;
	}
}

.nffat-video.is-loading .nffat-video__start-icon {
	animation: nffat-video-wait 900ms ease-in-out infinite alternate;
}

@keyframes nffat-video-wait {
	to {
		transform: scale(0.9);
		opacity: 0.7;
	}
}

.nffat-video.is-playing .nffat-video__poster,
.nffat-video.is-playing .nffat-video__start {
	display: none;
}

.nffat-video__shield {
	position: absolute;
	inset: 0;
	cursor: pointer;
}

/* Our controls */
.nffat-video__controls {
	position: absolute;
	inset: auto 12px 12px;
	z-index: 1;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border-radius: 999px;
	background: rgb(4 41 39 / 0.82);
	color: var(--wp--preset--color--white);
	transition: opacity 250ms var(--nffat-ease-out), translate 250ms var(--nffat-ease-out);
}

/* While playing, controls step aside until the pointer or keyboard comes back. */
@media (hover: hover) and (pointer: fine) {
	.nffat-video.is-playing:not(.is-paused) .nffat-video__stage:not(:hover, :focus-within) .nffat-video__controls {
		opacity: 0;
		translate: 0 8px;
	}
}

.nffat-video__control {
	display: grid;
	flex: none;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.nffat-video__control svg {
	width: 20px;
	height: 20px;
}

.nffat-video__toggle {
	background: var(--wp--preset--color--magenta);
}

.nffat-video__control:focus-visible,
.nffat-video__seek:focus-visible {
	outline: 3px solid var(--wp--preset--color--magenta-100);
	outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
	.nffat-video__control:not(.nffat-video__toggle):hover {
		background: rgb(255 255 255 / 0.14);
	}
}

.nffat-video__time {
	flex: none;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
}

.nffat-video__seek {
	--played: 0%;
	flex: 1;
	min-width: 0;
	height: 6px;
	margin: 0 6px;
	border-radius: 6px;
	background: linear-gradient(to right, var(--wp--preset--color--magenta) var(--played), rgb(255 255 255 / 0.3) var(--played));
	appearance: none;
	cursor: pointer;
}

.nffat-video__seek::-webkit-slider-thumb {
	width: 16px;
	height: 16px;
	border: 0;
	border-radius: 50%;
	background: var(--wp--preset--color--white);
	appearance: none;
}

.nffat-video__seek::-moz-range-thumb {
	width: 16px;
	height: 16px;
	border: 0;
	border-radius: 50%;
	background: var(--wp--preset--color--white);
}

/* The page's sections sit 96px apart; a video and its caption read as one piece with what follows, so pull that in. */
.nffat-designed__content > .nffat-video {
	margin-bottom: -32px;
}

.nffat-video__caption {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 24px;
	margin-top: 16px;
}

.nffat-video__caption .nffat-video__description {
	max-width: 760px;
	color: var(--wp--preset--color--ink-muted);
	font-size: 16px;
	line-height: 1.6;
}

.nffat-video .nffat-video__youtube {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 10px;
	margin-left: auto;
	padding: 10px 18px 10px 14px;
	border-radius: 999px;
	background: #FF0000;
	background-image: none;
	color: var(--wp--preset--color--white);
	font-size: 15px;
	font-weight: 700;
	text-decoration: none;
	transition: background-color 200ms var(--nffat-ease-out), transform 160ms var(--nffat-ease-out);
}

.nffat-video__youtube-icon {
	width: 22px;
	height: 22px;
}

.nffat-video .nffat-video__youtube:active {
	transform: scale(0.97);
}

.nffat-video .nffat-video__youtube:focus-visible {
	outline: 3px solid var(--wp--preset--color--ink);
	outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
	.nffat-video .nffat-video__youtube:hover {
		background-color: #CC0000;
	}
}

@media (max-width: 699px) {
	.nffat-designed__content > .nffat-video {
		margin-bottom: -16px;
	}

	.nffat-video__start .nffat-video__description {
		display: none;
	}

	.nffat-video__caption .nffat-video__description--below {
		display: block;
	}

	.nffat-video__caption {
		flex-direction: column;
		gap: 14px;
	}

	.nffat-video .nffat-video__youtube {
		margin-left: 0;
	}
}

@media (max-width: 599px) {
	.nffat-video__start {
		flex-direction: column;
		align-items: flex-start;
		justify-content: flex-end;
		gap: 12px;
	}

	.nffat-video__time,
	.nffat-video__mute {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nffat-video__poster,
	.nffat-video__start-icon,
	.nffat-video__controls {
		transition: none;
	}

	.nffat-video.is-loading .nffat-video__start-icon {
		animation: none;
	}
}
