/**
 * Reviews Feed — Widgets & Badges (SBR-163)
 *
 * Deliberately NOT scoped to [id^=sb-reviews-container-]. The feed stylesheet
 * scopes most of its selectors that way (190 lines reference
 * sb-reviews-container), which is correct for feed items but
 * fatal for badges: a badge renders on a page, in a sidebar or in an email where
 * that container does not exist, so scoped rules would never match.
 *
 * Every selector here is namespaced `.sbr-badge*` and appears nowhere in
 * sbr-styles.css, so no existing feed rendering can be affected.
 *
 * What is left after 19 Aug: the shared star row and the attribution line, which
 * the saved-badge shapes include, plus the classes the locked upsell wall builds
 * by hand. The placement shapes' own rules went with the shapes.
 *
 * Star geometry and the half-star clip mirror sbr-styles.css:260-285.
 * Default colours mirror sbr_settings_defaults() (class/sbr-functions.php).
 */

.sbr-badge {
	--sbr-badge-star: #ED4944;
	--sbr-badge-star-dim: #D8DCE6;
	--sbr-badge-text: #141B38;
	--sbr-badge-subtext: #434960;
	--sbr-badge-surface: #ffffff;
	--sbr-badge-border: #DCDDE1;
	--sbr-badge-accent: #ED4944;
	--sbr-badge-on-accent: #ffffff;
	--sbr-badge-rating-size: 20px;
	--sbr-badge-rating-weight: 600;
	--sbr-badge-subtext-size: 12px;
	--sbr-badge-label-size: 14px;
	--sbr-badge-label-weight: 600;
	--sbr-badge-star-size: 20px;
	--sbr-badge-star-gap: 2px;
	--sbr-badge-radius: 8px;

	display: inline-flex;
	flex-direction: column;
	gap: 6px;
	line-height: 1.35;
	color: var(--sbr-badge-text);
	font-family: inherit;
	box-sizing: border-box;
}

.sbr-badge *,
.sbr-badge *::before,
.sbr-badge *::after {
	box-sizing: inherit;
}

.sbr-badge.sbr-badge-boxed {
	background: var(--sbr-badge-surface);
	border: 1px solid var(--sbr-badge-border);
	border-radius: var(--sbr-badge-radius);
	padding: 12px 16px;
}

/* ---- stars ---- */

.sbr-badge-stars {
	display: inline-flex;
	align-items: center;
	line-height: 1;
	color: var(--sbr-badge-star);
}

.sbr-badge-star {
	display: inline-flex;
	width: var(--sbr-badge-star-size);
	height: var(--sbr-badge-star-size);
	margin: 0 var(--sbr-badge-star-gap);
}

.sbr-badge-star svg {
	width: 100%;
	height: 100%;
	display: block;
	fill: currentColor;
}

.sbr-badge-star-dimmed {
	color: var(--sbr-badge-star-dim);
}

/*
 * Half star: a FULL-SIZE star overlaid and clipped to 50% width by
 * overflow:hidden — never a half-width star. Mirrors the technique at
 * sbr-styles.css:270-281. If the inner svg is allowed to shrink to the 50%
 * box it squashes instead of clipping, so its size is pinned below.
 */
.sbr-badge-star-half {
	position: relative;
}

.sbr-badge-star-half .sbr-badge-star-base {
	display: block;
	width: 100%;
	height: 100%;
	color: var(--sbr-badge-star-dim);
}

.sbr-badge-star-half .sbr-badge-star-fill {
	position: absolute;
	left: 0;
	top: 0;
	width: 50%;
	height: 100%;
	overflow: hidden;
	color: var(--sbr-badge-star);
}

.sbr-badge-star-half .sbr-badge-star-fill svg {
	width: var(--sbr-badge-star-size);
	height: var(--sbr-badge-star-size);
}

/* ---- text ---- */

.sbr-badge-main {
	display: flex;
	align-items: center;
	gap: 8px;
}

.sbr-badge-rating {
	font-size: var(--sbr-badge-rating-size);
	font-weight: var(--sbr-badge-rating-weight);
	color: var(--sbr-badge-text);
}

.sbr-badge-subtext {
	font-size: var(--sbr-badge-subtext-size);
	color: var(--sbr-badge-subtext);
}

.sbr-badge-powered {
	font-size: 11px;
	color: var(--sbr-badge-subtext);
	opacity: 0.85;
}

.sbr-badge-powered a {
	color: var(--sbr-badge-accent);
	font-weight: 600;
	text-decoration: none;
}

.sbr-badge-size-large {
	--sbr-badge-rating-size: 28px;
	--sbr-badge-label-size: 16px;
	--sbr-badge-subtext-size: 13px;
	--sbr-badge-star-size: 24px;
}

/* ---- upsell hero canvas ----
   The locked Trust Badges screen shows a live badge instead of a splash PNG,
   so the periwinkle-to-sky panel Review Alerts' popup-splash.png bakes into
   its image is reproduced here. Both locked pages then present their hero on
   the same canvas, and a badge redesign only changes what sits inside it. */

.sbr-tb-splash {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 350px;
	padding: 24px;
	border-radius: 8px;
	background: linear-gradient(158deg, #cfd9f5 0%, #cfe3f7 100%);
}
