/**
 * Bandeau de consentement, charte BienveNum.
 *
 * Turquoise #27B8CC, orange #F59B1D, beige #FFF8EC, bleu foncé #093034,
 * Montserrat. Aucun dégradé, la charte l'interdit.
 *
 * Les deux boutons de premier niveau, refuser et accepter, partagent
 * volontairement le même style plein turquoise. C'est une exigence, pas une
 * facilité de code : un refus rendu moins visible qu'une acceptation vicie le
 * consentement recueilli.
 */

.bvnaf-cmp {
	--bvnaf-turquoise: #27B8CC;
	--bvnaf-orange: #F59B1D;
	--bvnaf-beige: #FFF8EC;
	--bvnaf-encre: #093034;

	position: fixed;
	inset: auto 0 0 0;
	z-index: 99999;
	padding: 1.25rem 1rem;
	background: var(--bvnaf-beige);
	border-top: 4px solid var(--bvnaf-turquoise);
	box-shadow: 0 -6px 28px rgba(9, 48, 52, 0.16);
	font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	font-size: 0.9375rem;
	line-height: 1.6;
	color: var(--bvnaf-encre);
}

.bvnaf-cmp__box {
	max-width: 68rem;
	margin: 0 auto;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1.25rem;
}

.bvnaf-cmp__text {
	flex: 1 1 24rem;
	margin: 0;
}

.bvnaf-cmp__text a {
	color: var(--bvnaf-encre);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.bvnaf-cmp__text a:hover {
	color: var(--bvnaf-turquoise);
}

.bvnaf-cmp__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.625rem;
}

.bvnaf-cmp__btn {
	flex: 0 0 auto;
	min-width: 10rem;
	padding: 0.6875rem 1.5rem;
	border: 2px solid var(--bvnaf-turquoise);
	border-radius: 50px;
	background: var(--bvnaf-turquoise);
	color: #ffffff;
	font-family: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 150ms ease, color 150ms ease;
}

.bvnaf-cmp__btn:hover {
	background: #1fa3b5;
	border-color: #1fa3b5;
}

.bvnaf-cmp__btn:focus-visible {
	outline: 3px solid var(--bvnaf-orange);
	outline-offset: 2px;
}

/* Réservé aux actions secondaires, jamais au refus. */
.bvnaf-cmp__btn--ghost {
	background: transparent;
	color: var(--bvnaf-encre);
	border-color: var(--bvnaf-encre);
	min-width: auto;
}

.bvnaf-cmp__btn--ghost:hover {
	background: var(--bvnaf-encre);
	border-color: var(--bvnaf-encre);
	color: #ffffff;
}

.bvnaf-cmp__panel {
	flex: 1 1 100%;
	gap: 0.625rem;
	padding-top: 1rem;
	margin-top: 0.25rem;
	border-top: 1px solid rgba(9, 48, 52, 0.15);
}

/* Le panel de details (4 cases + Enregistrer) reste masque tant que
   le JS n a pas retire l attribut hidden au clic sur Choisir. Regle
   necessaire : un selecteur de classe (.bvnaf-cmp__panel) a une
   specificite superieure a l attribut [hidden] et l ecrasait sinon. */
.bvnaf-cmp__panel:not([hidden]) {
	display: grid;
}

.bvnaf-cmp__panel label {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	cursor: pointer;
}

.bvnaf-cmp__panel input[type="checkbox"] {
	width: 1.125rem;
	height: 1.125rem;
	accent-color: var(--bvnaf-turquoise);
	cursor: pointer;
}

.bvnaf-cmp__panel input[disabled] {
	cursor: default;
	opacity: 0.6;
}

.bvnaf-cmp__panel .bvnaf-cmp__btn {
	justify-self: start;
	margin-top: 0.5rem;
	background: var(--bvnaf-orange);
	border-color: var(--bvnaf-orange);
}

.bvnaf-cmp__panel .bvnaf-cmp__btn:hover {
	background: #dd8a15;
	border-color: #dd8a15;
}

.bvnaf-consent-reopen {
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	color: inherit;
	text-decoration: underline;
	cursor: pointer;
}

@media (max-width: 48rem) {
	.bvnaf-cmp__actions {
		width: 100%;
	}

	.bvnaf-cmp__btn {
		flex: 1 1 auto;
		min-width: 0;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.bvnaf-cmp {
		animation: bvnaf-cmp-in 220ms ease-out;
	}

	@keyframes bvnaf-cmp-in {
		from { transform: translateY(100%); }
		to { transform: translateY(0); }
	}
}

/**
 * Lien permanent de gestion des cookies, posé en pied de page par le
 * service de consentement. Discret mais toujours atteignable : c'est lui
 * qui rend le consentement révocable à tout moment.
 */
.bvnaf-consent-footer {
	padding: 12px 16px 20px;
	text-align: center;
}

.bvnaf-consent-reopen {
	background: none;
	border: 0;
	padding: 4px 8px;
	font: inherit;
	font-size: 14px;
	color: inherit;
	opacity: .85;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

.bvnaf-consent-reopen:hover,
.bvnaf-consent-reopen:focus-visible {
	opacity: 1;
}

/* Le lien doit rester atteignable au doigt : 44px est le repère
   d'accessibilité pour une cible tactile. */
@media (pointer: coarse) {
	.bvnaf-consent-reopen {
		padding: 10px 12px;
	}
}
