/* ==========================================================================
 * Menu du bas (telephone), pastilles de notification, avatar du bandeau.
 *
 * Feuille a part, comme volet-filtres.css et booster.css : monmixtcg.css n'est
 * pas touche.
 *
 * LA REGLE `button` DU SITE (pleine largeur, degrade violet) n'est jamais
 * appliquee ici : la barre n'utilise que des <a> et des <summary>.
 *
 * Z-INDEX : 900. Le volet de filtres est a 1000 (fond) et 1001 (panneau), donc
 * il recouvre la barre quand il est ouvert.
 * ========================================================================== */

:root {
	--barre-fond: #ffffff;
	--barre-bord: #e4e0f3;
	--barre-texte: #6b6880;
	--barre-actif: #6d28d9;
	--pastille-fond: #e11d48;
}

/* ---------- La pastille rouge ------------------------------------------- */

.pastille-notif {
	position: absolute;
	top: -5px;
	right: -9px;
	min-width: 17px;
	height: 17px;
	padding: 0 4px;
	box-sizing: border-box;
	border-radius: 9px;
	background: var(--pastille-fond);
	color: #fff;
	font-size: 10.5px;
	font-weight: 700;
	line-height: 17px;
	text-align: center;
	box-shadow: 0 0 0 2px var(--barre-fond);
	pointer-events: none;
}

/* Sans nombre : un simple point (booster). */
.pastille-notif.pastille-point {
	min-width: 0;
	width: 12px;
	height: 12px;
	padding: 0;
	top: -3px;
	right: -5px;
}

/* Dans le menu de bureau : a cote du libelle. */
.pastille-notif.pastille-inline {
	position: static;
	display: inline-block;
	margin-left: 6px;
	vertical-align: middle;
	box-shadow: none;
}

.pastille-notif.pastille-inline.pastille-point {
	width: 9px;
	height: 9px;
	margin-left: 5px;
}

/* ---------- L'avatar du bandeau ----------------------------------------- */

.bandeau-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	flex: 0 0 auto;
	border-radius: 50%;
	overflow: hidden;
	box-shadow: 0 0 0 2px rgba(255, 255, 255, .55);
	transition: box-shadow .15s ease;
}

.bandeau-avatar:hover,
.bandeau-avatar:focus-visible {
	box-shadow: 0 0 0 3px #fff;
}

.bandeau-avatar svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* ---------- La barre du bas -------------------------------------------- */

.barre-bas {
	display: none;
}

@media (max-width: 640px) {

	/* Le menu public passe dans la barre ; le texte de bienvenue fait place
	 * a l'avatar. */
	.menu.menu-public,
	.bandeau .bienvenue {
		display: none;
	}

	/* Ne pas laisser la barre cacher le bas de la page. */
	body.avec-barre-bas .page {
		padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
	}

	.barre-bas {
		display: grid;
		grid-template-columns: repeat(5, minmax(0, 1fr));
		align-items: end;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 900;
		box-sizing: border-box;
		padding: 6px 2px calc(6px + env(safe-area-inset-bottom, 0px));
		background: var(--barre-fond);
		border-top: 1px solid var(--barre-bord);
		box-shadow: 0 -4px 18px rgba(80, 50, 150, .10);
	}

	/* Une entree : <a> ou <summary>, jamais <button>. */
	.barre-lien {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: flex-end;
		gap: 3px;
		min-width: 0;
		padding: 4px 1px 2px;
		margin: 0;
		border: 0;
		border-radius: 10px;
		background: none;
		box-shadow: none;
		transform: none;
		color: var(--barre-texte);
		text-decoration: none;
		cursor: pointer;
		list-style: none;
		-webkit-tap-highlight-color: transparent;
	}

	.barre-lien::-webkit-details-marker {
		display: none;
	}

	.barre-lien:hover {
		transform: none;
		background: none;
	}

	.barre-lien:focus-visible {
		outline: 2px solid var(--barre-actif);
		outline-offset: 1px;
	}

	/* Le libelle suit la largeur de l'ecran : 9,5 px sur 320 px, 12 px au plus. */
	.barre-libelle {
		display: block;
		max-width: 100%;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		font-size: clamp(9.5px, 2.8vw, 12px);
		font-weight: 600;
		line-height: 1.15;
		letter-spacing: -.01em;
	}

	.barre-icone {
		position: relative;
		display: inline-flex;
		width: 28px;
		height: 28px;
		align-items: center;
		justify-content: center;
	}

	.barre-icone svg {
		width: 26px;
		height: 26px;
		fill: none;
		stroke: currentColor;
		stroke-width: 1.8;
		stroke-linecap: round;
		stroke-linejoin: round;
	}

	.barre-actif .barre-lien,
	.barre-lien.barre-actif,
	details.barre-deroulant[open] > .barre-lien {
		color: var(--barre-actif);
	}

	.barre-actif .barre-libelle,
	.barre-lien.barre-actif .barre-libelle {
		font-weight: 800;
	}

	/* --- Booster : au centre, en relief, l'element le plus visible --- */

	.barre-booster {
		position: relative;
	}

	.barre-booster .barre-lien {
		margin-top: -22px;
		color: var(--barre-actif);
	}

	.barre-booster .barre-icone {
		width: 54px;
		height: 54px;
		border-radius: 18px;
		background: linear-gradient(145deg, #a78bfa 0%, #7c3aed 55%, #5b21b6 100%);
		color: #fff;
		box-shadow: 0 0 0 4px var(--barre-fond),
			0 8px 16px rgba(91, 33, 182, .38);
		transition: transform .12s ease;
	}

	.barre-booster .barre-lien:active .barre-icone {
		transform: scale(.94);
	}

	.barre-booster .barre-icone svg {
		width: 40px;
		height: 40px;
		stroke: #fff;
		stroke-width: 1.6;
	}

	.barre-booster .barre-libelle {
		font-weight: 800;
	}

	.barre-booster .pastille-notif {
		top: -5px;
		right: -5px;
		box-shadow: 0 0 0 3px var(--barre-fond);
	}

	/* --- Collections : sous-menu a deux entrees ---
	 *
	 * <details> : il s'ouvre sans script. Le panneau est positionne par rapport a
	 * la barre (fixe), pas par rapport a l'entree. */

	details.barre-deroulant {
		position: static;
	}

	.barre-sous {
		position: absolute;
		left: 8px;
		bottom: calc(100% + 10px);
		display: flex;
		gap: 4px;
		padding: 8px;
		border-radius: 18px;
		background: var(--barre-fond);
		border: 1px solid var(--barre-bord);
		box-shadow: 0 10px 28px rgba(60, 30, 120, .22);
	}

	/* La petite pointe vers l'entree Collections. */
	.barre-sous::after {
		content: "";
		position: absolute;
		left: calc(10vw - 14px);
		bottom: -7px;
		width: 12px;
		height: 12px;
		background: var(--barre-fond);
		border-right: 1px solid var(--barre-bord);
		border-bottom: 1px solid var(--barre-bord);
		transform: rotate(45deg);
	}

	.barre-sous a {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 5px;
		width: 74px;
		padding: 10px 4px 8px;
		border-radius: 12px;
		color: var(--barre-actif);
		text-decoration: none;
		font-size: 12.5px;
		font-weight: 700;
		background: #f3effd;
	}

	.barre-sous a:active,
	.barre-sous a:focus-visible {
		background: #e6dcfc;
	}

	/* Echanges : deux entrees, comme Collections, la pointe sous la 2e colonne. */
	.barre-sous-2::after {
		left: calc(30vw - 14px);
	}

	/* Sur echanges.php, le sous-menu d'« Echanges » remplace la barre d'onglets de
	 * la page (« Proposer un echange » / « Echanges en cours »). Les panneaux et
	 * leur titre restent : c'est l'ancre du lien qui choisit le panneau. */
	body.barre-page-echanges .onglets {
		display: none !important;
	}

	/* Amis : quatre entrees, en grille de deux, ancrees a droite sous « Amis »
	 * (4e colonne : son centre est a 30 % du bord droit). */
	.barre-sous.barre-sous-4 {
		left: auto;
		right: 8px;
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.barre-sous-4::after {
		left: auto;
		right: calc(30vw - 14px);
	}

	.barre-sous-4 a {
		width: auto;
		min-width: 108px;
		box-sizing: border-box;
		text-align: center;
		line-height: 1.2;
	}

	.barre-sous-icone {
		position: relative;
		display: inline-flex;
	}

	.barre-sous-icone .pastille-notif {
		top: -4px;
		right: -8px;
		box-shadow: 0 0 0 2px #f3effd;
	}

	.barre-sous svg {
		width: 30px;
		height: 30px;
		fill: none;
		stroke: currentColor;
		stroke-width: 1.7;
		stroke-linecap: round;
		stroke-linejoin: round;
	}
}

/* Texte pour lecteur d'ecran dans la barre et le menu : meme regle que
 * .visuellement-cache de monmixtcg.css, rappelee ici pour ne pas en dependre. */
.barre-bas .visuellement-cache,
.menu-public .visuellement-cache {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
