/*
 * RahkarTheme — product-reviews.css
 *
 * Loaded ONLY on is_product() pages where the reviews section will render
 * (see enqueue.php feature registry: 'product-reviews'). Zero bytes
 * elsewhere.
 *
 * Layout strategy:
 *   desktop  →  two-column body: cards list on the right, summary card on
 *               the left (RTL flips this: visually summary is top-right of
 *               the page, list is on the left/below). Vertical card list.
 *   mobile   →  stacked: summary card on top, then a horizontal scroll
 *               rail of cards with a final "view all" tile.
 *
 * All styling driven by theme.json tokens (--wp--preset--color--*) so the
 * primary color follows the theme without hardcoding.
 */

/* ===== Root ============================================================ */

.rh-reviews {
	margin-block-start: var(--wp--preset--spacing--30, 1rem);
}

/* ===== Body grid (desktop two-column) ================================== */

.rh-reviews__body {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1rem;
}

@media (min-width: 900px) {
	.rh-reviews__body {
		/*
		 * Summary on the visual RIGHT (RTL reading start), comment list on
		 * the visual LEFT. With direction:rtl the first grid track lays out
		 * at the right edge, so 280px goes first to anchor the summary to
		 * the right; minmax(0, 1fr) takes the remaining width on the left
		 * for the cards (and the empty-state copy).
		 */
		grid-template-columns: 280px minmax(0, 1fr);
		align-items: start;
		gap: 1.5rem;
	}
}

/* ===== Summary card =================================================== */

.rh-reviews__summary {
	background: var(--wp--preset--color--base, #fff);
	border: 1px solid var(--wp--preset--color--border, #e2e4e9);
	border-radius: 0.75rem;
	padding: 1rem 1rem 1.125rem;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0.5rem;
	/* On desktop the summary is the second grid column (i.e. visually
	   right of the list in RTL). On mobile it's just the first item. */
}

@media (min-width: 900px) {
	.rh-reviews__summary {
		grid-column: 1;
		position: sticky;
		top: calc(var(--rh-header-height, 64px) + 1rem);
	}
}

.rh-reviews__summary-title {
	margin: 0 0 0.25rem;
	font-size: var(--wp--preset--font-size--md, 1.125rem);
	font-weight: 700;
	color: var(--wp--preset--color--contrast, #0f1115);
}

.rh-reviews__summary-score {
	display: flex;
	align-items: baseline;
	gap: 0.375rem;
	margin-block-start: 0.25rem;
}

.rh-reviews__summary-avg {
	font-size: 2rem;
	font-weight: 700;
	line-height: 1;
	color: var(--wp--preset--color--contrast, #0f1115);
	letter-spacing: -0.01em;
}

.rh-reviews__summary-avg-of {
	font-size: 1rem;
	font-weight: 500;
	color: var(--wp--preset--color--text-muted, #5b6271);
	margin-inline-start: 0.125rem;
}

.rh-reviews__summary-count {
	font-size: var(--wp--preset--font-size--sm, 0.875rem);
	color: var(--wp--preset--color--text-muted, #5b6271);
}

.rh-reviews__summary-stars {
	margin-block-start: 0.125rem;
}

.rh-reviews__summary-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--wp--custom--button--gap, 8px);
	box-sizing: border-box;
	width: 100%;
	text-align: center;
	margin-block-start: 0.75rem;
	min-height: var(--wp--custom--button--h--md, 44px);
	padding: 0 var(--wp--custom--button--px--md, 20px);
	border: 1px solid var(--wp--preset--color--primary, #0a66c2);
	color: var(--wp--preset--color--primary, #0a66c2);
	background: transparent;
	border-radius: var(--wp--custom--button--radius, 10px);
	font-weight: var(--wp--custom--button--fw, 600);
	font-size: var(--wp--custom--button--fs--md, 0.9375rem);
	text-decoration: none;
	transition: background-color 120ms ease, color 120ms ease;
}

.rh-reviews__summary-cta:hover,
.rh-reviews__summary-cta:focus-visible {
	background: var(--wp--preset--color--primary, #0a66c2);
	color: var(--wp--preset--color--base, #fff);
}

.rh-reviews__summary-cta--inline {
	display: inline-block;
	margin-block-start: 0;
}

/* ===== List (desktop) / rail (mobile) ================================== */

.rh-reviews__list {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

@media (min-width: 900px) {
	.rh-reviews__list {
		grid-column: 2;
	}
}

/*
 * Mobile horizontal scroll rail.
 *
 *   - flex-direction: row reverses to a single horizontal track
 *   - scroll-snap-type makes each card snap into the viewport on swipe
 *   - overflow-x: auto enables native scroll with native momentum
 *   - scroll-padding-inline accounts for the RTL padding so the first
 *     card aligns to the page padding edge
 *
 * The card width is ~72vw so that, after the page padding (1rem) and the
 * inter-card gap (0.625rem), roughly 30% of the NEXT card peeks in — a clear
 * "there's more, swipe" affordance without arrows. (At 360–414px viewports
 * the peek lands at ≈0.3 × card width.)
 */
@media (max-width: 899px) {
	.rh-reviews__list {
		flex-direction: row;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scroll-padding-inline: 1rem;
		/* breakout to viewport edge — match other full-bleed mobile rails */
		margin-inline: calc(50% - 50vw);
		padding-inline: 1rem;
		padding-block: 0.25rem 0.5rem;
		gap: 0.625rem;
		/* hide native scrollbar — content already affordances horizontal */
		scrollbar-width: none;
	}
	.rh-reviews__list::-webkit-scrollbar { display: none; }

	.rh-reviews__list > * {
		flex: 0 0 72vw;
		max-width: 22rem;
		scroll-snap-align: start;
	}
}

/* ===== Card =========================================================== */

.rh-reviews__card {
	background: var(--wp--preset--color--base, #fff);
	border: 1px solid var(--wp--preset--color--border, #e2e4e9);
	border-radius: 0.75rem;
	padding: 0.875rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.rh-reviews__card-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	min-height: 1.25rem;
}

.rh-reviews__card-stars {
	display: inline-flex;
	align-items: center;
}

.rh-reviews__card-meta {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: var(--wp--preset--font-size--xs, 0.75rem);
	color: var(--wp--preset--color--text-muted, #5b6271);
}

.rh-reviews__card-author {
	font-weight: 600;
	color: var(--wp--preset--color--text, #1a1d23);
}

.rh-reviews__card-sep {
	color: var(--wp--preset--color--border, #e2e4e9);
}

.rh-reviews__card-body {
	font-size: var(--wp--preset--font-size--sm, 0.875rem);
	line-height: 1.7;
	color: var(--wp--preset--color--text, #1a1d23);
}

.rh-reviews__card-body p {
	margin: 0;
}

.rh-reviews__card-body p + p {
	margin-block-start: 0.5rem;
}

/*
 * Long-review clamp.
 *
 *   - max-height = 5 lines × line-height(1.7) × font-size(--sm). Calc keeps
 *     the math token-driven so a font-size change in theme.json scales the
 *     clamp automatically — no magic pixel number to maintain.
 *   - The fade gradient at the bottom hints there's more to read without
 *     adding an arrow. mask-image rather than ::after so it works over any
 *     background colour (the card might sit on surface, base, or muted).
 *   - is-expanded removes the cap; we cap to a generous 9999px instead of
 *     `none` so the height transition stays animatable if we add one later.
 *
 *  The .has-clamp gate is added by JS only when scrollHeight actually
 *  exceeds clientHeight, so short reviews are never clipped or faded.
 *  Without JS (the .rh-reviews has no .is-clamp-ready class) the clamp is
 *  off — the SSR HTML shows full content, which is the safer no-JS default.
 */
.rh-reviews.is-clamp-ready .rh-reviews__card-body--clamped.has-clamp {
	max-height: calc(5 * 1.7 * var(--wp--preset--font-size--sm, 0.875rem));
	overflow: hidden;
	-webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
	mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
}

.rh-reviews.is-clamp-ready .rh-reviews__card-body--clamped.has-clamp.is-expanded {
	max-height: 9999px;
	-webkit-mask-image: none;
	mask-image: none;
}

.rh-reviews__card-toggle {
	align-self: flex-start;
	background: transparent;
	border: 0;
	padding: 0;
	margin-block-start: 0.125rem;
	color: var(--wp--preset--color--primary, #0a66c2);
	font: inherit;
	font-size: var(--wp--preset--font-size--xs, 0.75rem);
	font-weight: 600;
	cursor: pointer;
	line-height: 1.6;
}

.rh-reviews__card-toggle:hover,
.rh-reviews__card-toggle:focus-visible {
	text-decoration: underline;
}

/* ===== Badge ("خریدار") ================================================ */

.rh-reviews__badge {
	display: inline-flex;
	align-items: center;
	padding: 0.125rem 0.5rem;
	border-radius: 999px;
	font-size: var(--wp--preset--font-size--xs, 0.75rem);
	font-weight: 600;
	line-height: 1.6;
}

.rh-reviews__badge--buyer {
	background: color-mix(in srgb, var(--wp--preset--color--success, #198754) 12%, transparent);
	color: var(--wp--preset--color--success, #198754);
}

/* ===== Stars =========================================================== */

.rh-reviews__stars {
	display: inline-flex;
	align-items: center;
	gap: 0.125rem;
}

.rh-reviews__star--solid {
	color: var(--wp--preset--color--warning, #d97706);
}

.rh-reviews__star--outline {
	color: var(--wp--preset--color--border, #e2e4e9);
}

/* ===== "View all" tile (mobile only) =================================== */

.rh-reviews__viewall-tile {
	display: none;
}

@media (max-width: 899px) {
	.rh-reviews__viewall-tile {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 0.5rem;
		background: var(--wp--preset--color--surface, #f7f7f8);
		border: 1px solid var(--wp--preset--color--border, #e2e4e9);
		border-radius: 0.75rem;
		padding: 1rem;
		text-decoration: none;
		color: var(--wp--preset--color--text, #1a1d23);
		text-align: center;
	}
	.rh-reviews__viewall-icon {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 2.5rem;
		height: 2.5rem;
		border-radius: 999px;
		background: var(--wp--preset--color--base, #fff);
		border: 1px solid var(--wp--preset--color--border, #e2e4e9);
		color: var(--wp--preset--color--text, #1a1d23);
	}
	.rh-reviews__viewall-label {
		font-weight: 600;
		font-size: var(--wp--preset--font-size--sm, 0.875rem);
	}
	.rh-reviews__viewall-count {
		font-size: var(--wp--preset--font-size--xs, 0.75rem);
		color: var(--wp--preset--color--text-muted, #5b6271);
	}
}

/* Desktop view-all link (under list) */
.rh-reviews__foot {
	margin-block-start: 1rem;
	text-align: center;
}

.rh-reviews__viewall-link {
	display: inline-block;
	font-weight: 600;
	font-size: var(--wp--preset--font-size--sm, 0.875rem);
	color: var(--wp--preset--color--primary, #0a66c2);
	text-decoration: none;
}

.rh-reviews__viewall-link:hover,
.rh-reviews__viewall-link:focus-visible {
	text-decoration: underline;
}

@media (max-width: 899px) {
	/* On mobile the rail tile already plays this role — hide the duplicate. */
	.rh-reviews__foot { display: none; }
}

/* ===== Empty state ====================================================== */

/*
 * Inviting two-up: copy block on the right (RTL start), chat-bubble icon
 * on the left. No background card — the message is meant to feel light,
 * not like a placeholder error. The summary card on the right already
 * provides the "افزودن دیدگاه جدید" CTA; we don't repeat it here.
 */
.rh-reviews__empty {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1.25rem;
	padding: 2rem 1rem;
	color: var(--wp--preset--color--text-muted, #5b6271);
	text-align: center;
}

.rh-reviews__empty-copy {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	text-align: center;
}

.rh-reviews__empty-title {
	margin: 0;
	color: var(--wp--preset--color--contrast, #0f1115);
	font-size: var(--wp--preset--font-size--md, 1.125rem);
	font-weight: 700;
}

.rh-reviews__empty-text {
	margin: 0;
	color: var(--wp--preset--color--text-muted, #5b6271);
	font-size: var(--wp--preset--font-size--sm, 0.875rem);
	line-height: 1.7;
}

.rh-reviews__empty-icon {
	color: var(--wp--preset--color--text-muted, #5b6271);
	opacity: 0.55;
	flex-shrink: 0;
}

@media (min-width: 900px) {
	.rh-reviews__body--empty {
		/* keep summary right + empty card left even when there are no reviews */
		grid-template-columns: 280px minmax(0, 1fr);
	}
	.rh-reviews__body--empty .rh-reviews__empty {
		grid-column: 2;
	}
}

/* =========================================================================
 *  Archive view  (URL: /product/.../?rh_reviews=1)
 * ========================================================================= */

.rh-reviews-archive {
	/* Override the inline section's compact top spacing — the archive is
	   the page's main content, not a section after the product summary. */
	margin-block-start: 0;
}

/* ---- "بازگشت به محصول" link inside the summary card ----
 *
 * Replaces the old gray crumb strip on desktop. Sits at the top of the
 * sticky summary card, above the product-named title. (On mobile the card
 * is hidden and the mini-header carries the back action instead.) */
.rh-reviews__summary-back {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	align-self: flex-start;
	margin-block-end: 0.625rem;
	color: var(--wp--preset--color--text-muted, #5b6271);
	font-size: var(--wp--preset--font-size--sm, 0.875rem);
	text-decoration: none;
	transition: color 120ms ease;
}
.rh-reviews__summary-back svg { flex-shrink: 0; }
.rh-reviews__summary-back:hover,
.rh-reviews__summary-back:focus-visible {
	color: var(--wp--preset--color--primary, #0a66c2);
}

/* ---- main column ---- */

.rh-reviews-archive__main {
	display: flex;
	flex-direction: column;
	gap: 0.875rem;
}

@media (min-width: 900px) {
	.rh-reviews-archive__main {
		/* Wide LEFT track (1fr) — column 2 in this RTL grid. Column 1 is the
		   280px summary card; putting main there too stacks both in the
		   narrow right track and leaves the left half blank. */
		grid-column: 2;
	}
}

/* ---- toolbar (filter + sort + total) ---- */

.rh-reviews-archive__toolbar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.75rem;
	padding: 0.875rem 1rem;
	background: var(--wp--preset--color--base, #fff);
	border: 1px solid var(--wp--preset--color--border, #e2e4e9);
	border-radius: 0.75rem;
	/* Keep sort/filter reachable while scrolling a long list — sticks just
	   under the site header on both mobile and desktop. Opaque background +
	   z-index so review cards scroll underneath, not through it. */
	position: sticky;
	top: calc(var(--rh-header-height, 64px) + 0.5rem);
	z-index: 5;
	/* When JS scrolls the toolbar back into view after a pager click, leave
	   room for the sticky site header instead of tucking under it. */
	scroll-margin-top: calc(var(--rh-header-height, 64px) + 1rem);
}

.rh-reviews-archive__filter {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	padding: 0.375rem 0.75rem;
	border: 1px solid var(--wp--preset--color--border, #e2e4e9);
	border-radius: 999px;
	font-size: var(--wp--preset--font-size--xs, 0.75rem);
	color: var(--wp--preset--color--text, #1a1d23);
	background: var(--wp--preset--color--base, #fff);
	text-decoration: none;
	transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}

.rh-reviews-archive__filter-dot {
	width: 0.625rem;
	height: 0.625rem;
	border-radius: 999px;
	border: 1.5px solid var(--wp--preset--color--text-muted, #5b6271);
	background: transparent;
	transition: background-color 120ms ease, border-color 120ms ease;
}

.rh-reviews-archive__filter.is-on {
	border-color: var(--wp--preset--color--primary, #0a66c2);
	background: color-mix(in srgb, var(--wp--preset--color--primary, #0a66c2) 8%, transparent);
	color: var(--wp--preset--color--primary, #0a66c2);
}

.rh-reviews-archive__filter.is-on .rh-reviews-archive__filter-dot {
	background: var(--wp--preset--color--primary, #0a66c2);
	border-color: var(--wp--preset--color--primary, #0a66c2);
}

.rh-reviews-archive__filter:hover:not(.is-on),
.rh-reviews-archive__filter:focus-visible:not(.is-on) {
	border-color: var(--wp--preset--color--text-muted, #5b6271);
}

/* sort group */

.rh-reviews-archive__sort {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	flex: 1 1 auto;
	min-width: 0;
}

.rh-reviews-archive__sort-label {
	color: var(--wp--preset--color--text-muted, #5b6271);
	font-size: var(--wp--preset--font-size--xs, 0.75rem);
	white-space: nowrap;
}

.rh-reviews-archive__sort-tabs {
	display: inline-flex;
	list-style: none;
	margin: 0;
	padding: 0;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.rh-reviews-archive__sort-tabs > li { margin: 0; }

.rh-reviews-archive__sort-tab {
	display: inline-block;
	padding: 0.25rem 0.5rem;
	font-size: var(--wp--preset--font-size--sm, 0.875rem);
	color: var(--wp--preset--color--text-muted, #5b6271);
	text-decoration: none;
	border-block-end: 2px solid transparent;
	transition: color 120ms ease, border-color 120ms ease;
}

.rh-reviews-archive__sort-tab:hover,
.rh-reviews-archive__sort-tab:focus-visible {
	color: var(--wp--preset--color--text, #1a1d23);
}

.rh-reviews-archive__sort-tab.is-active {
	color: var(--wp--preset--color--primary, #0a66c2);
	border-block-end-color: var(--wp--preset--color--primary, #0a66c2);
	font-weight: 600;
}

.rh-reviews-archive__total {
	margin-inline-start: auto;
	color: var(--wp--preset--color--text-muted, #5b6271);
	font-size: var(--wp--preset--font-size--xs, 0.75rem);
	white-space: nowrap;
}

/* ---- mobile toolbar: slim, scrollable, pinned under the mini-header ----
 *
 * The default wrapping toolbar stacks into ~3 rows on a phone and pins at
 * the desktop header offset (the 64px fallback), leaving a gap above it.
 * On mobile the sticky chrome is the 56px .rh-product-mini bar, so we pin
 * the toolbar flush under it, collapse to a single slim row, hide the sort
 * label + total (the count already shows in the rating card) to reclaim
 * width, and let the sort tabs scroll horizontally instead of wrapping. */
@media (max-width: 900px) {
	.rh-reviews-archive__toolbar {
		/* Full-bleed bar flush under the mini-header: span the viewport,
		   square edges, hairline bottom border only — same full-bleed trick
		   as the product breadcrumb/tabs (product-single.css). padding-inline
		   re-uses the page gutter so the inner content lines up with the
		   review cards below. */
		top: var(--rh-page-header-h, 56px);
		width: 100vw;
		margin-inline: calc(50% - 50vw);
		box-sizing: border-box;
		border: 0;
		border-bottom: 1px solid var(--wp--preset--color--border, #e2e4e9);
		border-radius: 0;
		flex-wrap: nowrap;       /* everything on ONE row */
		align-items: center;
		gap: 0.5rem;
		padding: 0.4375rem var(--wp--preset--spacing--40, 1rem); /* slim */
		overflow: hidden;        /* clip the horizontal sort scroller */
	}

	.rh-reviews-archive__filter {
		flex: 0 0 auto;          /* pill keeps its size; only the sorts scroll */
		padding-block: 0.3125rem;
	}

	.rh-reviews-archive__sort-label,
	.rh-reviews-archive__total {
		display: none;           /* count already lives in the rating card */
	}

	/* A hairline divider between the filter pill and the scrolling sorts so
	   the two zones read as distinct on the slim bar. */
	.rh-reviews-archive__sort {
		flex: 1 1 auto;
		min-width: 0;
		gap: 0;
		padding-inline-start: 0.5rem;
		border-inline-start: 1px solid var(--wp--preset--color--border, #e2e4e9);
	}

	.rh-reviews-archive__sort-tabs {
		flex-wrap: nowrap;
		overflow-x: auto;
		gap: 0.75rem;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		/* Fade the trailing (left, in RTL) edge so a half-cut tab hints
		   "there's more — scroll". */
		-webkit-mask-image: linear-gradient(to left, transparent, #000 1.5rem);
		mask-image: linear-gradient(to left, transparent, #000 1.5rem);
	}
	.rh-reviews-archive__sort-tabs::-webkit-scrollbar { display: none; }

	.rh-reviews-archive__sort-tab {
		flex: 0 0 auto;          /* natural width — overflow scrolls, never shrinks */
		white-space: nowrap;
		padding-block: 0.125rem;
	}
}

/* ---- mobile sticky action bar (rating + add-review CTA) ----
 *
 * Desktop keeps the full summary card in the right column. On mobile that
 * card is redundant with this bar, so we hide it and pin a slim bar just
 * above the site dock: rating (start) + "افزودن دیدگاه" CTA (end). */
.rh-reviews-archive__actionbar {
	display: none;
}

@media (max-width: 900px) {
	/* The summary card's role (score + count + CTA) moves to the sticky bar
	   below, so drop the big card on mobile. Scoped to the archive so the
	   inline product-page reviews section is untouched. */
	.rh-reviews-archive .rh-reviews__summary {
		display: none;
	}

	/* Clear the ~52px action bar (the dock's 64px is already reserved on
	   <body> by bottom-nav.css). */
	.rh-reviews-archive__main {
		padding-bottom: 3.5rem;
	}

	.rh-reviews-archive__actionbar {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 0.75rem;
		position: fixed;
		inset-inline: 0;
		bottom: calc(64px + env(safe-area-inset-bottom, 0px)); /* sits above the dock */
		z-index: 940; /* under the dock (950), over page content */
		padding: 0.5rem var(--wp--preset--spacing--40, 1rem);
		background: var(--wp--preset--color--base, #fff);
		border-top: 1px solid var(--wp--preset--color--border, #e2e4e9);
		box-shadow: 0 -2px 12px rgba(15, 17, 21, 0.06);
	}

	.rh-reviews-archive__actionbar-rating {
		display: inline-flex;
		align-items: center;
		gap: 0.375rem;
		min-width: 0;
		font-size: 0.9375rem;
	}
	.rh-reviews-archive__actionbar-avg {
		font-weight: 700;
		color: var(--wp--preset--color--contrast, #0f1115);
	}
	.rh-reviews-archive__actionbar-count {
		color: var(--wp--preset--color--text-muted, #5b6271);
		font-size: 0.8125rem;
		white-space: nowrap;
	}

	.rh-reviews-archive__actionbar-cta {
		flex: 0 0 auto;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		padding: 0.5rem 1.25rem;
		border-radius: 0.625rem;
		background: var(--wp--preset--color--primary, #0a66c2);
		color: var(--wp--preset--color--base, #fff);
		font-weight: 700;
		font-size: 0.875rem;
		text-decoration: none;
		transition: filter 120ms ease;
	}
	.rh-reviews-archive__actionbar-cta:active {
		filter: brightness(0.94);
	}
}

/* ---- list ---- */

.rh-reviews-archive__list {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

/* ---- AJAX loading skeleton ----
 *
 * While a sort / filter / pager fetch is in flight, product-reviews.js
 * replaces the list rows with shimmer placeholders and flags the main
 * column .is-loading (muting the toolbar + pager so they can't be
 * re-clicked mid-request). Placeholder count is matched to the rows being
 * replaced, so the list height barely moves. */
.rh-reviews-archive__main.is-loading .rh-reviews-archive__toolbar,
.rh-reviews-archive__main.is-loading .rh-reviews-archive__pagination {
	pointer-events: none;
}

.rh-reviews-archive__main.is-loading .rh-reviews-archive__pagination {
	opacity: 0.45;
}

.rh-reviews-archive__skel {
	display: flex;
	flex-direction: column;
	gap: 0.625rem;
	padding: 1rem;
	border: 1px solid var(--wp--preset--color--border, #e2e4e9);
	border-radius: 0.75rem;
	background: var(--wp--preset--color--base, #fff);
}

.rh-skel {
	display: block;
	height: 0.75rem;
	border-radius: 0.375rem;
	background: color-mix(in srgb, var(--wp--preset--color--text-muted, #5b6271) 16%, transparent);
	position: relative;
	overflow: hidden;
}

.rh-skel--stars { width: 6rem; height: 0.95rem; }
.rh-skel--meta  { width: 9rem; }
.rh-skel--line  { width: 100%; }
.rh-skel--short { width: 58%; }

.rh-skel::after {
	content: "";
	position: absolute;
	inset: 0;
	transform: translateX(-100%);
	background: linear-gradient(
		90deg,
		transparent,
		color-mix(in srgb, var(--wp--preset--color--base, #fff) 65%, transparent),
		transparent
	);
	animation: rh-skel-shimmer 1.15s ease-in-out infinite;
}

@keyframes rh-skel-shimmer {
	100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
	.rh-skel::after { animation: none; }
}

/* ---- pagination ---- */

.rh-reviews-archive__pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 0.375rem;
	margin-block-start: 0.5rem;
	padding-block: 0.5rem;
}

.rh-reviews-archive__page {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.25rem;
	height: 2.25rem;
	padding: 0 0.5rem;
	border: 1px solid var(--wp--preset--color--border, #e2e4e9);
	border-radius: 0.5rem;
	background: var(--wp--preset--color--base, #fff);
	color: var(--wp--preset--color--text, #1a1d23);
	text-decoration: none;
	font-size: var(--wp--preset--font-size--sm, 0.875rem);
	font-variant-numeric: tabular-nums;
	transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

.rh-reviews-archive__page:hover,
.rh-reviews-archive__page:focus-visible {
	border-color: var(--wp--preset--color--primary, #0a66c2);
	color: var(--wp--preset--color--primary, #0a66c2);
}

.rh-reviews-archive__page.is-current {
	background: var(--wp--preset--color--primary, #0a66c2);
	border-color: var(--wp--preset--color--primary, #0a66c2);
	color: var(--wp--preset--color--base, #fff);
	pointer-events: none;
}

.rh-reviews-archive__page--gap {
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--text-muted, #5b6271);
}

.rh-reviews-archive__page--prev,
.rh-reviews-archive__page--next {
	color: var(--wp--preset--color--text-muted, #5b6271);
}

/* a11y helper — visually hidden but readable for screen readers */
.rh-reviews-archive .screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

/* NB: the mobile toolbar layout lives in the (max-width: 900px) block above
   (slim single row, pinned under the mini-header, horizontally scrolling
   sort tabs). The old column/rail layout that used to sit here was removed
   — it came later in the cascade and reverted the toolbar to stacked rows. */
