/**
 * Filtres produits — design 2026.
 *
 * Principes :
 *   1. le panneau s'aligne sur le thème (variables Blocksy --theme-palette-color-*, --theme-border-radius)
 *      et n'impose rien : tout passe par des variables locales surchargées par l'administration ;
 *   2. trois densités et trois arrondis, pilotés par des classes sur le corps ;
 *   3. aucune image, aucune police téléchargée, aucun gradient lourd : le coût de rendu est minimal ;
 *   4. accessibilité : contrastes AA, cibles de 44 px sur mobile, focus visible, listes sémantiques.
 */

.fp-panneau {
	--fp-accent: var(--theme-palette-color-1, #17324d);
	--fp-texte: var(--theme-text-color, #1f2429);
	--fp-texte-doux: var(--theme-text-color, #5b636b);
	--fp-bord: var(--theme-border-color, #e5e7ea);
	--fp-fond: var(--theme-palette-color-8, #fff);
	--fp-fond-doux: color-mix(in srgb, var(--fp-accent) 5%, #fff);
	--fp-rayon: 10px;
	--fp-rayon-petit: 7px;
	--fp-espace: 0.75rem;
	--fp-pastille: 20px;

	box-sizing: border-box;
	color: var(--fp-texte);
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

.fp-panneau *,
.fp-panneau *::before,
.fp-panneau *::after {
	box-sizing: border-box;
}

/* --- densité et arrondi (réglages) ----------------------------------------- */

.fp-mode-colonne .fp-panneau,
.fp-mode-bandeau .fp-panneau {
	--fp-rayon: 10px;
}

body .fp-arrondi-net {
	--fp-rayon: 2px;
	--fp-rayon-petit: 2px;
}

body .fp-arrondi-arrondi {
	--fp-rayon: 18px;
	--fp-rayon-petit: 12px;
}

body .fp-densite-compact {
	--fp-espace: 0.45rem;
}

body .fp-densite-aere {
	--fp-espace: 1.15rem;
}

/* --- panneau --------------------------------------------------------------- */

.fp-panneau__titre,
.fp-panneau__ouvrir {
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.fp-panneau__titre {
	margin: 0 0 var(--fp-espace);
	padding: 0;
}

.fp-panneau__ouvrir {
	display: none;
	width: 100%;
	align-items: center;
	gap: 0.6rem;
	padding: 0.8rem 1rem;
	border: 1px solid var(--fp-bord);
	border-radius: var(--fp-rayon);
	background: var(--fp-fond);
	color: inherit;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.fp-panneau__ouvrir:hover {
	border-color: var(--fp-accent);
}

.fp-panneau__icone {
	width: 18px;
	height: 18px;
	flex: 0 0 auto;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 6h16M7 12h10M10 18h4'/%3E%3C/svg%3E") center/18px no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 6h16M7 12h10M10 18h4'/%3E%3C/svg%3E") center/18px no-repeat;
	opacity: 0.85;
}

.fp-panneau__chevron {
	margin-left: auto;
	width: 10px;
	height: 10px;
	border: solid currentColor;
	border-width: 0 2px 2px 0;
	padding: 0;
	transform: rotate(45deg);
	transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.fp-panneau__ouvrir[aria-expanded="true"] .fp-panneau__chevron {
	transform: rotate(-135deg);
}

.fp-nav {
	display: block;
}

/* --- blocs ----------------------------------------------------------------- */

.fp-bloc {
	padding: var(--fp-espace) 0;
	border-top: 1px solid var(--fp-bord);
}

.fp-bloc:first-of-type {
	border-top: 0;
	padding-top: 0;
}

.fp-bloc__titre {
	margin: 0 0 0.55rem;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--fp-texte-doux);
}

.fp-label {
	display: block;
	margin-bottom: 0.35rem;
	font-size: 0.875rem;
}

/* --- listes de valeurs ---------------------------------------------------- */

.fp-liste {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 21rem;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.fp-liste__item {
	margin: 0;
	padding: 0;
}

.fp-liste__item a {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.42rem 0.5rem;
	border-radius: var(--fp-rayon-petit);
	text-decoration: none;
	color: inherit;
	transition: background-color 0.15s ease;
}

.fp-liste__item a:hover,
.fp-liste__item a:focus-visible {
	background: var(--fp-fond-doux);
}

.fp-liste__item--actif a {
	background: color-mix(in srgb, var(--fp-accent) 12%, transparent);
	font-weight: 600;
}

.fp-liste__nom {
	flex: 1 1 auto;
	min-width: 0;
	overflow-wrap: anywhere;
}

.fp-liste__compte {
	flex: 0 0 auto;
	font-size: 0.8125rem;
	color: var(--fp-texte-doux);
	font-variant-numeric: tabular-nums;
}

.fp-liste__coche {
	display: none;
}

.fp-liste__item--actif .fp-liste__coche {
	display: block;
	width: 14px;
	height: 14px;
	flex: 0 0 auto;
	background: var(--fp-accent);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E") center/14px no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E") center/14px no-repeat;
}

/* --- pastilles de couleur -------------------------------------------------- */

.fp-pastille {
	flex: 0 0 auto;
	width: var(--fp-pastille);
	height: var(--fp-pastille);
	border-radius: 50%;
	background-clip: padding-box;
	box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.2);
}

.fp-pastille--claire,
.fp-pastille--inconnue {
	box-shadow: inset 0 0 0 1.5px rgba(15, 23, 42, 0.28);
}

.fp-pastille--inconnue {
	background: repeating-linear-gradient(45deg, #f3f4f6 0 4px, #e5e7eb 4px 8px);
}

.fp-pastille--multi {
	border-radius: 5px;
}

.fp-liste__item--actif .fp-pastille {
	box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.2), 0 0 0 2px var(--fp-accent);
}

/* --- prix ------------------------------------------------------------------ */

.fp-prix__curseur {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	margin-bottom: 0.75rem;
}

.fp-prix__rail {
	position: relative;
	height: 4px;
	border-radius: 999px;
	background: var(--fp-bord);
	margin: 0.9rem 0.6rem 0.2rem;
}

.fp-prix__barre {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 100%;
	border-radius: 999px;
	background: var(--fp-accent);
}

.fp-prix__curseur input[type="range"] {
	-webkit-appearance: none;
	appearance: none;
	position: absolute;
	left: 0;
	right: 0;
	width: 100%;
	height: 1.6rem;
	margin: 0;
	background: none;
	pointer-events: none;
}

.fp-prix__curseur input[type="range"]:first-of-type {
	top: -0.1rem;
}

.fp-prix__curseur input[type="range"]:last-of-type {
	top: -0.1rem;
}

.fp-prix__curseur input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	border: 2px solid var(--fp-accent);
	background: #fff;
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
	cursor: pointer;
	pointer-events: auto;
}

.fp-prix__curseur input[type="range"]::-moz-range-thumb {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 2px solid var(--fp-accent);
	background: #fff;
	cursor: pointer;
	pointer-events: auto;
}

.fp-prix__champs {
	display: flex;
	align-items: flex-end;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.fp-prix__champ {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	flex: 1 1 6rem;
	font-size: 0.8125rem;
	color: var(--fp-texte-doux);
}

.fp-prix__champ input {
	width: 100%;
	padding: 0.45rem 0.55rem;
	border: 1px solid var(--fp-bord);
	border-radius: var(--fp-rayon-petit);
	font: inherit;
	color: var(--fp-texte);
	background: var(--fp-fond);
}

.fp-prix__champ input:focus-visible {
	border-color: var(--fp-accent);
	outline: 2px solid color-mix(in srgb, var(--fp-accent) 35%, transparent);
	outline-offset: 1px;
}

.fp-prix__devise {
	padding-bottom: 0.5rem;
	font-size: 0.875rem;
	color: var(--fp-texte-doux);
}

/* --- cases ----------------------------------------------------------------- */

.fp-cases {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.1rem;
}

.fp-case {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.42rem 0.5rem;
	border-radius: var(--fp-rayon-petit);
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.fp-case:hover {
	background: var(--fp-fond-doux);
}

.fp-case input {
	width: 17px;
	height: 17px;
	margin: 0;
	accent-color: var(--fp-accent);
}

/* --- étoiles --------------------------------------------------------------- */

.fp-etoiles {
	flex: 0 0 auto;
	color: var(--fp-accent);
	letter-spacing: 1px;
	font-size: 0.95rem;
}

/* --- champ de recherche --------------------------------------------------- */

.fp-champ {
	position: relative;
	display: block;
}

.fp-champ input {
	width: 100%;
	padding: 0.5rem 2.4rem 0.5rem 0.6rem;
	border: 1px solid var(--fp-bord);
	border-radius: var(--fp-rayon-petit);
	font: inherit;
	background: var(--fp-fond);
	color: var(--fp-texte);
}

.fp-champ input:focus-visible {
	border-color: var(--fp-accent);
	outline: 2px solid color-mix(in srgb, var(--fp-accent) 35%, transparent);
	outline-offset: 1px;
}

.fp-champ__valider {
	position: absolute;
	top: 50%;
	right: 0.25rem;
	transform: translateY(-50%);
	width: 1.9rem;
	height: 1.9rem;
	border: 0;
	border-radius: var(--fp-rayon-petit);
	background: var(--fp-accent);
	cursor: pointer;
	-webkit-mask: none;
}

.fp-champ__valider::after {
	content: "";
	position: absolute;
	inset: 0;
	background: #fff;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.6-3.6'/%3E%3C/svg%3E") center/15px no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.6-3.6'/%3E%3C/svg%3E") center/15px no-repeat;
}

/* --- boutons --------------------------------------------------------------- */

.fp-panneau__actions {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
	padding-top: var(--fp-espace);
}

.fp-bouton {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 42px;
	padding: 0.6rem 1.15rem;
	border: 1px solid transparent;
	border-radius: var(--fp-rayon);
	font: inherit;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.15s ease, background-color 0.15s ease;
}

.fp-bouton--principal {
	background: var(--fp-accent);
	border-color: var(--fp-accent);
	color: #fff;
}

.fp-bouton--principal:hover,
.fp-bouton--principal:focus-visible {
	filter: brightness(1.1);
	color: #fff;
}

.fp-bouton--petit {
	min-height: 36px;
	padding: 0.4rem 0.9rem;
	font-size: 0.875rem;
}

.fp-bouton--lien {
	background: transparent;
	border-color: var(--fp-bord);
	color: var(--fp-texte);
}

.fp-bouton--lien:hover {
	border-color: var(--fp-accent);
	color: var(--fp-texte);
}

.fp-plus {
	display: inline-block;
	margin-top: 0.35rem;
	padding: 0.3rem 0.5rem;
	border: 0;
	border-radius: var(--fp-rayon-petit);
	background: transparent;
	color: var(--fp-accent);
	font: inherit;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

.fp-plus:hover {
	background: var(--fp-fond-doux);
}

.fp-liste__item--replie {
	display: none;
}

.fp-bloc--ouvert .fp-liste__item--replie {
	display: block;
}

.fp-note {
	margin: 0.4rem 0 0;
	font-size: 0.78rem;
	color: var(--fp-texte-doux);
}

/* --- bandeau des filtres actifs ------------------------------------------- */

.fp-actifs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 1rem;
}

.fp-actifs__liste {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.fp-puce {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.35rem 0.7rem;
	border: 1px solid var(--fp-bord);
	border-radius: 999px;
	background: var(--fp-fond);
	font-size: 0.8125rem;
	text-decoration: none;
	color: var(--fp-texte);
	transition: border-color 0.15s ease;
}

.fp-puce:hover,
.fp-puce:focus-visible {
	border-color: var(--fp-accent);
	color: var(--fp-texte);
}

.fp-puce__groupe {
	color: var(--fp-texte-doux);
}

.fp-puce__valeur {
	font-weight: 600;
}

.fp-puce__croix {
	width: 12px;
	height: 12px;
	background: currentColor;
	opacity: 0.6;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center/12px no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center/12px no-repeat;
}

.fp-actifs__tout {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--fp-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* --- mode bandeau (au-dessus de la grille) -------------------------------- */

.fp-panneau--bandeau {
	padding: 1rem 1.1rem;
	border: 1px solid var(--fp-bord);
	border-radius: var(--fp-rayon);
	background: var(--fp-fond);
	margin-bottom: 1.5rem;
}

.fp-panneau--bandeau .fp-panneau__titre {
	margin-bottom: 0.5rem;
}

.fp-panneau--bandeau .fp-bloc {
	border-top: 0;
	padding: 0;
}

.fp-grille {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: 1rem 1.5rem;
	align-items: start;
}

/* --- disposition à deux colonnes : filtres à gauche, produits à droite ------ */

/*
 * Deux colonnes posées par `grid` + `align-items: start` : la hauteur de la colonne de filtres ne
 * peut donc JAMAIS déterminer la position verticale de la grille. Aucune marge négative, aucun
 * `position: absolute`, aucune hauteur fixe — la disposition vient de la structure (le panneau est
 * un frère de la colonne produits, pas un bloc dedans).
 */
.fp-layout--cote-a-cote {
	display: grid;
	grid-template-columns: minmax(240px, 270px) minmax(0, 1fr);
	gap: clamp(1.25rem, 2.5vw, 2.25rem);
	align-items: start;
}

.fp-layout__filtres {
	min-width: 0;
	/* La colonne de filtres défile toute seule : elle peut être plus haute que l'écran sans
	   allonger la page ni décaler la grille. */
	position: sticky;
	top: 1.5rem;
	max-height: calc(100vh - 3rem);
	overflow: auto;
	overscroll-behavior: contain;
}

/* La grille produit reste maître de sa largeur, même avec des images larges ou des titres longs. */
.fp-layout__produits {
	min-width: 0;
}

/* Nombre de produits par ligne : on pilote la variable du thème, pas la largeur des cartes. */
body .fp-layout__produits [data-products] {
	--shop-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1400px) {
	.fp-layout--cote-a-cote {
		grid-template-columns: minmax(220px, 250px) minmax(0, 1fr);
	}
}

@media (max-width: 1200px) {
	body .fp-layout__produits [data-products] {
		--shop-columns: repeat(3, minmax(0, 1fr));
	}
}

/* --- mobile et tablette : filtres en accordéon, largeur entière pour les produits ----- */

@media (max-width: 1000px) {
	.fp-layout--cote-a-cote {
		grid-template-columns: minmax(0, 1fr);
		gap: 0.75rem;
	}

	.fp-layout__filtres {
		position: static;
		max-height: none;
		overflow: visible;
	}

	body .fp-layout__produits [data-products] {
		--shop-columns: repeat(2, minmax(0, 1fr));
	}

	/* Ouvert : la liste défile dans le panneau, la page ne s'allonge pas démesurément.
	   Le repli lui-même dépend de `.fp-js` (voir la section mobile) : sans JavaScript, un bouton qui
	   n'ouvre rien vaut moins que des filtres affichés. */
	.fp-js .fp-panneau--repliable.fp-panneau--ouvert .fp-panneau__form {
		max-height: 70vh;
		overflow: auto;
		overscroll-behavior: contain;
	}
}

@media (max-width: 600px) {
	body .fp-layout__produits [data-products] {
		--shop-columns: repeat(2, minmax(0, 1fr));
	}
}

/* --- état de chargement --------------------------------------------------- */

/*
 * Pendant une sélection, le panneau reste INTERACTIF : bloquer les clics (règle précédente)
 * empêchait d'enchaîner deux critères et donnait l'impression d'une interface figée. Ici l'état est
 * signalé par une barre fine, et la requête obsolète est annulée côté script.
 */
.fp-panneau--instantane.fp-chargement {
	position: relative;
}

.fp-panneau--instantane.fp-chargement::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	height: 2px;
	background: linear-gradient(
		90deg,
		transparent 0%,
		var(--fp-accent) 40%,
		var(--fp-accent) 60%,
		transparent 100%
	);
	background-size: 40% 100%;
	background-repeat: no-repeat;
	animation: fp-progression 0.9s linear infinite;
	pointer-events: none;
}

@keyframes fp-progression {
	from {
		background-position: -40% 0;
	}
	to {
		background-position: 140% 0;
	}
}

/* La grille s'efface légèrement pendant le calcul, puis la nouvelle apparaît en fondu. */
.fp-grille-chargement {
	opacity: 0.5;
	transition: opacity 0.15s ease;
}

.fp-grille-arrivee {
	animation: fp-apparition 0.22s ease both;
}

@keyframes fp-apparition {
	from {
		opacity: 0.35;
	}
	to {
		opacity: 1;
	}
}

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

.fp-en-cours {
	opacity: 0.6;
	pointer-events: none;
}

.fp-chargement-cible {
	position: relative;
}

.fp-chargement-cible::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.6);
	backdrop-filter: saturate(0.6);
}

/* --- aperçu dans l'administration ---------------------------------------- */

.fp-apercu {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	margin: 0 0.6rem 0.4rem 0;
	font-size: 0.8125rem;
}

.fp-apercu__pastille {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.22);
}

/* --- mobile -------------------------------------------------------------- */

@media (max-width: 1000px) {
	/* Sans JavaScript, le panneau reste OUVERT : le bouton ne pourrait rien ouvrir, et des filtres
	   cachés derrière un bouton inerte rendraient le catalogue infiltrable sur mobile. `.fp-js` est
	   posée par le script dès son exécution. */
	.fp-js .fp-panneau--repliable .fp-panneau__ouvrir {
		display: flex;
	}

	.fp-js .fp-panneau--repliable .fp-panneau__form {
		display: none;
		padding-top: 1rem;
	}

	.fp-js .fp-panneau--repliable.fp-panneau--ouvert .fp-panneau__form {
		display: block;
	}

	.fp-js .fp-panneau--repliable .fp-panneau__titre {
		display: none;
	}

	.fp-panneau--bandeau .fp-panneau__form {
		display: block;
		padding-top: 0;
	}
}

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

	/* La barre de progression disparaît : elle n'apporte rien sans animation, l'état reste lisible
	   par `aria-busy` et par le compteur mis à jour. */
	.fp-panneau--instantane.fp-chargement::after {
		display: none;
	}

	.fp-grille-arrivee {
		animation: none !important;
	}
}
