/*
 * Le bandeau cookies (inc/cookies.php, assets/js/cookies.js).
 *
 * Une petite carte en bas à gauche, qui ne couvre rien d'important et ne
 * bloque pas la lecture. « Accepter » est le bouton plein ; « Refuser » est
 * plus discret mais garde la même taille, sur la même ligne : refuser reste
 * aussi simple qu'accepter.
 */

.kahel-cookies {
	position: fixed;
	bottom: 20px;
	left: 20px;
	z-index: 60;
	box-sizing: border-box;
	width: min(372px, calc(100vw - 40px));
	padding: 18px 20px 16px;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--radius--lg);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	box-shadow: var(--wp--preset--shadow--card);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
}

.kahel-cookies[hidden] {
	display: none;
}

.kahel-cookies:focus {
	outline: none;
}

.kahel-cookies:focus-visible {
	outline: 2px solid var(--wp--preset--color--orange);
	outline-offset: 3px;
}

.kahel-cookies-tete {
	display: flex;
	align-items: center;
	gap: 10px;
}

.kahel-cookies-picto {
	display: grid;
	flex: 0 0 auto;
	place-items: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--wp--preset--color--cream);
	color: var(--wp--preset--color--orange);
	rotate: -14deg;
}

.kahel-cookies-picto .kahel-picto {
	width: 18px;
	height: 18px;
}

.kahel-cookies .kahel-cookies-titre {
	margin: 0;
	font-size: 1rem;
	font-weight: var(--wp--custom--weight--heading);
	letter-spacing: -0.02em;
	line-height: 1.25;
}

.kahel-cookies .kahel-cookies-texte,
.kahel-cookies .kahel-cookies-etat {
	margin: 10px 0 0;
	color: var(--wp--preset--color--muted);
}

.kahel-cookies .kahel-cookies-etat {
	color: var(--wp--preset--color--ink);
	font-weight: 700;
}

.kahel-cookies-pied {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px 16px;
	margin-top: 14px;
}

.kahel-cookies-lien:is(:link, :visited) {
	color: var(--wp--preset--color--muted);
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--line-strong);
	text-underline-offset: 3px;
	transition: color var(--wp--custom--motion--duration-fast) var(--wp--custom--motion--ease);
}

.kahel-cookies-lien:is(:hover, :focus-visible) {
	color: var(--wp--preset--color--orange-deep);
	text-decoration-color: currentColor;
}

.kahel-cookies-actions {
	display: flex;
	gap: 8px;
	margin-left: auto;
}

.kahel-cookies-bouton {
	min-height: 38px;
	padding: 0 16px;
	border: 1.5px solid transparent;
	border-radius: var(--wp--custom--radius--md);
	background: transparent;
	font: inherit;
	font-weight: 800;
	line-height: 1;
	cursor: pointer;
	transition:
		background-color var(--wp--custom--motion--duration-fast) var(--wp--custom--motion--ease),
		color var(--wp--custom--motion--duration-fast) var(--wp--custom--motion--ease),
		box-shadow var(--wp--custom--motion--duration-fast) var(--wp--custom--motion--ease),
		translate var(--wp--custom--motion--duration-fast) var(--wp--custom--motion--ease);
}

/* « Accepter » : le bouton plein du site. */
.kahel-cookies-bouton.is-principal {
	padding: 0 20px;
	border-color: var(--wp--preset--color--orange);
	background: var(--wp--preset--color--orange);
	color: var(--wp--preset--color--ink);
	box-shadow: var(--wp--preset--shadow--button);
}

.kahel-cookies-bouton.is-principal:hover {
	border-color: var(--wp--preset--color--orange-deep);
	background: var(--wp--preset--color--orange-deep);
	color: var(--wp--preset--color--cream);
	translate: 0 -1px;
}

/* « Refuser » : sans fond ni bordure, mais lisible et de même taille. */
.kahel-cookies-bouton.is-discret {
	padding: 0 10px;
	color: var(--wp--preset--color--muted);
	font-weight: 700;
}

.kahel-cookies-bouton.is-discret:hover {
	background: var(--wp--preset--color--cream);
	color: var(--wp--preset--color--ink);
}

.kahel-cookies-bouton:active {
	translate: 0 1px;
}

.kahel-cookies-bouton:focus-visible {
	outline: 2px solid var(--wp--preset--color--orange);
	outline-offset: 2px;
}

/* L'entrée : la carte monte doucement, puis la patte fait un petit bond. */
.kahel-motion .kahel-cookies {
	opacity: 0;
	translate: 0 18px;
	scale: 0.98;
	transition:
		opacity 420ms var(--wp--custom--motion--ease),
		translate 720ms var(--wp--custom--motion--ease),
		scale 720ms var(--wp--custom--motion--ease);
}

.kahel-motion .kahel-cookies.is-visible {
	opacity: 1;
	translate: 0 0;
	scale: 1;
}

.kahel-motion .kahel-cookies.is-visible .kahel-cookies-picto {
	animation: kahel-cookies-bond 700ms var(--wp--custom--motion--ease-spring) 220ms both;
}

@keyframes kahel-cookies-bond {
	from {
		scale: 0.4;
		rotate: -50deg;
		opacity: 0;
	}

	to {
		scale: 1;
		rotate: -14deg;
		opacity: 1;
	}
}

@media (max-width: 600px) {
	.kahel-cookies {
		right: 12px;
		bottom: 12px;
		left: 12px;
		width: auto;
		padding: 16px 16px 14px;
	}
}

@media print {
	.kahel-cookies {
		display: none !important;
	}
}
