/*
 * Recherche dans la FAQ — un champ de recherche au-dessus des questions
 * (assets/js/recherche-faq.js).
 *
 * Même largeur et même fond que les blocs FAQ : posé juste au-dessus de l'un
 * d'eux, il en devient l'en-tête.
 */

.kahel-faq-recherche-section {
	padding-top: var(--wp--custom--home--faq-padding-y);
	padding-bottom: var(--wp--custom--home--faq-padding-y);
}

/* Sans FAQ sur la page, le bloc n'a rien à chercher. */
.kahel-faq-recherche-section.is-sans-faq {
	display: none;
}

/* Collé à la FAQ qui le suit : un seul ensemble, un écart court entre le champ et les questions. */
.kahel-faq-recherche-section:has(+ :is(.kahel-faq-liste-section, .kahel-home-faq-section)) {
	padding-bottom: 0;
}

.kahel-faq-recherche-section + :is(.kahel-faq-liste-section, .kahel-home-faq-section) {
	padding-top: clamp(20px, 2.5vw, 32px);
}

/* La FAQ qui suit est masquée par la recherche : le bloc retrouve sa marge du bas. */
.kahel-faq-recherche-section:has(+ .kahel-faq-bloc-masque) {
	padding-bottom: var(--wp--custom--home--faq-padding-y);
}

/* La largeur du bloc « FAQ (une colonne) » : normale, ou toute la grille. */
.kahel-faq-recherche-section.is-layout-constrained > .kahel-faq-recherche {
	width: 100%;
	max-width: 860px;
	margin-inline: auto;
}

.kahel-faq-recherche-section.is-large.is-layout-constrained > .kahel-faq-recherche {
	max-width: var(--wp--style--global--wide-size);
}

.kahel-faq-recherche-form {
	margin: 0;
}

.kahel-faq-recherche-libelle {
	display: block;
	margin: 0 0 12px;
	color: var(--wp--preset--color--orange-deep);
	font-size: var(--wp--preset--font-size--caption);
	font-weight: var(--wp--custom--weight--strong);
	letter-spacing: var(--wp--custom--letter-spacing--kicker);
	text-transform: uppercase;
}

/* Intitulé vide : il reste lu par les lecteurs d'écran. */
.kahel-faq-recherche-libelle.is-masque {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.kahel-faq-recherche-champ {
	position: relative;
	display: flex;
	align-items: center;
}

.kahel-faq-recherche-loupe {
	position: absolute;
	left: 22px;
	color: var(--wp--preset--color--orange);
	pointer-events: none;
	transition: transform 420ms var(--wp--custom--motion--ease-spring);
}

.kahel-faq-recherche-champ:focus-within .kahel-faq-recherche-loupe {
	transform: scale(1.12) rotate(-8deg);
}

.kahel-faq-recherche-champ input {
	box-sizing: border-box;
	width: 100%;
	min-height: 62px;
	margin: 0;
	padding: 0 64px 0 58px;
	border: 1.5px solid var(--wp--preset--color--line-strong);
	border-radius: var(--wp--custom--radius--pill);
	background: #fff;
	box-shadow: 0 16px 36px -26px rgba(88, 46, 18, 0.4);
	color: var(--wp--preset--color--ink);
	font-family: inherit;
	font-size: 1.08rem;
	font-weight: 600;
	-webkit-appearance: none;
	appearance: none;
	transition:
		border-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);
}

.kahel-faq-recherche-champ input::placeholder {
	color: var(--wp--preset--color--muted);
	font-weight: 500;
	opacity: 0.85;
}

.kahel-faq-recherche-champ input:hover {
	border-color: var(--wp--preset--color--orange);
}

.kahel-faq-recherche-champ input:focus {
	border-color: var(--wp--preset--color--orange);
	outline: none;
	box-shadow:
		0 0 0 4px rgba(244, 122, 31, 0.18),
		0 16px 36px -26px rgba(88, 46, 18, 0.4);
}

/* La croix du navigateur laisse la place à la nôtre. */
.kahel-faq-recherche-champ input::-webkit-search-cancel-button,
.kahel-faq-recherche-champ input::-webkit-search-decoration {
	-webkit-appearance: none;
	appearance: none;
}

.kahel-faq-recherche-effacer {
	position: absolute;
	right: 11px;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--wp--preset--color--cream);
	color: var(--wp--preset--color--ink);
	cursor: pointer;
	transition:
		background-color var(--wp--custom--motion--duration-fast) var(--wp--custom--motion--ease),
		transform 420ms var(--wp--custom--motion--ease-spring);
}

.kahel-faq-recherche-effacer[hidden] {
	display: none;
}

.kahel-faq-recherche-effacer:is(:hover, :focus-visible) {
	background: var(--wp--preset--color--orange);
	transform: rotate(90deg);
}

.kahel-faq-recherche-effacer:focus-visible {
	outline: 2px solid var(--wp--preset--color--orange-deep);
	outline-offset: 2px;
}

.kahel-faq-recherche-statut {
	margin: 14px 0 0 6px;
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
}

.kahel-faq-recherche-statut:empty {
	margin: 0;
}

.kahel-faq-recherche-vide {
	margin: 6px 0 0 6px;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 800;
}

.kahel-faq-recherche-vide[hidden] {
	display: none;
}

.kahel-faq-recherche-vide a {
	color: var(--wp--preset--color--orange-deep);
	text-decoration: none;
}

.kahel-faq-recherche-vide a:is(:hover, :focus-visible) {
	text-decoration: underline;
	text-underline-offset: 0.22em;
}

/* Dans les FAQ de la page : les questions écartées, et les mots trouvés. */
.kahel-faq-masquee,
.kahel-faq-bloc-masque {
	display: none !important;
}

.kahel-home-faq-item mark.kahel-faq-trouve {
	padding: 0 0.08em;
	border-radius: 4px;
	background: rgba(244, 122, 31, 0.22);
	color: inherit;
}

@media (max-width: 600px) {
	.kahel-faq-recherche-champ input {
		min-height: 56px;
		padding-left: 50px;
		font-size: 1rem;
	}

	.kahel-faq-recherche-loupe {
		left: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.kahel-faq-recherche-loupe,
	.kahel-faq-recherche-effacer {
		transition: none;
	}
}
