/**
 * Google reviews: slider, grid, list and badge layouts.
 * Loaded only on pages that render [nova_google_reviews].
 * Colours follow the theme accent (--nova-accent); light and dark are scoped to the block.
 */

.nova-gr {
	--gr-accent: var(--nova-accent, #2b6cff);
	--gr-star: #fbbc04;
	--gr-star-off: #d5d9df;
	--gr-bg: transparent;
	--gr-card: #fff;
	--gr-text: var(--nova-text, #3a4150);
	--gr-head: var(--nova-heading, #11161f);
	--gr-muted: #6b7380;
	--gr-border: var(--nova-border, #e3e7ee);
	--gr-avatar-bg: #e8eefc;
	--gr-avatar-fg: #1d3f9e;
	--gr-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 20px -8px rgba(16, 24, 40, .12);
	--gr-radius: var(--nova-radius, 14px);
	--gr-gap: 20px;
	/* Cards per row (set inline from per_row) and what is actually visible at this screen width. */
	--gr-per: 3;
	--gr-vis: var(--gr-per, 3);
	--gr-lines: 5;
	/* Card scale: the compact text mode lowers these a step (see "Compact" below). */
	--gr-pad: 22px;
	--gr-fs: .95em;
	--gr-author-fs: 1em;
	--gr-av: 44px;
	--gr-av-fs: 15px;
	--gr-stars-fs: 1.15em;
	--gr-mark: 20px;
	--gr-inner: 10px;

	box-sizing: border-box;
	position: relative;
	margin: 0 0 1.5em;
	color: var(--gr-text);
	font-size: 16px;
	line-height: 1.55;
	background: var(--gr-bg);
	text-align: left;
}

.nova-gr *,
.nova-gr *::before,
.nova-gr *::after {
	box-sizing: border-box;
}

.nova-gr--dark {
	--gr-bg: #12161d;
	--gr-card: #1b212b;
	--gr-text: #c9d0dc;
	--gr-head: #fff;
	--gr-muted: #98a2b3;
	--gr-border: #2a3240;
	--gr-star-off: #3b4453;
	--gr-avatar-bg: #2a3650;
	--gr-avatar-fg: #cfdcff;
	--gr-shadow: none;
	padding: 28px;
	border-radius: calc(var(--gr-radius) + 4px);
}

.nova-gr[hidden],
.nova-gr [hidden] {
	display: none !important;
}

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

.nova-gr__stars {
	position: relative;
	display: inline-block;
	flex: none;
	/* Shrink to the five stars even when blockified as a flex/grid item, so the % fill is of 5 stars. */
	width: max-content;
	justify-self: start;
	align-self: flex-start;
	font-size: 1.15em;
	line-height: 0;
	vertical-align: middle;
	white-space: nowrap;
}

.nova-gr__stars-off,
.nova-gr__stars-on {
	display: inline-flex;
}

.nova-gr__stars-on {
	position: absolute;
	top: 0;
	left: 0;
	overflow: hidden;
}

.nova-gr__stars svg {
	display: block;
	flex: none;
	width: 1em;
	height: 1em;
}

.nova-gr__stars-off svg {
	fill: var(--gr-star-off);
}

.nova-gr__stars-on svg {
	fill: var(--gr-star);
}

/* ---------------------------------------------------------- Summary */

.nova-gr__summary {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 28px;
	margin: 0 0 22px;
}

.nova-gr__brand {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	color: var(--gr-head);
	font-weight: 600;
	font-size: 1.05em;
}

.nova-gr__brand-text {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 .35em;
}

.nova-gr__rate {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
}

.nova-gr__score {
	color: var(--gr-head);
	font-size: 1.7em;
	font-weight: 700;
	line-height: 1;
}

.nova-gr__count {
	color: var(--gr-muted);
	font-size: .9em;
}

.nova-gr__g {
	flex: none;
	width: 20px;
	height: 20px;
}

.nova-gr__g--lg {
	width: 34px;
	height: 34px;
}

.nova-gr__word {
	font-weight: 700;
	letter-spacing: -.01em;
}

.nova-gr__word i {
	font-style: normal;
}

.nova-gr__word i:nth-child(1),
.nova-gr__word i:nth-child(4) { color: #4285f4; }
.nova-gr__word i:nth-child(2),
.nova-gr__word i:nth-child(6) { color: #ea4335; }
.nova-gr__word i:nth-child(3) { color: #fbbc04; }
.nova-gr__word i:nth-child(5) { color: #34a853; }

/* ------------------------------------------------------------ Cards */

.nova-gr__track,
.nova-gr__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.nova-gr__item {
	margin: 0;
	padding: 0;
	list-style: none;
}

.nova-gr__card {
	display: flex;
	flex-direction: column;
	gap: var(--gr-inner);
	height: 100%;
	padding: var(--gr-pad);
	background: var(--gr-card);
	border: 1px solid var(--gr-border);
	border-radius: var(--gr-radius);
	box-shadow: var(--gr-shadow);
}

.nova-gr__head {
	display: flex;
	align-items: center;
	gap: 12px;
}

.nova-gr__avatar {
	flex: none;
	width: var(--gr-av);
	height: var(--gr-av);
	border-radius: 50%;
	object-fit: cover;
	background: var(--gr-avatar-bg);
}

.nova-gr__avatar--initials {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--gr-avatar-fg);
	font-size: var(--gr-av-fs);
	font-weight: 700;
	letter-spacing: .02em;
	line-height: 1;
}

.nova-gr__who {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-width: 0;
	line-height: 1.3;
}

.nova-gr__author {
	overflow: hidden;
	color: var(--gr-head);
	font-size: var(--gr-author-fs);
	font-weight: 600;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.nova-gr__date {
	color: var(--gr-muted);
	font-size: .82em;
}

.nova-gr__head .nova-gr__g {
	align-self: flex-start;
	width: var(--gr-mark);
	height: var(--gr-mark);
}

.nova-gr__card > .nova-gr__stars {
	font-size: var(--gr-stars-fs);
}

.nova-gr__text {
	margin: 0;
	font-size: var(--gr-fs);
	overflow-wrap: anywhere;
}

/* Fixed text height: the full text stays in the page, CSS clips it after --gr-lines lines with "…".
   The button is revealed by the script only when the text really is clipped. */
.nova-gr__text--clamp {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
}

.nova-gr__clamp {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: var(--gr-lines, 5);
	line-clamp: var(--gr-lines, 5);
	max-width: 100%;
	margin: 0;
	overflow: hidden;
}

.nova-gr__text--clamp.is-open .nova-gr__clamp {
	display: block;
	-webkit-line-clamp: unset;
	line-clamp: unset;
	overflow: visible;
}

/* ---------------------------------------------- Cards per row, compact */

@media (min-width: 961px) {
	.nova-gr--pr-4 { --gr-gap: 18px; }
	.nova-gr--pr-5 { --gr-gap: 14px; }

	/* Compact text mode (automatic from 4 cards per row): one step smaller, a second step for 5. */
	.nova-gr--compact {
		--gr-pad: 17px;
		--gr-fs: .88em;
		--gr-author-fs: .95em;
		--gr-av: 38px;
		--gr-av-fs: 13px;
		--gr-stars-fs: 1.02em;
		--gr-mark: 18px;
		--gr-inner: 8px;
	}

	.nova-gr--compact.nova-gr--pr-5 {
		--gr-pad: 15px;
		--gr-fs: .85em;
		--gr-author-fs: .92em;
		--gr-av: 34px;
		--gr-av-fs: 12px;
		--gr-stars-fs: .95em;
		--gr-mark: 16px;
		--gr-inner: 7px;
	}

	.nova-gr--compact .nova-gr__head {
		gap: 10px;
	}

	/* Narrow cards: let a long name use two lines instead of cutting it off. */
	.nova-gr--compact .nova-gr__author {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		white-space: normal;
		overflow-wrap: anywhere;
	}
}

/* Visible cards: the setting on desktop, at most 4 below 1100px, 2 on tablets, 1 on phones. */
@media (max-width: 1100px) {
	.nova-gr { --gr-vis: min(var(--gr-per, 3), 4); }
}

@media (max-width: 960px) {
	.nova-gr { --gr-vis: min(var(--gr-per, 3), 2); }
}

@media (max-width: 620px) {
	.nova-gr { --gr-vis: 1; }
}

.nova-gr__more {
	display: inline;
	margin: 0;
	padding: 0;
	color: var(--gr-accent);
	font: inherit;
	font-size: .92em;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
	background: none;
	border: 0;
	border-radius: 2px;
	cursor: pointer;
}

.nova-gr__more:hover {
	text-decoration-thickness: 2px;
}

.nova-gr--dark .nova-gr__more {
	color: #9db9ff;
}

/* ------------------------------------------------------------- Grid */

.nova-gr--grid .nova-gr__list {
	display: grid;
	grid-template-columns: repeat(var(--gr-vis, 3), minmax(0, 1fr));
	gap: var(--gr-gap);
	align-items: stretch;
}

/* ------------------------------------------------------------- List */

.nova-gr--list .nova-gr__list {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

@media (min-width: 700px) {
	.nova-gr--list .nova-gr__card {
		display: grid;
		grid-template-columns: 230px minmax(0, 1fr);
		grid-template-areas: "head text" "stars text";
		align-items: start;
		gap: 8px 28px;
	}

	.nova-gr--list .nova-gr__head { grid-area: head; }
	.nova-gr--list .nova-gr__card > .nova-gr__stars { grid-area: stars; }
	.nova-gr--list .nova-gr__text { grid-area: text; grid-row: 1 / span 2; align-self: center; }
	.nova-gr--list .nova-gr__head .nova-gr__g { display: none; }
}

/* ----------------------------------------------------------- Slider */

.nova-gr__viewport {
	position: relative;
	min-width: 0;
	max-width: 100%;
	/* The track is a wide scroller; keep it from stretching flex/grid parents. */
	contain: inline-size;
}

.nova-gr__track {
	display: flex;
	gap: var(--gr-gap);
	margin: -6px;
	padding: 6px;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-padding: 0 6px;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.nova-gr__track::-webkit-scrollbar {
	display: none;
}

.nova-gr__track:focus-visible {
	outline: 2px solid var(--gr-accent);
	outline-offset: 2px;
	border-radius: var(--gr-radius);
}

.nova-gr__track > .nova-gr__item {
	flex: 0 0 calc((100% - (var(--gr-vis, 3) - 1) * var(--gr-gap)) / var(--gr-vis, 3));
	min-width: 0;
	scroll-snap-align: start;
}

.nova-gr__nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	margin-top: 18px;
}

.nova-gr__dots {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 2px;
}

.nova-gr__dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	margin: 0;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}

.nova-gr__dot::before {
	content: "";
	width: 9px;
	height: 9px;
	background: var(--gr-star-off);
	border-radius: 50%;
	transition: background-color .2s, transform .2s;
}

.nova-gr__dot[aria-current="true"]::before {
	background: var(--gr-accent);
	transform: scale(1.3);
}

.nova-gr--dark .nova-gr__dot[aria-current="true"]::before {
	background: #9db9ff;
}

.nova-gr__arrow,
.nova-gr__pause {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	color: var(--gr-head);
	background: var(--gr-card);
	border: 1px solid var(--gr-border);
	border-radius: 50%;
	box-shadow: var(--gr-shadow);
	cursor: pointer;
	transition: color .2s, border-color .2s, opacity .2s;
}

.nova-gr__pause {
	width: 32px;
	height: 32px;
}

.nova-gr__arrow svg,
.nova-gr__pause svg {
	display: block;
	width: 18px;
	height: 18px;
}

.nova-gr__pause svg {
	width: 14px;
	height: 14px;
}

.nova-gr__arrow:hover:not(:disabled),
.nova-gr__pause:hover {
	color: var(--gr-accent);
	border-color: var(--gr-accent);
}

.nova-gr__arrow:disabled {
	opacity: .35;
	cursor: default;
}

.nova-gr__pause .nova-gr__ic-play { display: none; }
.nova-gr__pause.is-paused .nova-gr__ic-play { display: block; }
.nova-gr__pause.is-paused .nova-gr__ic-pause { display: none; }

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

.nova-gr--dark button:focus-visible,
.nova-gr--dark a:focus-visible {
	outline-color: #9db9ff;
}

/* ---------------------------------------------------------- Actions */

.nova-gr__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin-top: 26px;
}

.nova-gr__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: .75em 1.4em;
	color: #fff;
	font-size: .95em;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	background: var(--gr-accent);
	border: 2px solid var(--gr-accent);
	border-radius: var(--nova-radius-btn, 999px);
	transition: filter .2s, background-color .2s, color .2s;
}

.nova-gr__btn:hover {
	color: #fff;
	filter: brightness(.92);
}

.nova-gr__btn--ghost {
	color: var(--gr-accent);
	background: transparent;
}

.nova-gr__btn--ghost:hover {
	color: #fff;
	background: var(--gr-accent);
	filter: none;
}

.nova-gr--dark .nova-gr__btn--ghost {
	color: #fff;
	border-color: #fff;
}

.nova-gr--dark .nova-gr__btn--ghost:hover {
	color: var(--gr-bg);
	background: #fff;
}

/* ------------------------------------------------------------ Badge */

.nova-gr--badge {
	display: inline-block;
	margin: 0;
	padding: 0;
	background: none;
	vertical-align: middle;
}

.nova-gr-badge {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	padding: 10px 18px 10px 14px;
	color: var(--gr-text);
	text-decoration: none;
	background: var(--gr-card);
	border: 1px solid var(--gr-border);
	border-radius: 14px;
	box-shadow: var(--gr-shadow);
	transition: transform .2s, box-shadow .2s;
}

.nova-gr--dark.nova-gr--badge .nova-gr-badge {
	box-shadow: 0 6px 20px -8px rgba(0, 0, 0, .5);
}

a.nova-gr-badge:hover {
	color: var(--gr-text);
	transform: translateY(-2px);
	box-shadow: 0 10px 28px -10px rgba(16, 24, 40, .28);
}

.nova-gr-badge__body {
	display: flex;
	flex-direction: column;
	gap: 3px;
	line-height: 1.2;
}

.nova-gr-badge__title {
	color: var(--gr-head);
	font-size: .82em;
	font-weight: 600;
}

.nova-gr-badge__row {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 8px;
}

.nova-gr-badge .nova-gr__score {
	font-size: 1.25em;
}

.nova-gr-badge .nova-gr__stars {
	font-size: 1em;
}

.nova-gr-badge .nova-gr__count {
	font-size: .8em;
}

.nova-gr--floating {
	position: fixed;
	bottom: 16px;
	left: 16px;
	z-index: 9990;
	max-width: calc(100vw - 32px);
}

@media (max-width: 480px) {
	.nova-gr--floating {
		bottom: 10px;
		left: 10px;
	}

	.nova-gr--floating .nova-gr-badge {
		gap: 9px;
		padding: 8px 12px 8px 10px;
	}

	.nova-gr--floating .nova-gr__g--lg {
		width: 28px;
		height: 28px;
	}
}

/* ----------------------------------------------- Admin-only notice */

.nova-gr-notice {
	margin: 0 0 1.5em;
	padding: 12px 16px;
	color: #7a1f1f;
	font-size: 14px;
	background: #fdeded;
	border: 1px dashed #d63638;
	border-radius: 8px;
}

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

@media (max-width: 620px) {
	.nova-gr--dark {
		padding: 18px;
	}

	.nova-gr__card {
		padding: 18px;
	}

	.nova-gr__summary {
		flex-direction: column;
		align-items: flex-start;
	}

	.nova-gr__actions .nova-gr__btn {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nova-gr *,
	.nova-gr *::before,
	.nova-gr *::after {
		transition: none !important;
		animation: none !important;
	}

	.nova-gr__track {
		scroll-behavior: auto !important;
	}

	a.nova-gr-badge:hover {
		transform: none;
	}
}

.nova-gr__rate .nova-gr__stars,
.nova-gr-badge__row .nova-gr__stars {
	align-self: center;
}
