/**
 * Numeric pagination + optional Load more under the product grid (category archives).
 */

/* Stack numeric nav above auto-load sentinel (matches typical layout) */
.cpchp-pagination-toolbar {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	width: 100%;
	max-width: 1340px;
	margin-left: auto;
	margin-right: auto;
	padding-left: 1rem;
	padding-right: 1rem;
	box-sizing: border-box;
}

/* Scroll sentinel: triggers auto-load when near viewport bottom (see cpchp-load-more.js) */
.cpchp-load-more-wrap.cpchp-auto-load {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	flex-shrink: 0;
	width: 100%;
	position: relative;
}

.cpchp-auto-load-sentinel {
	height: 1px;
	width: 100%;
	margin: 0;
	padding: 0;
	pointer-events: none;
	overflow: hidden;
}

.cpchp-loader {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 0;
	overflow: hidden;
	opacity: 0;
	transition: opacity 0.2s ease, min-height 0.2s ease;
}

.cpchp-load-more-wrap.cpchp-auto-load.is-loading .cpchp-loader {
	min-height: 3rem;
	opacity: 1;
}

.cpchp-loader-img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	image-rendering: auto;
}

.cpchp-numeric-pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 2rem auto 1.5rem;
	padding: 0;
	list-style: none;
	width: 100%;
	box-sizing: border-box;
}

.cpchp-numeric-pagination ul.page-numbers {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cpchp-numeric-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.25rem;
	height: 2.25rem;
	padding: 0 0.35rem;
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	color: #1e73be;
	background: #f7f7f7;
	border: 1px solid #d9d9d9;
	border-radius: 2px;
	box-sizing: border-box;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cpchp-numeric-pagination a.page-numbers:hover:not(.current),
.cpchp-numeric-pagination a.page-numbers:focus:not(.current) {
	color: #135a99;
	background: #fff;
	border-color: #b0b0b0;
	outline: none;
}

/* Strong active state — must be clearly distinct from other page buttons */
.cpchp-numeric-pagination .page-numbers.current {
	color: #fff;
	background: #1e73be;
	border-color: #135a99;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
	cursor: default;
	font-weight: 700;
}

.cpchp-numeric-pagination.cpchp-is-loading .page-numbers.current {
	opacity: 1;
}

/* While AJAX is in flight, subtle pulse so users see which page is “in progress” */
.cpchp-numeric-pagination.cpchp-is-loading .page-numbers.current {
	animation: cpchp-pulse 1s ease-in-out infinite;
}

@keyframes cpchp-pulse {
	0%,
	100% {
		filter: brightness(1);
	}
	50% {
		filter: brightness(1.12);
	}
}

.cpchp-numeric-pagination .page-numbers.dots {
	min-width: auto;
	padding: 0 0.25rem;
	border: none;
	background: transparent;
	color: #666;
}

.cpchp-wrap--fallback {
	max-width: 1340px;
	margin-left: auto;
	margin-right: auto;
	padding-left: 1rem;
	padding-right: 1rem;
}

/*
 * AJAX-appended products use classic WooCommerce loop markup (h2.woocommerce-loop-product__title).
 * Block-rendered cards use h3 with scoped rules; global h1–h6 { clamp(...) } would otherwise make
 * those h2 titles huge. Match the theme’s product card title sizing (see .product-list li h3).
 */
ul.wp-block-post-template > li.product h2.woocommerce-loop-product__title,
ul.wp-block-post-template > li.type-product h2.woocommerce-loop-product__title {
	font-size: var(--size18, 1.125rem) !important;
	font-weight: 600;
	line-height: 22px;
	letter-spacing: 0.45px;
	margin: 8px 0 6px 0;
	padding-left: 10px;
	padding-right: 10px;
	text-align: left;
	color: var(--wp--preset--color--black, #1a1a1a);
	font-family: var(--wp--preset--font-family--montserrat-semi-bold, "Montserrat", system-ui, sans-serif);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
}

@media (max-width: 991px) {
	ul.wp-block-post-template > li.product h2.woocommerce-loop-product__title,
	ul.wp-block-post-template > li.type-product h2.woocommerce-loop-product__title {
		margin-bottom: 0 !important;
	}
}

/*
 * Classic loop markup inside block grid: full-width image + one row with price (left) and rating (right).
 * Matches .product-list / wc-block card layout from the theme.
 */
ul.wp-block-post-template > li.product a.woocommerce-loop-product__link,
ul.wp-block-post-template > li.type-product a.woocommerce-loop-product__link {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	column-gap: 0.5rem;
	row-gap: 0.25rem;
	text-decoration: none;
}

ul.wp-block-post-template > li.product a.woocommerce-loop-product__link > span.onsale,
ul.wp-block-post-template > li.type-product a.woocommerce-loop-product__link > span.onsale,
ul.wp-block-post-template > li.product a.woocommerce-loop-product__link > .onsale,
ul.wp-block-post-template > li.type-product a.woocommerce-loop-product__link > .onsale {
	flex: 0 0 100%;
}

/* Landscape rectangle — matches typical WooCommerce block product-image cards (not 1:1 square). */
ul.wp-block-post-template > li.product a.woocommerce-loop-product__link > img,
ul.wp-block-post-template > li.type-product a.woocommerce-loop-product__link > img {
	flex: 0 0 100%;
	width: 100%;
	max-width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	object-position: center;
	display: block;
	border-top-left-radius: 8px;
	border-top-right-radius: 8px;
}

ul.wp-block-post-template > li.product a.woocommerce-loop-product__link > h2.woocommerce-loop-product__title,
ul.wp-block-post-template > li.type-product a.woocommerce-loop-product__link > h2.woocommerce-loop-product__title {
	flex: 0 0 100%;
	width: 100%;
	box-sizing: border-box;
}

/* Price left — cap width so rating + “(N reviews)” keeps one line on the right */
ul.wp-block-post-template > li.product a.woocommerce-loop-product__link > .price,
ul.wp-block-post-template > li.type-product a.woocommerce-loop-product__link > .price {
	flex: 1 1 auto;
	min-width: 0;
	max-width: 50%;
	text-align: left;
	align-self: center;
	margin-top: 0.35rem;
	margin-bottom: 0.35rem;
	padding-left: 10px;
	padding-right: 0.35rem;
	color: var(--wp--preset--color--secondry-color, #1e73be);
	font-size: var(--size18, 1.125rem);
	font-weight: 600;
	line-height: 22px;
	font-family: var(--wp--preset--font-family--montserrat-medium, "Montserrat", system-ui, sans-serif);
}

/* Rating + “(N reviews)” on one line, right — do not shrink (fixes wrap to second line) */
ul.wp-block-post-template > li.product a.woocommerce-loop-product__link > .wc-block-components-product-rating__container,
ul.wp-block-post-template > li.type-product a.woocommerce-loop-product__link > .wc-block-components-product-rating__container,
ul.wp-block-post-template > li.product a.woocommerce-loop-product__link > .star-rating,
ul.wp-block-post-template > li.type-product a.woocommerce-loop-product__link > .star-rating {
	flex: 0 0 auto;
	flex-shrink: 0;
	margin-left: auto;
	align-self: center;
	margin-top: 0.35rem;
	margin-bottom: 0.35rem;
	padding-right: 10px;
	padding-left: 0.25rem;
	max-width: none;
	min-width: max-content;
	white-space: nowrap !important;
	display: inline-flex !important;
	align-items: center !important;
	flex-wrap: nowrap !important;
	gap: 4px;
	line-height: 1.2;
}

ul.wp-block-post-template > li.product a.woocommerce-loop-product__link > .wc-block-components-product-rating__container .review-count,
ul.wp-block-post-template > li.type-product a.woocommerce-loop-product__link > .wc-block-components-product-rating__container .review-count,
ul.wp-block-post-template > li.product a.woocommerce-loop-product__link > .wc-block-components-product-rating__container a,
ul.wp-block-post-template > li.type-product a.woocommerce-loop-product__link > .wc-block-components-product-rating__container a {
	white-space: nowrap !important;
}

/* Inner <a> replaced by <span data-cpchp-reviews-href> — keep link affordance */
ul.wp-block-post-template > li.product [data-cpchp-reviews-href],
ul.wp-block-post-template > li.type-product [data-cpchp-reviews-href] {
	cursor: pointer;
	text-decoration: none;
}

/* Only price, no rating: full width */
ul.wp-block-post-template > li.product a.woocommerce-loop-product__link > .price:last-child,
ul.wp-block-post-template > li.type-product a.woocommerce-loop-product__link > .price:last-child {
	flex: 0 0 100%;
	margin-left: 0;
	padding-right: 10px;
}
