/* ==========================================================================
   Multi-Source Reviews — valeurs par défaut issues de la maquette Maslow.
   Toutes surchargeables via les contrôles Elementor (variables CSS ou sélecteurs).
   Écrit en CSS natif imbriqué (pas de préprocesseur) : `&` désigne toujours
   le sélecteur complet du parent, la concaténation façon Sass (`&--mod`)
   n'existe pas.
   ========================================================================== */

.msr-block {
	--msr-summary-overlap: 21px;
	--msr-block-gap: 17px;
	--msr-per-view: 5;
	--msr-card-width: 199px;
	--msr-gap: 20px;
	--msr-peek: 0px;
	/* Mode « Avis fixes » par défaut (les réglages Elementor « Mode » surchargent ces variables). */
	--msr-carousel: 0;
	--msr-nav-display: none;
	--msr-flow: row;
	--msr-template: repeat(var(--msr-per-view), minmax(0, var(--msr-card-width)));
	--msr-auto-cols: auto;
	--msr-auto-rows: var(--msr-grid-rows, 0px);
	--msr-row-gap: var(--msr-grid-row-gap, 0px);
	--msr-overflow: var(--msr-grid-overflow, hidden);
	--msr-snap: none;
	--msr-justify: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--msr-block-gap);
	padding: 0 16px 36px;
	background-color: #ffffff;
	box-sizing: border-box;

	/* Valeurs par défaut par appareil, alignées sur les breakpoints Elementor du site
	   (tablette paysage ≤ 1200, tablette portrait ≤ 1024, mobile ≤ 767).
	   Les réglages Elementor « Mode » et « Avis visibles » prennent le relais. */
	@media (max-width: 1200px) {
		--msr-per-view: 4;
	}

	@media (max-width: 1024px) {
		--msr-per-view: 3;
	}

	@media (max-width: 767px) {
		--msr-per-view: 1;
		--msr-peek: 48px;
		--msr-carousel: 1;
		--msr-nav-display: flex;
		--msr-flow: column;
		--msr-template: none;
		--msr-auto-cols: calc((100% - (var(--msr-per-view) - 1) * var(--msr-gap) - var(--msr-peek)) / var(--msr-per-view));
		--msr-auto-rows: auto;
		--msr-row-gap: 0px;
		--msr-overflow: auto hidden;
		--msr-snap: x mandatory;
		--msr-justify: start;
	}
}

/* Le badge déborde sur le haut du bloc, comme un onglet. */
.msr-block--has-summary {
	margin-top: var(--msr-summary-overlap);

	.msr-summary {
		margin-top: calc(-1 * var(--msr-summary-overlap));

		@media (max-width: 767px) {
			margin-top: -50px;
			padding: 10px 20px;
		}
	}
}

.msr-sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.msr-stars {
	display: block;
	height: auto;
	flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Badge des notes globales
   -------------------------------------------------------------------------- */

.msr-summary {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	column-gap: 28px;
	row-gap: 8px;
	max-width: 100%;
	padding: 10px 20px;
	background-color: #ffffff;
	border-radius: 500px;
	box-sizing: border-box;

	.msr-stars {
		width: 57px;
	}
}

.msr-summary-item {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: inherit;
	text-decoration: none;

	&:is(a):hover .msr-summary-text,
	&:is(a):focus-visible .msr-summary-text {
		text-decoration: underline;
	}

	&[data-source="google"] .msr-summary-logo {
		--msr-logo-height: 21px;
	}

	@media (max-width: 767px) {
		align-items: stretch;
		flex-direction: column;
		gap: 5px;
	}
}

.msr-summary-logo {
	--msr-logo-height: 16px;
	position: relative;
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;

	svg {
		display: block;
		width: auto;
		height: var(--msr-logo-height);
	}
}

.msr-summary-logo--text {
	font-weight: 700;
	font-size: 14px;
}

.msr-summary-details {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
}

.msr-summary-text {
	font-size: 7px;
	line-height: normal;
	letter-spacing: -0.14px;
	white-space: nowrap;
	color: #090825;

	strong {
		font-weight: 700;
	}
}

/* --------------------------------------------------------------------------
   Liste des avis
   -------------------------------------------------------------------------- */

.msr-reviews {
	display: grid;
	grid-auto-flow: var(--msr-flow);
	grid-template-columns: var(--msr-template);
	grid-template-rows: auto;
	grid-auto-columns: var(--msr-auto-cols);
	grid-auto-rows: var(--msr-auto-rows);
	justify-content: var(--msr-justify);
	overflow: var(--msr-overflow);
	scroll-snap-type: var(--msr-snap);
	overscroll-behavior-x: contain;
	column-gap: var(--msr-gap);
	row-gap: var(--msr-row-gap);
	width: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
	box-sizing: border-box;
	scrollbar-width: none; /* carrousel : navigation par flèches, points ou glisser */

	&::-webkit-scrollbar {
		display: none;
	}

	@media (prefers-reduced-motion: reduce) {
		scroll-behavior: auto;
	}
}

.msr-item {
	display: flex;
	min-width: 0;
	margin: 0;
	padding: 0;
	scroll-snap-align: start;

	&::before,
	&::marker {
		content: none;
	}
}

.msr-card {
	position: relative; /* contient le texte masqué (.msr-sr-only) des cartes hors écran */
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 100%;
	padding: 20px;
	color: inherit;
	text-decoration: none;
	background-color: transparent;
	border: 0.5px solid #ebe7e6;
	border-radius: 4px;
	box-sizing: border-box;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;

	&:is(a):hover,
	&:is(a):focus-visible {
		border-color: #948d8d;
		text-decoration: none;
	}

	&:is(a):focus-visible {
		outline: 2px solid currentColor;
		outline-offset: -3px; /* à l'intérieur : la liste peut masquer ce qui déborde */
	}

	.msr-stars {
		width: 79px;
	}
}

.msr-card-text {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: var(--msr-text-lines, 7);
	overflow: hidden;
	margin: 0;
	font-size: 10px;
	line-height: 14px;
	letter-spacing: -0.2px;
	color: #553030;
	overflow-wrap: break-word;
}

.msr-card-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	column-gap: 12px;
	row-gap: 2px;
	margin-top: auto;
	padding-top: 6px;
	font-size: 10px;
	line-height: 14px;
	letter-spacing: -0.2px;
}

.msr-card-author {
	font-weight: 700;
	color: #553030;
}

.msr-card-date {
	color: #948d8d;
	white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Navigation du carrousel
   -------------------------------------------------------------------------- */

.msr-nav {
	display: var(--msr-nav-display, none);
	align-items: center;
	justify-content: center;
	gap: 16px;
	margin-top: 4px;

	/* Sélecteurs doublés pour passer devant les resets de thème sur `button`. */
	.msr-arrow {
		&,
		&:focus {
			display: inline-flex;
			align-items: center;
			justify-content: center;
			flex-shrink: 0;
			width: 32px;
			height: 32px;
			margin: 0;
			padding: 0;
			color: #553030;
			background-color: transparent;
			border: 0.5px solid #ebe7e6;
			border-radius: 50%;
			box-shadow: none;
			cursor: pointer;
			transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
		}

		&:not(:disabled):hover,
		&:focus-visible {
			color: #553030;
			background-color: #f5f2f2;
			border-color: #948d8d;
		}

		&:focus-visible {
			outline: 2px solid currentColor;
			outline-offset: 2px;
		}

		&:disabled {
			opacity: 0.35;
			cursor: default;
		}
	}
}

.msr-arrow svg {
	display: block;
	width: 50%;
	height: 50%;
}

.msr-dots {
	--msr-dot-size: 8px;
	--msr-dot-color: #ebe7e6;
	--msr-dot-active: #553030;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 4px;

	.msr-dot {
		&,
		&:focus {
			display: inline-flex;
			align-items: center;
			justify-content: center;
			width: calc(var(--msr-dot-size) + 12px);
			height: calc(var(--msr-dot-size) + 12px);
			margin: 0;
			padding: 0;
			background: transparent;
			border: 0;
			box-shadow: none;
			cursor: pointer;
		}

		&::before {
			content: "";
			width: var(--msr-dot-size);
			height: var(--msr-dot-size);
			border-radius: 50%;
			background-color: var(--msr-dot-color);
			transition: background-color 0.2s ease, transform 0.2s ease;
		}

		&:hover,
		&:focus-visible {
			background: transparent;
		}

		&[aria-current="true"]::before {
			background-color: var(--msr-dot-active);
			transform: scale(1.15);
		}

		&:focus-visible {
			outline: 2px solid var(--msr-dot-active);
			outline-offset: 0;
			border-radius: 50%;
		}
	}
}
