/*
 * Bannière de consentement et panneau de choix (wl-consent).
 * Carte claire, lisible sur les sections nuit comme claires. Refus par le lien
 * « Continuer sans accepter » en haut à droite (forme admise par la CNIL) ;
 * dans le panneau, « Tout refuser » reste un bouton.
 */

.wl-consent {
	position: fixed;
	z-index: 1000;
	right: 1rem;
	bottom: 1rem;
	left: 1rem;
	box-sizing: border-box;
	max-width: 34rem;
	padding: 1.25rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--medium);
	background: var(--wp--preset--color--base);
	box-shadow: var(--wp--custom--shadow--medium);
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
	animation: wl-consent-in 240ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.wl-consent[hidden] {
	display: none;
}

@keyframes wl-consent-in {
	from {
		opacity: 0;
		translate: 0 1rem;
	}
}

@media (min-width: 48rem) {
	.wl-consent {
		right: auto;
		bottom: 1.5rem;
		left: 1.5rem;
	}
}

.wl-consent :where(p) {
	margin: 0;
}

.wl-consent__title,
.wl-consent-panel__title {
	font-size: var(--wp--preset--font-size--base);
	font-weight: 700;
}

/* Titre et lien de refus sur une ligne ; le lien passe dessous si la place manque. */
.wl-consent__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.25rem 1rem;
}

.wl-consent__refuse {
	min-height: 2.75rem;
	margin: -0.75rem -0.5rem -0.75rem auto;
	padding: 0 0.5rem;
	border: 0;
	background: none;
	color: var(--wp--preset--color--contrast);
	font: inherit;
	font-weight: 500;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
	cursor: pointer;
}

.wl-consent__refuse:hover {
	text-decoration-thickness: 2px;
}

.wl-consent__text {
	margin-top: 0.375rem !important;
	color: var(--wp--preset--color--muted);
}

.wl-consent a,
.wl-consent-panel a {
	color: var(--wp--preset--color--accent);
}

/* Boutons : côte à côte, à la ligne si la place manque (le dernier prend toute la largeur). */
.wl-consent__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 1rem;
}

.wl-consent__btn {
	flex: 1 1 9rem;
	min-height: 2.75rem;
	padding: 0.625em 1em;
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--gradient--marque-fonce);
	color: var(--wp--preset--color--accent-contrast);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: box-shadow var(--wp--custom--transition);
}

.wl-consent__btn:hover {
	box-shadow: var(--wp--custom--shadow--medium);
}

.wl-consent__btn--ghost {
	border: 1.5px solid var(--wp--preset--color--border-strong);
	background: transparent;
	color: var(--wp--preset--color--contrast);
}

.wl-consent__btn--ghost:hover {
	border-color: var(--wp--preset--color--contrast);
	background: var(--wp--preset--color--surface);
	box-shadow: none;
}

/* Panneau de choix : boîte de dialogue modale native (focus piégé, Échap). */
.wl-consent-panel {
	box-sizing: border-box;
	width: min(36rem, calc(100% - 2rem));
	max-height: calc(100dvh - 2rem);
	padding: 1.5rem;
	border: 0;
	border-radius: var(--wp--custom--radius--large);
	background: var(--wp--preset--color--base);
	box-shadow: var(--wp--custom--shadow--medium);
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
}

.wl-consent-panel::backdrop {
	background: rgb(5 6 15 / 0.6);
}

.wl-consent-panel p {
	margin: 0;
}

.wl-consent-panel__form > * + * {
	margin-top: 1rem !important;
}

.wl-consent-panel__item {
	padding: 1rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--medium);
}

.wl-consent-panel__item p {
	margin-top: 0.25rem;
	color: var(--wp--preset--color--muted);
}

.wl-consent-panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.wl-consent-panel__name {
	margin: 0;
	font-weight: 600;
	color: var(--wp--preset--color--contrast) !important;
}

.wl-consent-panel__always {
	color: var(--wp--preset--color--accent);
	font-size: 0.8125rem;
	font-weight: 600;
}

/* Interrupteur : case native restylée, pastille animée par translate. */
.wl-consent-panel__switch {
	position: relative;
	flex: none;
	width: 2.75rem;
	height: 1.5rem;
	margin: 0;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--border-strong);
	cursor: pointer;
	appearance: none;
	transition: background-color var(--wp--custom--transition);
}

.wl-consent-panel__switch::before {
	content: "";
	position: absolute;
	top: 0.1875rem;
	left: 0.1875rem;
	width: 1.125rem;
	height: 1.125rem;
	border-radius: 50%;
	background: var(--wp--preset--color--base);
	transition: translate var(--wp--custom--transition);
}

.wl-consent-panel__switch:checked {
	background: var(--wp--preset--color--accent);
}

.wl-consent-panel__switch:checked::before {
	translate: 1.25rem 0;
}

.wl-consent-panel__id {
	font-size: 0.8125rem;
	color: var(--wp--preset--color--muted);
	overflow-wrap: anywhere;
}

.wl-consent-panel__id span {
	font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
	.wl-consent,
	.wl-consent-panel__switch,
	.wl-consent-panel__switch::before {
		animation: none;
		transition: none;
	}
}
