/*
 * Good Act 2 — pages catégories : haut de page compact et Good Score des vignettes (inc/category-top.php).
 * Couleurs de la charte : noir, blanc, accent #64E6CB, jaune #FFED82, HR #F8F5ED, gris moyen #808080, vert #31C1A4.
 */

/* ------------------------------------------------------------------
 * Titre et introduction
 * ------------------------------------------------------------------ */

/* Pleine largeur, aligné sur le fil d'Ariane (le thème le limite à 1000 px, centré). */
body.ga2-cattop .woocommerce-products-header {
	max-width: none;
	margin: 0;
	padding: 48px 0 16px; /* le fil d'Ariane du thème est posé au-dessus */
	text-align: left;
}

/* Mobile : le fil d'Ariane tient souvent sur deux lignes. */
@media (max-width: 767px) {
	body.ga2-cattop .woocommerce-products-header {
		padding-top: 64px;
	}
}

body.ga2-cattop .woocommerce-products-header__pic {
	display: none;
}

body.ga2-cattop .woocommerce-products-header .woocommerce-products-header__title {
	margin: 0 0 18px;
	font-size: 30px;
	line-height: 1.15;
	text-align: left;
}

body.ga2-cattop .woocommerce-products-header .term-description {
	max-width: 780px;
	margin: 0;
	text-align: left;
}

/* « Voir plus » du thème : 3 lignes du premier paragraphe visibles (au lieu de 2 lignes de chaque paragraphe,
   qui laissait des blancs quand l'introduction en a plusieurs). */
body.ga2-cattop .woocommerce-products-header .term-description.readMoreTrigger:not(.readMoreTrigger--open) p {
	max-height: 4.5em;
	-webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent);
	mask-image: linear-gradient(to bottom, #000 45%, transparent); /* fondu sur les dernières lignes */
}

body.ga2-cattop .woocommerce-products-header .term-description.readMoreTrigger:not(.readMoreTrigger--open) > :not(:first-child) {
	display: none;
}

body.ga2-cattop .woocommerce-products-header .term-description > p:first-child {
	margin-bottom: 0;
}

body.ga2-cattop .woocommerce-products-header .term-description.readMoreTrigger::after {
	margin: 2px 0 0;
}

@media (min-width: 992px) {
	/* Titre à gauche, introduction à droite. */
	body.ga2-cattop .woocommerce-products-header {
		display: grid;
		grid-template-columns: minmax(0, auto) minmax(0, 1fr);
		column-gap: 48px;
		align-items: start;
	}

	body.ga2-cattop .woocommerce-products-header .woocommerce-products-header__title {
		max-width: 420px;
		margin: 0;
		font-size: 38px;
	}
}

/* ------------------------------------------------------------------
 * Sous-catégories en pastilles
 * ------------------------------------------------------------------ */

.ga2-subcats {
	margin: 0 0 14px;
}

.ga2-subcats__list {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ga2-subcats__list > li {
	margin: 0;
	list-style: none;
}

.ga2-subcats__item {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 48px;
	padding: 4px 16px 4px 4px;
	border: 1px solid #e6e1d6;
	border-radius: 999px;
	background: #fff;
	color: #000;
	text-decoration: none;
	white-space: nowrap;
	transition: border-color 0.15s;
}

.ga2-subcats__item:hover,
.ga2-subcats__item:focus-visible {
	border-color: #64e6cb;
	color: #000;
}

.ga2-subcats__pic {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	overflow: hidden;
	border-radius: 50%;
	background: #f8f5ed;
}

.ga2-subcats__pic img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ga2-subcats__name {
	font-size: 14px;
	font-weight: 500;
}

/* « Tout voir » : retour à la catégorie parente, sur une catégorie sans sous-catégories. */
.ga2-subcats__item--all {
	border-color: #000;
}

/* Au-delà de 10 pastilles : les suivantes apparaissent avec « Voir plus ». */
.ga2-subcats:not(.is-open) .ga2-subcats__extra {
	display: none;
}

.ga2-subcats.is-open .ga2-subcats__more-wrap {
	display: none;
}

.ga2-subcats__more {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 48px;
	padding: 4px 16px;
	border: 1px dashed #808080;
	border-radius: 999px;
	background: transparent;
	color: #000;
	font-family: inherit;
	font-size: 14px;
	font-weight: 500;
	white-space: nowrap;
	cursor: pointer;
}

.ga2-subcats__more:hover,
.ga2-subcats__more:focus-visible {
	border-color: #64e6cb;
}

.ga2-subcats__count {
	font-size: 12px;
	color: #808080;
}

/* Mobile : une ligne qui défile horizontalement. */
@media (max-width: 767px) {
	.ga2-subcats {
		margin-right: -15px;
	}

	.ga2-subcats__list {
		flex-wrap: nowrap;
		overflow-x: auto;
		padding-right: 15px;
		scrollbar-width: none;
	}

	.ga2-subcats__list::-webkit-scrollbar {
		display: none;
	}
}

/* ------------------------------------------------------------------
 * Barre : filtres, nombre de résultats, tri
 * (sur mobile, YITH affiche les filtres dans une fenêtre, classe filters-modal : sa présentation n'est pas touchée,
 * sauf le champ « Voir les prix pour … pièces »)
 * ------------------------------------------------------------------ */

.ga2-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 16px;
	margin: 0 0 24px;
	padding: 10px 16px;
	border-radius: 14px;
	background: #fff;
}

/* Messages WooCommerce et bouton « Filtres » mobile de YITH : sur toute la largeur. */
.ga2-toolbar > .woocommerce-notices-wrapper,
.ga2-toolbar > .yith-wcan-filters-opener {
	flex: 1 1 100%;
}

.ga2-toolbar > .woocommerce-notices-wrapper:empty {
	display: none;
}

/* Filtres à gauche, résultats et tri à droite sur la même ligne s'il y a la place (dès ~1 340 px avec les
   filtres actuels), sinon résultats et tri passent à droite sur une seconde ligne. */
body.ga2-cattop .ga2-toolbar .yith-wcan-filters:not(.filters-modal) {
	position: relative;
	flex: 0 1 auto;
	width: auto;
	min-width: 0;
	margin: 0;
	padding: 0;
	background: none;
}

body.ga2-cattop .ga2-toolbar .yith-wcan-filters:not(.filters-modal) form {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

/* Titre « Filtres » : gardé pour les lecteurs d'écran, masqué à l'écran (les boutons parlent d'eux-mêmes et la
   barre tient ainsi sur une ligne dès ~1 340 px). */
body.ga2-cattop .ga2-toolbar .yith-wcan-filters:not(.filters-modal) form > h3 {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* Quantité et prix (filtres du thème Good Act) : le script du thème leur met un display en ligne. */
body.ga2-cattop .ga2-toolbar .yith-wcan-filters:not(.filters-modal) .k_custom_filters {
	display: flex !important;
	flex-wrap: wrap;
	gap: 8px;
}

body.ga2-cattop .ga2-toolbar .yith-wcan-filters:not(.filters-modal) .yith-wcan-filter {
	width: auto;
	min-width: 0;
	margin: 0;
}

/* Chaque filtre à la largeur de son nom (au lieu de 150 px minimum), sans les marges de YITH. */
body.ga2-cattop .ga2-toolbar .yith-wcan-filters:not(.filters-modal) .yith-wcan-filter .filter-title.collapsable {
	display: flex;
	align-items: center;
	width: auto;
	height: 40px;
	margin: 0;
	padding: 0 30px 0 12px;
	font-size: 13px;
	white-space: nowrap;
}

/* « Voir les prix pour [100] pièces » : en premier, sur fond vert d'eau, pour le distinguer des autres filtres. */
body.ga2-cattop .ga2-toolbar .yith-wcan-filters .ga2-qty {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 40px;
	padding: 0 14px;
	border: 1px solid #64e6cb;
	border-radius: 999px;
	background: #e0faf4;
	font-size: 13px;
	white-space: nowrap;
}

/* Dans la fenêtre de filtres mobile : centré, avec les marges des autres filtres. */
body.ga2-cattop .yith-wcan-filters.filters-modal .ga2-qty {
	justify-content: center;
	margin: 12px 20px 4px;
}

body.ga2-cattop .ga2-toolbar .yith-wcan-filters .ga2-qty::after {
	content: none; /* « ex. » du thème */
}

.ga2-qty__label,
.ga2-qty__unit {
	margin: 0;
	font-weight: 500;
	cursor: text;
}

body.ga2-cattop .ga2-toolbar .yith-wcan-filters .ga2-qty .k_quantite {
	width: 58px;
	height: 28px;
	margin: 0;
	padding: 0 6px;
	border: 1px solid #64e6cb;
	border-radius: 999px;
	background: #fff;
	font-size: 13px;
	font-weight: 700;
	text-align: center;
}

/* « Appliquer les filtres » : dans la ligne, après les filtres, au lieu d'être posé par-dessus. */
body.ga2-cattop .ga2-toolbar .yith-wcan-filters:not(.filters-modal) .apply-filters {
	position: static;
	transform: none;
	height: 40px;
	margin: 0;
	padding: 0 14px;
	border-radius: 999px;
	font-size: 13px;
	white-space: nowrap;
}

/* Quantité appliquée : rappel juste sous la barre des filtres, et quantité mise en avant sur chaque vignette. */
.ga2-qty-notice {
	display: flex;
	flex-wrap: wrap;
	margin: -12px 0 24px;
	align-items: center;
	justify-content: space-between;
	gap: 6px 16px;
	padding: 8px 14px;
	border-radius: 10px;
	background: #e0faf4;
	font-size: 13px;
}

.ga2-qty-notice__actions {
	display: flex;
	gap: 16px;
}

.ga2-qty-notice__actions label,
.ga2-qty-notice__actions a {
	margin: 0;
	color: #000;
	font-weight: 500;
	text-decoration: underline;
	text-decoration-color: #31c1a4;
	text-underline-offset: 3px;
	cursor: pointer;
}

body.ga2-qty-on .wc-product-card__price > span:last-of-type {
	padding: 0 4px;
	border-radius: 4px;
	background: #e0faf4;
}

/* Nombre de résultats et tri, à droite (sans les marges et décalages du thème). */
.ga2-toolbar__end {
	display: flex;
	flex: none;
	align-items: center;
	gap: 12px;
	margin-left: auto;
}

body.ga2-cattop .ga2-toolbar__end .woocommerce-result-count {
	float: none;
	width: auto;
	margin: 0;
	font-size: 13px;
	line-height: 1.2;
	white-space: nowrap;
}

body.ga2-cattop .ga2-toolbar__end .woocommerce-ordering {
	float: none;
	width: auto;
	margin: 0;
}

body.ga2-cattop .ga2-toolbar__end .woocommerce-ordering select {
	width: 180px;
	height: 40px;
	margin: 0;
	padding: 0 34px 0 14px;
	font-size: 13px;
	line-height: 38px;
}

/* ------------------------------------------------------------------
 * Vignettes produits : Good Score sur l'échelle A à E (comme sur la fiche produit)
 * ------------------------------------------------------------------ */

.ga2-gs {
	position: absolute;
	top: 0;
	right: 40px;
	display: inline-flex;
	overflow: hidden;
	border: 1px solid #e5e0d5;
	border-radius: 6px;
	background: #fff;
	line-height: 1;
}

.ga2-gs i {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 20px;
	font-family: Rubik, Arial, sans-serif;
	font-size: 11px;
	font-style: normal;
	font-weight: 600;
	color: #8a867c;
}

.ga2-gs i.is-on {
	color: #111;
}

.ga2-gs i.ga2-gs-A { background: #1f7a5c; color: #fff; }
.ga2-gs i.ga2-gs-B { background: #6baf4e; color: #fff; }
.ga2-gs i.ga2-gs-C { background: #e9c93a; }
.ga2-gs i.ga2-gs-D { background: #e8913a; }
.ga2-gs i.ga2-gs-E { background: #c2372f; color: #fff; }

/* Mobile : seulement la lettre du produit, dans une pastille ronde, pour ne pas cacher la photo. */
@media (max-width: 767px) {
	.ga2-gs {
		right: 24px;
		border: 0;
		border-radius: 50%;
		background: none;
	}

	.ga2-gs i:not(.is-on) {
		display: none;
	}

	.ga2-gs i.is-on {
		width: 24px;
		height: 24px;
		border-radius: 50%;
		font-size: 12px;
	}
}
