/*
 * Блок отзывов покупателей. Спецификация GPT Luna, токены темы v4.
 */

.rc-reviews {
	--rc-reviews-bg: var(--v4-bg, #f5f7fa);
	--rc-reviews-surface: var(--v4-surface, #ffffff);
	--rc-reviews-text: var(--v4-ink, #101820);
	--rc-reviews-muted: var(--v4-muted, #66717c);
	--rc-reviews-fill: var(--v4-fill, #eef1f4);
	--rc-reviews-border: var(--v4-line, #e3e8ed);
	--rc-reviews-control: var(--v4-control, #c8d0d8);
	--rc-reviews-accent: var(--v4-accent, #b83a1b);
	--rc-reviews-accent-hover: var(--v4-accent-hover, #982f18);
	--rc-reviews-accent-active: var(--v4-accent-active, #7f2713);
	background: var(--rc-reviews-bg);
	color: var(--rc-reviews-text);
}

.rc-reviews--compact {
	padding-block: 48px;
}

@media (min-width: 768px) {
	.rc-reviews--compact {
		padding-block: 56px;
	}
}

.rc-reviews__inner {
	box-sizing: border-box;
	width: 100%;
	max-width: var(--wp--style--global--wide-size, 1280px);
	margin-inline: auto;
}

.rc-reviews__header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 24px;
	margin-block-end: var(--v4-head-gap, 24px);
}

.rc-reviews__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 16px;
	margin-inline-start: auto;
}

.rc-reviews__actions .rc-link-arrow {
	margin: 0;
}

.rc-reviews__controls {
	display: flex;
	gap: 8px;
}

.rc-reviews__arrow {
	box-sizing: border-box;
	display: grid;
	width: 44px;
	height: 44px;
	padding: 0;
	place-items: center;
	border: 1px solid var(--rc-reviews-control);
	border-radius: var(--v4-r-btn, 6px);
	background: var(--rc-reviews-fill);
	color: var(--rc-reviews-text);
	font-size: 1.125rem;
	line-height: 1;
	cursor: pointer;
	transition: background var(--v4-dur, 180ms) var(--v4-ease, ease), color var(--v4-dur, 180ms) var(--v4-ease, ease), border-color var(--v4-dur, 180ms) var(--v4-ease, ease);
}

.rc-reviews__arrow:hover:not(:disabled) {
	border-color: var(--rc-reviews-accent-hover);
	background: var(--rc-reviews-accent);
	color: var(--rc-reviews-surface);
}

.rc-reviews__arrow:active:not(:disabled) {
	background: var(--rc-reviews-accent-active);
	border-color: var(--rc-reviews-accent-active);
	color: var(--rc-reviews-surface);
}

.rc-reviews__arrow:disabled {
	background: var(--rc-reviews-fill);
	border-color: var(--rc-reviews-control);
	color: var(--rc-reviews-muted);
	cursor: not-allowed;
}

.rc-reviews__arrow:focus-visible,
.rc-reviews__card:focus-visible,
.rc-reviews__dialog-close:focus-visible,
.rc-reviews__track:focus-visible {
	outline: 2px solid var(--rc-reviews-accent);
	outline-offset: 3px;
}

.rc-reviews__track {
	display: flex;
	height: auto;
	align-items: stretch;
	gap: 16px;
	overflow-x: auto;
	overscroll-behavior-inline: contain;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.rc-reviews__track::-webkit-scrollbar {
	display: none;
}

.rc-reviews__card {
	box-sizing: border-box;
	display: grid;
	flex: 0 0 calc((100% - 32px) / 2.5);
	height: auto;
	padding: 0;
	place-items: center;
	overflow: hidden;
	border: 1px solid var(--rc-reviews-border);
	border-radius: var(--v4-r-card, 8px);
	background: var(--rc-reviews-surface);
	cursor: zoom-in;
	scroll-snap-align: start;
	transition: box-shadow var(--v4-dur, 180ms) var(--v4-ease, ease);
}

.rc-reviews__card:hover {
	box-shadow: 0 12px 32px rgb(16 24 32 / 10%);
}

html body .rc-reviews__image {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto !important;
	object-fit: contain;
	background: transparent;
}

.rc-reviews--compact .rc-reviews__track {
	height: auto;
	gap: 12px;
}

.rc-reviews--compact .rc-reviews__card {
	flex-basis: calc((100% - 24px) / 2.5);
	height: auto;
	padding: 0;
}

html body .rc-reviews--compact .rc-reviews__image {
	height: auto !important;
}

@media (max-width: 767px) {
	.rc-reviews__controls {
		display: none;
	}

	.rc-reviews__card,
	.rc-reviews--compact .rc-reviews__card {
		flex-basis: calc((100% - 16px) / 1.2);
	}

	.rc-reviews--compact .rc-reviews__card {
		flex-basis: calc((100% - 12px) / 1.2);
	}
}

.rc-reviews__dialog {
	position: fixed;
	box-sizing: border-box;
	width: max-content;
	max-width: min(92vw, 720px);
	max-height: 90dvh;
	padding: 48px 16px 16px;
	overflow: auto;
	border: 1px solid var(--rc-reviews-border);
	border-radius: var(--v4-r-card, 8px);
	background: var(--rc-reviews-surface);
	color: var(--rc-reviews-text);
}

.rc-reviews__dialog::backdrop {
	background: rgb(16 24 32 / 78%);
}

.rc-reviews__dialog-image {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: calc(90dvh - 80px);
	object-fit: contain;
	margin-inline: auto;
}

.rc-reviews__dialog-close {
	position: absolute;
	top: 8px;
	right: 8px;
	box-sizing: border-box;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--rc-reviews-control);
	border-radius: var(--v4-r-btn, 6px);
	background: var(--rc-reviews-fill);
	color: var(--rc-reviews-text);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.rc-reviews__dialog-close:hover {
	border-color: var(--rc-reviews-accent-hover);
	background: var(--rc-reviews-accent);
	color: var(--rc-reviews-surface);
}

@media (prefers-reduced-motion: reduce) {
	.rc-reviews *,
	.rc-reviews__dialog {
		scroll-behavior: auto !important;
		transition: none !important;
		animation: none !important;
	}
}

/* Контейнер как у других секций: gutter + wide 1280. Сброс вылета alignfull. */
html body .rc-reviews-slot,
html body .rc-reviews-slot.alignfull {
	box-sizing: border-box;
	width: 100%;
	max-width: none;
	margin-inline: 0;
	padding-inline: 0;
}

html body .rc-reviews-slot > .wp-block-shortcode,
html body .rc-reviews-slot .rc-reviews.alignfull {
	box-sizing: border-box;
	width: 100%;
	max-width: none;
	margin-inline: 0;
	padding-inline: 0;
}
