/* Le volet de filtres.
 *
 * SANS SCRIPT (pas de classe `avec-js` sur <html>), le volet est un bloc normal,
 * au-dessus de la liste, et le bouton d'ouverture est masque : le formulaire
 * « Appliquer » suffit. AVEC SCRIPT, le volet devient un panneau fixe a droite.
 *
 * Les couleurs reprennent des variables si elles existent ; les valeurs apres la
 * virgule sont des secours neutres, a aligner sur monmixtcg.css.
 *
 * Cette feuille porte aussi les GRILLES DE CARTES ET DE BADGES sur telephone
 * (3 par ligne, 5 avec l'interrupteur « 5 items par ligne ») : voir plus bas.
 */

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

/* LE BOUTON D'OUVERTURE : a droite, juste avant la liste.
 * Les puces des filtres actifs sont a sa gauche (voir .volet-puces). */
.volet-barre {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: .5rem;
	margin: .5rem 0;
}
.volet-ouvrir { display: none; }
.avec-js .volet-ouvrir {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	position: relative;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--fond-discret, #eee);
	color: var(--couleur-accent, #3b9bf5);
	cursor: pointer;
}
.avec-js .volet-ouvrir:hover { background: var(--fond-survol, #e2e2e2); }
.volet-ouvrir svg,
.volet-raz svg {
	width: 1.3rem;
	height: 1.3rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.volet-compteur {
	position: absolute;
	top: -.15rem;
	right: -.15rem;
	min-width: 1.1rem;
	height: 1.1rem;
	padding: 0 .25rem;
	border-radius: .55rem;
	background: var(--couleur-accent, #3b9bf5);
	color: #fff;
	font-size: .7rem;
	line-height: 1.1rem;
	text-align: center;
}

/* L'INTERRUPTEUR : texte puis interrupteur, a gauche de l'icone d'entonnoir, dans la meme barre.
 *
 * C'est un bouton d'envoi (`role="switch"`) dans un petit formulaire GET : il marche
 * sans script, avec ou sans `avec-js`. Comme pour la puce, les selecteurs a deux
 * classes passent devant la regle generale `button` du site (pleine largeur, fond
 * violet, ombre, soulevement au survol). */
.volet-interrupteur { margin: 0; }
.volet-interrupteur .volet-interrupteur-btn {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	width: auto;
	max-width: none;
	margin: 0;
	padding: .2rem .3rem .2rem .5rem;
	border: 0;
	border-radius: 1.2rem;
	background: transparent;
	box-shadow: none;
	transform: none;
	color: var(--encre, #241b3a);
	font: inherit;
	font-size: .85rem;
	font-weight: 400;
	line-height: 1.3;
	cursor: pointer;
}
.volet-interrupteur .volet-interrupteur-btn:hover {
	background: var(--fond-discret, #eee);
	box-shadow: none;
	transform: none;
}
.volet-interrupteur .volet-interrupteur-btn:active {
	box-shadow: none;
	transform: none;
}
.volet-interrupteur .volet-interrupteur-btn:focus-visible {
	outline: 2px solid var(--couleur-accent, #3b9bf5);
	outline-offset: 2px;
}
.volet-interrupteur-piste {
	position: relative;
	flex: none;
	width: 2.4rem;
	height: 1.35rem;
	border-radius: .7rem;
	background: var(--bordure, #bbb);
	transition: background .15s ease;
}
.volet-interrupteur-bouton {
	position: absolute;
	top: .15rem;
	left: .15rem;
	width: 1.05rem;
	height: 1.05rem;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
	transition: transform .15s ease;
}
.volet-interrupteur-btn[aria-checked="true"] .volet-interrupteur-piste {
	background: var(--couleur-accent, #3b9bf5);
}
.volet-interrupteur-btn[aria-checked="true"] .volet-interrupteur-bouton {
	transform: translateX(1.05rem);
}

/* L'INTERRUPTEUR « 5 ITEMS PAR LIGNE » : le meme interrupteur, mais pilote par le script.
 *
 * Il n'envoie rien au serveur : volet-filtres.js pose la classe `cinq-par-ligne` sur <html>
 * et la garde dans le navigateur (localStorage). Sans script il n'a donc rien a faire : il est
 * masque, comme l'icone d'entonnoir. Il reste aussi masque dans la barre des amis de
 * « Proposer un echange » (etape 1) : il n'y a aucune carte a regrouper a cet endroit. */
.volet-interrupteur-colonnes { display: none; }
.avec-js .volet-interrupteur-colonnes { display: block; }
.avec-js .etape-ami .volet-interrupteur-colonnes { display: none; }

/* LES FILTRES ACTIFS : des puces, a gauche de l'icone, creees par volet-filtres.js.
 *
 * Le bouton de retrait neutralise la regle generale `button` du site (pleine
 * largeur, fond violet, ombre, soulevement au survol) : les selecteurs a deux
 * classes passent devant `button` et `button:hover`. */
.volet-puces {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: .35rem;
	min-width: 0;
}
.volet-puces:empty { display: none; }
.volet-puce {
	display: inline-flex;
	align-items: center;
	gap: .15rem;
	max-width: 100%;
	padding: .15rem .2rem .15rem .7rem;
	border-radius: 1.2rem;
	background: var(--fond-discret, #eee);
	color: var(--encre, #241b3a);
	font-size: .8rem;
	line-height: 1.3;
}
.volet-puce-texte {
	min-width: 0;
	max-width: 14rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.volet-puce .volet-puce-retirer {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 1.4rem;
	height: 1.4rem;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	box-shadow: none;
	color: var(--texte-discret, #666);
	font-size: 1.1rem;
	font-weight: 400;
	line-height: 1;
	cursor: pointer;
	text-decoration: none;
	transform: none;
}
.volet-puce .volet-puce-retirer:hover {
	background: var(--fond-survol, #e2e2e2);
	color: var(--couleur-accent, #3b9bf5);
	box-shadow: none;
	transform: none;
}
.volet-puce .volet-puce-retirer:active {
	box-shadow: none;
	transform: none;
}

/* LE VOLET, SANS SCRIPT : un bloc ordinaire */
.volet {
	margin: 0 0 1rem;
	border: 1px solid var(--bordure, #ddd);
	border-radius: .5rem;
	background: var(--fond-carte, #fff);
}
.volet-fermer { display: none; }
.volet-entete {
	display: flex;
	align-items: center;
	gap: .5rem;
	padding: .75rem 1rem;
	border-bottom: 1px solid var(--bordure, #ddd);
}
.volet-titre {
	margin: 0 auto 0 0;
	font-size: .95rem;
	text-transform: uppercase;
	letter-spacing: .03em;
	color: var(--texte-discret, #666);
}
.volet-raz {
	display: inline-flex;
	color: var(--couleur-accent, #3b9bf5);
}
.volet-section {
	padding: .9rem 1rem;
	border-bottom: 1px solid var(--bordure, #ddd);
}
.volet-section-titre {
	margin: 0 0 .5rem;
	font-size: .7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--texte-discret, #888);
}
.volet .recherche { display: block; }
.volet .champ-recherche,
.volet .volet-select {
	box-sizing: border-box;
	width: 100%;
	padding: .55rem .6rem;
	border: 1px solid var(--bordure, #ddd);
	border-radius: .3rem;
	background: var(--fond-champ, #fafafa);
	font: inherit;
}
.volet .aide { display: block; margin-top: .35rem; }
.volet-pied {
	display: flex;
	justify-content: flex-end;
	padding: .75rem 1rem;
}
.volet-appliquer {
	padding: .5rem 1.4rem;
	border: 0;
	border-radius: 1.2rem;
	background: var(--couleur-accent, #3b9bf5);
	color: #fff;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

/* LE VOLET, AVEC SCRIPT : un panneau fixe, hors champ tant qu'il est ferme */
.avec-js .volet {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 1001;
	width: min(26rem, 100vw);
	margin: 0;
	border: 0;
	border-radius: 0;
	box-shadow: -4px 0 18px rgba(0, 0, 0, .25);
	transform: translateX(100%);
	visibility: hidden;
	transition: transform .25s ease, visibility 0s linear .25s;
}
.avec-js .volet.ouvert {
	transform: none;
	visibility: visible;
	transition: transform .25s ease, visibility 0s linear 0s;
}
.avec-js .volet-forme {
	display: flex;
	flex-direction: column;
	height: 100%;
}
.avec-js .volet-corps {
	flex: 1;
	overflow-y: auto;
}
.avec-js .volet-pied {
	border-top: 1px solid var(--bordure, #ddd);
	background: var(--fond-carte, #fff);
}
.avec-js .volet-fermer {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	font-size: 1.6rem;
	line-height: 1;
	color: var(--texte-discret, #666);
	cursor: pointer;
}
.avec-js .volet-fermer:hover { background: var(--fond-discret, #eee); }

.volet-fond {
	position: fixed;
	inset: 0;
	z-index: 1000;
	background: rgba(0, 0, 0, .5);
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease, visibility 0s linear .25s;
}
.volet-fond.visible {
	opacity: 1;
	visibility: visible;
	transition: opacity .25s ease, visibility 0s linear 0s;
}
body.volet-ouvert { overflow: hidden; }

/* La legende du selecteur de contre-proposition, avec le bouton a droite */
.echange-selecteur-tete {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .5rem;
}
.echange-selecteur-tete .volet-barre { margin: 0; }

/* ==================================================== LES GRILLES : 3 PAR LIGNE, 5 AVEC L'INTERRUPTEUR
 *
 * Ces regles s'appliquent aux cartes de Ma collection, de Chez les autres et des
 * Echanges (`.cartes`), et aux badges de Mes badges (`.badges-type .grille-badges`).
 * Cette feuille est lue APRES monmixtcg.css : a specificite egale, c'est elle qui l'emporte.
 * Elle remplace le bloc « DEUX CARTES PAR LIGNE » de monmixtcg.css, qui n'a plus d'effet
 * sur ces pages (il reste valable pour `.cartes-tirage`, exclu ici) et peut etre retire
 * quand ce fichier sera rouvert.
 *
 * TELEPHONE (560 px et moins) : TROIS PAR LIGNE
 *
 * Colonnes elastiques (`minmax(0, 1fr)`) : une colonne retrecit sous le contenu de la
 * carte, un nom long ne fait pas deborder la grille. La carte est mise a l'echelle : bord,
 * rayon, marges et textes plus petits. Les deux pastilles de droite (le coeur « Je recherche
 * cette carte » et le cadenas) sont EMPILEES au lieu d'etre cote a cote, pour ne jamais
 * rencontrer la pastille du nombre d'exemplaires, a gauche. Les selecteurs de pastille portent
 * `.cartes` pour passer devant le `right: 48px` que collection.php et autres.php ecrivent
 * dans leur propre <style>.
 *
 * L'INTERRUPTEUR « 5 ITEMS PAR LIGNE » pose la classe `cinq-par-ligne` sur <html>
 * (volet-filtres.js, memorisee dans le navigateur) : cinq colonnes a toutes les largeurs.
 * Sur telephone, l'album et l'edition ne tiennent plus et disparaissent ; le titre reste. */
@media (max-width: 560px) {
	.cartes:not(.cartes-tirage) {
		display: grid;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 8px;
	}
	.cartes:not(.cartes-tirage) > .carte,
	.cartes:not(.cartes-tirage) > .carte-groupe {
		flex: none;
		width: auto;
		max-width: none;
	}
	.cartes:not(.cartes-tirage) > .vide,
	.cartes:not(.cartes-tirage) > .cartes-section-titre {
		grid-column: 1 / -1;
	}

	.cartes:not(.cartes-tirage) .carte {
		border-width: 2px;
		border-radius: var(--r-m, 16px);
	}
	.cartes:not(.cartes-tirage) .carte-corps { padding: 6px 6px 8px; }
	.cartes:not(.cartes-tirage) .carte-nom { font-size: .75em; }
	.cartes:not(.cartes-tirage) .carte-latin { margin-top: 2px; font-size: .62em; }
	.cartes:not(.cartes-tirage) .carte-edition { margin-top: 4px; font-size: 10px; }
	.cartes:not(.cartes-tirage) .carte-exemplaires {
		top: 4px;
		left: 4px;
		max-width: calc(100% - 8px);
		padding: 2px 6px;
		overflow: hidden;
		font-size: 9px;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.cartes:not(.cartes-tirage) .carte-favori {
		top: 4px;
		right: 4px;
		width: 22px;
		height: 22px;
		font-size: 12px;
	}
	.cartes:not(.cartes-tirage) .carte-favori-btn {
		width: 22px;
		height: 22px;
		font-size: 12px;
	}
	.cartes:not(.cartes-tirage) .carte-favori svg { width: 12px; height: 12px; }
	.cartes:not(.cartes-tirage) .carte-souhait { right: 4px; }
	.cartes:not(.cartes-tirage) .carte-souhait + .carte-favori { top: 30px; }

	/* Mes badges : trois par ligne. Le bloc replie perd ses marges laterales pour gagner de la
	 * place ; `.corps` en tete passe devant la marge que badges.php ecrit dans son <style>. */
	.badges-type .grille-badges {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 8px;
	}
	.corps .badges-type .grille-badges { margin: 4px 8px 14px; }
	.badges-type .badge-item {
		padding: 10px 4px;
		border-width: 2px;
		border-radius: 14px;
	}
	.badges-type .badge-image {
		width: 52px;
		height: 52px;
		margin-bottom: 6px;
	}
	.badges-type .badge-defaut { font-size: 22px; }
	.badges-type .badge-nom {
		font-size: 11px;
		line-height: 1.2;
		overflow-wrap: anywhere;
	}
	.badges-type .badge-etoiles { font-size: 11px; letter-spacing: 1px; }
	.badges-type .badge-statut { font-size: 10px; }
}

/* CINQ PAR LIGNE, A TOUTES LES LARGEURS */
html.cinq-par-ligne .cartes:not(.cartes-tirage) {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 12px;
}
html.cinq-par-ligne .cartes:not(.cartes-tirage) > .carte,
html.cinq-par-ligne .cartes:not(.cartes-tirage) > .carte-groupe {
	flex: none;
	width: auto;
	max-width: none;
}
html.cinq-par-ligne .cartes:not(.cartes-tirage) > .vide,
html.cinq-par-ligne .cartes:not(.cartes-tirage) > .cartes-section-titre {
	grid-column: 1 / -1;
}
html.cinq-par-ligne .badges-type .grille-badges {
	grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (max-width: 560px) {
	html.cinq-par-ligne .cartes:not(.cartes-tirage) { gap: 5px; }
	html.cinq-par-ligne .cartes:not(.cartes-tirage) .carte { border-radius: 10px; }
	html.cinq-par-ligne .cartes:not(.cartes-tirage) .carte-corps { padding: 3px 3px 5px; }
	html.cinq-par-ligne .cartes:not(.cartes-tirage) .carte-nom {
		min-height: 2.4em;
		font-size: .56em;
		line-height: 1.2;
	}
	html.cinq-par-ligne .cartes:not(.cartes-tirage) .carte-latin,
	html.cinq-par-ligne .cartes:not(.cartes-tirage) .carte-edition {
		display: none;
	}
	html.cinq-par-ligne .cartes:not(.cartes-tirage) .carte-exemplaires {
		top: 3px;
		left: 3px;
		max-width: calc(100% - 28px);
		padding: 1px 4px;
		font-size: 7px;
	}
	html.cinq-par-ligne .cartes:not(.cartes-tirage) .carte-favori {
		top: 3px;
		right: 3px;
		width: 17px;
		height: 17px;
		font-size: 10px;
	}
	html.cinq-par-ligne .cartes:not(.cartes-tirage) .carte-favori-btn {
		width: 17px;
		height: 17px;
		font-size: 10px;
	}
	html.cinq-par-ligne .cartes:not(.cartes-tirage) .carte-favori svg { width: 10px; height: 10px; }
	html.cinq-par-ligne .cartes:not(.cartes-tirage) .carte-souhait { right: 3px; }
	html.cinq-par-ligne .cartes:not(.cartes-tirage) .carte-souhait + .carte-favori { top: 23px; }

	/* Les editions d'une carte choisie (Echanges) : plus petites, elles restent lisibles. */
	html.cinq-par-ligne .cartes:not(.cartes-tirage) .carte-editions-titre,
	html.cinq-par-ligne .cartes:not(.cartes-tirage) .carte-editions-option { font-size: 8px; }
	html.cinq-par-ligne .cartes:not(.cartes-tirage) .carte-editions-nb {
		padding-left: 0;
		font-size: 7px;
	}

	html.cinq-par-ligne .badges-type .grille-badges { gap: 5px; }
	html.cinq-par-ligne .corps .badges-type .grille-badges { margin: 4px 6px 12px; }
	html.cinq-par-ligne .badges-type .badge-item {
		padding: 6px 2px;
		border-radius: 10px;
	}
	html.cinq-par-ligne .badges-type .badge-image {
		width: 34px;
		height: 34px;
		margin-bottom: 4px;
	}
	html.cinq-par-ligne .badges-type .badge-defaut { font-size: 15px; }
	html.cinq-par-ligne .badges-type .badge-nom { font-size: 8.5px; }
	html.cinq-par-ligne .badges-type .badge-etoiles { font-size: 8px; letter-spacing: 0; }
	html.cinq-par-ligne .badges-type .badge-statut { font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) {
	.avec-js .volet,
	.avec-js .volet.ouvert,
	.volet-fond,
	.volet-fond.visible,
	.volet-interrupteur-piste,
	.volet-interrupteur-bouton { transition: none; }
}
