/* ============================================================
   Product Finder
   ============================================================ */

/* ---- Reset page ---- */

.pf-page {
	margin: 0;
	overflow: hidden;
	height: 100dvh; /* bloque le scroll du body */
}


/* ---- Base de tous les écrans (overlay plein écran indépendant) ---- */

.pf-screen {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	background-color: var(--color-gris-vert);
}

/*
 * L'attribut [hidden] sur les écrans doit toujours l'emporter
 * sur les règles display: flex / display: block de ce fichier.
 * Sans ce correctif, le display CSS écrase le comportement natif de [hidden].
 */
.pf-screen[hidden]       { display: none !important; }
.pf-loader[hidden]       { display: none !important; }
.pf-error[hidden]        { display: none !important; }
.pf-results-error[hidden]{ display: none !important; }
.pf-nav__prev[hidden]    { display: none !important; }
.pf-nav__next[hidden]    { display: none !important; }

/* ---- Icône générique ---- */

.pf-icon {
	display: block;
	flex-shrink: 0;
}

/* ============================================================
   Bouton fermer (commun à tous les écrans)
   ============================================================ */

.pf-close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 10;
	background: none;
	border: none;
	cursor: pointer;
	padding: 6px;
	color: var(--color-vert-noir);
	line-height: 0;
	border-radius: 50%;
	transition: background 0.2s;
}

.pf-close:hover,
.pf-close:focus-visible {
	background: rgba(0, 0, 0, 0.08);
	outline: none;
}

/* ============================================================
   ÉCRAN INTRO
   ============================================================ */

.pf-screen--intro {
	display: flex;
	flex-direction: column;
}

@keyframes pf-fadein-up {
	from { opacity: 0; transform: translateY(18px); }
	to   { opacity: 1; transform: translateY(0); }
}

@keyframes pf-fadein {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.pf-intro-title {
	color: var(--color-vert-noir);
	margin: 0;
	animation: pf-fadein-up 0.4s ease-out both;
}

.pf-intro-sub {
	color: var(--color-vert-noir);
	margin: 0;
	animation: pf-fadein-up 0.4s ease-out both;
	animation-delay: 0.08s;
}

.pf-start {
	align-self: center;
	animation: pf-fadein-up 0.4s ease-out both;
	animation-delay: 0.16s;
}

.pf-intro-image {
	width: 100%;
	min-height: 220px;
	flex-shrink: 0;
	overflow: hidden;
	animation: pf-fadein 0.4s ease-out both;
}

.pf-intro-image img {
	display: block;
	width: 100%;
	height: auto;
}

.pf-intro-body {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 60px 24px 24px;
}

.pf-intro-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 30px;
	text-align: center;
	width: 100%;
	max-width: 340px;
}

@media (prefers-reduced-motion: reduce) {
	.pf-intro-title,
	.pf-intro-sub,
	.pf-start,
	.pf-intro-image {
		animation: none;
	}
}

/* ============================================================
   ÉCRAN QUESTIONNAIRE
   ============================================================ */

.pf-screen--quiz {
	display: flex;
	flex-direction: column;
	padding-left: 40px; /* réserve l'espace pour la barre de progression */
	align-items: end;
}

/* ---- Barre de progression (position fixe gauche) ---- */

.pf-progress {
	position: fixed;
	left: 0;
	top: 0;
	bottom: 0;
	width: 40px;
	z-index: 5;
}

.pf-progress__track {
	position: absolute;
	left: 14px;
	top: 55px;
	bottom: 30px;
	max-height: 600px;
	width: 11px;
	background: #f5f5f5;
	border-radius: 10px;
	overflow: hidden;
}

.pf-progress__fill {
	width: 100%;
	height: 0%;
	background: var(--color-rouge);
	border-radius: 10px;
	transition: height 0.4s ease;
}

/* Compteur positionné à côté du haut de la barre */
.pf-progress__label {
	position: absolute;
	left: 40px;
	top: 55px;
	color: var(--color-vert-noir);
	font-weight: 700;
	line-height: 1;
}

/* ---- Corps du questionnaire ---- */

.pf-quiz-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: 100px 0 24px 16px;
	max-width: 460px;
	width: 100%;
	box-sizing: border-box;
}

.pf-question__title {
	padding-right: 16px;
}

.pf-form {
	flex: 1;
}

/* ---- Transitions entre questions ---- */

.pf-question {
	border: none;
	padding: 0;
	margin: 0;
}

.pf-question[data-state="hidden"] {
	display: none;
}

.pf-question[data-state="active"] {
	display: block;
}

.pf-question[data-state="entering-fwd"] {
	display: block;
	animation: pf-enter-fwd 0.28s ease both;
}

.pf-question[data-state="entering-bwd"] {
	display: block;
	animation: pf-enter-bwd 0.28s ease both;
}

@keyframes pf-enter-fwd {
	from { opacity: 0; transform: translateX(24px); }
	to   { opacity: 1; transform: translateX(0); }
}

@keyframes pf-enter-bwd {
	from { opacity: 0; transform: translateX(-24px); }
	to   { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
	.pf-question[data-state="entering-fwd"],
	.pf-question[data-state="entering-bwd"] {
		animation: none;
	}
}

/* ---- Titre de la question ---- */

.pf-question__title {
	color: var(--color-vert-noir);
	text-align: center;
	margin: 0 0 1.5em;
}

/* ---- Réponses ---- */

.pf-answers {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.pf-answer {
	display: flex;
	align-items: center;
	gap: 16px;
	background: #fff;
	border-radius: 50px 0 0 50px;
	padding: 12px 20px;
	min-height: 72px;
	cursor: pointer;
	position: relative;
	transition: box-shadow 0.2s;
}

.pf-answer__input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	pointer-events: none;
}

.pf-answer__indicator {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--color-gris-vert);
	border: 1px solid var(--color-vert-noir);
	flex-shrink: 0;
	position: relative;
	transition: border-color 0.15s;
}

.pf-answer__indicator::after {
	content: '';
	position: absolute;
	inset: 4px;
	border-radius: 50%;
	background: var(--color-rouge);
	opacity: 0;
	transform: scale(0);
	transition: opacity 0.15s, transform 0.15s;
}

.pf-answer:has(.pf-answer__input:checked) .pf-answer__indicator::after {
	opacity: 1;
	transform: scale(1);
}

.pf-answer:has(.pf-answer__input:checked) {
	box-shadow: 0 5px 8.7px 0 rgba(0, 0, 0, 0.35);
}

.pf-answer__text {
	color: var(--color-vert-noir);
	flex: 1;
	line-height: 1.25;
}

.pf-answer__subtitle {
	display: block;
	font-size: 0.78em;
	opacity: 0.7;
	margin-top: 2px;
}

/* Focus visible sur le label (via l'input focalisé) */
.pf-answer:has(.pf-answer__input:focus-visible) {
	outline: 2px solid var(--color-rouge);
	outline-offset: 2px;
}

/* ---- Pied de page du quiz ---- */

.pf-quiz-footer {
	margin-top: 24px;
	padding-right: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.pf-error {
	color: var(--color-rouge);
	font-weight: 700;
	text-align: center;
	margin: 0;
}

.pf-nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 24px;
	flex-wrap: wrap;
}

.pf-nav__prev {
	display: flex;
	align-items: center;
	gap: 6px;
	background: none;
	border: none;
	cursor: pointer;
	color: var(--color-vert-noir);
	font-weight: 700;
	padding: 6px 0;
	transition: opacity 0.2s;
}

.pf-nav__prev:hover {
	opacity: 0.7;
}

/* ============================================================
   ÉCRAN RÉSULTATS
   ============================================================ */

/* ---- Barre supérieure ---- */

.pf-results-topbar {
	position: relative;
	display: flex;
	align-items: center;
	padding: 14px 52px 14px 14px;
	min-height: 58px;
}

/* Le .pf-close est en position absolute (top:14, right:14) */

.pf-restart {
	display: flex;
	align-items: center;
	gap: 6px;
	background: none;
	border: none;
	cursor: pointer;
	color: var(--color-vert-noir);
	font-weight: 700;
	padding: 6px 0;
	transition: opacity 0.2s;
}

.pf-restart:hover {
	opacity: 0.7;
}

/* ---- Intro résultats ---- */

.pf-results-intro {
	text-align: center;
	padding: 16px 24px 40px;
}

.pf-results-sub {
	color: var(--color-vert-noir);
	margin: 0 0 4px;
	font-weight: 700;
}

.pf-results-title {
	color: var(--color-vert-noir);
	margin: 0;
	line-height: 1.06;
}

/* ---- Loader ---- */

.pf-loader {
	display: flex;
	justify-content: center;
	padding: 48px 0;
}

.pf-loader__spinner {
	display: block;
	width: 36px;
	height: 36px;
	border: 3px solid var(--color-gris-vert);
	border-top-color: var(--color-rouge);
	border-radius: 50%;
	animation: pf-spin 0.8s linear infinite;
}

@keyframes pf-spin {
	to { transform: rotate(360deg); }
}

/* ---- Grille produits ---- */

.pf-results-grid {
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding: 0 16px 8px;
}

/*
 * Réinitialisation du style product-card pour le contexte "fond clair".
 * Les cartes du catalogue sont conçues pour un fond vert foncé.
 * Sur desktop, style.css applique : background transparent + ::before vert,
 * margin: 0 12%, overflow: visible, border-radius: 0.
 * On réinitialise tout ici sans toucher au template part.
 */
.pf-results-grid .product-card {
	background: #fff;
	border: none;
	border-radius: 20px;
	overflow: hidden;
	margin: 0;
	opacity: 0;
	animation: pf-card-in 0.4s ease forwards;
}

/* Retire le pseudo-élément vert appliqué par style.css en desktop */
.pf-results-grid .product-card::before {
	display: none;
}

.pf-results-grid .product-card:nth-child(2) { animation-delay: 0.1s; }
.pf-results-grid .product-card:nth-child(3) { animation-delay: 0.2s; }

/* Couleurs texte : contexte fond blanc */
.pf-results-grid .product-card__brand {
	color: var(--color-vert-logo);
}

.pf-results-grid .product-card__title {
	color: var(--color-vert-noir);
}

.pf-results-grid .product-card__features {
	color: var(--color-vert-noir);
}

/* Image : pas d'effet bleed dans ce contexte */
.pf-results-grid .product-card--detouree .product-card__img-wrap {
	margin: 0;
	padding-top: 0;
	aspect-ratio: 1 / 0.5;
}

.pf-results-grid .product-card:not(.product-card--detouree) .product-card__img-wrap {
	margin: 0;
	border-radius: 0;
}

@keyframes pf-card-in {
	from { opacity: 0; transform: translateY(16px); }
	to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	.pf-results-grid .product-card {
		animation: none;
		opacity: 1;
	}
}

/* ---- Message d'erreur résultats ---- */

.pf-results-error {
	text-align: center;
	padding: 32px 24px;
	color: var(--color-vert-noir);
}

.pf-results-error p {
	margin: 0 0 16px;
}

/* ============================================================
   SECTION SHOWROOM
   ============================================================ */

.pf-showroom {
	margin-top: 50px;
	background: linear-gradient(87deg,rgba(1, 37, 21, 1) 25%, rgba(0, 81, 49, 1) 100%);
	border-radius: 100px 100px 0 0;
	padding: 50px 0 48px;
}

.pf-showroom__title {
	color: var(--color-gris);
	text-align: center;
	margin: 0 0 24px;
}

.pf-showroom__text {
	color: var(--color-gris);
	text-align: center;
	padding: 0 24px;
	margin: 0;
	max-width: 900px;
	margin-inline: auto;
}

.pf-showroom .lit-magasins {
	margin-top: 50px;
}

/* Titre de carte magasin en h3 (au lieu de h2 dans le widget) : même style */
.pf-showroom .lit-magasin-card__title {
	font-size: clamp(1.25rem, 1.7vw, 1.7vw);
	margin: 0;
	color: var(--color-blanc);
}

/* Animations de la section showroom déclenchées à l'affichage des résultats */
.pf-showroom .lit-magasin-card {
	opacity: 0;
}

.pf-showroom .lit-magasin-card.is-visible {
	animation: lit-magasin-fadeInUp 0.6s ease forwards;
}

.pf-showroom .lit-magasins__grid .lit-magasin-card:nth-child(2).is-visible {
	animation-delay: 0.12s;
}

@media (prefers-reduced-motion: reduce) {
	.pf-showroom .lit-magasin-card {
		opacity: 1;
		animation: none;
	}
}

/* ============================================================
   Desktop (≥ 768px)
   ============================================================ */

@media (min-width: 768px) {

	/* Intro */
	.pf-intro-body {
		padding-top: 80px;
	}

	.pf-intro-image {
		min-height: 320px;
	}

	/* Quiz — padding-right: 40px compense le padding-left de .pf-screen--quiz
	   (barre de progression fixe) pour que margin: auto centre vraiment. */
	.pf-screen--quiz {
		padding-right: 40px;
	}

	.pf-quiz-body {
		margin: 0 auto;
		padding-left: 32px;
		padding-right: 32px;
	}

	.pf-answers {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		gap: 16px;
	}

	.pf-answer {
		flex: 0 0 calc(25% - 12px);
	}

	.pf-answer {
		min-height: 80px;
		padding: 16px 20px;
		border-radius: 20px;
	}

	/* Résultats : grille 3 colonnes */
	.pf-results-grid {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 36px;
		padding: 0 24px 8px;
	}

}

@media (min-width: 1025px) {

	.pf-intro-image {
		width: 50%;
	}

	.pf-intro-content {
		max-width: 480px;
	}

	.pf-quiz-body {
		max-width: 1100px;
	}

	.pf-results-grid {
		max-width: 1200px;
		margin: 0 auto;
		padding: 0 32px 8px;
	}

	/*
	 * Réinitialisation des surcharges desktop de style.css sur .product-card :
	 * background transparent, margin: 0 12%, overflow: visible, border-radius: 0.
	 * Ces règles s'appliquent car product-finder.css est chargé après style.css.
	 */
	.pf-results-grid .product-card {
		background: #fff;
		border: none;
		border-radius: 20px;
		overflow: hidden;
		margin: 0;
		display: flex;
		flex-direction: column;
		box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	}

	.pf-results-grid .product-card:hover {
		box-shadow: 0 4px 20px rgba(0, 0, 0, 0.14);
	}

	.pf-results-grid .product-card__body {
		padding: 12px 14px 16px;
	}

}
