/**
 * Tech Market Shop — rating stars.
 *
 * Self-contained: no star font, no dependency on WooCommerce's .star-rating
 * styles, so the stars render identically on the shop grid, the flavour page
 * and the product page even when the theme does not load WooCommerce CSS.
 *
 * Proportional fill
 * ----------------
 * The fill layer is a clipped copy of the full star row, sized by
 * --tms-stars-fill. 4.7 → 94%, so the fifth star is 70% painted instead of
 * being rounded to four or five.
 */

.tms-stars {
	--tms-star-empty: #e3e3e3;
	--tms-star-full: #f5a524;

	position: relative;
	display: inline-block;
	flex: 0 0 auto;
	width: 5em;
	height: 1em;
	font-size: 13px;
	line-height: 1;
	vertical-align: middle;
}

.tms-stars--md {
	font-size: 16px;
}

.tms-stars > span {
	position: absolute;
	top: 0;
	left: 0;
	display: block;
	height: 1em;
}

.tms-stars__track {
	width: 5em;
}

.tms-stars__fill {
	width: var(--tms-stars-fill, 0%);
	overflow: hidden;
}

.tms-stars svg {
	display: block;
	width: 5em;
	height: 1em;
	overflow: visible;
}

.tms-stars__track svg path {
	fill: var(--tms-star-empty);
}

.tms-stars__fill svg path {
	fill: var(--tms-star-full);
}

/* ------------------------------------------------------------ product page */

.tms-product-rating {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 8px;
	margin: 6px 0 12px;
	color: #4a4a4a;
	font-size: 13px;
	line-height: 1.4;
}

.tms-product-rating__link {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 8px;
	color: inherit;
	text-decoration: none;
}

.tms-product-rating__link:hover .tms-product-rating__text,
.tms-product-rating__link:focus-visible .tms-product-rating__text {
	text-decoration: underline;
	text-underline-offset: 2px;
}

.tms-product-rating__link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
	border-radius: 4px;
}

.tms-product-rating__text {
	color: #4a4a4a;
	white-space: nowrap;
}

.tms-product-rating__text b {
	color: var(--tms-text, #090909);
	font-weight: 750;
}

.tms-product-rating__sep {
	color: #bdbdbd;
}

.tms-product-rating__count {
	color: #6b6b6b;
	white-space: nowrap;
}

.tms-product-rating__note {
	color: var(--tms-muted, #929292);
	font-size: 12px;
	white-space: nowrap;
}

.tms-product-rating.is-empty {
	color: var(--tms-muted, #929292);
	font-size: 13px;
}

.tms-reviews-anchor {
	display: block;
	position: relative;
	top: -12px;
	width: 0;
	height: 0;
	visibility: hidden;
}

/* --------------------------------------------------------------- card */

.tms-card-rating {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 6px 0 0;
	color: #6b6b6b;
	font-size: 11px;
	line-height: 1.2;
	min-height: 14px;
}

.tms-card-rating__value {
	color: var(--tms-text, #090909);
	font-weight: 700;
	font-size: 11px;
}

.tms-card-rating__count {
	color: #8b8b8b;
	font-size: 11px;
}

.tms-card-rating .tms-stars {
	font-size: 12px;
}

.tms-card-rating.is-empty {
	color: #a0a0a0;
}

.tms-card-rating__none {
	color: #a0a0a0;
	font-size: 11px;
	line-height: 1.2;
}

/* --------------------------------------------------------------- mobile */

@media (max-width: 767px) {
	.tms-product-rating {
		gap: 5px 6px;
		margin: 4px 0 10px;
		font-size: 12px;
	}

	.tms-product-rating .tms-stars--md {
		font-size: 14px;
	}

	.tms-product-rating__note {
		font-size: 11px;
	}

	.tms-card-rating {
		gap: 4px;
		font-size: 10px;
	}

	.tms-card-rating .tms-stars {
		font-size: 11px;
	}

	.tms-card-rating__value,
	.tms-card-rating__count,
	.tms-card-rating__none {
		font-size: 10px;
	}
}

@media (max-width: 400px) {
	.tms-card-rating__count {
		display: none;
	}
}

/* Respect users who ask for less motion/colour contrast is unaffected;
   reduced-motion is irrelevant here but the media query keeps the block
   readable for high-contrast mode. */
@media (forced-colors: active) {
	.tms-stars__track svg path {
		fill: GrayText;
	}

	.tms-stars__fill svg path {
		fill: CanvasText;
	}
}

