/**
 * Carrusel «Estante virales»: flechas sobre el carrusel.
 * Difuminado en los bordes con capas (::before / ::after), no mask en el scroll
 * (evita el fallo donde el degradé solo se veía al pasar el cursor).
 */

.quiztheme-pulse-viral-shelf {
	--qt-viral-fade: rgb(245 246 252);
	overflow: visible;
}

.quiztheme-pulse-viral-shelf__slider {
	position: relative;
	overflow: visible;
}

/* Capas de difuminado: siempre visibles, por encima del scroll */
.quiztheme-pulse-viral-shelf__slider::before,
.quiztheme-pulse-viral-shelf__slider::after {
	content: "";
	position: absolute;
	top: 0.5rem;
	bottom: 2.25rem;
	width: 3.25rem;
	z-index: 15;
	pointer-events: none;
}

.quiztheme-pulse-viral-shelf__slider::before {
	left: 0;
	background: linear-gradient(
		to right,
		var(--qt-viral-fade) 0,
		rgb(245 246 252 / 0.72) 35%,
		rgb(245 246 252 / 0.2) 72%,
		transparent 100%
	);
}

.quiztheme-pulse-viral-shelf__slider::after {
	right: 0;
	background: linear-gradient(
		to left,
		var(--qt-viral-fade) 0,
		rgb(245 246 252 / 0.72) 35%,
		rgb(245 246 252 / 0.2) 72%,
		transparent 100%
	);
}

.quiztheme-pulse-viral-shelf__viewport {
	overflow-x: auto;
	overflow-y: visible;
	scroll-behavior: smooth;
	scroll-snap-type: x mandatory;
	scroll-padding-inline: 0.75rem;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	padding: 0.75rem 3rem;
	box-sizing: border-box;
	position: relative;
	z-index: 1;
	min-width: 0;
}

/* Tarjeta: ancho por defecto escritorio (equivale a w-80) */
.quiztheme-pulse-viral-shelf__card {
	flex-shrink: 0;
	box-sizing: border-box;
	width: 20rem;
	max-width: 100%;
}

@media (max-width: 767px) {
	.quiztheme-pulse-viral-shelf__slider::before,
	.quiztheme-pulse-viral-shelf__slider::after {
		content: none;
		display: none;
	}

	/*
	 * Una tarjeta por vista: flex en el viewport (no grid: en varios motores la rejilla
	 * encogía todas las columnas y scrollWidth = clientWidth → sin scroll y flechas hidden).
	 * Track con display:contents: cada .__card es hijo flex del viewport; 100 % = ancho útil.
	 */
	.quiztheme-pulse-viral-shelf__viewport {
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: flex-start;
		gap: 0.65rem;
		/* Sin padding horizontal: el ancho útil = todo el carrusel (flechas van en absolute). Antes 2.125rem × 2 robaba ~68px y fijaba ~207px en muchos móviles. */
		padding: 0.45rem 0 2.5rem;
		padding-left: max( 0px, env( safe-area-inset-left, 0px ) );
		padding-right: max( 0px, env( safe-area-inset-right, 0px ) );
		scroll-padding-inline: 0;
	}

	.quiztheme-pulse-viral-shelf .quiztheme-pulse-viral-shelf__track {
		display: contents !important;
		gap: 0 !important;
	}

	.quiztheme-pulse-viral-shelf__card {
		flex: 0 0 var(--qt-viral-slot, 100%);
		width: var(--qt-viral-slot, auto);
		min-width: 0;
		max-width: var(--qt-viral-slot, none);
		box-sizing: border-box;
	}

	.quiztheme-pulse-viral-shelf__card h3 {
		font-size: 1.05rem;
	}

	.quiztheme-pulse-viral-shelf__card .aspect-video {
		margin-bottom: 0.65rem;
	}
}

.quiztheme-pulse-viral-shelf__viewport::-webkit-scrollbar {
	display: none;
}

.quiztheme-pulse-viral-shelf__track {
	min-height: min-content;
}

.quiztheme-pulse-viral-shelf__btn {
	position: absolute;
	top: 38%;
	transform: translateY(-50%);
	z-index: 20;
	width: 2.75rem;
	height: 2.75rem;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0;
	border: none;
	border-radius: 9999px;
	background: #fff;
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
	cursor: pointer;
	color: #2c2f33;
	transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.quiztheme-pulse-viral-shelf__btn:hover:not(:disabled) {
	box-shadow: 0 6px 22px rgba(0, 0, 0, 0.16);
	transform: translateY(-50%) scale(1.05);
}

.quiztheme-pulse-viral-shelf__btn:disabled {
	opacity: 0.3;
	cursor: default;
	transform: translateY(-50%);
}

.quiztheme-pulse-viral-shelf__btn--prev {
	left: 0.25rem;
}

.quiztheme-pulse-viral-shelf__btn--next {
	right: 0.25rem;
}

.quiztheme-pulse-viral-shelf__btn .material-symbols-outlined {
	font-size: 1.5rem;
	line-height: 1;
}

@media (max-width: 640px) {
	.quiztheme-pulse-viral-shelf__btn {
		width: 2.25rem;
		height: 2.25rem;
	}

	.quiztheme-pulse-viral-shelf__btn--prev {
		left: 0;
	}

	.quiztheme-pulse-viral-shelf__btn--next {
		right: 0;
	}
}
