/* Cabecera: logo, buscador, secciones, herramientas y barra de categorías. */
.cn-header {
	box-shadow: 0 1px 0 var(--cn-line), 0 6px 20px -16px rgba(13, 38, 71, .35);
}

.cn-brand {
	justify-content: center;
	flex: none;
	width: auto;
}

/* Aire lateral del logo (el buscador, que es flexible, cede ese espacio). */
@media (min-width: 821px) {
	.cn-brand {
		padding-inline: 14px;
	}
}

.cn-brand img {
	display: block;
	width: auto;
	height: 38px;
	max-height: none;
	mix-blend-mode: multiply;
}

/* Fila de la cabecera algo más prieta: lo que se ahorra se lo lleva el buscador. */
.cn-header__row {
	gap: 8px;
}

/* IMP002: el buscador es la pieza clave de la cabecera: crece con prioridad y los accesos rápidos y el selector ceden. */
.cn-search {
	position: relative;
	flex: 1 1 0;
	min-width: 0;
}

/*
 * Buscador de cabecera ensanchado (theme.js añade .is-ancho solo con el cursor en el campo y al menos una letra):
 * tapa Novedades, Ofertas y Outlet sin mover nada. El hueco que ocupa en la fila no cambia (anchura extra compensada
 * con margen negativo), así que el resto de la cabecera no se recoloca.
 */
.cn-search.is-ancho {
	z-index: 60;
	flex: none;
	width: calc(var(--cn-search-w, 520px) + var(--cn-search-extra, 0px));
	max-width: none;
	margin-inline-end: calc(-1 * var(--cn-search-extra, 0px));
	border-radius: 12px;
	background: var(--cn-surface);
}


.cn-search > svg {
	position: absolute;
	top: 50%;
	inset-inline-start: 12px;
	width: 18px;
	height: 18px;
	color: var(--cn-muted);
	transform: translateY(-50%);
	pointer-events: none;
}

.cn-search input[type="search"] {
	width: 100%;
	padding: 10px 56px 10px 38px;
	border-color: var(--cn-accent);
	box-shadow: 0 0 0 3px var(--cn-accent-soft), 0 6px 16px -8px rgba(11, 127, 134, .55);
	text-overflow: ellipsis;
}

.cn-search input[type="search"]:focus {
	box-shadow: 0 0 0 3px rgba(11, 127, 134, .28), 0 6px 16px -8px rgba(11, 127, 134, .55);
}

/*
 * Rotador de mensajes: capa sobre el campo (el placeholder nativo no admite estilos por letra). No recibe clics, no se
 * lee (aria-hidden), no mueve nada (absoluta) y se oculta con foco o texto. theme.js trocea el mensaje en letras (en
 * árabe, en palabras) y la ola recorre el texto en el sentido de lectura.
 */
.cn-rot {
	position: absolute;
	top: 0;
	bottom: 0;
	inset-inline: 38px 50px;
	display: flex;
	align-items: center;
	overflow: hidden;
	color: var(--cn-muted);
	font: inherit;
	font-size: .94em;
	line-height: 1.2;
	white-space: nowrap;
	pointer-events: none;
	transition: opacity .3s ease;
}

.cn-search input[type="search"]:focus ~ .cn-rot,
.cn-search input[type="search"]:not(:placeholder-shown) ~ .cn-rot,
.cn-rot.is-off {
	opacity: 0;
}

.cn-rot__t {
	display: inline-block;
	transition: opacity .35s ease;
}

.cn-rot__t.is-out {
	opacity: 0;
}

.cn-rot__l {
	display: inline-block;
	white-space: pre;
	transform-origin: 50% 80%;
}

.cn-rot.is-ola .cn-rot__l {
	animation: cn-rot-ola .7s ease-in-out both;
	animation-delay: calc(var(--i, 0) * 45ms);
}

@keyframes cn-rot-ola {
	0%,
	100% {
		color: inherit;
		transform: translateY(0) scale(1);
	}

	40% {
		color: var(--cn-accent);
		transform: translateY(-3.5px) scale(1.15);
	}
}

@media (prefers-reduced-motion: reduce) {
	.cn-rot,
	.cn-rot__t {
		transition: none;
	}

	.cn-rot.is-ola .cn-rot__l {
		animation: none;
	}
}

.cn-aio-wrap {
	position: absolute;
	top: 50%;
	inset-inline-end: 4px;
	z-index: 60;
	transform: translateY(-50%);
}

.cn-aio {
	display: grid;
	place-items: center;
	width: 40px;
	height: 36px;
	padding: 0;
	border: 1px solid var(--cn-line);
	border-radius: 8px;
	background: var(--cn-accent-soft);
	color: #0a6a70;
	cursor: pointer;
}

.cn-aio:hover,
.cn-aio:focus-visible,
.cn-aio[aria-expanded="true"] {
	border-color: var(--cn-accent);
	background: var(--cn-accent);
	color: var(--cn-accent-ink);
}

.cn-aio svg {
	width: 20px;
	height: 20px;
}

.cn-aio-menu {
	position: absolute;
	top: calc(100% + 6px);
	inset-inline-end: 0;
	z-index: 60;
	display: grid;
	gap: 2px;
	min-width: 240px;
	padding: 6px;
	border: 1px solid var(--cn-line);
	border-radius: 10px;
	background: var(--cn-surface);
	box-shadow: var(--cn-shadow);
}

.cn-aio-menu[hidden] {
	display: none;
}

.cn-aio-menu button,
.cn-aio-menu a {
	display: flex;
	gap: 10px;
	align-items: center;
	width: 100%;
	min-height: 44px;
	padding: 9px 10px;
	border: 0;
	border-radius: 8px;
	background: none;
	color: var(--cn-ink);
	font: inherit;
	font-size: .9rem;
	font-weight: 600;
	text-align: start;
	text-decoration: none;
	cursor: pointer;
}

.cn-aio-menu button:hover,
.cn-aio-menu button:focus-visible,
.cn-aio-menu a:hover,
.cn-aio-menu a:focus-visible {
	background: var(--cn-accent-soft);
	color: #0a6a70;
}

.cn-aio-menu svg {
	flex: none;
	width: 18px;
	height: 18px;
	color: var(--cn-accent);
}

.cn-pop {
	position: absolute;
	top: calc(100% + 6px);
	inset-inline-end: 0;
	inset-inline-start: 0;
	z-index: 50;
	max-height: calc(100dvh - 140px);
	overflow-y: auto;
	padding: 8px;
	border: 1px solid var(--cn-line);
	border-radius: var(--cn-radius);
	background: var(--cn-surface);
	box-shadow: var(--cn-shadow);
}

.cn-pop[hidden] {
	display: none;
}

.cn-pop a {
	display: grid;
	grid-template-columns: 44px minmax(0, 1fr);
	gap: 10px;
	align-items: center;
	padding: 6px;
	border-radius: 8px;
	color: var(--cn-ink);
	font-size: .88rem;
	line-height: 1.35;
	text-decoration: none;
}

.cn-pop a:hover,
.cn-pop a.is-active {
	background: var(--cn-bg);
}

.cn-pop img {
	width: 44px;
	height: 44px;
	border-radius: 6px;
	background: #fff;
	object-fit: contain;
}

.cn-pop__t {
	display: -webkit-box;
	overflow: hidden;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.cn-pop mark {
	background: var(--cn-accent-soft);
	color: inherit;
}

.cn-pop__none {
	margin: 0;
	padding: 8px 6px 4px;
	color: var(--cn-muted);
	font-size: .84rem;
	font-weight: 700;
}

.cn-pop a.cn-pop__cat {
	display: block;
	color: #0a6a70;
	font-weight: 700;
}

.cn-pop a.cn-pop__cat small {
	color: var(--cn-muted);
	font-weight: 400;
}

.cn-pop a.cn-pop__all {
	display: block;
	padding: 8px 6px 4px;
	color: #0a6a70;
	font-size: .84rem;
	font-weight: 700;
}

.cn-quick {
	display: flex;
	flex: none;
	gap: 14px;
	margin-inline-start: auto;
}

/*
 * El buscador nunca cede espacio: la fila se aprieta (huecos, logo, herramientas) y los accesos rápidos son solo Ofertas y
 * Outlet; Novedades vive en el menú «Todas las categorías». Hasta 1180 px los accesos se recogen (ya están en ese menú).
 */
.cn-cmp {
	display: none;
	flex: none;
	gap: 6px;
	align-items: center;
	color: #0a6a70;
	font-size: .88rem;
	font-weight: 700;
	text-decoration: none;
	white-space: nowrap;
}

.cn-cmp svg {
	width: 18px;
	height: 18px;
	color: var(--cn-accent);
}

.cn-cmp:hover span,
.cn-cmp:focus-visible span {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* «Comparar factura» a la vista desde 1181 px; por debajo vive en el menú del icono de foto del buscador. */
@media (min-width: 1181px) {
	.cn-cmp {
		display: inline-flex;
	}
}

/* Ancho mínimo del buscador desde 1024 px: el mayor de 440 px y el 38 % de la fila. */
@media (min-width: 1024px) {
	.cn-search {
		min-width: max(440px, 38%);
	}
}

.cn-quick a {
	padding: 2px 0;
	border-bottom: 2px solid transparent;
	color: var(--cn-ink);
	font-size: .88rem;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.cn-quick a:hover {
	border-bottom-color: var(--cn-accent);
	color: #0a6a70;
}

.cn-quick .cn-quick__out {
	color: var(--cn-signal);
}

.cn-tools {
	display: flex;
	gap: 4px;
	align-items: center;
}

.cn-tool {
	position: relative;
	display: grid;
	place-items: center;
	width: 38px;
	height: 42px;
	border-radius: 10px;
	color: var(--cn-ink);
}

.cn-tool:hover {
	background: var(--cn-accent-soft);
	color: #0a6a70;
}

.cn-tool svg {
	width: 23px;
	height: 23px;
}

.cn-cart__count {
	position: absolute;
	top: 2px;
	inset-inline-end: 0;
	min-width: 18px;
	padding: 2px 5px;
	border-radius: 999px;
	background: var(--cn-accent);
	color: var(--cn-accent-ink);
	font: 800 .68rem/1.1 var(--cn-body);
	text-align: center;
}

.cn-bar {
	border-top: 1px solid var(--cn-line);
}

/* Hamburguesa «Todas las categorías»: botón verde a la izquierda del logo, siempre visible (FIX001 2.1). */
.cn-burger {
	display: inline-flex;
	flex: none;
	gap: 8px;
	align-items: center;
	padding: 10px 14px;
	border: 0;
	border-radius: 8px;
	background: var(--cn-accent);
	color: var(--cn-accent-ink);
	font: 700 15.5px/1.6 var(--cn-body);
	white-space: nowrap;
	cursor: pointer;
}

.cn-burger:hover,
.cn-burger[aria-expanded="true"] {
	background: #0a6a70;
}

.cn-burger svg {
	width: 18px;
	height: 18px;
}

.cn-burger__t--short {
	display: none;
}

/* El botón de categorías usa su etiqueta corta: lo que libera se lo lleva el buscador. Solo el ancho completo (fila más
   ancha) recupera «Todas las categorías». */
.cn-burger__t--full {
	display: none;
}

.cn-burger__t--short {
	display: inline;
}

@media (min-width: 1600px) {
	html.cn-ancho-completo .cn-burger__t--full {
		display: inline;
	}

	html.cn-ancho-completo .cn-burger__t--short {
		display: none;
	}
}

.cn-tool:focus-visible,
.cn-burger:focus-visible {
	outline: 3px solid var(--cn-ink);
	outline-offset: 2px;
}

/* Menú móvil abierto: la página no se desplaza (la hoja es una capa fija con su propio scroller). */
body.cn-menu-open {
	overflow: hidden;
}

@media (max-width: 1180px) {
	.cn-brand {
		width: auto;
	}

	.cn-burger__t--full {
		display: none;
	}

	.cn-burger__t--short {
		display: inline;
	}

	/* Tablet: fila y herramientas más compactas para que el buscador conserve su ancho. */
	.cn-header__row {
		gap: 8px;
	}

	.cn-tool {
		width: 36px;
	}

	.cn-quick {
		display: none;
	}

	.cn-tools {
		margin-inline-start: auto;
	}
}

/* Punto de corte único (820 px): el mismo valor que data-bp del plugin y que matchMedia en cahnos-nav.js. */
@media (max-width: 820px) {
	.cn-header__row {
		flex-wrap: wrap;
		gap: 8px 10px;
		padding-block: 8px;
	}

	.cn-burger {
		order: 1;
		gap: 6px;
		min-height: 44px;
		padding: 0 10px;
		font-size: .9rem;
	}

	.cn-burger__t--full {
		display: none;
	}

	.cn-burger__t--short {
		display: inline;
	}

	.cn-brand {
		order: 2;
		min-width: 0;
		flex: 0 1 auto;
		width: auto;
	}

	.cn-brand img {
		height: 30px;
		max-width: 100%;
	}

	.cn-tools {
		order: 3;
		gap: 0;
	}

	.cn-tool {
		width: 44px;
		height: 44px;
	}

	.cn-search {
		order: 4;
		flex-basis: 100%;
		max-width: none;
	}

	.cn-search input[type="search"] {
		min-height: 44px;
		padding-block: 10px;
		padding-inline-end: 52px;
	}

	.cn-aio-wrap {
		inset-inline-end: 2px;
	}

	.cn-aio {
		width: 44px;
		height: 44px;
	}

	.cn-bar {
		border-top: 0;
	}
}

@media (max-width: 560px) {
	.cn-tool[href*="wa.me"] {
		display: none;
	}
}

/* Resultados del buscador de cabecera más anchos (escritorio): el campo no cambia de tamaño (así sus iconos no se
   mueven al pulsarlos); solo el desplegable tiene ancho propio para que los títulos se lean enteros. */
@media (min-width: 1100px) {
	.cn-search .cn-pop {
		inset-inline-end: auto;
		width: min(760px, calc(100vw - 32px));
	}

	.cn-search .cn-pop a {
		grid-template-columns: 56px minmax(0, 1fr);
	}
}

/* ---------- EVO008: botón de ancho completo, bajo el carrito (extremo derecho de la barra del menú) ---------- */
.cn-ancho {
	display: none;
}

@media (min-width: 1280px) {
	.cn-ancho {
		position: absolute;
		top: 50%;
		inset-inline-end: var(--cn-gutter, clamp(16px, 4vw, 40px));
		z-index: 5;
		display: grid;
		place-items: center;
		width: 40px;
		height: 40px;
		padding: 0;
		border: 0;
		border-radius: 8px;
		background: transparent;
		color: var(--cn-ink);
		cursor: pointer;
		transform: translateY(-50%);
	}

	.cn-ancho:hover {
		background: var(--cn-accent-soft);
	}

	.cn-ancho:focus-visible {
		outline: 2px solid var(--cn-accent);
		outline-offset: 2px;
	}

	.cn-ancho__i {
		width: 20px;
		height: 20px;
	}

	.cn-ancho__i--contraer,
	.cn-ancho[aria-pressed="true"] .cn-ancho__i--expandir {
		display: none;
	}

	.cn-ancho[aria-pressed="true"] .cn-ancho__i--contraer {
		display: block;
	}
}
