/**
 * Hero « titre page » (acf/hero-titre-page) — version dense :
 *   ┌───────────────────────────────────────────┐
 *   │ Inicio › Los restaurantes      • 125 ...  │
 *   │  Encuentra rápidamente un [restaurante]…  │
 *   │  ✓ Sin comisiones  ✓ < 24h  ✓ Calidad     │
 *   └───────────────────────────────────────────┘
 *
 * Variables locales pour faciliter la maintenance / la déclinaison hôtel-circuit.
 */

.kl-hero-titre-page {
	--khtp-radius: 14px;
	--khtp-border: rgba(41, 44, 61, 0.1);
	--khtp-shadow: 0 1px 2px rgba(41, 44, 61, 0.05);
	--khtp-bg-from: #ffffff;
	--khtp-bg-to: #fafafb;
	--khtp-accent: var(--highlight-color, #e2081d);
	--khtp-text-muted: rgba(41, 44, 61, 0.65);
	position: relative;
	z-index: 1;
}

/* Section : un peu d’air au-dessus (la breadcrumb globale est masquée), aucune
 * marge sous la card pour que la barre filtres se colle dessous. */
.kl-section-hero-titre-page {
	position: relative;
	padding-top: 1.1rem;
	padding-bottom: 0;
	margin-bottom: 0;
}

@media (min-width: 992px) {
	.kl-section-hero-titre-page {
		padding-top: 1.5rem;
	}
}

/* Cacher la breadcrumb « globale » du thème quand notre hero la prend en charge */
.kl-breadcrumb:has(+ .kl-content-main .kl-section-hero-titre-page),
.kl-breadcrumb:has(+ .kl-linsting-cpt--loader + .kl-content-main .kl-section-hero-titre-page) {
	display: none;
}

/* Carte hero : surface unifiée breadcrumb + titre + value-props */
.kl-section-hero-titre-page .kl-hero-titre-page__surface {
	position: relative;
	overflow: hidden;
	border-radius: var(--khtp-radius);
	padding: 0.85rem 1rem 0.95rem;
	background: linear-gradient(160deg, var(--khtp-bg-from) 0%, var(--khtp-bg-to) 100%);
	border: 1px solid var(--khtp-border);
	box-shadow: var(--khtp-shadow);
}

@media (min-width: 768px) {
	.kl-section-hero-titre-page .kl-hero-titre-page__surface {
		padding: 1rem 1.4rem 1.1rem;
	}
}

@media (min-width: 992px) {
	.kl-section-hero-titre-page .kl-hero-titre-page__surface {
		padding: 1.1rem 1.6rem 1.2rem 1.7rem;
	}
}

/* Décor : pastille floutée alignée avec la couleur de marque, anti-vide */
.kl-section-hero-titre-page .kl-hero-titre-page__deco {
	position: absolute;
	top: -45%;
	right: -8%;
	width: min(38vw, 360px);
	height: min(38vw, 360px);
	pointer-events: none;
	border-radius: 50%;
	background: radial-gradient(
		closest-side,
		var(--khtp-accent) 0%,
		transparent 72%
	);
	opacity: 0.07;
}

@supports (color: color-mix(in srgb, #e2081d 40%, transparent)) {
	.kl-section-hero-titre-page .kl-hero-titre-page__deco {
		background: radial-gradient(
			closest-side,
			color-mix(in srgb, var(--khtp-accent) 70%, transparent) 0%,
			transparent 72%
		);
		opacity: 0.18;
	}
}

/* Topbar : breadcrumb à gauche, compteur à droite */
.kl-section-hero-titre-page .kl-hero-titre-page__topbar {
	position: relative;
	z-index: 2;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1rem;
	justify-content: space-between;
	padding-bottom: 0.6rem;
	border-bottom: 1px solid rgba(41, 44, 61, 0.08);
	margin-bottom: 0.7rem;
}

@media (min-width: 992px) {
	.kl-section-hero-titre-page .kl-hero-titre-page__topbar {
		padding-bottom: 0.7rem;
		margin-bottom: 0.85rem;
	}
}

/* Breadcrumb intégré (sortie Rank Math : <p><a>…</a><span class="separator">›</span>…</p>) */
.kl-section-hero-titre-page .kl-hero-titre-page__crumbs {
	font-size: 0.82rem;
	font-weight: 500;
	color: var(--khtp-text-muted);
	line-height: 1.3;
	min-width: 0;
}

.kl-section-hero-titre-page .kl-hero-titre-page__crumbs p,
.kl-section-hero-titre-page .kl-hero-titre-page__crumbs ul {
	margin: 0;
	padding: 0;
	list-style: none;
	display: inline;
}

.kl-section-hero-titre-page .kl-hero-titre-page__crumbs a {
	color: var(--khtp-text-muted);
	text-decoration: none;
	transition: color 0.15s ease;
}

.kl-section-hero-titre-page .kl-hero-titre-page__crumbs a:hover {
	color: var(--khtp-accent);
}

.kl-section-hero-titre-page .kl-hero-titre-page__crumbs .separator {
	display: inline-block;
	margin: 0 0.35em;
	color: rgba(41, 44, 61, 0.35);
}

.kl-section-hero-titre-page .kl-hero-titre-page__crumbs .last,
.kl-section-hero-titre-page .kl-hero-titre-page__crumbs li:last-child {
	color: #292c3d;
	font-weight: 600;
}

/* Compteur établissements */
.kl-section-hero-titre-page .kl-hero-titre-page__count {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	font-size: 0.82rem;
	color: #292c3d;
	background: rgba(41, 44, 61, 0.05);
	padding: 0.3rem 0.75rem;
	border-radius: 999px;
	white-space: nowrap;
	font-weight: 500;
	letter-spacing: 0.01em;
	flex-shrink: 0;
	min-width: max-content;
}

.kl-section-hero-titre-page .kl-hero-titre-page__count > * {
	white-space: nowrap;
	display: inline-block;
}

.kl-section-hero-titre-page .kl-hero-titre-page__count strong {
	font-weight: 700;
	font-size: 0.92rem;
}

.kl-section-hero-titre-page .kl-hero-titre-page__count-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--khtp-accent);
	box-shadow: 0 0 0 3px rgba(226, 8, 29, 0.18);
	animation: khtp-pulse 2.4s ease-out infinite;
	flex-shrink: 0;
}

@supports (color: color-mix(in srgb, #e2081d 40%, transparent)) {
	.kl-section-hero-titre-page .kl-hero-titre-page__count-dot {
		box-shadow: 0 0 0 3px color-mix(in srgb, var(--khtp-accent) 22%, transparent);
	}
}

@keyframes khtp-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
	.kl-section-hero-titre-page .kl-hero-titre-page__count-dot {
		animation: none;
	}
}

/* Bloc principal : titre */
.kl-section-hero-titre-page .kl-hero-titre-page__main {
	position: relative;
	z-index: 2;
	text-align: center;
}

.kl-section-hero-titre-page .kl-hero-titre-page__title {
	margin: 0 !important;
	font-weight: 600 !important;
	letter-spacing: -0.02em;
	line-height: 1.18;
	font-size: clamp(1.3rem, 2.4vw + 0.5rem, 2rem);
}

@media (min-width: 992px) {
	.kl-section-hero-titre-page .kl-hero-titre-page__title {
		line-height: 1.2;
		font-size: clamp(1.5rem, 1vw + 1.1rem, 2.05rem);
	}
}

.kl-section-hero-titre-page .kl-hero-titre-page__title .kl-color-principal,
.kl-section-hero-titre-page .kl-hero-titre-page__title .kl-color-primaire {
	display: inline-block;
	padding: 0.06em 0.32em 0.1em;
	border-radius: 0.25em;
	font-weight: 700;
	color: var(--khtp-accent);
	background: rgba(41, 44, 61, 0.05);
	vertical-align: baseline;
}

@supports (color: color-mix(in srgb, #e2081d 40%, transparent)) {
	.kl-section-hero-titre-page .kl-hero-titre-page__title .kl-color-principal,
	.kl-section-hero-titre-page .kl-hero-titre-page__title .kl-color-primaire {
		background: color-mix(in srgb, var(--khtp-accent) 12%, transparent);
	}
}

/* Value props : 3 pastilles texte + icône, en ligne sur desktop, scrollables sur mobile */
.kl-section-hero-titre-page .kl-hero-titre-page__props {
	position: relative;
	z-index: 2;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.4rem 1.1rem;
	margin: 0.75rem 0 0;
	padding: 0;
	list-style: none;
	font-size: 0.85rem;
	color: var(--khtp-text-muted);
}

@media (min-width: 992px) {
	.kl-section-hero-titre-page .kl-hero-titre-page__props {
		margin-top: 0.85rem;
		gap: 0.4rem 1.6rem;
		font-size: 0.88rem;
	}
}

.kl-section-hero-titre-page .kl-hero-titre-page__prop {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-weight: 500;
	white-space: nowrap;
}

.kl-section-hero-titre-page .kl-hero-titre-page__prop-icon {
	width: 16px;
	height: 16px;
	color: var(--khtp-accent);
	flex-shrink: 0;
}

/* Mobile : compteur peut passer sous breadcrumb si la place manque */
@media (max-width: 575.98px) {
	.kl-section-hero-titre-page .kl-hero-titre-page__topbar {
		gap: 0.4rem;
	}
	.kl-section-hero-titre-page .kl-hero-titre-page__count {
		font-size: 0.78rem;
		padding: 0.25rem 0.55rem;
	}
}

/* Rapprocher la barre de filtres du hero. La section listing et ses wrappers
 * (row / container Bootstrap) ajoutent ~20–40 px de blanc qu'on neutralise ici
 * pour coller la barre de recherche directement sous la card hero. */
.kl-section-hero-titre-page + .kl-section-listing-cpt {
	margin-top: 0;
	padding-top: 0;
}

.kl-section-hero-titre-page + .kl-section-listing-cpt .kl-linsting-cpt__search--filters {
	padding-top: 0;
	margin-top: 0;
}

.kl-section-hero-titre-page + .kl-section-listing-cpt .kl-linsting-cpt__search--filters > .kl-border-separator--full:first-child {
	display: none;
}

.kl-section-hero-titre-page + .kl-section-listing-cpt .kl-linsting-cpt__search--filters .kl-search-establishment {
	padding-top: 0.25rem;
	padding-bottom: 0.5rem;
}

@media (min-width: 992px) {
	.kl-section-hero-titre-page + .kl-section-listing-cpt .kl-linsting-cpt__search--filters .kl-search-establishment {
		padding-top: 0.35rem;
		padding-bottom: 0.6rem;
	}
}

/* ─────────────────────────────────────────────────────────────────────
 * Aligner le haut de la grille de cards avec le haut de la map (split
 * desktop). Avant : « Résultats : N » + paddings poussaient les cards
 * 60–80 px sous la map. La pill « 126 restaurants » du hero rend ce
 * compteur dupliqué redondant — on le masque sur desktop split et on
 * supprime les paddings du conteneur d’actions.
 * ───────────────────────────────────────────────────────────────────── */
@media (min-width: 992px) {
	.kl-section-hero-titre-page ~ .kl-section-listing-cpt
		.kl-linsting-cpt--progressive
		.kl-pt-sp-1.kl-pt--lg-sp-3 {
		padding-top: 0 !important;
	}

	.kl-section-hero-titre-page ~ .kl-section-listing-cpt
		.kl-linsting-cpt--progressive
		.kl-linsting-cpt--actions {
		padding-bottom: 0 !important;
	}

	/* Le compteur de la hero (« 126 restaurants ») rend ce « Résultats : N »
	 * redondant — on le masque sur desktop dans le mode split. La version
	 * mobile (.kl-total-post--mobile) reste visible par ailleurs. */
	.kl-section-hero-titre-page ~ .kl-section-listing-cpt
		.kl-linsting-cpt--progressive
		.kl-linsting-cpt--actions .kl-total-post {
		display: none;
	}

	/* Plus de filtre sélectionné = pas de bandeau vide qui décale la grille. */
	.kl-section-hero-titre-page ~ .kl-section-listing-cpt
		.kl-linsting-cpt--progressive
		.kl-linsting-cpt--selected-filter:empty {
		display: none;
	}

	/* Petit espacement minimal entre la barre filtres et le haut de la grille
	 * (l'écart sert juste à éviter qu'une card soit collée au filet). */
	.kl-section-hero-titre-page ~ .kl-section-listing-cpt
		.kl-linsting-cpt--progressive
		.kl-linsting-cpt--wrapper {
		padding-top: 0;
	}
}

/* ─────────────────────────────────────────────────────────────────────
 * Barre filtres intégrée dans la hero (above-the-fold) — voir le slot
 * `.kl-hero-titre-page__filters-slot` rendu par le template hero-titre-page
 * et le script inline qui y déplace `.kl-linsting-cpt__search--filters` (ou
 * son équivalent non-progressif) avant init Tom Select.
 *
 * Quand la barre est dans la hero (classe `--in-hero`), on neutralise le
 * comportement `position: fixed` du listing-progressive.css et on l'intègre
 * visuellement à la card hero (mêmes radius, fond clair, ombre interne).
 * ───────────────────────────────────────────────────────────────────── */
.kl-hero-titre-page__filters-slot {
	margin-top: 1rem;
	width: 100%;
}

/* Override de la barre quand elle est rendue à l'intérieur de la hero —
 * on a besoin de !important pour gagner sur les sélecteurs très spécifiques
 * définis dans listing-progressive.css (.kl-linsting-cpt--progressive ...).
 */
.kl-linsting-cpt__search--in-hero,
.kl-linsting-cpt--progressive .kl-linsting-cpt__search--in-hero,
.kl-linsting-cpt--progressive .kl-linsting-cpt__search.kl-linsting-cpt__search--in-hero {
	position: static !important;
	transform: none !important;
	top: auto !important;
	left: auto !important;
	right: auto !important;
	width: 100% !important;
	background: #ffffff !important;
	box-shadow: 0 1px 2px rgba(41, 44, 61, 0.06) !important;
	border: 1px solid var(--khtp-border) !important;
	border-radius: var(--khtp-radius) !important;
	padding: 0.45rem 0.6rem !important;
	pointer-events: auto !important;
	z-index: auto !important;
	transition: none !important;
}

/* Le séparateur full-width hérité du markup mode progressif n'a pas sa
 * place dans la hero (visuellement parasite) : on le masque. */
.kl-linsting-cpt__search--in-hero .kl-border-separator {
	display: none !important;
}

/* On retire les paddings/maxwidth des wrappers internes pour que la barre
 * occupe toute la largeur du slot (largeur de la hero). */
.kl-linsting-cpt__search--in-hero > .row,
.kl-linsting-cpt__search--in-hero > .row > [class^="col-"] {
	margin: 0 !important;
	padding: 0 !important;
	flex: 0 0 100% !important;
	max-width: 100% !important;
}
.kl-linsting-cpt__search--in-hero .container.kl-max-w-xl-site-lg {
	max-width: 100% !important;
	padding: 0 !important;
	margin: 0 !important;
}

/* Quand le body porte la classe past, le sélecteur de listing-progressive
 * applique `transform: translateY(-110%)` à toutes les barres : on annule
 * cette transition pour la barre intégrée hero (sinon elle se cache). */
body.kl-listing-bar--past .kl-linsting-cpt__search--in-hero {
	transform: none !important;
	pointer-events: auto !important;
}

/* Sur mobile : la barre prend toute la largeur, sans bordure, conserve son
 * comportement « drawer Filtres » natif quand l'utilisateur clique sur
 * « Filtrer » plus bas dans la page (ce drawer reste géré par le JS thème). */
@media (max-width: 991.98px) {
	.kl-hero-titre-page__filters-slot {
		display: none; /* On laisse la barre native mobile (drawer + bouton « Filtrer »
		                  + sticky-top) qui est déjà très ergonomique sur petit écran. */
	}
}

/* Une fois la barre déplacée, le placeholder du flux d'origine (.kl-listing-filters-spacer
 * créé par main.js) n'a plus de raison d'exister : on le force à 0. */
html.kl-has-hero-filters .kl-listing-filters-spacer {
	height: 0 !important;
	display: none !important;
}

/* Page actualités : enchaînement hero PJ1 → pastilles catégories */
.kl-section-hero-news + .kl-filter-controls--topics {
	border-top: 0;
	padding-top: 0.75rem;
}
