/*
 * The video facade, shared by every screen that has one.
 *
 * ONE SOURCE, THREE PLACES. A chapter, a guide hub and a public page all render
 * the same button-over-a-poster and the same player that replaces it. These
 * rules used to live in reader.css, which loads only on reading screens — so
 * [smartg_public_video] on an ordinary page rendered a bare <figure>: a plain
 * bordered button with the title and the running time run together, and no box
 * at all. Copying the rules into a second file would have fixed that page and
 * started the drift; they are here instead and both callers load this.
 *
 * LOADED FIRST, OVERRIDDEN AFTER. reader.css declares this as a dependency, so
 * it prints before and the reader's own rules — the reading measure, the hub's
 * lead variant — still win. Nothing about the chapter facade changes.
 *
 * EVERY CUSTOM PROPERTY CARRIES A FALLBACK. On a chapter the reader's :root
 * supplies them; on a Divi page nothing does, and a var() with no fallback
 * resolves to nothing at all rather than to a sensible default. The fallbacks
 * are the reader's own values.
 */

.smartg-video {
	margin: 0 auto 2.5rem;
}

.smartg-video__stage {
	position: relative;
	aspect-ratio: 16 / 9;
	background: #223038;
	border-radius: var(--smartg-radius, 4px);
	overflow: hidden;
}

.smartg-video__button {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 1rem;
	border: 0;

	/* A poster that fails to load leaves this solid panel rather than a broken
	   image, and covers the moment before a proxied poster arrives. */
	background-color: #223038;
	background-size: cover;
	background-position: center;
	color: #ffffff;
	cursor: pointer;
	font: inherit;
	font-size: 0.85rem;
	text-align: center;
}

.smartg-video__icon {
	width: 4rem;
	height: 4rem;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	position: relative;
}

.smartg-video__icon::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 54%;
	transform: translate(-50%, -50%);
	border-style: solid;
	border-width: 0.7rem 0 0.7rem 1.15rem;
	border-color: transparent transparent transparent #1f2933;
}

.smartg-video__label {
	background: rgba(31, 41, 51, 0.72);
	padding: 0.35rem 0.8rem;
	border-radius: 999px;
}

.smartg-video__frame,
.smartg-video__player {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

/*
 * The stage is 16:9 and a rendition may not be, so the player is contained
 * rather than cropped: a video letterboxes into the panel instead of having its
 * edges cut off. The panel behind it is already the dark solid the poster sits
 * on, so the bars are not a visible seam.
 */
.smartg-video__player {
	object-fit: contain;
	background: #223038;
}

.smartg-video__note {
	margin: 0.5rem 0 0;
	font-size: 0.75em;
	color: var(--smartg-ink-muted, #52606d);
}

/*
 * The editor's line about the video, above the standing note about how the
 * button behaves. Its own block and its own colour, because one is about this
 * video and the other is about every video on the site.
 */
.smartg-video__caption {
	display: block;
	margin-bottom: 0.2rem;
	font-size: 1.15em;
	color: var(--smartg-ink, #1f2933);
}

/*
 * A flow item in the button's own flex column, not an absolutely positioned
 * corner label. Nothing in the chapter print path is taken out of flow, and
 * that includes things print is going to hide anyway.
 */
.smartg-video__duration {
	padding: 0.15rem 0.5rem;
	border: 1px solid rgba(255, 255, 255, 0.6);
	border-radius: 3px;
	color: #fff;
	font-family: var(--smartg-ui-font, inherit);
	font-size: 0.72rem;
	letter-spacing: 0.04em;
	font-variant-numeric: tabular-nums;
}
