/*
 * Ratings and review quotes from Phorest: [phorest_reviews], [phorest_rating], and the ratings
 * inside the menu tables. Loads after clarity-phorest-menu.css and uses its --cpm-* tokens.
 */

/* Stars are a mask over a two-stop gradient, so a 4.9 fills the last star nine tenths and the
   shape scales with the text. */
.cpm-stars {
	--cpm-star-size: 1em;

	display: inline-block;
	flex: none;
	width: calc(var(--cpm-star-size) * 5);
	height: var(--cpm-star-size);
	vertical-align: -0.12em;
	background: linear-gradient(90deg, var(--cpm-star) var(--cpm-fill, 100%), var(--cpm-tint-strong) var(--cpm-fill, 100%));
	-webkit-mask: var(--cpm-star-shape) 0 0 / var(--cpm-star-size) var(--cpm-star-size) repeat-x;
	mask: var(--cpm-star-shape) 0 0 / var(--cpm-star-size) var(--cpm-star-size) repeat-x;
}

.cpm-stars--sm {
	--cpm-star-size: 0.9em;
}

.cpm-stars--md {
	--cpm-star-size: 1.15em;
}

/* Compact: one star, the score and the count, for table rows and stylist columns. */
.cpm-rating {
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
	letter-spacing: 0;
	text-transform: none;
	white-space: nowrap;
}

.cpm-rating__star {
	width: 0.95em;
	height: 0.95em;
	background: var(--cpm-star);
	-webkit-mask: var(--cpm-star-shape) center / contain no-repeat;
	mask: var(--cpm-star-shape) center / contain no-repeat;
}

.cpm-rating__value {
	color: var(--cpm-ink);
	font-weight: 700;
}

.cpm-rating__count {
	color: var(--cpm-muted);
}

/* Next to the duration under a service name. */
.cpm-service__meta > span + .cpm-rating {
	margin-left: 0.85em;
}

.cpm-person__link .cpm-rating {
	margin-top: 0.2em;
	font-size: 0.72em;
}

.cpm-staff__link .cpm-rating {
	margin-top: 0.15em;
	font-size: 0.8em;
}

/* [phorest_rating]: one line under a name or heading. */
.cpm-rating-line {
	margin: 0 0 1em;
	padding: 0;
	color: var(--cpm-ink);
	line-height: 1.4;
}

.cpm-rating-line__inner {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25em 0.55em;
	color: inherit;
	text-decoration: none;
}

.cpm-rating-line__value {
	font-weight: 700;
}

.cpm-rating-line__count {
	color: var(--cpm-muted);
}

a.cpm-rating-line__inner .cpm-rating-line__count {
	color: var(--cpm-accent);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
}

a.cpm-rating-line__inner:hover .cpm-rating-line__count {
	text-decoration-thickness: 2px;
}

/* [phorest_reviews] */
.cpm-reviews {
	margin: 0 0 2.5em;
	color: var(--cpm-ink);
	line-height: 1.5;
}

/* Under a menu table, at the page's reading width even when the table runs wide. */
.cpm-menu + .cpm-reviews {
	margin-top: clamp(40px, 6vw, 72px);
}

.cpm-reviews *,
.cpm-reviews *::before,
.cpm-reviews *::after {
	box-sizing: border-box;
}

.cpm-reviews__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1em 2em;
	padding-bottom: 1.25em;
	border-bottom: 2px solid var(--cpm-ink);
}

.cpm-reviews .cpm-reviews__title {
	margin: 0;
	padding: 0;
	color: var(--cpm-ink);
	font-size: 1.5em;
	line-height: 1.25;
	text-wrap: balance;
}

.cpm-reviews__score {
	display: flex;
	align-items: center;
	gap: 0.7em;
}

.cpm-reviews__value {
	font-size: 2.6em;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.02em;
	line-height: 1;
}

.cpm-reviews__meta {
	display: flex;
	flex-direction: column;
	gap: 0.35em;
}

.cpm-reviews__count {
	color: var(--cpm-muted);
	font-size: 0.85em;
}

/* Rows stretch to their tallest quote, so the rules under each pair line up. The !important
   resets beat Divi's `#left-area ul`, which pages with a sidebar get. */
.cpm-reviews .cpm-reviews__list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 21em), 1fr));
	column-gap: 3em;
	margin: 0;
	padding: 0 !important;
	list-style: none !important;
}

.cpm-reviews .cpm-review {
	display: block;
	margin: 0;
	padding: 1.5em 0;
	border-bottom: 1px solid var(--cpm-line);
}

.cpm-review__figure {
	margin: 0;
}

.cpm-review__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
	margin-bottom: 0.65em;
}

.cpm-review__date {
	color: var(--cpm-muted);
	font-size: 0.8em;
}

/* Divi gives every blockquote a thick left border and an indent. */
.cpm-reviews .cpm-review__text {
	margin: 0;
	padding: 0;
	border: 0;
	color: var(--cpm-ink);
	font-size: 1.05em;
	font-style: normal;
	line-height: 1.6;
	quotes: none;
}

.cpm-reviews .cpm-review__text p {
	margin: 0;
	padding: 0;
	text-wrap: pretty;
}

.cpm-review__text.is-clamped p {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 6;
}

.cpm-reviews .cpm-review__more {
	margin: 0.45em 0 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--cpm-accent);
	font: inherit;
	font-size: 0.85em;
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.cpm-review__by {
	display: flex;
	flex-direction: column;
	gap: 0.15em;
	margin-top: 0.85em;
	color: var(--cpm-muted);
	font-size: 0.85em;
}

.cpm-review__name {
	color: var(--cpm-ink);
	font-weight: 700;
}

.cpm-reviews .cpm-review__what a {
	color: var(--cpm-accent);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Only rendered for admins, who see the page uncached. */
.cpm-reviews .cpm-review__hide {
	display: inline-block;
	margin-top: 0.6em;
	color: #b32d2e;
	font-size: 0.75em;
}

.cpm-reviews__source {
	margin: 1.25em 0 0;
	padding: 0;
	color: var(--cpm-muted);
	font-size: 0.8em;
}

@media (max-width: 720px) {
	.cpm-reviews__value {
		font-size: 2.2em;
	}

	/* The phone strip of stylists is too tight for a rating under each photo. */
	.cpm-people.cpm-js .cpm-person .cpm-rating {
		display: none;
	}
}
