/*
 * Infinite scroll on product archives.
 */

/* Numbered pagination stays in the markup; the script takes over on screen. */
html.rua-infinite-ready .woocommerce-pagination {
	display: none;
}

.rua-infinite {
	align-items: center;
	color: #666;
	display: flex;
	flex-direction: column;
	font-size: 14px;
	gap: 12px;
	min-height: 64px;
	padding: 24px 0;
	text-align: center;
}

.rua-infinite__spinner {
	animation: rua-infinite-spin 0.8s linear infinite;
	border: 3px solid rgba(0, 0, 0, 0.1);
	border-radius: 50%;
	border-top-color: #7d1636;
	display: none;
	height: 28px;
	width: 28px;
}

.rua-infinite.is-loading .rua-infinite__spinner {
	display: block;
}

.rua-infinite__status {
	margin: 0;
}

/*
 * The retry button is toggled with the `hidden` attribute rather than a
 * class, because the theme's `.button` rule would otherwise win on
 * specificity and keep it on screen.
 */
.rua-infinite__retry[hidden] {
	display: none !important;
}

.rua-infinite.is-done {
	color: #999;
}

@keyframes rua-infinite-spin {
	to {
		transform: rotate(360deg);
	}
}

/*
 * Skeleton cards stand in for the next page while it loads: a photo block
 * in the theme's card ratio and two lines, with a light sweep across them.
 * The spinner stays out of the way while they are on screen.
 */
.rua-infinite.is-loading .rua-infinite__spinner {
	display: none;
}

.rua-skeleton {
	pointer-events: none;
}

.rua-skeleton__image,
.rua-skeleton__line {
	background: linear-gradient(100deg, rgba(0, 0, 0, 0.06) 40%, rgba(0, 0, 0, 0.11) 50%, rgba(0, 0, 0, 0.06) 60%);
	background-size: 240% 100%;
	animation: rua-skeleton-sweep 1.4s ease-in-out infinite;
}

.rua-skeleton__image {
	aspect-ratio: var(--rua-card-ratio, 3 / 4);
	border-radius: var(--rua-radius, 8px);
	margin-bottom: 12px;
}

.rua-skeleton__line {
	border-radius: 4px;
	height: 14px;
	margin-bottom: 8px;
	width: 80%;
}

.rua-skeleton__line--short {
	width: 40%;
}

@keyframes rua-skeleton-sweep {
	from {
		background-position: 120% 0;
	}
	to {
		background-position: -120% 0;
	}
}

/* Fetched cards rise into place one after another. */
.rua-arriving {
	animation: rua-arrive 420ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes rua-arrive {
	from {
		opacity: 0;
		transform: translateY(16px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.rua-infinite__spinner {
		animation-duration: 2s;
	}

	.rua-skeleton__image,
	.rua-skeleton__line {
		animation: none;
		background: rgba(0, 0, 0, 0.07);
	}

	.rua-arriving {
		animation: none;
	}
}
