/* Barra de FAQ — mismo lenguaje visual que la web de AGH (Nexros): negro, rojo #FE0000, crema y botones píldora. */
.webagh-bar {
	--webagh-ink: #212121;
	--webagh-red: #FE0000;
	--webagh-cream: #F6E9E0;
	--webagh-muted: #54595F;
	/* 0 = opaca, 1 = fondo transparente. La mueve el JS con el scroll para no tapar la página. */
	--webagh-fade: 0;
	/* Fija arriba al hacer scroll; con la barra de administración de WordPress, justo debajo de ella. */
	position: sticky;
	top: 0;
	z-index: 1002;
	background: rgba(33, 33, 33, calc(1 - var(--webagh-fade)));
	color: #fff;
	transition: background-color .25s ease;
	font-family: "Host Grotesk", system-ui, -apple-system, sans-serif;
	font-size: 15px;
	line-height: 1.4;
}

/* Escribiendo (o con el ratón encima), vuelve a ser opaca. !important para ganar al valor en línea que pone el JS. */
.webagh-bar:focus-within {
	--webagh-fade: 0 !important;
}

/* Solo con ratón: en el móvil :hover se queda pegado tras tocar y la barra no volvería a aclararse. */
@media (hover: hover) {
	.webagh-bar:hover {
		--webagh-fade: 0 !important;
	}
}

/* Menú móvil del tema abierto: la barra pasa por debajo para no tapar su logo ni la X de cerrar. */
body:has(.pxl-header-menu.active) .webagh-bar {
	z-index: 998;
}

/* Casi transparente: los clics fuera de la caja de búsqueda llegan a la página de debajo. */
.webagh-bar.is-faded {
	pointer-events: none;
}

.webagh-bar.is-faded .webagh-bar__box {
	pointer-events: auto;
}

.admin-bar .webagh-bar {
	top: var(--wp-admin--admin-bar--height, 32px);
}

/* Por debajo de 600 px la barra de administración ya no es fija y se va con el scroll. */
@media (max-width: 600px) {
	.admin-bar .webagh-bar {
		top: 0;
	}
}

/* --webagh-offset lo calcula el JS: dónde acaba la barra fija. Los anclajes no quedan debajo de ella. */
html {
	scroll-padding-top: var(--webagh-offset, 0px);
}

/*
 * Tema Nexros: su cabecera fija (escritorio) y la de móvil van con top: 0 y quedarían tapadas por la barra.
 * Se bajan justo debajo. !important porque el tema fija el top de la de escritorio con .admin-bar y más especificidad.
 */
#pxl-header-elementor .pxl-header-elementor-sticky,
#pxl-header-elementor #pxl-header-mobile.pxl-header-mobile-fixed {
	top: var(--webagh-offset, 0px) !important;
}

.webagh-bar *,
.webagh-bar *::before,
.webagh-bar *::after {
	box-sizing: border-box;
}

.webagh-bar__inner {
	display: flex;
	align-items: center;
	gap: 20px;
	max-width: 1320px;
	margin: 0 auto;
	padding: 10px 24px;
}

.webagh-bar__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	letter-spacing: .02em;
	text-transform: uppercase;
	white-space: nowrap;
	opacity: calc(1 - var(--webagh-fade));
	transition: opacity .25s ease;
}

.webagh-bar__eyebrow::before {
	content: "";
	width: 8px;
	height: 8px;
	background: var(--webagh-red);
}

.webagh-bar__box {
	position: relative;
	flex: 1;
	max-width: 720px;
}

.webagh-bar .webagh-bar__field {
	display: flex;
	align-items: center;
	gap: 10px;
	height: 42px;
	margin: 0;
	padding: 0 8px 0 16px;
	border: 1px solid rgba(255, 255, 255, .28);
	border-radius: 999px;
	/* Sin el fondo de la barra, la caja lleva el suyo translúcido para que se lea sobre cualquier imagen. */
	background: rgba(33, 33, 33, calc(.6 * var(--webagh-fade)));
	-webkit-backdrop-filter: blur(calc(8px * var(--webagh-fade)));
	backdrop-filter: blur(calc(8px * var(--webagh-fade)));
	cursor: text;
	transition: border-color .15s ease, background-color .25s ease;
}

.webagh-bar .webagh-bar__field:hover {
	border-color: rgba(255, 255, 255, .55);
}

.webagh-bar .webagh-bar__field:focus-within {
	border-color: var(--webagh-red);
}

.webagh-bar__icon {
	flex: none;
	width: 16px;
	height: 16px;
	color: rgba(255, 255, 255, .7);
}

/* El tema estiliza los inputs con fuerza: aquí se neutraliza solo lo imprescindible. */
.webagh-bar input.webagh-bar__input {
	flex: 1;
	min-width: 0;
	width: auto;
	height: 100%;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	color: #fff !important;
	font: inherit;
	outline: none;
}

.webagh-bar input.webagh-bar__input::placeholder {
	color: rgba(255, 255, 255, .6);
	opacity: 1;
}

.webagh-bar input.webagh-bar__input::-webkit-search-cancel-button {
	filter: invert(1);
}

.webagh-bar__kbd {
	padding: 4px 7px;
	border: 1px solid rgba(255, 255, 255, .3);
	border-radius: 6px;
	background: transparent;
	color: rgba(255, 255, 255, .7);
	font-family: inherit;
	font-size: 12px;
	line-height: 1;
}

.webagh-results {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	max-height: min(60vh, 480px);
	overflow-y: auto;
	background: #fff;
	color: var(--webagh-ink);
	border: 1px solid var(--webagh-ink);
	box-shadow: 0 18px 40px rgba(33, 33, 33, .18);
}

.webagh-results[hidden] {
	display: none;
}

.webagh-results__head,
.webagh-results__empty {
	padding: 12px 16px 6px;
	color: var(--webagh-muted);
	font-size: 12px;
	letter-spacing: .04em;
	text-transform: uppercase;
}

.webagh-results__link {
	color: var(--webagh-ink);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-color: var(--webagh-red);
	text-underline-offset: 3px;
}

.webagh-results__empty {
	padding-bottom: 12px;
	font-size: 14px;
	letter-spacing: 0;
	text-transform: none;
}

.webagh-bar button.webagh-option {
	display: grid;
	grid-template-columns: 32px 1fr;
	gap: 12px;
	align-items: baseline;
	width: 100%;
	margin: 0;
	padding: 12px 16px;
	border: 0;
	border-top: 1px solid #EEE6DF;
	border-radius: 0;
	background: #fff;
	box-shadow: none;
	color: var(--webagh-ink);
	font: inherit;
	font-size: 15px;
	letter-spacing: normal;
	line-height: 1.4;
	text-align: left;
	text-transform: none;
	cursor: pointer;
}

.webagh-bar button.webagh-option:hover,
.webagh-bar button.webagh-option.is-active {
	background: var(--webagh-cream);
	color: var(--webagh-ink);
}

.webagh-option__num {
	color: var(--webagh-muted);
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

.webagh-option:hover .webagh-option__num,
.webagh-option.is-active .webagh-option__num,
.webagh-option--ask .webagh-option__num {
	color: var(--webagh-red);
}

.webagh-option__q mark {
	background: transparent;
	color: inherit;
	font-weight: 700;
	text-decoration: underline;
	text-decoration-color: var(--webagh-red);
	text-underline-offset: 3px;
}

.webagh-option--ask .webagh-option__q {
	font-weight: 600;
}

.webagh-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

@media (max-width: 767px) {
	.webagh-bar__inner {
		gap: 10px;
		padding: 8px 16px;
	}

	.webagh-bar__eyebrow,
	.webagh-bar__kbd {
		display: none;
	}

	.webagh-bar__box {
		max-width: none;
	}

	.webagh-bar .webagh-bar__field {
		height: 40px;
	}

	/* 16 px: con menos, Safari del iPhone amplía la página al pinchar en la caja. */
	.webagh-bar input.webagh-bar__input {
		font-size: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.webagh-bar,
	.webagh-bar__eyebrow,
	.webagh-bar .webagh-bar__field {
		transition: none;
	}
}
