/**
 * RPY Review Blocks - frontend styles.
 *
 * Colours resolve from Kadence's global palette variables where they exist, so the
 * blocks pick up the site's own scheme instead of imposing one. The fallbacks only
 * apply if the theme is swapped for something that doesn't define the palette.
 *
 * The visual language is borrowed from the subject matter: instrument readouts and
 * spec sheets. Numbers are set in tabular monospace, rules are hairlines, and the
 * one loud element is the segmented meter under the score.
 */

.rpy-rev {
	--rpy-accent: var( --global-palette1, #0f766e );
	--rpy-ink: var( --global-palette3, #16191d );
	--rpy-muted: var( --global-palette5, #62707f );
	--rpy-line: var( --global-palette7, #dfe3e8 );
	--rpy-surface: var( --global-palette8, #f5f7f8 );
	--rpy-bg: var( --global-palette9, #ffffff );
	--rpy-pos: #16745a;
	--rpy-neg: #9a3b32;
	--rpy-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

	margin-block: 2rem;
	color: var( --rpy-ink );
}

.rpy-rev *,
.rpy-rev *::before,
.rpy-rev *::after {
	box-sizing: border-box;
}

/* ---------------------------------------------------------------------------
 * 1. Score card
 * ------------------------------------------------------------------------ */

.rpy-score {
	display: grid;
	grid-template-columns: minmax( 0, 13rem ) minmax( 0, 1fr );
	gap: clamp( 1rem, 3vw, 2rem );
	align-items: start;
	padding: clamp( 1.1rem, 3vw, 1.75rem );
	background: var( --rpy-bg );
	border: 1px solid var( --rpy-line );
	border-radius: 5px;
}

.rpy-score__readout {
	min-width: 0;
}

.rpy-score__eyebrow {
	margin: 0 0 0.35rem;
	font-family: var( --rpy-mono );
	font-size: 0.7rem;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var( --rpy-muted );
}

.rpy-score__figure {
	margin: 0;
	display: flex;
	align-items: baseline;
	gap: 0.1em;
	font-family: var( --rpy-mono );
	font-variant-numeric: tabular-nums;
	line-height: 0.9;
}

.rpy-score__value {
	font-size: clamp( 2.75rem, 8vw, 3.85rem );
	font-weight: 600;
	letter-spacing: -0.04em;
	color: var( --rpy-ink );
}

.rpy-score__max {
	font-size: clamp( 1.05rem, 3vw, 1.3rem );
	font-weight: 500;
	color: var( --rpy-muted );
}

/* The signature element: one segment per point, filled proportionally. */
.rpy-score__meter {
	display: flex;
	gap: 3px;
	margin-top: 0.85rem;
}

.rpy-score__seg {
	position: relative;
	flex: 1 1 0;
	height: 7px;
	min-width: 4px;
	background: var( --rpy-line );
	border-radius: 1px;
	overflow: hidden;
}

.rpy-score__seg::after {
	content: "";
	position: absolute;
	inset: 0 auto 0 0;
	width: var( --rpy-fill, 0% );
	background: var( --rpy-accent );
}

.rpy-score__body {
	min-width: 0;
}

.rpy-score__product {
	margin: 0 0 0.6rem;
	font-size: 1.08rem;
	font-weight: 600;
	line-height: 1.3;
}

.rpy-score__brand {
	display: block;
	font-family: var( --rpy-mono );
	font-size: 0.7rem;
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var( --rpy-muted );
	margin-bottom: 0.15rem;
}

.rpy-score__verdict {
	margin: 0;
	font-size: 0.97rem;
	line-height: 1.6;
	color: var( --rpy-ink );
}

.rpy-score__verdict > p {
	margin: 0 0 0.6rem;
}

.rpy-score__verdict > p:last-child {
	margin-bottom: 0;
}

.rpy-score__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1.1rem;
	align-items: baseline;
	margin: 1rem 0 0;
	padding-top: 0.8rem;
	border-top: 1px solid var( --rpy-line );
	font-size: 0.85rem;
	color: var( --rpy-muted );
}

.rpy-score__price strong {
	font-family: var( --rpy-mono );
	font-variant-numeric: tabular-nums;
	color: var( --rpy-ink );
}

.rpy-score__link {
	color: var( --rpy-accent );
	text-decoration: underline;
	text-underline-offset: 0.18em;
}

/* Verdict-only card: no readout column, so the prose gets the full width and the
   accent moves to a left rule to keep the card from reading as a plain paragraph. */
.rpy-score.is-verdict-only {
	grid-template-columns: 1fr;
	border-left: 3px solid var( --rpy-accent );
}

.rpy-score.is-verdict-only .rpy-score__eyebrow {
	margin-bottom: 0.5rem;
}

@media ( max-width: 600px ) {
	.rpy-score {
		grid-template-columns: 1fr;
		gap: 1.1rem;
	}

	.rpy-score.is-verdict-only .rpy-score__readout {
		border-bottom: 0;
		padding-bottom: 0;
	}

	.rpy-score__readout {
		padding-bottom: 1.1rem;
		border-bottom: 1px solid var( --rpy-line );
	}
}

/* ---------------------------------------------------------------------------
 * 2. Pros / cons
 * ------------------------------------------------------------------------ */

.rpy-pc {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 15rem, 1fr ) );
	gap: clamp( 1rem, 3vw, 2rem );
}

.rpy-pc__col {
	min-width: 0;
	padding-top: 0.75rem;
	border-top: 2px solid var( --rpy-line );
}

.rpy-pc__col--pro {
	border-top-color: var( --rpy-pos );
}

.rpy-pc__col--con {
	border-top-color: var( --rpy-neg );
}

.rpy-pc__title {
	margin: 0 0 0.7rem;
	font-family: var( --rpy-mono );
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var( --rpy-muted );
}

.rpy-pc__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.rpy-pc__item {
	position: relative;
	margin: 0;
	padding: 0.34rem 0 0.34rem 1.35rem;
	font-size: 0.95rem;
	line-height: 1.5;
}

/* Typographic markers rather than icons: the sign carries the meaning, the text
   stays in the body colour so the list reads as prose, not as a scorecard. */
.rpy-pc__item::before {
	position: absolute;
	left: 0;
	top: 0.34rem;
	font-family: var( --rpy-mono );
	font-weight: 600;
	line-height: 1.5;
}

.rpy-pc__col--pro .rpy-pc__item::before {
	content: "+";
	color: var( --rpy-pos );
}

.rpy-pc__col--con .rpy-pc__item::before {
	content: "\2212"; /* true minus sign, not a hyphen */
	color: var( --rpy-neg );
}

/* ---------------------------------------------------------------------------
 * 3. Spec table
 * ------------------------------------------------------------------------ */

.rpy-spec__title {
	margin: 0 0 0.75rem;
	font-family: var( --rpy-mono );
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var( --rpy-muted );
}

.rpy-spec__table {
	width: 100%;
	margin: 0;
	border: 1px solid var( --rpy-line );
	border-radius: 5px;
	border-collapse: collapse;
	overflow: hidden;
	font-size: 0.92rem;
}

.rpy-spec__caption {
	caption-side: bottom;
	padding-top: 0.6rem;
	font-size: 0.8rem;
	color: var( --rpy-muted );
	text-align: left;
}

.rpy-spec__row:nth-child( odd ) {
	background: var( --rpy-surface );
}

.rpy-spec__label,
.rpy-spec__value {
	padding: 0.6rem 0.85rem;
	text-align: left;
	vertical-align: top;
	border: 0;
	line-height: 1.45;
}

.rpy-spec__label {
	width: 40%;
	font-weight: 500;
	color: var( --rpy-muted );
}

.rpy-spec__value {
	font-family: var( --rpy-mono );
	font-variant-numeric: tabular-nums;
	color: var( --rpy-ink );
}

.rpy-spec.is-compact .rpy-spec__label,
.rpy-spec.is-compact .rpy-spec__value {
	padding: 0.38rem 0.7rem;
	font-size: 0.87rem;
}

@media ( max-width: 480px ) {
	.rpy-spec__table,
	.rpy-spec__row,
	.rpy-spec__label,
	.rpy-spec__value {
		display: block;
		width: 100%;
	}

	.rpy-spec__label {
		padding-bottom: 0;
		font-size: 0.78rem;
		letter-spacing: 0.03em;
	}

	.rpy-spec__value {
		padding-top: 0.15rem;
	}
}

/* ---------------------------------------------------------------------------
 * Quality floor
 * ------------------------------------------------------------------------ */

.rpy-rev a:focus-visible,
.rpy-rev button:focus-visible {
	outline: 2px solid var( --rpy-accent );
	outline-offset: 2px;
}

@media print {
	.rpy-score,
	.rpy-spec__table {
		border-color: #999;
	}
}
