:root {
	--rch-bar-height: 72px;
	--rch-bg-panel: #ffffff;
	--rch-border-soft: rgba(90, 52, 43, 0.14);
	--rch-text-main: var(--color-brown);
	--rch-text-secondary: rgba(90, 52, 43, 0.72);
	--rch-text-muted: rgba(90, 52, 43, 0.58);
	--rch-card-bg: var(--color-cream);
}

/* =========================================================
   SEARCH SHELL
   ========================================================= */

.rch-custom-search,
.rch-custom-search * {
	box-sizing: border-box;
}

.rch-custom-search {
	position: fixed;
	inset: 0;
	z-index: 100001;

	font-family: var(--font-body);
	color: var(--rch-text-main);

	pointer-events: none;
}

.rch-custom-overlay {
	position: absolute;
	inset: 0;

	background: rgba(76, 33, 26, 0.08);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);

	opacity: 0;
	transition: opacity 0.16s ease;
}

/*
 * Mobile/tablette :
 * le panneau blanc occupe tout l'espace disponible sous le bandeau.
 *
 * Desktop :
 * cette règle est surchargée plus bas pour revenir
 * à une hauteur naturelle.
 */
.rch-custom-panel {
	position: absolute;
	inset: 0;

	display: flex;
	flex-direction: column;

	background: var(--rch-bg-panel);

	opacity: 0;
	visibility: hidden;

	transition: opacity 0.16s ease;

	overflow: hidden;
}

.rch-custom-search.is-open,
.rch-custom-search.is-open .rch-custom-panel {
	pointer-events: auto;
}

.rch-custom-search.is-closing {
	pointer-events: none;
}

.rch-custom-search.is-open .rch-custom-overlay {
	opacity: 1;
}

.rch-custom-search.is-open .rch-custom-panel {
	opacity: 1;
	visibility: visible;
}

.rch-custom-search.is-closing .rch-custom-overlay {
	opacity: 0;
}

.rch-custom-search.is-closing .rch-custom-panel {
	opacity: 0;
	visibility: visible;
	pointer-events: none;
}

/* =========================================================
   INNER / SCROLL
   ========================================================= */

.rch-custom-inner {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;

	min-height: 0;
	width: min(100% - 48px, 1440px);
	margin: 0 auto;

	background: var(--rch-bg-panel);

	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

/* Sans requête : seule la barre reste visible. */
.rch-custom-search:not(.has-query) .rch-custom-results,
.rch-custom-search:not(.has-query) .rch-custom-status,
.rch-custom-search:not(.has-query) .rch-custom-empty-state {
	display: none;
}

/* =========================================================
   SEARCH BAR
   ========================================================= */

.rch-custom-bar {
	position: sticky;
	top: 0;
	z-index: 3;

	display: flex;
	align-items: center;
	gap: 12px;

	flex: 0 0 var(--rch-bar-height);
	min-height: var(--rch-bar-height);

	background: var(--rch-bg-panel);
	border-bottom: 0;
}


.rch-custom-bar-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;

	flex: 0 0 28px;
	width: 28px;
	height: 28px;
}

.rch-custom-bar-icon-shape {
	display: block;

	width: 22px;
	height: 22px;

	background-color: var(--rch-text-main);

	mask: url("../images/icon-search.svg") center / contain no-repeat;
	-webkit-mask: url("../images/icon-search.svg") center / contain no-repeat;
}

.rch-custom-input {
	flex: 1 1 auto;
	min-width: 0;

	margin: 0;
	padding: 2px 0 0;

	border: 0 !important;
	border-radius: 0 !important;
	outline: 0 !important;
	box-shadow: none !important;

	appearance: none;
	-webkit-appearance: none;

	background: transparent !important;

	color: var(--rch-text-main);
	font-family: var(--font-title);
	font-size: clamp(19px, 1.5vw, 24px);
	line-height: 1.15;
}

.rch-custom-input::placeholder {
	color: rgba(90, 52, 43, 0.56);
	opacity: 1;
}

/* Supprime le X natif des inputs type="search". */
.rch-custom-input::-webkit-search-decoration,
.rch-custom-input::-webkit-search-cancel-button,
.rch-custom-input::-webkit-search-results-button,
.rch-custom-input::-webkit-search-results-decoration {
	-webkit-appearance: none;
	appearance: none;
	display: none;
}

.rch-custom-input::-ms-clear,
.rch-custom-input::-ms-reveal {
	display: none;
	width: 0;
	height: 0;
}

.rch-custom-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;

	flex: 0 0 32px;
	width: 32px;
	height: 32px;

	margin-left: auto;
	padding: 0;

	border: 0;
	border-radius: 50%;

	background: var(--color-brown);

	cursor: pointer;

	transition:
		opacity 0.18s ease,
		transform 0.12s ease;
}

.rch-custom-close:hover {
	opacity: 0.88;
}

.rch-custom-close:active {
	transform: scale(0.97);
}

.rch-custom-close:focus-visible,
.rch-custom-panel :is(a, button):focus-visible {
	outline: 2px solid var(--color-accent);
	outline-offset: 3px;
}


/*
 * Le focus de l'input est indiqué par la barre basse,
 * pas par un rectangle autour du champ.
 */
.rch-custom-input:focus-visible {
	outline: 0 !important;
	box-shadow: none !important;
}


/* =========================================================
   STATUS / LOADING
   ========================================================= */

.rch-custom-status {
	flex: 0 0 auto;

	margin: 14px 0 0;

	color: var(--rch-text-muted);
	font-size: var(--fs-sm);
}

.rch-custom-status:empty {
	display: none;
}

.rch-loader {
	display: inline-block;

	width: var(--umatatea-loader-size-small);
	height: var(--umatatea-loader-size-small);

	margin-right: 8px;

	vertical-align: middle;

	border: var(--umatatea-loader-border-width) solid var(--umatatea-loader-track);
	border-top-color: var(--umatatea-loader-color);
	border-radius: 50%;

	animation: umatatea-loader-spin var(--umatatea-loader-speed) linear infinite;
}

/* =========================================================
   RESULTS
   Mobile/tablette : Produits puis Catégories
   ========================================================= */

.rch-custom-results {
	display: grid;
	grid-template-columns: 1fr;

	gap: 34px;
	padding: 28px 0 36px;
}

.rch-custom-products-col,
.rch-custom-categories-col {
	min-width: 0;
}

.rch-custom-products-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;

	gap: 16px;
	margin-bottom: 16px;
}

.rch-custom-heading {
	margin: 0 0 16px;

	color: var(--rch-text-main);

	font-family: var(--font-commerce-title);
	font-size: 21px;
	font-weight: 400;
	line-height: 1.12;
}

.rch-custom-products-heading .rch-custom-heading {
	margin: 0;
}

/* =========================================================
   PRODUCT RAIL
   ========================================================= */

.rch-custom-products-grid {
	display: flex;

	gap: 16px;

	overflow-x: auto;
	overflow-y: hidden;

	padding: 2px 24px 8px 0;

	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.rch-custom-products-grid::-webkit-scrollbar {
	display: none;
}

.rch-custom-product-card {
	display: block;

	flex: 0 0 min(62vw, 240px);

	color: inherit;
	text-decoration: none !important;

	scroll-snap-align: start;
}

.rch-custom-product-card:nth-child(n + 7) {
	display: none;
}

.rch-custom-product-image-wrap {
	position: relative;

	width: 100%;
	aspect-ratio: 5 / 6;

	margin-bottom: 10px;

	overflow: hidden;

	border-radius: 2px;
	background: var(--rch-card-bg);
}

/*
 * IMPORTANT :
 * la recherche ne réutilise PAS les translations de crop du catalogue.
 *
 * Dans le search, l'image remplit simplement son cadre 5:6,
 * centrée proprement.
 */
.rch-custom-product-image {
	position: absolute !important;
	inset: 0 !important;

	width: 100% !important;
	height: 100% !important;
	max-width: none !important;

	margin: 0 !important;

	object-fit: cover !important;
	object-position: center !important;

	transform: none !important;
}

.rch-custom-product-content {
	display: flex;
	flex-direction: column;

	gap: 5px;

	text-align: left;
}

.rch-custom-product-title {
	display: -webkit-box;

	overflow: hidden;

	color: var(--rch-text-main);

	font-size: 14px;
	font-weight: 600;
	line-height: 1.28;

	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.rch-custom-product-price {
	color: var(--rch-text-secondary);

	font-size: 12.5px;
	font-weight: 500;
	line-height: 1.25;
}

/* =========================================================
   SEE ALL / ARROWS
   ========================================================= */

.rch-custom-see-all,
.rch-custom-empty-link {
	display: inline-flex;
	align-items: center;

	gap: 8px;

	color: rgba(90, 52, 43, 0.78);

	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.12em;
	line-height: 1;

	text-decoration: none !important;
	text-transform: uppercase;
}

.rch-custom-see-all:hover,
.rch-custom-empty-link:hover {
	color: var(--rch-text-main);
}

.rch-custom-arrow {
	display: inline-flex;
	align-items: center;

	width: 18px;
	height: 14px;

	flex: 0 0 18px;
}

.rch-custom-arrow-line {
	position: relative;
	display: block;

	width: 14px;
	height: 1.5px;

	border-radius: 999px;
	background: currentColor;
}

.rch-custom-arrow-line::after {
	content: "";

	position: absolute;
	top: 50%;
	right: -1px;

	width: 6px;
	height: 6px;

	border-top: 1.5px solid currentColor;
	border-right: 1.5px solid currentColor;

	transform: translateY(-50%) rotate(45deg);
}

/* =========================================================
   CATEGORIES
   ========================================================= */

.rch-custom-categories-list {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

.rch-custom-category-item {
	display: inline-flex;
	align-items: center;

	gap: 9px;
	padding: 8px 0;

	color: var(--rch-text-secondary);

	font-size: 15px;
	line-height: 1.35;

	text-decoration: none !important;
}

.rch-custom-category-item:hover {
	color: var(--rch-text-main);
}

.rch-custom-category-count {
	display: none;
}

.rch-custom-no-results {
	max-width: 420px;

	color: var(--rch-text-muted);

	font-size: var(--fs-base);
	line-height: 1.55;
}

/* =========================================================
   EMPTY / ERROR STATES
   ========================================================= */

.rch-custom-empty-state {
	align-self: flex-start;
	width: min(100%, 520px);
	margin: 24px 0 28px;
	padding: 0;
	border-top: 0;
	color: var(--rch-text-secondary);
}

.rch-custom-empty-state:empty {
	display: none;
}

.rch-custom-empty-title {
	margin: 0 0 6px;
	color: var(--rch-text-main);
	font-family: var(--font-commerce-title);
	font-size: 18px;
	font-weight: 400;
	line-height: 1.2;
}

.rch-custom-empty-copy {
	margin: 0;
	font-size: 13.5px;
	line-height: 1.5;
	color: var(--rch-text-secondary);
}

.rch-custom-retry {
	min-height: 42px;

	padding: 0 18px;

	border: 1px solid var(--color-brown);

	background: var(--color-brown);
	color: #fffdfb;

	cursor: pointer;

	font: inherit;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.1em;

	text-transform: uppercase;
}

.rch-custom-search.is-no-results .rch-custom-results,
.rch-custom-search.is-error .rch-custom-results {
	display: none;
}

/* =========================================================
   SEARCH RESULTS PAGE EMPTY STATE
   ========================================================= */

.umatatea-search-empty {
	max-width: 620px;

	margin: 96px auto 120px;
	padding: 0 24px;

	color: var(--color-brown);
	text-align: center;
}

.umatatea-search-empty__eyebrow {
	margin: 0 0 14px;

	color: var(--color-accent);

	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.14em;

	text-transform: uppercase;
}

.umatatea-search-empty__title {
	margin: 0 auto 18px;

	font-family: var(--font-commerce-title);
	font-size: 34px;
	font-weight: 400;
	line-height: 1.08;
}

.umatatea-search-empty__text {
	max-width: 460px;

	margin: 0 auto 30px;

	color: var(--rch-text-secondary);

	font-size: 14px;
	line-height: 1.65;
}

.umatatea-search-empty__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;

	min-height: 48px;

	padding: 0 26px;

	background: var(--color-brown);
	color: #fffdfb;

	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.12em;

	text-decoration: none !important;
	text-transform: uppercase;
}



/* =========================================================
   TABLET
   Same UX as mobile, with wider cards
   ========================================================= */

@media (min-width: 768px) and (max-width: 1024px) {
	.rch-custom-inner {
		width: min(100% - 64px, 860px);
	}

	.rch-custom-results {
		gap: 24px;
		padding-top: 20px;
	}

	.rch-custom-product-card {
		flex-basis: min(31vw, 260px);
	}

	.rch-custom-heading {
		font-size: 18px;
	}

	.rch-custom-product-title {
		font-size: 13.5px;
		font-weight: 600;
		line-height: 1.3;
	}
}

/* =========================================================
   DESKTOP
   Overlay fullscreen, white panel = natural height
   ========================================================= */

@media (min-width: 1025px) {
	:root {
		--rch-bar-height: 72px;
	}

	.rch-custom-input {
		padding-top: 0;
		line-height: 1.2;
	}

	.rch-custom-panel {
		inset: 0 0 auto;

		max-height: 100vh;
		max-height: 100dvh;

		overflow-x: hidden;
		overflow-y: auto;

		overscroll-behavior: contain;
	}

	.rch-custom-inner {
		flex: 0 0 auto;

		min-height: auto;

		width: min(100% - 96px, 1440px);

		overflow: visible;
	}

	.rch-custom-results {
		grid-template-columns: 260px minmax(0, 1fr);
		grid-template-areas: "categories products";

		gap: 48px;

		padding: 30px 0 24px;
	}

	.rch-custom-products-col {
		grid-area: products;
	}

	.rch-custom-categories-col {
		grid-area: categories;

		padding-right: 36px;

		border-right: 1px solid rgba(90, 52, 43, 0.08);
	}

	.rch-custom-products-grid {
		display: grid;
		grid-template-columns: repeat(4, minmax(0, 1fr));

		gap: 18px;

		overflow: visible;

		padding: 0;
	}

	.rch-custom-product-card {
		width: 100%;
		flex: none;
	}

	.rch-custom-product-card:nth-child(n + 5) {
		display: none;
	}

	.rch-custom-product-content {
		text-align: center;
	}

	.rch-custom-empty-state {
		margin-bottom: 40px;
	}
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 767px) {
	:root {
		--rch-bar-height: 64px;
	}

	.rch-custom-inner {
		width: min(100% - 32px, 640px);
	}

	.rch-custom-bar {
		gap: 9px;
	}

	.rch-custom-bar-icon {
		flex-basis: 24px;

		width: 24px;
		height: 24px;
	}

	.rch-custom-bar-icon-shape {
		width: 19px;
		height: 19px;
	}

	.rch-custom-input {
		font-size: 19px;
	}

	.rch-custom-results {
		gap: 22px;
		padding: 24px 0 32px;
	}

	/*
	 * ≈1.6–1.8 carte visible selon largeur écran.
	 * Cela rend le swipe immédiatement compréhensible.
	 */
	.rch-custom-product-card {
		flex-basis: min(53vw, 210px);
	}

	.rch-custom-heading {
		font-size: 18px;
	}

	.rch-custom-product-title {
		font-size: 13.5px;
		font-weight: 600;
		line-height: 1.3;
	}

	.rch-custom-empty-state {
		margin-top: 24px;
	}
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
	.rch-custom-overlay,
	.rch-custom-panel,
	.rch-custom-close {
		transition: none;
	}

	.rch-custom-close:hover {
		transform: none;
	}
}


/* Search ouvert : masque le bandeau d'annonce sans modifier sa hauteur */
body.rch-search-open .site-top-banner,
body.rch-search-open [data-top-banner] {
	visibility: hidden;
	pointer-events: none;
}
