/**
 * Up Next
 *
 * Covers the player when something finishes. Rendered server-side and
 * revealed by up-next.js, so there's no wait at the moment it's needed.
 *
 * The frame exists only to position this — it wraps the player in
 * template-parts/single/media--default.php.
 */

 :root {
	--rv-upnext-bg: var(--base-ultra-dark-trans-90);
	--rv-upnext-pad: var(--space-m);
}

.rv-player-frame {
	position: relative;
}

.rv-upnext {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: grid;
	place-items: center;
	padding: var(--rv-upnext-pad);
	background: var(--rv-upnext-bg);
	color: var(--primary-ultra-light);
	animation: rv-upnext-in 200ms ease;
}

.rv-upnext[hidden] {
	display: none;
}

@keyframes rv-upnext-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.rv-upnext {
		animation: none;
	}
}

.rv-upnext__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-s);
	inline-size: 100%;
	max-inline-size: 30rem;
	text-align: center;
}

.rv-upnext__context {
	--rv-section-heading-color: currentColor;

	margin: 0;
	opacity: 0.75;
}

/* ACSS recolours every link on hover, and on a dark overlay that turns the
   title an unreadable primary. Held to the inherited colour explicitly. */
.rv-upnext__link,
.rv-upnext__link:hover {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
	inline-size: 100%;
	color: inherit;
	text-align: start;
	text-decoration: none;
}

.rv-upnext__media {
	flex: none;
	inline-size: 140px;
	aspect-ratio: 16 / 9;
	border-radius: var(--radius-m);
	overflow: hidden;
	background: var(--base-dark);
}

.rv-upnext__media img {
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
	display: block;
}

.rv-upnext__body {
	display: flex;
	flex-direction: column;
	gap: 12px;
	min-inline-size: 0;
}

.rv-upnext__title {
	font-size: var(--text-l);
	font-weight: 700;
	line-height: 1.05;
}

.rv-upnext__meta {
	font-size: var(--text-s);
	opacity: 0.7;
}

.rv-upnext__actions {
	display: flex;
	align-items: center;
	gap: var(--space-s);
}

.rv-upnext__series {
	color: inherit;
	font-size: var(--text-s);
	opacity: 0.75;
	text-decoration: underline;
	text-underline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
	.rv-upnext__series:hover {
		color: inherit;
		opacity: 1;
	}
}

.rv-upnext__dismiss {
	position: absolute;
	inset-block-start: var(--space-xs);
	inset-inline-end: var(--space-xs);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-xs);
	border: none;
	background: transparent;
	color: currentColor;
	opacity: 0.7;
	cursor: pointer;
}

.rv-upnext__dismiss svg {
	inline-size: var(--rv-icon-size);
	block-size: var(--rv-icon-size);
	fill: currentColor;
}

@media (hover: hover) and (pointer: fine) {
	.rv-upnext__dismiss:hover {
		opacity: 1;
	}
}

/* Audio has no visual frame to cover, so the overlay sits beneath the player
   rather than over it. */
.rv-player-frame:has(.audio-player) .rv-upnext {
	position: static;
	margin-block-start: var(--space-s);
	border-radius: var(--radius-m);
}

@media (max-width: 600px) {
	.rv-upnext__link {
		flex-direction: column;
		text-align: center;
	}
}