.stars { position: relative; display: inline-flex; flex: none; width: max-content; --star: 14px; }
.stars .icon { width: var(--star); height: var(--star); }
.stars--lg { --star: 18px; }
.stars__empty, .stars__fill { display: flex; gap: 2px; }
.stars__empty { color: var(--sand); }
.stars__fill { position: absolute; inset: 0; color: var(--ink); clip-path: inset(0 calc(100% - var(--rating)) 0 0); }

.pdp-head__rating { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; font-size: 12px; color: var(--body-text); }
.pdp-head__rating span { text-decoration: underline; text-decoration-color: var(--sand); text-underline-offset: 3px; transition: text-decoration-color var(--dur-fast) ease; }
@media (hover: hover) and (pointer: fine) {
	.pdp-head__rating:hover span { text-decoration-color: currentColor; }
}

/* Section on the product page */
.reviews {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
	gap: 64px;
	align-items: start;
	padding: 128px var(--gutter) 0;
	scroll-margin-top: calc(var(--admin-bar) + var(--header-h));
}

.reviews__summary { position: sticky; top: calc(var(--admin-bar) + var(--header-h) + 24px); display: flex; flex-direction: column; align-items: flex-start; gap: 28px; max-width: 360px; }
.reviews__average { display: flex; align-items: center; gap: 20px; }
.reviews__average > div { display: flex; flex-direction: column; gap: 8px; }
.reviews__score { font-size: 64px; font-weight: 400; letter-spacing: -0.04em; line-height: 0.9; font-variant-numeric: tabular-nums; }

.reviews__breakdown { display: flex; flex-direction: column; gap: 8px; align-self: stretch; margin: 0; padding: 0; list-style: none; }
.reviews__bar { display: grid; grid-template-columns: 52px minmax(0, 1fr) 24px; align-items: center; gap: 12px; font-size: 12px; color: var(--body-text); font-variant-numeric: tabular-nums; }
.reviews__bar-track { height: 4px; background: linear-gradient(90deg, var(--ink) var(--share), var(--line) var(--share)); }
.reviews__bar-count { text-align: right; }

.reviews__actions { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; align-self: stretch; padding-top: 28px; border-top: 1px solid var(--line); }
.reviews__actions:not(:has(*)) { display: none; }
.reviews__note { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--body-text); }
.reviews__note .icon { width: 14px; height: 14px; color: var(--olive); }

.reviews__list { display: flex; flex-direction: column; align-items: flex-start; max-width: 720px; }
.reviews__empty { padding: 24px 0; border-top: 1px solid var(--line); align-self: stretch; font-size: 14px; color: var(--body-text); }
.reviews__more { margin-top: 32px; }
.reviews__more .icon { transition: none; }

.review { display: flex; flex-direction: column; gap: 18px; align-self: stretch; padding: 36px 0; border-top: 1px solid var(--line); }
.review:last-of-type { border-bottom: 1px solid var(--line); }
.review__by { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12px; color: var(--body-text); }
.review__initial { display: grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--line); font-size: 13px; font-weight: 500; color: var(--ink); }
.review__author { font-size: 14px; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.review__verified { display: inline-flex; align-items: center; gap: 4px; color: var(--olive); font-weight: 500; }
.review__verified .icon { width: 12px; height: 12px; }
.review__text { display: flex; flex-direction: column; gap: 10px; max-width: 60ch; font-size: 17px; line-height: 1.55; letter-spacing: -0.006em; color: var(--ink); overflow-wrap: anywhere; text-wrap: pretty; }

.review__media { display: flex; flex-wrap: wrap; gap: 8px; }
.review__thumb { width: 128px; aspect-ratio: 4 / 5; cursor: zoom-in; transition: opacity var(--dur-fast) ease; }
.reviews__list .review__media:has(> .review__thumb:only-of-type) .review__thumb { width: 200px; }
@media (hover: hover) and (pointer: fine) {
	.review__thumb:hover { opacity: 0.85; }
}

/* Review media comes in any shape, unlike the 2:3 product shots the lightbox arrows are placed for. */
.review__media .lightbox__stage { --photo-half: 40cqw; }

.review__product {
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	gap: 8px;
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.117em;
	text-transform: uppercase;
}
.review__product .icon { width: 13px; height: 13px; transition: transform var(--dur-fast) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
	.review__product:hover .icon { transform: translateX(3px); }
}

.reviews__all { font-size: 13px; color: var(--body-text); text-decoration: underline; text-decoration-color: var(--sand); text-underline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
	.reviews__all:hover { color: var(--ink); text-decoration-color: currentColor; }
}

/* Form drawer */
.review-form__form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.review-form__body { display: flex; flex-direction: column; gap: 28px; flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 28px 32px 32px; }

.review-form__piece { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.review-form__thumb { flex: none; width: 48px; aspect-ratio: 4 / 5; }

.rate { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; border: 0; min-width: 0; }
.rate legend { padding: 0; margin-bottom: 12px; }
.rate__stars { display: flex; }
.rate__star { position: relative; display: grid; place-items: center; width: 44px; height: 44px; margin-left: -6px; cursor: pointer; }
.rate__star:first-child { margin-left: -10px; }
.rate__star input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.rate__star .icon { grid-area: 1 / 1; width: 28px; height: 28px; pointer-events: none; transition: transform var(--dur-press) var(--ease-out); }
.rate__empty { color: var(--stone); }
.rate__full { color: var(--ink); opacity: 0; }
.rate__star:active .icon { transform: scale(0.9); }
.rate__star:has(input:focus-visible) { outline: 1px solid var(--ink); outline-offset: -4px; }

/* Stars up to the chosen one fill; while a mouse hovers, the stars up to the pointer preview instead. */
.rate__star:has(~ .rate__star input:checked) .rate__full, .rate__star:has(input:checked) .rate__full { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
	.rate__stars:hover .rate__full { opacity: 0; }
	.rate__stars:hover .rate__star:hover .rate__full, .rate__stars:hover .rate__star:has(~ .rate__star:hover) .rate__full { opacity: 1; }
}

.review-photos__list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.review-photos__list:empty { display: none; }
.review-photos__item { position: relative; aspect-ratio: 4 / 5; }
.review-photos__item.is-preparing img { opacity: 0.4; }
.review-photos__remove {
	position: absolute;
	top: 4px;
	right: 4px;
	display: grid;
	place-items: center;
	width: 28px;
	height: 28px;
	background: rgb(252 251 248 / 0.92);
	color: var(--ink);
}
/* A bigger invisible hit area than the visible chip. */
.review-photos__remove::before { content: ""; position: absolute; inset: -8px; }
.review-photos__remove .icon { width: 14px; height: 14px; }

.review-photos__add {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	justify-self: start;
	gap: 10px;
	min-height: var(--btn-h);
	padding: 8px 16px;
	border: 1px dashed var(--stone);
	font-size: 11.5px;
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	cursor: pointer;
	transition: border-color var(--dur-fast) ease, transform var(--dur-press) var(--ease-out);
}
.review-photos__add .icon { width: 16px; height: 16px; }
.review-photos__add:active { transform: scale(0.97); }
.review-photos__add:has(input:focus-visible) { outline: 1px solid var(--ink); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
	.review-photos__add:hover { border-color: var(--ink); }
}

/* Without JavaScript the browser's own file picker shows which photos were chosen. */
.review-photos__input { font-size: 12px; text-transform: none; letter-spacing: 0; }
.review-photos.is-enhanced .review-photos__input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.review-photos.is-enhanced .review-photos__add[hidden] { display: none; }

.review-form__note { font-size: 12px; line-height: 1.5; color: var(--stone); }
.review-form__error { font-size: 12px; font-weight: 500; color: var(--clay); }
.review-form__done-text { max-width: 32ch; font-size: 14px; line-height: 1.5; color: var(--body-text); }

/* Reviews page: every review as a column of cards, led by its first photo or video. */
.reviews-page { max-width: var(--max); margin: 0 auto; }
.reviews-page .page-intro { align-items: flex-end; }

.reviews-wall { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 56px 32px; align-items: start; padding: 0 var(--gutter) 128px; }
.reviews-wall .review { gap: 14px; padding: 0; border: 0; }
.reviews-wall .review:last-of-type { border-bottom: 0; }
.reviews-wall .review__media { order: -1; padding: 0 0 6px; }
.reviews-wall .review__thumb { position: relative; width: 100%; }
.reviews-wall .review__thumb .media-play .icon { max-width: 44px; }
.reviews-wall .review__text { font-size: 15px; color: var(--body-text); }

.review__count {
	position: absolute;
	right: 12px;
	bottom: 12px;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	background: rgb(17 16 15 / 0.6);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	font-size: 12px;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	color: var(--paper);
}
.review__count .icon { width: 14px; height: 14px; }

@media (max-width: 1100px) {
	.reviews { gap: 40px; }
	.reviews-wall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px 24px; }
}

@media (max-width: 900px) {
	.reviews { grid-template-columns: 1fr; gap: 28px; padding-top: 72px; }
	.reviews__summary { position: static; }
	.reviews__list { max-width: none; }
	.review { padding: 24px 0; }
}

@media (max-width: 720px) {
	.review-form__body { padding-inline: 20px; }
	.reviews-wall { grid-template-columns: minmax(0, 1fr); gap: 40px; padding-bottom: 72px; }
}
