/**
 * Reviews + "Meet the shop" (inc/reviews.php): product page (under the description) and the /reviews/ page.
 * Uses the TPTrue tokens (header.css). Radius rule: buttons = pill, panels = 16px.
 */

.tp-reviews,
.tp-shop,
.tp-reviews-page {
	--tp-star: #e8a317;
	--tp-star-off: var(--tp-border);
}

/* ---------- Stars ---------- */

.tp-stars {
	position: relative;
	display: inline-flex;
	flex-shrink: 0;
	font-size: 16px;
	line-height: 1;
	vertical-align: middle;
}

.tp-stars .tp-icon {
	flex-shrink: 0;
	width: 1em;
	height: 1em;
}

.tp-stars__base {
	display: inline-flex;
	gap: 2px;
	color: var(--tp-star-off);
}

.tp-stars__fill {
	position: absolute;
	inset: 0 auto 0 0;
	display: inline-flex;
	gap: 2px;
	overflow: hidden;
	white-space: nowrap;
	color: var(--tp-star);
}

/* ---------- Buttons used here (home.css has the base .tp-btn) ---------- */

.tp-btn--outline {
	gap: 8px;
	color: var(--tp-ink);
	background: transparent;
	box-shadow: inset 0 0 0 1.5px var(--tp-ink);
}

.tp-btn--outline:hover {
	color: var(--tp-ink);
	background: var(--tp-surface);
}

.tp-btn--sm {
	min-height: 40px;
	padding: 8px 18px;
	font-size: 14px;
}

/* ---------- This item's reviews ---------- */

.tp-reviews {
	margin-top: 56px;
}

.tp-reviews__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px 16px;
	margin-bottom: 8px;
}

.tp-reviews__avg {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-weight: 600;
	color: var(--tp-ink);
}

.tp-reviews__avg--lg {
	gap: 10px;
	font-size: 18px;
}

.tp-reviews__avg--lg .tp-stars {
	font-size: 22px;
}

.tp-reviews__avg--lg > span:last-child {
	font-weight: 400;
	color: var(--tp-muted);
}

.tp-reviews__hint {
	margin: 8px 0 0;
	font-size: 13px;
	color: var(--tp-muted);
}

.tp-reviews__list {
	display: flex;
	flex-direction: column;
}

.tp-reviews__list .tp-review {
	padding: 24px 0;
	border-bottom: 1px solid var(--tp-hairline);
}

.tp-reviews__note {
	margin: 20px 0 0;
	font-size: 14px;
	color: var(--tp-muted);
}

.tp-reviews__note a {
	color: var(--tp-primary);
}

.tp-reviews__rest summary {
	margin-top: 20px;
	list-style: none;
}

.tp-reviews__rest summary::-webkit-details-marker {
	display: none;
}

.tp-reviews__rest[open] summary {
	display: none;
}

/* Summary: big item average, then a ring per detail rating (Etsy style) */

.tp-reviews__summary {
	display: grid;
	grid-template-columns: auto; /* the item average; each ring then gets an equal column */
	grid-auto-columns: minmax(0, 1fr);
	grid-auto-flow: column;
	align-items: center;
	gap: 12px;
	margin: 20px 0 8px;
	padding-bottom: 24px;
	border-bottom: 1px solid var(--tp-hairline);
}

.tp-reviews__score {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	gap: 8px;
	margin-right: 12px;
}

.tp-reviews__big {
	font-size: 44px;
	font-weight: 500;
	line-height: 1;
	letter-spacing: -0.02em;
	color: var(--tp-ink);
}

.tp-reviews__big-star {
	width: 30px;
	height: 30px;
	color: var(--tp-star);
}

.tp-reviews__score p {
	display: flex;
	flex-direction: column;
	margin: 0 0 0 4px;
	line-height: 1.35;
}

.tp-reviews__label {
	font-size: 15px;
	color: var(--tp-ink);
	text-decoration: underline dashed var(--tp-muted);
	text-underline-offset: 4px;
	cursor: help;
}

.tp-reviews__count {
	font-size: 13px;
	color: var(--tp-muted);
}

.tp-reviews__aspect {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	font-size: 13px;
	line-height: 1.3;
	color: var(--tp-ink);
}

.tp-ring {
	display: grid;
	flex-shrink: 0;
	place-items: center;
	width: 42px;
	height: 42px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: -0.02em;
	border-radius: 50%;
	box-shadow: inset 0 0 0 2px var(--tp-star);
}

/* Review header: stars + number left, name | date right */

.tp-review__top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 6px 16px;
}

.tp-review__score {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 15px;
	font-weight: 600;
	color: var(--tp-ink);
}

.tp-review__who {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	font-size: 14px;
	color: var(--tp-muted);
}

.tp-review__who time {
	padding-left: 10px;
	border-left: 1px solid var(--tp-border);
}

p.tp-review__verified {
	margin: 0;
	font-size: 13px;
}

/* Empty state ("Be the first to review this item") */

.tp-reviews__empty {
	padding: 16px 18px;
	background: #fffaf0;
	border-radius: 12px;
	box-shadow: inset 0 0 0 1px #f5e2b8;
}

.tp-reviews__empty-title {
	margin: 0 0 8px;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--tp-ink);
}

.tp-reviews__empty-body {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	color: var(--tp-ink);
}

.tp-reviews__empty-body p {
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
	color: var(--tp-muted);
}

/* star in a soft amber chip */
.tp-reviews__empty-icon {
	box-sizing: border-box;
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	padding: 7px;
	color: var(--tp-star);
	background: #fdecc2;
	border-radius: 8px;
}

.tp-reviews__jump {
	display: inline-block;
	margin-top: 6px;
	font-size: 14px;
	font-weight: 600;
	color: var(--tp-primary);
	text-decoration: none;
}

.tp-reviews__jump::after {
	content: " →";
}

.tp-reviews__jump:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ---------- One review ---------- */

.tp-review {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-width: 0;
}

.tp-review__text {
	color: var(--tp-ink);
	line-height: 1.55;
	overflow-wrap: anywhere;
}

.tp-review__text p {
	margin: 0 0 8px;
}

.tp-review__text p:last-child {
	margin-bottom: 0;
}

.tp-review__meta p {
	margin: 0;
}

.tp-review__by {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 10px;
	font-size: 14px;
	color: var(--tp-muted);
}

.tp-review__name {
	font-weight: 600;
	color: var(--tp-ink);
}

.tp-review__verified {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: #13795b;
}

.tp-review__item {
	overflow: hidden;
	margin-top: 4px !important;
	font-size: 13px;
	white-space: nowrap;
	text-overflow: ellipsis;
	color: var(--tp-muted);
}

.tp-review__item a {
	position: relative;
	z-index: 1; /* above the card link of the strip */
	color: var(--tp-muted);
}

/* ---------- Review form (verified buyers) ---------- */

.tp-review-form {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 10px;
	margin-top: 24px;
	padding: 24px;
	background: var(--tp-surface);
	border-radius: 16px;
}

.tp-review-form__title {
	margin: 0 0 4px;
	font-size: 18px;
	font-weight: 600;
	color: var(--tp-ink);
}

.tp-review-form__label {
	padding: 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--tp-ink);
}

.tp-review-form textarea {
	box-sizing: border-box;
	width: 100%;
	padding: 12px 14px;
	font: inherit;
	color: var(--tp-ink);
	background: #fff;
	border: 1px solid var(--tp-border);
	border-radius: 12px;
	resize: vertical;
}

.tp-review-form textarea:focus {
	border-color: var(--tp-primary);
	outline: none;
}

.tp-rate {
	margin: 0 0 6px;
	padding: 0;
	border: 0;
}

/* 5 → 1 in the DOM, shown reversed: hovering / checking a star lights it and every star before it. */
.tp-rate__stars {
	display: inline-flex;
	flex-direction: row-reverse;
	gap: 4px;
	margin-top: 6px;
}

.tp-rate__stars input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.tp-rate__stars label {
	font-size: 30px;
	line-height: 1;
	color: var(--tp-border);
	cursor: pointer;
	transition: color 0.15s var(--tp-ease), transform 0.15s var(--tp-ease);
}

.tp-rate__stars label .tp-icon {
	width: 1em;
	height: 1em;
}

.tp-rate__stars label:hover,
.tp-rate__stars label:hover ~ label,
.tp-rate__stars input:checked ~ label {
	color: #e8a317;
}

.tp-rate__stars label:hover {
	transform: scale(1.08);
}

.tp-rate__stars input:focus-visible + label {
	outline: 2px solid var(--tp-primary);
	outline-offset: 2px;
	border-radius: 4px;
}

/* Optional detail ratings in the review form */

.tp-review-form__more {
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 100%;
	margin: 0 0 6px;
	padding: 0;
	border: 0;
}

.tp-rate--sm {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 4px 16px;
	max-width: 420px;
}

.tp-rate__name {
	font-size: 14px;
	color: var(--tp-ink);
}

.tp-rate--sm .tp-rate__stars {
	margin-top: 0;
}

.tp-rate--sm .tp-rate__stars label {
	font-size: 22px;
}

.tp-rate__yesno {
	display: inline-flex;
	gap: 8px;
}

.tp-rate__yesno input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.tp-rate__yesno label {
	padding: 6px 16px;
	font-size: 14px;
	color: var(--tp-ink);
	background: #fff;
	border-radius: var(--tp-r-pill);
	box-shadow: inset 0 0 0 1px var(--tp-border);
	cursor: pointer;
}

.tp-rate__yesno input:checked + label {
	color: #fff;
	background: var(--tp-ink);
	box-shadow: none;
}

.tp-rate__yesno input:focus-visible + label {
	outline: 2px solid var(--tp-primary);
	outline-offset: 2px;
}

/* ---------- Meet the shop ---------- */

.tp-shop {
	margin-top: 40px;
	padding: 24px;
	background: var(--tp-surface);
	border-radius: 16px;
}

.tp-shop__top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
}

.tp-shop__id {
	display: flex;
	align-items: center;
	gap: 16px;
	min-width: 0;
}

.tp-shop__avatar {
	flex-shrink: 0;
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 16px;
	background: #fff;
}

.tp-shop__avatar--letter {
	display: grid;
	place-items: center;
	font-size: 28px;
	font-weight: 600;
	color: #fff;
	background: var(--tp-primary);
}

.tp-shop__eyebrow {
	margin: 0 0 2px;
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--tp-muted);
}

.tp-shop__name {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--tp-ink);
}

.tp-shop__where {
	font-size: 15px;
	font-weight: 400;
	color: var(--tp-muted);
}

.tp-shop__facts {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 2px 8px;
	margin: 6px 0 0;
	font-size: 14px;
	font-weight: 500;
	color: var(--tp-ink);
}

.tp-shop__dot {
	color: var(--tp-muted);
}

.tp-shop__rating {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.tp-shop__rating .tp-icon {
	color: var(--tp-ink);
}

.tp-shop__rating a {
	font-weight: 400;
	color: var(--tp-muted);
	text-decoration: none;
}

.tp-shop__rating a:hover {
	text-decoration: underline;
}

.tp-shop__cta {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
}

.tp-shop__reply {
	margin: 0;
	font-size: 13px;
	color: var(--tp-muted);
}

.tp-shop__badges {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 16px;
	margin: 24px 0 0;
	padding: 24px 0 0;
	list-style: none;
	border-top: 1px solid var(--tp-border);
}

.tp-shop__badges li {
	display: flex;
	gap: 10px;
}

.tp-shop__badges .tp-icon {
	flex-shrink: 0;
	width: 22px;
	height: 22px;
	color: var(--tp-ink);
}

.tp-shop__badges p {
	margin: 0;
	font-size: 14px;
	line-height: 1.45;
	color: var(--tp-muted);
}

.tp-shop__badges strong {
	display: block;
	color: var(--tp-ink);
}

/* Latest shop reviews: horizontal strip of clamped cards */

.tp-shop__reviews {
	margin-top: 24px;
	padding-top: 24px;
	border-top: 1px solid var(--tp-border);
}

.tp-shop__reviews-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.tp-shop__reviews-head h3 {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: var(--tp-ink);
}

.tp-shop__all {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 15px;
	font-weight: 500;
	color: var(--tp-ink);
	text-decoration: none;
	white-space: nowrap;
}

.tp-shop__all .tp-icon {
	width: 14px;
	height: 14px;
	transition: transform 0.2s var(--tp-ease);
}

.tp-shop__all:hover .tp-icon {
	transform: translateX(3px);
}

.tp-shop__slider {
	position: relative;
	margin-top: 16px;
}

/* Arrows sit on the two ends of the strip, vertically centred; hidden at the start / end of the row. */
.tp-strip-nav {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: inline-grid;
	place-items: center;
	width: 32px;
	height: 32px;
	padding: 0;
	color: var(--tp-ink);
	background: #fff;
	border: 0;
	border-radius: var(--tp-r-pill);
	box-shadow: 0 0 0 1px var(--tp-border), 0 2px 8px rgb(31 49 71 / 0.12);
	cursor: pointer;
	transform: translateY(-50%);
	transition: background-color 0.2s var(--tp-ease), opacity 0.2s var(--tp-ease);
}

.tp-strip-nav--prev { left: -14px; }
.tp-strip-nav--next { right: -14px; }

.tp-strip-nav:hover {
	background: var(--tp-surface);
}

.tp-strip-nav.is-disabled {
	opacity: 0;
	pointer-events: none;
}

.tp-strip-nav .tp-icon {
	width: 14px;
	height: 14px;
}

/* Swiper (slidesPerView: auto): slide width comes from .tp-review--strip. Without JS the row scrolls natively. */
.tp-shop__strip {
	padding: 2px; /* room for the card ring and focus outline */
}

/* Fade out on the right while more reviews follow; reviews.js adds .is-end on the last slide. */
.tp-shop__strip {
	-webkit-mask-image: linear-gradient(to right, #000 calc(100% - 72px), transparent);
	mask-image: linear-gradient(to right, #000 calc(100% - 72px), transparent);
}

.tp-shop__strip.is-end {
	-webkit-mask-image: none;
	mask-image: none;
}

.tp-shop__strip:not(.swiper-initialized) .swiper-wrapper {
	gap: 12px;
	overflow-x: auto;
}

.tp-shop__slider:not(:has(.swiper-initialized)) .tp-strip-nav {
	display: none;
}

.tp-shop__strip .swiper-wrapper {
	align-items: stretch;
}

.tp-shop__strip .tp-review--strip { /* beats .swiper-slide { display: block; width: 100% } */
	display: flex;
	flex: 0 0 260px;
	box-sizing: border-box;
	width: 260px;
	height: auto;
}

.tp-review--strip {
	padding: 16px;
	background: #fff;
	border-radius: 16px;
	box-shadow: inset 0 0 0 1px var(--tp-hairline);
	transition: box-shadow 0.2s var(--tp-ease);
}

.tp-review--strip:hover {
	box-shadow: inset 0 0 0 1px var(--tp-border), 0 4px 16px rgb(31 49 71 / 0.08);
}

.tp-review--strip .tp-review__text {
	display: -webkit-box;
	overflow: hidden;
	font-size: 14px;
	-webkit-line-clamp: 4;
	-webkit-box-orient: vertical;
}

.tp-review--strip .tp-review__meta {
	margin-top: auto;
}

/* The whole card opens the full review on /reviews/ */
.tp-review__more {
	position: absolute;
	inset: 0;
	border-radius: inherit;
}

.tp-review__more:focus-visible {
	outline: 2px solid var(--tp-primary);
	outline-offset: 2px;
}

.tp-review--strip .tp-review__by {
	font-size: 13px;
}

/* ---------- /reviews/ page ---------- */

.tp-reviews-page .tp-reviews__list {
	margin-top: 16px;
}

.tp-reviews-page .tp-review:target {
	margin: 0 -16px;
	padding: 24px 16px;
	background: var(--tp-surface);
	border-radius: 16px;
}

.tp-reviews__pager {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 24px;
}

.tp-reviews__pager .page-numbers {
	display: inline-grid;
	place-items: center;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	color: var(--tp-ink);
	text-decoration: none;
	border-radius: var(--tp-r-pill);
	box-shadow: inset 0 0 0 1px var(--tp-border);
}

.tp-reviews__pager .current {
	color: #fff;
	background: var(--tp-ink);
	box-shadow: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 767px) {
	.tp-reviews {
		margin-top: 40px;
	}

	.tp-reviews__summary {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-auto-flow: row;
	}

	.tp-reviews__score {
		grid-column: 1 / -1;
	}

	.tp-review-form,
	.tp-shop {
		padding: 20px 16px;
	}

	.tp-strip-nav {
		display: none;
	}

	.tp-shop__cta {
		align-items: stretch;
		width: 100%;
	}

	.tp-shop__cta .tp-btn {
		width: 100%;
	}

	.tp-shop__strip .tp-review--strip {
		flex-basis: 78%;
		width: 78%;
	}
}
