/*
 * Touchstone Reviews: the review box.
 *
 * "Inherits theme" is the default look. Fonts and text color come from the page.
 * Lines and tracks are tints of the text color, so they suit light and dark themes
 * alike. Text itself is never tinted: a theme whose text only just passes the
 * contrast minimum would fail it with any tint, so smaller lines are set apart by
 * size and weight instead. The accent stays neutral until the theme or the site owner
 * supplies one (class touchstone-review--has-accent, set on the server together with
 * a text color that is readable on it).
 *
 * A built-in palette (class touchstone-review--palette-NAME) is a full set of the custom
 * properties below, written by the server into the box's style attribute. The values
 * live in PHP only, so nothing here names a palette or one of its colors.
 *
 * Three layouts share these rules: the scorecard (the base rules), the classic card
 * and the compact summary, each with its own section further down.
 */

.touchstone-review {
	--touchstone-review-surface: transparent;
	--touchstone-review-foot: transparent;
	--touchstone-review-muted: currentColor;
	--touchstone-review-border: rgba(128, 128, 128, 0.35);
	--touchstone-review-track: rgba(128, 128, 128, 0.22);
	--touchstone-review-chip: rgba(128, 128, 128, 0.16);
	--touchstone-review-border-width: 1px;
	--touchstone-review-radius: 14px;
	--touchstone-review-accent: currentColor;
	--touchstone-review-accent-text: currentColor;
	--touchstone-review-pro: currentColor;
	--touchstone-review-con: currentColor;
	--touchstone-review-pro-surface: var(--touchstone-review-track);
	--touchstone-review-con-surface: var(--touchstone-review-track);
	--touchstone-review-star: var(--touchstone-review-accent);
	--touchstone-review-star-off: var(--touchstone-review-track);
	--touchstone-review-tile: var(--touchstone-review-chip);
	--touchstone-review-tile-star: currentColor;
	--touchstone-review-tile-star-off: rgba(128, 128, 128, 0.5);
	--touchstone-review-shadow: none;

	box-sizing: border-box;
	/* The box takes its width from the column it sits in, never from its content, so its layout can respond to that width. */
	display: block;
	width: 100%;
	container-type: inline-size;
	margin-block: 1.75em;
	overflow: hidden;
	border: var(--touchstone-review-border-width) solid var(--touchstone-review-border);
	border-radius: var(--touchstone-review-radius);
	background: var(--touchstone-review-surface);
	box-shadow: var(--touchstone-review-shadow);
	/* Text color and font come from the page unless a palette names its own. */
	color: var(--touchstone-review-ink, inherit);
	font-family: var(--touchstone-review-body-font, inherit);
	/* Follows the page's text size within limits. The upper limit grows with the reader's own default font size. */
	font-size: calc(clamp(15px, 1em, max(18px, 1.125rem)) * var(--touchstone-review-text-scale, 1));
	/* Scores read best with full-height figures, whatever font the theme or palette brings. */
	font-variant-numeric: lining-nums;
	line-height: 1.5;
	/* A long word, product code or pasted address wraps inside the box, since whatever sticks out is cut off. */
	overflow-wrap: anywhere;
	text-align: start;
}

/* With an accent, the score badge wears it. Without one it is a quiet tint of the text color. */
.touchstone-review--has-accent {
	--touchstone-review-tile: var(--touchstone-review-accent);
	--touchstone-review-on-tile: var(--touchstone-review-on-accent);
}

@supports (color: color-mix(in srgb, red 50%, blue)) {
	.touchstone-review {
		--touchstone-review-border: color-mix(in srgb, currentColor 18%, transparent);
		--touchstone-review-track: color-mix(in srgb, currentColor 12%, transparent);
		--touchstone-review-chip: color-mix(in srgb, currentColor 10%, transparent);
		--touchstone-review-tile-star-off: color-mix(in srgb, currentColor 35%, transparent);
	}

	.touchstone-review--has-accent {
		--touchstone-review-chip: color-mix(in srgb, var(--touchstone-review-accent) 14%, transparent);
	}
}

.touchstone-review *,
.touchstone-review *::before,
.touchstone-review *::after {
	box-sizing: border-box;
}

/*
 * A built-in palette sets its own text colors and fonts, so the theme's rules for
 * headings, paragraphs, lists and links must not show through. The "inherit" look
 * has no palette class and keeps following the theme. :where() adds no weight, so
 * the layout rules further down can still override these.
 */
.touchstone-review:where([class*="touchstone-review--palette-"]) :is(h2, h3, h4, h5, h6, p, li, dt, dd) {
	color: inherit;
}

.touchstone-review:where([class*="touchstone-review--palette-"]) .touchstone-review__name,
.touchstone-review:where([class*="touchstone-review--palette-"]) .touchstone-review__score {
	color: inherit;
	font-family: var(--touchstone-review-heading-font, inherit);
}

.touchstone-review:where([class*="touchstone-review--palette-"]) .touchstone-review__verdict,
.touchstone-review:where([class*="touchstone-review--palette-"]) .touchstone-review__summary,
.touchstone-review:where([class*="touchstone-review--palette-"]) .touchstone-review__byline {
	color: var(--touchstone-review-body, inherit);
}

/* A link in the summary is underlined, so it is not told apart by its color alone, whatever the theme does with links. */
.touchstone-review:where([class*="touchstone-review--palette-"]) .touchstone-review__summary a {
	color: var(--touchstone-review-accent-text);
	text-decoration: underline;
}

/*
 * A font chosen in the style settings replaces the palette's and the theme's,
 * including any font the theme sets on headings, paragraphs and lists.
 */
.touchstone-review--has-font :is(h2, h3, h4, h5, h6, p, li, dt, dd, summary, a, span) {
	font-family: inherit;
}

.touchstone-review--has-font .touchstone-review__name,
.touchstone-review--has-font .touchstone-review__score {
	font-family: var(--touchstone-review-heading-font, inherit);
}

/* Screen reader only text. */
.touchstone-review .touchstone-review__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.touchstone-review .touchstone-review__icon {
	flex: none;
	width: 1em;
	height: 1em;
	font-size: 16px;
}

/* Top: score ring, badge, item name, verdict. */
.touchstone-review .touchstone-review__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: calc(20px * var(--touchstone-review-space, 1)) calc(32px * var(--touchstone-review-space, 1));
	padding: calc(24px * var(--touchstone-review-space, 1)) calc(20px * var(--touchstone-review-space, 1)) calc(22px * var(--touchstone-review-space, 1));
}

.touchstone-review .touchstone-review__ring {
	position: relative;
	flex: none;
	width: 136px;
	height: 136px;
}

.touchstone-review .touchstone-review__ring svg {
	display: block;
	width: 136px;
	height: 136px;
}

.touchstone-review .touchstone-review__ring-track {
	stroke: var(--touchstone-review-track);
}

.touchstone-review .touchstone-review__ring-value {
	stroke: var(--touchstone-review-accent);
}

.touchstone-review .touchstone-review__ring-text {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.touchstone-review .touchstone-review__score {
	font-size: 2.375em;
	font-weight: 700;
	line-height: 1;
}

.touchstone-review .touchstone-review__ring .touchstone-review__score--long {
	font-size: 1.875em;
}

.touchstone-review .touchstone-review__out-of {
	margin-top: calc(4px * var(--touchstone-review-space, 1));
	color: var(--touchstone-review-muted);
	font-size: 0.75em;
	line-height: 1.3;
}

.touchstone-review .touchstone-review__intro {
	display: flex;
	flex: 1 1 300px;
	flex-direction: column;
	gap: calc(8px * var(--touchstone-review-space, 1));
	min-width: 0;
}

.touchstone-review .touchstone-review__badge {
	align-self: flex-start;
	padding: calc(4px * var(--touchstone-review-space, 1)) calc(10px * var(--touchstone-review-space, 1));
	border-radius: 999px;
	background: var(--touchstone-review-chip);
	color: var(--touchstone-review-chip-text, inherit);
	font-size: 0.75em;
	font-weight: 600;
	line-height: 1.4;
}

.touchstone-review .touchstone-review__name {
	margin: 0;
	padding: 0;
	font-size: 1.625em;
	font-weight: 700;
	line-height: 1.2;
	overflow-wrap: anywhere;
}

.touchstone-review .touchstone-review__verdict {
	margin: 0;
	font-size: 1em;
	line-height: 1.5;
}

/* Criteria with bars. */
.touchstone-review .touchstone-review__criteria {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: calc(16px * var(--touchstone-review-space, 1)) calc(28px * var(--touchstone-review-space, 1));
	margin: 0;
	padding: calc(22px * var(--touchstone-review-space, 1)) calc(20px * var(--touchstone-review-space, 1));
	border-top: 1px solid var(--touchstone-review-border);
	list-style: none;
}

.touchstone-review .touchstone-review__criterion {
	display: flex;
	flex-direction: column;
	gap: calc(8px * var(--touchstone-review-space, 1));
	margin: 0;
	padding: 0;
	list-style: none;
}

.touchstone-review li::before,
.touchstone-review li::marker {
	content: none;
}

.touchstone-review .touchstone-review__criterion-row {
	display: flex;
	justify-content: space-between;
	gap: calc(12px * var(--touchstone-review-space, 1));
	font-size: 0.875em;
	line-height: 1.4;
}

.touchstone-review .touchstone-review__criterion-name {
	font-weight: 500;
	overflow-wrap: anywhere;
}

.touchstone-review .touchstone-review__criterion-score {
	flex: none;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.touchstone-review .touchstone-review__bar {
	display: block;
	height: 8px;
	overflow: hidden;
	border-radius: 999px;
	background: var(--touchstone-review-track);
}

.touchstone-review .touchstone-review__bar-fill {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: var(--touchstone-review-accent);
}

/*
 * Stars: one row of five, with a second copy on top inside a frame that is as wide as
 * the score's share of the scale. The frame hides what lies outside it.
 */
.touchstone-review .touchstone-review__stars {
	display: block;
	flex: none;
	width: 5em;
	height: 1em;
	font-size: 1.0625em;
}

.touchstone-review .touchstone-review__stars svg {
	overflow: hidden;
}

.touchstone-review .touchstone-review__stars-off {
	fill: var(--touchstone-review-star-off);
	fill-opacity: 1;
}

.touchstone-review .touchstone-review__stars-on {
	fill: var(--touchstone-review-star);
}

/* Stars fill from the side where reading starts. The shape is the same mirrored. */
.touchstone-review:dir(rtl) .touchstone-review__stars {
	transform: scaleX(-1);
}

/* The same for browsers that do not know :dir() yet. Kept as its own rule, since they would drop a shared one. */
.touchstone-review:where([dir="rtl"], [dir="rtl"] *) .touchstone-review__stars {
	transform: scaleX(-1);
}

/* Score badge: the overall score as a solid block, in the card and compact layouts. */
.touchstone-review .touchstone-review__tile {
	display: flex;
	flex: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	border-radius: calc(var(--touchstone-review-radius) * 0.72);
	background: var(--touchstone-review-tile);
	color: var(--touchstone-review-on-tile, inherit);
}

.touchstone-review .touchstone-review__tile .touchstone-review__out-of {
	color: inherit;
}

.touchstone-review .touchstone-review__tile .touchstone-review__stars-off {
	fill: var(--touchstone-review-tile-star-off);
}

.touchstone-review .touchstone-review__tile .touchstone-review__stars-on {
	fill: var(--touchstone-review-tile-star);
}

/* Unscored details. */
.touchstone-review .touchstone-review__details {
	display: flex;
	flex-wrap: wrap;
	gap: calc(8px * var(--touchstone-review-space, 1));
	margin: 0;
	padding: 0 calc(20px * var(--touchstone-review-space, 1)) calc(22px * var(--touchstone-review-space, 1));
}

.touchstone-review .touchstone-review__detail {
	display: flex;
	gap: calc(6px * var(--touchstone-review-space, 1));
	max-width: 100%;
	padding: calc(4px * var(--touchstone-review-space, 1)) calc(10px * var(--touchstone-review-space, 1));
	border: 1px solid var(--touchstone-review-border);
	border-radius: 999px;
	font-size: 0.8125em;
	line-height: 1.4;
}

/* The label keeps its width beside a long value, so the value is what wraps. A very long label may take half the row. */
.touchstone-review .touchstone-review__detail dt {
	flex: 0 1 auto;
	min-width: 0;
	margin: 0;
	overflow-wrap: anywhere;
	color: var(--touchstone-review-muted);
	font-weight: 400;
}

.touchstone-review .touchstone-review__detail dt::after {
	content: ":";
}

.touchstone-review .touchstone-review__detail dd {
	flex: 0 1 auto;
	min-width: 0;
	margin: 0;
	overflow-wrap: anywhere;
	font-weight: 600;
}

/* Summary. */
.touchstone-review .touchstone-review__summary {
	padding: calc(22px * var(--touchstone-review-space, 1)) calc(20px * var(--touchstone-review-space, 1));
	border-top: 1px solid var(--touchstone-review-border);
	font-size: 0.9375em;
	line-height: 1.6;
}

.touchstone-review .touchstone-review__summary > :first-child {
	margin-top: 0;
}

.touchstone-review .touchstone-review__summary > :last-child {
	margin-bottom: 0;
}

/* Pros and cons. */
.touchstone-review .touchstone-review__verdicts {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	border-top: 1px solid var(--touchstone-review-border);
}

.touchstone-review .touchstone-review__statements {
	display: flex;
	flex-direction: column;
	gap: calc(10px * var(--touchstone-review-space, 1));
	padding: calc(22px * var(--touchstone-review-space, 1)) calc(20px * var(--touchstone-review-space, 1));
}

.touchstone-review .touchstone-review__statements + .touchstone-review__statements {
	border-top: 1px solid var(--touchstone-review-border);
}

.touchstone-review .touchstone-review__statements-title {
	margin: 0;
	font-size: 0.8125em;
	font-weight: 700;
	letter-spacing: 0.04em;
	line-height: 1.4;
	text-transform: uppercase;
}

.touchstone-review .touchstone-review__statements--pros .touchstone-review__statements-title,
.touchstone-review .touchstone-review__statements--pros .touchstone-review__icon {
	color: var(--touchstone-review-pro);
}

.touchstone-review .touchstone-review__statements--cons .touchstone-review__statements-title,
.touchstone-review .touchstone-review__statements--cons .touchstone-review__icon {
	color: var(--touchstone-review-con);
}

.touchstone-review .touchstone-review__statements ul {
	display: flex;
	flex-direction: column;
	gap: calc(10px * var(--touchstone-review-space, 1));
	margin: 0;
	padding: 0;
	list-style: none;
}

.touchstone-review .touchstone-review__statements li {
	display: flex;
	gap: calc(8px * var(--touchstone-review-space, 1));
	margin: 0;
	padding: 0;
	font-size: 0.875em;
	line-height: 1.45;
	list-style: none;
}

.touchstone-review .touchstone-review__statements li .touchstone-review__icon {
	margin-top: calc(2px * var(--touchstone-review-space, 1));
}

/* Lets the text shrink beside its icon, so a long word wraps instead of pushing past the edge. */
.touchstone-review .touchstone-review__statements li > span {
	min-width: 0;
}

/* Bottom: byline, disclosure, button. */
.touchstone-review .touchstone-review__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: calc(16px * var(--touchstone-review-space, 1));
	padding: calc(20px * var(--touchstone-review-space, 1));
	border-top: 1px solid var(--touchstone-review-border);
	background: var(--touchstone-review-foot);
}

.touchstone-review .touchstone-review__notes {
	display: flex;
	flex: 1 1 240px;
	flex-direction: column;
	gap: calc(4px * var(--touchstone-review-space, 1));
	max-width: 400px;
}

.touchstone-review .touchstone-review__byline {
	font-size: 0.875em;
	line-height: 1.45;
}

.touchstone-review .touchstone-review__disclosure {
	color: var(--touchstone-review-muted);
	font-size: 0.75em;
	line-height: 1.45;
}

.touchstone-review .touchstone-review__button {
	display: inline-flex;
	align-items: center;
	gap: calc(8px * var(--touchstone-review-space, 1));
	min-height: 44px;
	/* The padding above and below only shows when a long label wraps onto a second line. */
	padding: calc(8px * var(--touchstone-review-space, 1)) calc(20px * var(--touchstone-review-space, 1));
	border: 2px solid currentColor;
	border-radius: calc(var(--touchstone-review-radius) * 0.72);
	background: transparent;
	color: inherit;
	font-size: 0.9375em;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
}

.touchstone-review--has-accent .touchstone-review__button {
	border-color: var(--touchstone-review-accent);
	background: var(--touchstone-review-accent);
	color: var(--touchstone-review-on-accent);
}

/* Hover adds an underline. Fading the button would take contrast away from its label. */
.touchstone-review .touchstone-review__button:hover {
	text-decoration: underline;
}

/*
 * The focus ring is drawn inside the button, in the color of its label. There it sits
 * on the button's own background, which the label is already checked against. Outside
 * the button it would sit on the box, where that color can be invisible.
 */
.touchstone-review .touchstone-review__button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: -6px;
}

/* The arrow points toward the end of the line in both reading directions. */
.touchstone-review:dir(rtl) .touchstone-review__button .touchstone-review__icon {
	transform: scaleX(-1);
}

.touchstone-review:where([dir="rtl"], [dir="rtl"] *) .touchstone-review__button .touchstone-review__icon {
	transform: scaleX(-1);
}

/* Wider boxes: two columns and more padding. Sized by the box, not the screen. */
@container (min-width: 560px) {
	.touchstone-review .touchstone-review__head {
		padding: calc(30px * var(--touchstone-review-space, 1)) calc(30px * var(--touchstone-review-space, 1)) calc(26px * var(--touchstone-review-space, 1));
	}

	.touchstone-review .touchstone-review__criteria {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		padding: calc(22px * var(--touchstone-review-space, 1)) calc(30px * var(--touchstone-review-space, 1));
	}

	.touchstone-review .touchstone-review__details {
		padding: 0 calc(30px * var(--touchstone-review-space, 1)) calc(22px * var(--touchstone-review-space, 1));
	}

	.touchstone-review .touchstone-review__summary {
		padding: calc(22px * var(--touchstone-review-space, 1)) calc(30px * var(--touchstone-review-space, 1));
	}

	.touchstone-review .touchstone-review__verdicts {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.touchstone-review .touchstone-review__statements {
		padding: calc(22px * var(--touchstone-review-space, 1)) calc(30px * var(--touchstone-review-space, 1));
	}

	.touchstone-review .touchstone-review__statements + .touchstone-review__statements {
		border-top: 0;
		border-inline-start: 1px solid var(--touchstone-review-border);
	}

	.touchstone-review .touchstone-review__foot {
		padding: calc(20px * var(--touchstone-review-space, 1)) calc(30px * var(--touchstone-review-space, 1));
	}
}

/*
 * Layout A, the classic card: item name beside the score badge, criteria as rows,
 * pros and cons as two tinted panels, then the verdict.
 */
.touchstone-review--card .touchstone-review__head {
	flex-wrap: nowrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: calc(16px * var(--touchstone-review-space, 1));
	padding: calc(22px * var(--touchstone-review-space, 1)) calc(20px * var(--touchstone-review-space, 1)) calc(18px * var(--touchstone-review-space, 1));
}

.touchstone-review--card .touchstone-review__intro {
	flex: 1 1 auto;
}

/* In this layout the badge line is a small label in the accent color, not a pill. */
.touchstone-review--card .touchstone-review__badge {
	padding: 0;
	border-radius: 0;
	background: none;
	color: var(--touchstone-review-accent-text);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.touchstone-review--card .touchstone-review__name {
	font-size: 1.5em;
	line-height: 1.15;
}

.touchstone-review--card .touchstone-review__byline {
	color: var(--touchstone-review-muted);
}

.touchstone-review--card .touchstone-review__tile {
	gap: calc(6px * var(--touchstone-review-space, 1));
	min-width: 6em;
	padding: calc(12px * var(--touchstone-review-space, 1)) calc(14px * var(--touchstone-review-space, 1));
}

.touchstone-review--card .touchstone-review__tile .touchstone-review__score {
	font-size: 2.25em;
}

.touchstone-review--card .touchstone-review__tile .touchstone-review__stars {
	font-size: 0.9375em;
}

.touchstone-review--card .touchstone-review__tile .touchstone-review__out-of {
	margin-top: 0;
}

.touchstone-review--card .touchstone-review__criteria {
	display: flex;
	flex-direction: column;
	gap: 0;
	padding: 0 calc(20px * var(--touchstone-review-space, 1));
	border-top: 0;
}

/*
 * One row per criterion: name, then the bar or stars, then the number. The name and
 * the number share a wrapper in the markup, which steps aside here (display: contents)
 * so all three can be placed on one grid.
 */
.touchstone-review--card .touchstone-review__criterion {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto auto;
	align-items: center;
	gap: 0 calc(12px * var(--touchstone-review-space, 1));
	padding: calc(12px * var(--touchstone-review-space, 1)) 0;
	border-top: 1px solid var(--touchstone-review-border);
}

.touchstone-review--card .touchstone-review__criterion-row {
	display: contents;
	font-size: 0.9375em;
}

.touchstone-review--card .touchstone-review__criterion-name {
	grid-area: 1 / 1;
}

.touchstone-review--card .touchstone-review__criterion-score {
	grid-area: 1 / 3;
	min-width: 2em;
	font-size: 0.9333em;
	font-weight: 600;
	text-align: end;
}

.touchstone-review--card .touchstone-review__criterion .touchstone-review__stars,
.touchstone-review--card .touchstone-review__criterion .touchstone-review__bar {
	grid-area: 1 / 2;
}

.touchstone-review--card .touchstone-review__criterion .touchstone-review__bar {
	width: clamp(72px, 36cqi, 260px);
}

.touchstone-review--card .touchstone-review__details {
	padding: calc(4px * var(--touchstone-review-space, 1)) calc(20px * var(--touchstone-review-space, 1)) 0;
}

.touchstone-review--card .touchstone-review__verdicts {
	gap: calc(14px * var(--touchstone-review-space, 1));
	padding: calc(20px * var(--touchstone-review-space, 1));
	border-top: 0;
}

.touchstone-review--card .touchstone-review__statements {
	padding: calc(16px * var(--touchstone-review-space, 1));
	border-radius: calc(var(--touchstone-review-radius) * 0.72);
}

.touchstone-review--card .touchstone-review__statements + .touchstone-review__statements {
	border: 0;
}

.touchstone-review--card .touchstone-review__statements--pros {
	background: var(--touchstone-review-pro-surface);
}

.touchstone-review--card .touchstone-review__statements--cons {
	background: var(--touchstone-review-con-surface);
}

.touchstone-review--card .touchstone-review__statements-title {
	letter-spacing: 0;
	text-transform: none;
}

.touchstone-review--card .touchstone-review__conclusion {
	display: flex;
	flex-direction: column;
	gap: calc(8px * var(--touchstone-review-space, 1));
	padding: calc(20px * var(--touchstone-review-space, 1)) calc(20px * var(--touchstone-review-space, 1)) calc(24px * var(--touchstone-review-space, 1));
}

.touchstone-review--card .touchstone-review__verdicts + .touchstone-review__conclusion {
	padding-top: calc(4px * var(--touchstone-review-space, 1));
}

.touchstone-review--card .touchstone-review__label {
	margin: 0;
	color: var(--touchstone-review-muted);
	font-size: 0.75em;
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1.4;
	text-transform: uppercase;
}

.touchstone-review--card .touchstone-review__verdict {
	font-size: 1.3125em;
	font-weight: 600;
	line-height: 1.35;
}

/* A palette draws the verdict line like a heading: its heading font, in the main text color. */
.touchstone-review--card:where([class*="touchstone-review--palette-"]) .touchstone-review__verdict {
	color: inherit;
	font-family: var(--touchstone-review-heading-font, inherit);
}

.touchstone-review--card .touchstone-review__summary {
	padding: 0;
	border-top: 0;
}

.touchstone-review--card .touchstone-review__foot {
	padding: calc(18px * var(--touchstone-review-space, 1)) calc(20px * var(--touchstone-review-space, 1));
}

.touchstone-review--card .touchstone-review__notes {
	max-width: 380px;
}

@container (min-width: 560px) {
	.touchstone-review--card .touchstone-review__head {
		gap: calc(24px * var(--touchstone-review-space, 1));
		padding: calc(28px * var(--touchstone-review-space, 1)) calc(28px * var(--touchstone-review-space, 1)) calc(22px * var(--touchstone-review-space, 1));
	}

	.touchstone-review--card .touchstone-review__name {
		font-size: 1.75em;
	}

	.touchstone-review--card .touchstone-review__tile {
		min-width: 7em;
		padding: calc(14px * var(--touchstone-review-space, 1)) calc(16px * var(--touchstone-review-space, 1));
	}

	.touchstone-review--card .touchstone-review__tile .touchstone-review__score {
		font-size: 2.625em;
	}

	.touchstone-review--card .touchstone-review__criteria {
		padding: 0 calc(28px * var(--touchstone-review-space, 1));
	}

	.touchstone-review--card .touchstone-review__details {
		padding: calc(4px * var(--touchstone-review-space, 1)) calc(28px * var(--touchstone-review-space, 1)) 0;
	}

	.touchstone-review--card .touchstone-review__verdicts {
		padding: calc(20px * var(--touchstone-review-space, 1)) calc(28px * var(--touchstone-review-space, 1));
	}

	.touchstone-review--card .touchstone-review__conclusion {
		padding-inline: calc(28px * var(--touchstone-review-space, 1));
	}

	.touchstone-review--card .touchstone-review__foot {
		padding: calc(18px * var(--touchstone-review-space, 1)) calc(28px * var(--touchstone-review-space, 1));
	}
}

/*
 * Layout B, the compact summary: score badge, item name, verdict and button on one
 * line, then a strip with the criteria and a toggle that reveals the full breakdown.
 */
.touchstone-review--compact .touchstone-review__head {
	gap: calc(16px * var(--touchstone-review-space, 1));
	padding: calc(18px * var(--touchstone-review-space, 1));
}

.touchstone-review--compact .touchstone-review__tile {
	min-width: 4.75em;
	min-height: 4.75em;
	padding: calc(6px * var(--touchstone-review-space, 1));
}

.touchstone-review--compact .touchstone-review__tile .touchstone-review__score {
	font-size: 1.875em;
}

.touchstone-review--compact .touchstone-review__tile .touchstone-review__out-of {
	font-size: 0.6875em;
}

/*
 * The text takes nearly all spare width while it shares a line with the button.
 * Once the button drops to a line of its own, it stretches across the box.
 */
.touchstone-review--compact .touchstone-review__intro {
	flex: 999 1 180px;
	gap: calc(6px * var(--touchstone-review-space, 1));
}

.touchstone-review--compact .touchstone-review__title {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: calc(6px * var(--touchstone-review-space, 1)) calc(10px * var(--touchstone-review-space, 1));
}

.touchstone-review--compact .touchstone-review__title .touchstone-review__stars {
	font-size: 0.9375em;
}

.touchstone-review--compact .touchstone-review__name {
	font-size: 1.1875em;
	line-height: 1.25;
}

.touchstone-review--compact .touchstone-review__verdict {
	font-size: 0.9375em;
	line-height: 1.45;
}

.touchstone-review--compact .touchstone-review__button {
	flex: 1 1 auto;
	justify-content: center;
	padding-inline: calc(18px * var(--touchstone-review-space, 1));
}

/*
 * The strip holds the criteria at its start and the toggle at its end. Both float, so
 * the toggle stays where it is when the panel opens underneath them, and drops below
 * the criteria on its own when they need the full width.
 */
.touchstone-review--compact .touchstone-review__strip {
	display: flow-root;
	padding: calc(10px * var(--touchstone-review-space, 1)) calc(18px * var(--touchstone-review-space, 1)) 0;
	border-top: 1px solid var(--touchstone-review-border);
	background: var(--touchstone-review-foot);
}

.touchstone-review--compact .touchstone-review__criteria {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	float: inline-start;
	gap: calc(4px * var(--touchstone-review-space, 1)) calc(16px * var(--touchstone-review-space, 1));
	max-width: 100%;
	min-height: 44px;
	margin-bottom: calc(10px * var(--touchstone-review-space, 1));
	padding: 0;
	border-top: 0;
}

.touchstone-review--compact .touchstone-review__criterion {
	flex-direction: row;
	align-items: center;
}

.touchstone-review--compact .touchstone-review__criterion-row {
	justify-content: flex-start;
	gap: calc(5px * var(--touchstone-review-space, 1));
	font-size: 0.8125em;
}

.touchstone-review--compact .touchstone-review__criterion-name {
	color: var(--touchstone-review-body, inherit);
	font-weight: 400;
}

.touchstone-review--compact .touchstone-review__criterion .touchstone-review__stars {
	font-size: 0.8125em;
}

.touchstone-review--compact .touchstone-review__criterion .touchstone-review__bar {
	width: 3.5em;
	height: 6px;
}

/* The toggle is the summary of a details element: the browser opens and closes it, with no script. */
.touchstone-review--compact .touchstone-review__toggle {
	display: flex;
	align-items: center;
	float: inline-end;
	gap: calc(6px * var(--touchstone-review-space, 1));
	min-height: 44px;
	margin-bottom: calc(10px * var(--touchstone-review-space, 1));
	padding: 0 calc(4px * var(--touchstone-review-space, 1));
	border-radius: 4px;
	color: var(--touchstone-review-accent-text);
	font-size: 0.8125em;
	font-weight: 600;
	line-height: 1.2;
	list-style: none;
	cursor: pointer;
}

.touchstone-review--compact .touchstone-review__toggle::-webkit-details-marker {
	display: none;
}

.touchstone-review--compact .touchstone-review__toggle:hover {
	text-decoration: underline;
}

.touchstone-review--compact .touchstone-review__toggle:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.touchstone-review--compact .touchstone-review__toggle .touchstone-review__icon {
	font-size: 14px;
}

.touchstone-review--compact .touchstone-review__more[open] .touchstone-review__toggle .touchstone-review__icon {
	transform: rotate(180deg);
}

/* The panel starts below both floats and reaches the edges of the box again. */
.touchstone-review--compact .touchstone-review__panel {
	display: flex;
	flex-direction: column;
	clear: both;
	gap: calc(16px * var(--touchstone-review-space, 1));
	margin-inline: calc(-18px * var(--touchstone-review-space, 1));
	padding: calc(18px * var(--touchstone-review-space, 1)) calc(18px * var(--touchstone-review-space, 1)) calc(16px * var(--touchstone-review-space, 1));
	border-top: 1px solid var(--touchstone-review-border);
	background: var(--touchstone-review-surface);
}

.touchstone-review--compact .touchstone-review__details,
.touchstone-review--compact .touchstone-review__summary,
.touchstone-review--compact .touchstone-review__verdicts,
.touchstone-review--compact .touchstone-review__statements,
.touchstone-review--compact .touchstone-review__statements + .touchstone-review__statements {
	padding: 0;
	border: 0;
}

.touchstone-review--compact .touchstone-review__verdicts {
	gap: calc(16px * var(--touchstone-review-space, 1));
}

.touchstone-review--compact .touchstone-review__statements,
.touchstone-review--compact .touchstone-review__statements ul {
	gap: calc(8px * var(--touchstone-review-space, 1));
}

.touchstone-review--compact .touchstone-review__statements-title {
	letter-spacing: 0;
	text-transform: none;
}

.touchstone-review--compact .touchstone-review__notes {
	flex: none;
	max-width: none;
}

@container (min-width: 560px) {
	.touchstone-review--compact .touchstone-review__head {
		gap: calc(20px * var(--touchstone-review-space, 1));
		padding: calc(20px * var(--touchstone-review-space, 1)) calc(22px * var(--touchstone-review-space, 1));
	}

	.touchstone-review--compact .touchstone-review__strip {
		padding-inline: calc(22px * var(--touchstone-review-space, 1));
	}

	.touchstone-review--compact .touchstone-review__panel {
		margin-inline: calc(-22px * var(--touchstone-review-space, 1));
		padding-inline: calc(22px * var(--touchstone-review-space, 1));
	}
}

/* Windows high contrast and similar modes: keep bars, stars, the ring and the score badge visible. */
@media (forced-colors: active) {
	.touchstone-review .touchstone-review__bar {
		outline: 1px solid CanvasText;
		outline-offset: -1px;
	}

	.touchstone-review .touchstone-review__bar-fill {
		background: CanvasText;
	}

	.touchstone-review .touchstone-review__ring-value {
		stroke: CanvasText;
	}

	/* Drawings keep their own colors in these modes, so the unfilled part of the ring is given a system color too. */
	.touchstone-review .touchstone-review__ring-track {
		stroke: GrayText;
	}

	.touchstone-review .touchstone-review__tile {
		outline: 1px solid CanvasText;
		outline-offset: -1px;
	}

	.touchstone-review .touchstone-review__stars-off,
	.touchstone-review .touchstone-review__tile .touchstone-review__stars-off {
		fill: Canvas;
		stroke: CanvasText;
		stroke-width: 1px;
	}

	.touchstone-review .touchstone-review__stars-on,
	.touchstone-review .touchstone-review__tile .touchstone-review__stars-on {
		fill: CanvasText;
		stroke: CanvasText;
		stroke-width: 1px;
	}
}

/* Printing leaves backgrounds out unless told otherwise, which would put light text on white paper. */
@media print {
	.touchstone-review {
		break-inside: avoid;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}
}
