/**
 * Google reviews carousel section (Story US-003).
 *
 * Responsive, auto-advancing carousel: 3 cards on desktop, 2 on tablet, 1 on
 * mobile. The number of visible cards is driven by the --reviews-per-view custom
 * property (set in the media queries below) which the carousel script also reads,
 * keeping a single source of truth for the breakpoints. Reuses the theme's
 * --mytheme-* design tokens (responsive.css) so it stays on-brand and dark-mode
 * friendly.
 *
 * @package my-theme
 */

.reviews-carousel {
	--reviews-per-view: 1;
	--rc-gap: 1.25rem;
	--rc-star: #f5a623;
	--rc-star-empty: rgba(90, 102, 117, 0.28);
	background: var(--mytheme-surface, #ffffff);
	color: var(--mytheme-ink, #16202c);
	padding: clamp(2.5rem, 6vw, 4.5rem) 0;
}

.reviews-carousel__inner {
	width: 100%;
}

/* --- Section heading ------------------------------------------------------ */

.reviews-carousel__head {
	max-width: 46rem;
	margin: 0 auto clamp(1.75rem, 4vw, 2.75rem);
	text-align: center;
}

.reviews-carousel__eyebrow {
	margin: 0 0 0.5rem;
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--mytheme-accent, #c8281e);
}

.reviews-carousel__title {
	margin: 0 0 0.85rem;
	font-size: clamp(1.75rem, 4vw, 2.5rem);
	line-height: 1.15;
	font-weight: 800;
}

.reviews-carousel__rating {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.4rem 0.75rem;
	margin: 0 auto;
}

.reviews-carousel__rating-value {
	display: inline-flex;
	align-items: baseline;
	gap: 0.15em;
	font-size: 1.5rem;
	font-weight: 800;
	line-height: 1;
	color: var(--mytheme-ink, #16202c);
}

.reviews-carousel__rating-star {
	color: var(--rc-star);
	font-size: 1.1em;
}

.reviews-carousel__rating-count {
	font-size: 0.95rem;
	color: var(--mytheme-muted, #5a6675);
}

.reviews-carousel__source {
	margin: 0.9rem 0 0;
}

.reviews-carousel__source-link {
	display: inline-flex;
	align-items: center;
	gap: 0.35em;
	font-weight: 600;
	font-size: 0.95rem;
	color: var(--mytheme-accent, #c8281e);
	text-decoration: none;
	transition: color var(--mytheme-duration, 220ms) var(--mytheme-ease, ease);
}

.reviews-carousel__source-link:hover,
.reviews-carousel__source-link:focus-visible {
	color: var(--mytheme-accent-dark, #a71d15);
	text-decoration: underline;
}

.reviews-carousel__source-icon {
	font-size: 0.85em;
}

/* --- Star rating (partial fill) ------------------------------------------- */

.rc-stars {
	position: relative;
	display: inline-block;
	white-space: nowrap;
	font-size: 1rem;
	line-height: 1;
	letter-spacing: 0.08em;
	font-family: Arial, sans-serif; /* Consistent star glyph width. */
}

.rc-stars--lg {
	font-size: 1.4rem;
}

.rc-stars__track {
	color: var(--rc-star-empty);
}

.rc-stars__fill {
	position: absolute;
	inset: 0;
	overflow: hidden;
	color: var(--rc-star);
}

/* --- Carousel viewport + track -------------------------------------------- */

.reviews-carousel__viewport {
	position: relative;
	overflow: hidden;
}

.reviews-carousel__track {
	position: relative;
	display: flex;
	gap: var(--rc-gap);
	margin: 0;
	padding: 0.5rem 0;
	list-style: none;
	transition: transform 450ms var(--mytheme-ease, ease);
	will-change: transform;
	touch-action: pan-y;
}

.reviews-carousel__slide {
	flex: 0 0 calc((100% - (var(--reviews-per-view) - 1) * var(--rc-gap)) / var(--reviews-per-view));
	max-width: calc((100% - (var(--reviews-per-view) - 1) * var(--rc-gap)) / var(--reviews-per-view));
	display: flex;
}

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

.rc-card {
	display: flex;
	flex-direction: column;
	width: 100%;
	background: var(--mytheme-surface, #ffffff);
	border: 1px solid var(--mytheme-border, #e3e8ef);
	border-radius: var(--mytheme-radius, 12px);
	box-shadow: var(--mytheme-shadow, 0 6px 20px rgba(16, 32, 44, 0.08));
	padding: 1.5rem;
	transition: transform var(--mytheme-duration, 220ms) var(--mytheme-ease, ease),
		box-shadow var(--mytheme-duration, 220ms) var(--mytheme-ease, ease);
}

.rc-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--mytheme-shadow-lg, 0 16px 40px rgba(16, 32, 44, 0.14));
}

.rc-card__head {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	margin-bottom: 1rem;
}

.rc-card__avatar {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	overflow: hidden;
	background: hsl(var(--rc-avatar-hue, 210) 55% 45%);
	color: #fff;
	font-weight: 700;
	font-size: 1.05rem;
	line-height: 1;
}

.rc-card__photo {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.rc-card__meta {
	flex: 1 1 auto;
	min-width: 0;
}

.rc-card__name {
	margin: 0 0 0.2rem;
	font-weight: 700;
	font-size: 1rem;
	color: var(--mytheme-ink, #16202c);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.rc-card__brand {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
}

.rc-card__body {
	flex: 1 1 auto;
}

.rc-card__text {
	margin: 0;
	font-size: 0.975rem;
	line-height: 1.6;
	color: var(--mytheme-ink, #16202c);
	quotes: none;
}

.rc-card__more {
	appearance: none;
	margin: 0.5rem 0 0;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--mytheme-accent, #c8281e);
	cursor: pointer;
	transition: color var(--mytheme-duration, 220ms) var(--mytheme-ease, ease);
}

.rc-card__more:hover,
.rc-card__more:focus-visible {
	color: var(--mytheme-accent-dark, #a71d15);
	text-decoration: underline;
}

.rc-card__time {
	margin: 1.1rem 0 0;
	padding-top: 0.9rem;
	border-top: 1px solid var(--mytheme-border, #e3e8ef);
	font-size: 0.85rem;
	color: var(--mytheme-muted, #5a6675);
}

/* --- Controls (arrows + dots) --------------------------------------------- */

.reviews-carousel__controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	margin-top: 1.75rem;
}

.reviews-carousel__arrow {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--mytheme-touch, 44px);
	height: var(--mytheme-touch, 44px);
	border: 1px solid var(--mytheme-border, #e3e8ef);
	border-radius: 50%;
	background: var(--mytheme-surface, #ffffff);
	color: var(--mytheme-ink, #16202c);
	cursor: pointer;
	transition: background var(--mytheme-duration, 220ms) var(--mytheme-ease, ease),
		border-color var(--mytheme-duration, 220ms) var(--mytheme-ease, ease),
		color var(--mytheme-duration, 220ms) var(--mytheme-ease, ease);
}

.reviews-carousel__arrow:hover,
.reviews-carousel__arrow:focus-visible {
	background: var(--mytheme-accent, #c8281e);
	border-color: var(--mytheme-accent, #c8281e);
	color: #fff;
}

.reviews-carousel__arrow:disabled {
	opacity: 0.4;
	cursor: default;
}

.reviews-carousel__dots {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.reviews-carousel__dot {
	appearance: none;
	width: 10px;
	height: 10px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--rc-star-empty);
	cursor: pointer;
	transition: background var(--mytheme-duration, 220ms) var(--mytheme-ease, ease),
		transform var(--mytheme-duration, 220ms) var(--mytheme-ease, ease);
}

.reviews-carousel__dot:hover {
	background: var(--mytheme-muted, #5a6675);
}

.reviews-carousel__dot.is-active {
	background: var(--mytheme-accent, #c8281e);
	transform: scale(1.25);
}

.reviews-carousel__dot:focus-visible,
.reviews-carousel__arrow:focus-visible {
	outline: 3px solid var(--mytheme-accent, #c8281e);
	outline-offset: 2px;
}

/* --- Responsive breakpoints (kept in sync with the carousel script) ------- */

@media (min-width: 600px) {
	.reviews-carousel {
		--reviews-per-view: 2;
	}
}

@media (min-width: 992px) {
	.reviews-carousel {
		--reviews-per-view: 3;
	}
}

/* --- Dark mode ------------------------------------------------------------ */

[data-theme="dark"] .reviews-carousel {
	background: var(--mytheme-bg, #0f1620);
	color: var(--mytheme-ink, #eef2f7);
}

[data-theme="dark"] .rc-card {
	background: var(--mytheme-surface, #17212e);
	border-color: var(--mytheme-border, #26313f);
}

/* --- Reduced motion ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.reviews-carousel__track {
		transition: none;
	}

	.rc-card {
		transition: none;
	}

	.rc-card:hover {
		transform: none;
	}
}
