/* =====================================================================
 * Product archive infinite scroll — loader + state styles.
 *
 * Enqueued only on WooCommerce archives (shop, product_cat, product_tag,
 * product_taxonomy) by /add-ons/utils/product-archive-infinite.php.
 *
 * Scope prefix `body.has-infinite-product-archive` is added by the JS
 * module on boot; this lets the CSS hide the legacy pagination only when
 * JS is actually running (graceful fallback to native pagination when JS
 * is off or fails).
 * =================================================================== */

.product-archive-sentinel {
	/* Invisible observer anchor — sits at the bottom of the product grid.
	   Keep it in flow (height: 1px) so it reliably enters the viewport as
	   the user scrolls, even on short pages. */
	height: 1px;
	margin: 0;
	padding: 0;
	pointer-events: none;
}

/* Hide the native pagination when JS is driving the page.
   Without this class (JS off / failed), the pagination stays visible. */
body.has-infinite-product-archive .woocommerce-pagination {
	display: none !important;
}

/* ---------------------------------------------------------------------
 * Loading indicator — three pulse-dots centered under the grid
 * ------------------------------------------------------------------- */
.product-archive-loader {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	padding: 2.5rem 1rem 3rem;
	color: #4b5563;
	font-size: 0.9rem;
	font-weight: 600;
	letter-spacing: 0.02em;
}

.product-archive-loader[hidden] {
	display: none !important;
}

.product-archive-loader__dots {
	display: inline-flex;
	gap: 0.5rem;
	align-items: center;
}

.product-archive-loader__dots span {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: linear-gradient(135deg, #F26322 0%, #d14d16 100%);
	box-shadow: 0 2px 8px rgba(242, 99, 34, 0.35);
	animation: product-archive-bounce 1.2s infinite ease-in-out both;
}

.product-archive-loader__dots span:nth-child(1) { animation-delay: -0.32s; }
.product-archive-loader__dots span:nth-child(2) { animation-delay: -0.16s; }
.product-archive-loader__dots span:nth-child(3) { animation-delay: 0s; }

@keyframes product-archive-bounce {
	0%, 80%, 100% {
		transform: scale(0.6);
		opacity: 0.6;
	}
	40% {
		transform: scale(1);
		opacity: 1;
	}
}

.product-archive-loader__text {
	color: #6b7280;
	font-size: 0.85rem;
	letter-spacing: 0.04em;
}

@media (prefers-reduced-motion: reduce) {
	.product-archive-loader__dots span {
		animation: none;
		opacity: 0.85;
	}
}

/* ---------------------------------------------------------------------
 * End-of-inventory state
 * ------------------------------------------------------------------- */
.product-archive-end {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 2rem 1rem 3rem;
	color: #9ca3af;
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.product-archive-end[hidden] {
	display: none !important;
}

.product-archive-end .bi {
	font-size: 1rem;
	color: #F26322;
	opacity: 0.8;
}

/* ---------------------------------------------------------------------
 * Newly-appended cards animate in so the infinite scroll feels alive
 * rather than cards just popping into existence. We can't attach this
 * via the PHP markup (cached), so use a tiny CSS animation that runs
 * on every .product that's freshly in the DOM — flash is imperceptible
 * for initial-page cards since they're already in view on load.
 * ------------------------------------------------------------------- */
body.has-infinite-product-archive .products > .product {
	animation: product-archive-enter 0.45s ease-out both;
}

@keyframes product-archive-enter {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	body.has-infinite-product-archive .products > .product {
		animation: none;
	}
}
