/*
 * Bursts: the portrait feed (apps/bursts.php) and the shelf at the top of /videos/.
 *
 * The feed is the one dark, full height page in an otherwise light site, the way
 * the Shorts player sits inside youtube.com. It fills the window below the fixed
 * masthead (bursts.js measures where that ends into --bursts-top) and is the only
 * thing that scrolls, one burst per snap. It is position: fixed, so nothing in the
 * page's own spacing above it can push it under the masthead.
 */

/* ---------- the feed page ---------- */

body.imatest-bursts-page {
	background: #000;
	overflow: hidden;
}
body.imatest-bursts-page #colophon,
body.imatest-bursts-page #footer-sidebar {
	display: none;
}

.imatest-bursts {
	--bursts-top: 62px;
	position: fixed;
	top: var(--bursts-top);
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1;
	overflow-y: auto;
	scroll-snap-type: y mandatory;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	background: #000;
	color: #fff;
	scrollbar-width: none;
}
.imatest-bursts::-webkit-scrollbar {
	display: none;
}

.imatest-burst {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	padding: 10px 0;
	box-sizing: border-box;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

.imatest-burst-frame {
	position: relative;
	height: 100%;
	aspect-ratio: 9 / 16;
	max-width: 100%;
	background: #111;
	border-radius: 12px;
	overflow: hidden;
}
.imatest-burst-video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
	cursor: pointer;
}
.imatest-burst-missing,
.imatest-bursts-empty {
	padding: 40px 20px;
	color: #ccc;
	text-align: center;
}

/* Title and description over the bottom of the video, as on the apps. */
.imatest-burst-info {
	position: absolute;
	left: 0;
	right: 64px;
	bottom: 0;
	padding: 48px 16px 18px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
	pointer-events: none;
}
.imatest-burst-title {
	margin: 0 0 4px;
	color: #fff;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.imatest-burst-about {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	color: rgba(255, 255, 255, 0.9);
	font-size: 14px;
	line-height: 1.4;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* Sound and share, stacked on the right. */
.imatest-burst-actions {
	position: absolute;
	right: 10px;
	bottom: 22px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.imatest-burst-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 0;
	border: 0;
	background: none;
	color: #fff;
	font-size: 11px;
	cursor: pointer;
}
.imatest-burst-btn[hidden] {
	display: none;
}
.imatest-burst-icon {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background-color: rgba(0, 0, 0, 0.45);
	background-position: center;
	background-repeat: no-repeat;
	background-size: 22px 22px;
}
.imatest-burst-btn:hover .imatest-burst-icon,
.imatest-burst-btn:focus-visible .imatest-burst-icon {
	background-color: rgba(255, 255, 255, 0.25);
}
.imatest-burst-sound .imatest-burst-icon {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4V5z' fill='white'/%3E%3Cpath d='m23 9-6 6M17 9l6 6'/%3E%3C/svg%3E");
}
.imatest-burst-sound[aria-pressed="true"] .imatest-burst-icon {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H2v6h4l5 4V5z' fill='white'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7M19 5a10 10 0 0 1 0 14'/%3E%3C/svg%3E");
}
.imatest-burst-share .imatest-burst-icon {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12v7a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-7'/%3E%3Cpath d='m16 6-4-4-4 4M12 2v13'/%3E%3C/svg%3E");
}

/* Play/pause flash in the middle when the video is tapped. */
.imatest-burst-state {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 72px;
	height: 72px;
	margin: -36px 0 0 -36px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.5) center / 32px 32px no-repeat;
	opacity: 0;
	pointer-events: none;
}
.imatest-burst-state[data-state="pause"] {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Crect x='6' y='4' width='4' height='16'/%3E%3Crect x='14' y='4' width='4' height='16'/%3E%3C/svg%3E");
}
.imatest-burst-state[data-state="play"] {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M7 4v16l13-8z'/%3E%3C/svg%3E");
}
.imatest-burst-state.is-shown {
	animation: imatest-burst-flash 0.7s ease-out;
}
@keyframes imatest-burst-flash {
	0% { opacity: 1; transform: scale(0.9); }
	100% { opacity: 0; transform: scale(1.15); }
}

.imatest-burst-progress {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 3px;
	background: rgba(255, 255, 255, 0.25);
}
.imatest-burst-progress span {
	display: block;
	width: 0;
	height: 100%;
	background: #fff;
}

/* Back to the library, and previous/next for mouse and keyboard users. */
.imatest-bursts-nav {
	position: fixed;
	top: calc(var(--bursts-top) + 14px);
	left: 14px;
	right: 14px;
	bottom: 0;
	pointer-events: none;
	z-index: 2;
}
.imatest-bursts-back,
.imatest-bursts-step {
	pointer-events: auto;
}
.imatest-bursts-back {
	display: inline-block;
	padding: 7px 14px 7px 12px;
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	font-size: 14px;
	text-decoration: none;
}
.imatest-bursts-back::before {
	content: "\2039\00a0";
}
.imatest-bursts-back:hover,
.imatest-bursts-back:focus {
	background: rgba(255, 255, 255, 0.26);
	color: #fff;
	text-decoration: none;
}
.imatest-bursts-step {
	position: absolute;
	right: 10px;
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14) center / 22px 22px no-repeat;
	color: transparent;
	font-size: 0;
	cursor: pointer;
}
.imatest-bursts-step[hidden] {
	display: none;
}
.imatest-bursts-step[data-step="-1"] {
	top: calc(50% - 56px);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 15 6-6 6 6'/%3E%3C/svg%3E");
}
.imatest-bursts-step[data-step="1"] {
	top: calc(50% + 8px);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.imatest-bursts-step:hover,
.imatest-bursts-step:focus-visible {
	background-color: rgba(255, 255, 255, 0.28);
}
.imatest-bursts-step:disabled {
	opacity: 0.3;
	cursor: default;
}

.imatest-bursts-toast {
	position: fixed;
	left: 50%;
	bottom: 28px;
	margin: 0;
	padding: 8px 16px;
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.92);
	color: #111;
	font-size: 14px;
	opacity: 0;
	transform: translateX(-50%);
	transition: opacity 0.2s;
	pointer-events: none;
	z-index: 3;
}
.imatest-bursts-toast.is-shown {
	opacity: 1;
}

/* After the last burst: a stop of its own that carries on to the video library. */
.imatest-bursts-end {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	height: 100%;
	padding: 20px;
	box-sizing: border-box;
	scroll-snap-align: start;
	scroll-snap-stop: always;
	color: #fff;
	text-align: center;
}
.imatest-bursts-end-title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
}
.imatest-bursts-end-link {
	display: inline-block;
	padding: 10px 22px;
	border-radius: 22px;
	background: #fff;
	color: #111;
	font-weight: 600;
	text-decoration: none;
}
.imatest-bursts-end-link:hover,
.imatest-bursts-end-link:focus {
	color: #111;
	text-decoration: none;
}
.imatest-bursts-end.is-leaving .imatest-bursts-end-link::after {
	content: "\2026";
}

/* Phones: edge to edge, as the apps are. Swiping replaces the step buttons. */
@media (max-width: 767px) {
	/* Nothing but the video: the site's top bar and the chat bubble go, as the apps
	   have no chrome over the player. "All videos" stays as the way out. */
	body.imatest-bursts-page #masthead,
	body.imatest-bursts-page .imatest-chat-link {
		display: none !important;
	}
	.imatest-burst {
		padding: 0;
	}
	.imatest-burst-frame {
		width: 100%;
		aspect-ratio: auto;
		border-radius: 0;
	}
	.imatest-burst-video {
		object-fit: cover;
	}
	.imatest-bursts-step {
		display: none;
	}
	.imatest-bursts-nav {
		top: calc(var(--bursts-top) + 10px);
		left: 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.imatest-burst-state.is-shown {
		animation: none;
	}
}

/* ---------- the shelf on /videos/ ---------- */

.imatest-bursts-shelf {
	margin: 0 0 34px;
}
.imatest-bursts-shelf-title {
	margin: 0 0 12px;
	font-size: 22px;
}
.imatest-bursts-shelf-title a {
	text-decoration: none;
}
.imatest-bursts-shelf-list {
	display: flex;
	gap: 14px;
	margin: 0;
	padding: 0 0 8px;
	overflow-x: auto;
	list-style: none;
	scroll-snap-type: x proximity;
}
.imatest-bursts-shelf-list li {
	flex: 0 0 160px;
	scroll-snap-align: start;
}
.imatest-bursts-shelf-card {
	display: block;
	text-decoration: none;
}
.imatest-bursts-shelf-card:hover,
.imatest-bursts-shelf-card:focus {
	text-decoration: none;
}
.imatest-bursts-shelf-thumb {
	display: block;
	position: relative;
	aspect-ratio: 9 / 16;
	background: #222;
	border-radius: 10px;
	overflow: hidden;
}
.imatest-bursts-shelf-thumb img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.2s;
}
.imatest-bursts-shelf-card:hover img {
	transform: scale(1.04);
}
.imatest-bursts-shelf-name {
	display: -webkit-box;
	margin-top: 8px;
	overflow: hidden;
	font-weight: 600;
	line-height: 1.35;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* Where the end of the bursts feed lands: the top of the regular videos, clear of the fixed masthead. */
#all-videos {
	scroll-margin-top: calc(var(--imatest-masthead-offset, 78px) + 16px);
}
