/**
 * 首页「滚动卡片」
 * 卡片皮复用合集卡（.mytheme-home-bento__card--coll-item），这里只负责流动和两侧渐隐。
 * 半轨右侧留出与 gap 相同的空隙，translateX(-50%) 才能无缝接上。
 */

.mytheme-home-bento__cell[data-type='scroll_cards'] {
	display: flex;
	flex-direction: column;
	gap: 12px;
	height: auto;
	min-height: 0;
	min-width: 0;
}

.mytheme-home-scroll__viewport {
	--mytheme-scroll-gap: 16px;
	container-type: inline-size;
	container-name: home-scroll;
	min-width: 0;
	overflow: hidden;
	touch-action: pan-y;
}

.mytheme-home-scroll__viewport.is-running {
	-webkit-mask-image: linear-gradient(to right, transparent 0%, #000 8%, #000 92%, transparent 100%);
	mask-image: linear-gradient(to right, transparent 0%, #000 8%, #000 92%, transparent 100%);
}

.mytheme-home-scroll__track {
	display: flex;
	width: max-content;
	align-items: stretch;
}

.mytheme-home-scroll__viewport.is-running .mytheme-home-scroll__track {
	animation: mytheme-home-scroll-run var(--mytheme-scroll-dur, 40s) linear infinite;
}

.mytheme-home-scroll__viewport.is-running:hover .mytheme-home-scroll__track,
.mytheme-home-scroll__viewport.is-running:focus-within .mytheme-home-scroll__track {
	animation-play-state: paused;
}

@keyframes mytheme-home-scroll-run {
	from {
		transform: translate3d(0, 0, 0);
	}
	to {
		transform: translate3d(-50%, 0, 0);
	}
}

.mytheme-home-scroll__half {
	display: flex;
	align-items: stretch;
	gap: var(--mytheme-scroll-gap);
	padding-right: var(--mytheme-scroll-gap);
}

.mytheme-home-scroll__viewport:not(.is-running) .mytheme-home-scroll__half {
	padding-right: 0;
}

.mytheme-home-scroll__card {
	flex: 0 0 auto;
	width: max(
		180px,
		calc((100cqw - (var(--mytheme-scroll-per, 4) - 1) * var(--mytheme-scroll-gap)) / var(--mytheme-scroll-per, 4))
	);
	height: auto;
	min-height: 0;
}

@media (prefers-reduced-motion: reduce) {
	.mytheme-home-scroll__viewport.is-running {
		-webkit-mask-image: none;
		mask-image: none;
	}

	.mytheme-home-scroll__viewport.is-running .mytheme-home-scroll__track {
		animation: none;
	}

	.mytheme-home-scroll__half[aria-hidden='true'] {
		display: none;
	}

	.mytheme-home-scroll__half {
		flex-wrap: wrap;
		padding-right: 0;
	}
}
