/* Inherited by the isolated header (same channel as --smn-adminbar-h). */
html.smn-vfeed-open {
	--smn-hdr-visibility: hidden;
	--smn-hdr-pointer-events: none;
}

.smn-vfeed {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100dvh;
	max-width: 100vw;
	max-height: 100dvh;
	margin: 0;
	padding: 0;
	border: 0;
	background: #000;
	color: #fff;
	overflow: hidden;
}

.smn-vfeed::backdrop {
	background: transparent;
}

/* Card→frame morph: overlay travels over the media. Close/nav stay on the stage
   so they do not fade out and back in with the scroller. */
.smn-vfeed--morph-start {
	background-color: transparent;
}

.smn-vfeed--morphing .smn-vfeed__scroller {
	visibility: hidden;
}

.smn-vfeed__morph {
	position: fixed;
	z-index: 2;
	overflow: hidden;
	border-radius: 4px;
	pointer-events: none;
	/* Keeps the per-frame box change from reaching the rest of the dialog. */
	contain: layout paint;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.smn-vfeed__morph img,
.smn-vfeed__morph video {
	display: block;
	width: 100%;
	height: 100%;
	-o-object-fit: cover;
	   object-fit: cover;
}

@media (prefers-reduced-motion: no-preference) {
	.smn-vfeed {
		transition: background-color 320ms linear;
	}

	.smn-vfeed__morph {
		transition-property: top, left, width, height;
		transition-duration: 320ms;
		transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
	}
}

.smn-vfeed__stage {
	position: relative;
	width: 100%;
	height: 100%;
	/* Desktop frames are height-bound, so the nav tracks the active slide's ratio
	   (published by the part) instead of measuring the frame. */
	--smn-vfeed-frame-w: min(
		calc(100dvh * var(--smn-vfeed-active-ratio, 9 / 16)),
		100%
	);
}

.smn-vfeed__close {
	position: absolute;
	top: max(4px, env(safe-area-inset-top, 0px));
	inset-inline-end: 4px;
	z-index: 4;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 24px;
	cursor: pointer;
	filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
}

.smn-vfeed__close:hover {
	opacity: 1;
	color: #fff;
}

.smn-vfeed__scroller {
	width: 100%;
	height: 100%;
	overflow-y: auto;
	scroll-snap-type: y mandatory;
	scrollbar-width: none;
}

.smn-vfeed__scroller::-webkit-scrollbar {
	display: none;
}

.smn-vfeed__slide {
	position: relative;
	width: 100%;
	height: 100%;
	margin: 0;
	scroll-snap-align: start;
	scroll-snap-stop: always;
	display: flex;
	align-items: center;
	justify-content: center;
}

.smn-vfeed__slide .smn-video-block {
	width: 100%;
	height: 100%;
	aspect-ratio: auto;
}

.smn-vfeed__slide--portrait .smn-video-block .vjs-tech {
	-o-object-fit: cover;
	   object-fit: cover;
}

/* 744 = Mini 6; 2/3 catches short-wide (Duo) and landscape. Phone portrait stays cover. */
@media (min-width: 744px), (min-aspect-ratio: 2 / 3) {
	.smn-vfeed__slide .smn-video-block {
		width: auto;
		height: 100%;
		aspect-ratio: var(--smn-vfeed-ratio, 9 / 16);
		max-width: 100%;
	}

	.smn-vfeed__slide--portrait .smn-video-block .vjs-tech {
		-o-object-fit: contain;
		   object-fit: contain;
	}
}

.smn-vfeed .smn-video-block__poster {
	width: 100%;
	height: 100%;
	-o-object-fit: cover;
	   object-fit: cover;
}

.smn-vfeed__slide--framed .smn-video-block__poster {
	display: none;
}

/* Feed chrome replaces Video.js controls. */
.smn-vfeed .vjs-big-play-button,
.smn-vfeed .vjs-control-bar,
.smn-vfeed .vjs-loading-spinner {
	display: none !important;
}

.smn-vfeed__surface {
	position: absolute;
	inset: 0;
	z-index: 3;
	display: grid;
	place-items: center;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}

.smn-vfeed__play {
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	border-radius: 9999px;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	font-size: 18px;
	padding-inline-start: 3px;
}

.smn-vfeed__chrome {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 4;
	display: flex;
	flex-direction: column;
}

.smn-vfeed__meta {
	display: flex;
	align-items: flex-end;
	gap: 12px;
	padding: 48px 16px 12px;
	background: linear-gradient(
		180deg,
		rgba(0, 0, 0, 0) 0%,
		rgba(0, 0, 0, 0.35) 45%,
		rgba(0, 0, 0, 0.75) 100%
	);
}

.smn-vfeed__title {
	flex: 1;
	min-width: 0;
	margin: 0;
	color: #fff;
	font-family: 'Suisse Intl', sans-serif;
	font-size: 16px;
	font-weight: 400;
	line-height: 22px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.smn-vfeed__mute {
	flex-shrink: 0;
	display: grid;
	place-items: center;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 16px;
	cursor: pointer;
}

.smn-vfeed__mute:hover {
	opacity: 1;
	color: #fff;
}

.smn-vfeed__progress {
	display: block;
	width: 100%;
	height: 4px;
	margin: 0;
	padding: 0;
	background: transparent;
	-moz-appearance: none;
	     appearance: none;
	-webkit-appearance: none;
	cursor: pointer;
}

.smn-vfeed__progress::-webkit-slider-runnable-track {
	height: 4px;
	background: linear-gradient(
		to right,
		#fff var(--smn-vfeed-progress, 0%),
		rgba(255, 255, 255, 0.24) var(--smn-vfeed-progress, 0%)
	);
}

/* The design has no handle; keep it for dragging but invisible. */
.smn-vfeed__progress::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 4px;
	height: 4px;
	border: 0;
	background: transparent;
}

.smn-vfeed__progress::-moz-range-track {
	height: 4px;
	background: rgba(255, 255, 255, 0.24);
}

.smn-vfeed__progress::-moz-range-progress {
	height: 4px;
	background: #fff;
}

.smn-vfeed__progress::-moz-range-thumb {
	width: 4px;
	height: 4px;
	border: 0;
	background: transparent;
}

/* Stage-level, outside the scroller: the arrows must not travel with snap scroll. */
.smn-vfeed__nav {
	position: absolute;
	top: 50%;
	inset-inline-start: min(
		calc(50% + var(--smn-vfeed-frame-w, 0px) / 2 + 32px),
		calc(100% - 56px)
	);
	transform: translateY(-50%);
	z-index: 4;
	display: flex;
	flex-direction: column;
	gap: 16px;
	/* The overlay sits on top of the scroller: only the buttons may swallow wheel. */
	pointer-events: none;
}

.smn-vfeed__nav .smn-vfeed__arrow {
	pointer-events: auto;
}

.smn-vfeed__arrow {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.4);
	border-radius: 9999px;
	background: transparent;
	color: #fff;
	font-size: 16px;
	cursor: pointer;
}

.smn-vfeed__arrow:hover {
	opacity: 1;
	color: #fff;
	background: rgba(255, 255, 255, 0.16);
}

.smn-vfeed__arrow:disabled {
	opacity: 0.3;
	cursor: default;
}

@media (max-width: 991px) {
	.smn-vfeed__nav {
		display: none;
	}
}

