/**
 *
 *   Nvm YouTube Shorts
 *   ==================
 *
 *   A row of vertical (9:16) video cards: one line of six on desktop, a
 *   swipeable strip on phones. Responsiville's generic button, list and image
 *   rules are overridden, hence the .responsiville prefix on some selectors.
 *
 */

.nvm-youtube-shorts {
	--nvm-youtube-shorts-ink  : #1f1f1f;
	--nvm-youtube-shorts-plum : var(--nvm-theme-color-purple);
	--nvm-youtube-shorts-gap  : clamp(12px, 1.6vw, 20px);

	box-sizing: border-box;
	max-width: 1240px;
	margin: 0 auto;
	padding: clamp(20px, 3vw, 40px);
	color: var(--nvm-youtube-shorts-ink);
}

.nvm-youtube-shorts__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 24px;
}

.responsiville .nvm-youtube-shorts h2.nvm-youtube-shorts__title {
	margin: 0;
	font-size: clamp(26px, 3vw, 38px);
	line-height: 1.2;
	color: var(--nvm-youtube-shorts-plum);
}

.responsiville .nvm-youtube-shorts p.nvm-youtube-shorts__text {
	margin: 8px 0 0;
	font-size: 16px;
	line-height: 1.6;
}

.responsiville .nvm-youtube-shorts a.nvm-youtube-shorts__channel {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 12px 24px;
	border: 0;
	border-radius: 999px;
	background: var(--nvm-youtube-shorts-plum);
	color: #fff;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	transition: opacity 0.2s ease;
}

.responsiville .nvm-youtube-shorts a.nvm-youtube-shorts__channel:hover,
.responsiville .nvm-youtube-shorts a.nvm-youtube-shorts__channel:focus-visible {
	opacity: 0.85;
}

.nvm-youtube-shorts__channel svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
}

.responsiville .nvm-youtube-shorts ul.nvm-youtube-shorts__list {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(0, 1fr);
	gap: var(--nvm-youtube-shorts-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.responsiville .nvm-youtube-shorts li.nvm-youtube-shorts__item {
	position: relative;
	margin: 0;
	padding: 0;
	aspect-ratio: 9 / 16;
	overflow: hidden;
	border-radius: 16px;
	background: #000;
}

.nvm-youtube-shorts__item::before {
	content: none;
}

.responsiville .nvm-youtube-shorts button.nvm-youtube-shorts__play {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	cursor: pointer;
}

/* The thumbnail is a 4:3 frame with the vertical video in its middle third. */
.responsiville .nvm-youtube-shorts .nvm-youtube-shorts__play img {
	display: block;
	width: 100%;
	height: 100% !important;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.nvm-youtube-shorts__play:hover img,
.nvm-youtube-shorts__play:focus-visible img {
	transform: scale(1.04);
}

.nvm-youtube-shorts__play:focus-visible {
	outline: 3px solid var(--nvm-youtube-shorts-plum);
	outline-offset: -3px;
}

.nvm-youtube-shorts__icon {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 56px;
	height: 56px;
	margin: -28px 0 0 -28px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	transition: background-color 0.2s ease;
}

.nvm-youtube-shorts__icon::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	margin: -10px 0 0 -6px;
	border-style: solid;
	border-width: 10px 0 10px 17px;
	border-color: transparent transparent transparent #fff;
}

.nvm-youtube-shorts__play:hover .nvm-youtube-shorts__icon,
.nvm-youtube-shorts__play:focus-visible .nvm-youtube-shorts__icon {
	background: #f00;
}

.nvm-youtube-shorts__caption {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	padding: 40px 12px 12px;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
	color: #fff;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.35;
	text-align: left;
}

.nvm-youtube-shorts__player {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Phones and small tablets: a horizontal strip, about two and a half cards
   visible, so it is obvious there is more to swipe to. */
@media (max-width: 959px) {

	.responsiville .nvm-youtube-shorts ul.nvm-youtube-shorts__list {
		grid-auto-columns: min(41%, 220px);
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
	}

	.nvm-youtube-shorts__list::-webkit-scrollbar {
		display: none;
	}

	.responsiville .nvm-youtube-shorts li.nvm-youtube-shorts__item {
		scroll-snap-align: start;
	}

	.nvm-youtube-shorts__caption {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 3;
		overflow: hidden;
		/* Bottom spacing as a border: line-clamp clips at the padding box, so a
		   bottom padding would show the start of a fourth line. */
		padding: 32px 10px 0;
		border-bottom: 10px solid transparent;
		font-size: 12px;
		word-break: normal;
		overflow-wrap: normal;
		hyphens: none;
	}
}
