/* ==========================================================================
   Header alGenio — ligero, sin dependencias, 100% responsive
   Naranja de marca: #FF9600
   ========================================================================== */

:root {
	--ag-orange: #ff9600;
	--ag-white: #ffffff;
	--ag-dark: #0b0b0b;
	--ag-header-h: 72px;          /* alto en desktop */
	--ag-header-h-scrolled: 62px; /* alto al hacer scroll */
	--ag-max: 1200px;             /* ancho máximo del contenido */
	--ag-z: 9990;
}

/* Accesibilidad: enlace de salto */
.skip-link.screen-reader-text {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: calc(var(--ag-z) + 10);
}
.skip-link.screen-reader-text:focus {
	left: 8px;
	top: 8px;
	width: auto;
	height: auto;
	padding: 10px 16px;
	background: var(--ag-white);
	color: #000;
	border-radius: 6px;
	font: 600 14px/1 'Poppins', sans-serif;
}

/* ------------------------------------------------------------------ */
/* Contenedor fijo                                                     */
/* ------------------------------------------------------------------ */
.ag-header,
.ag-header *,
.ag-header *::before,
.ag-header *::after { box-sizing: border-box; }

.ag-header {
	position: fixed;
	inset: 0 0 auto 0;               /* top:0; left:0; right:0 */
	z-index: var(--ag-z);
	background: transparent;
	transition: background-color .3s ease, box-shadow .3s ease, backdrop-filter .3s ease;
	-webkit-font-smoothing: antialiased;
}

/* Fondo oscuro sólido al hacer scroll */
.ag-header.is-scrolled {
	background-color: rgba(11, 11, 11, .92);
	box-shadow: 0 2px 18px rgba(0, 0, 0, .28);
	backdrop-filter: saturate(140%) blur(8px);
	-webkit-backdrop-filter: saturate(140%) blur(8px);
}

/* Compensar la barra de administración de WordPress (usuario logueado) */
.admin-bar .ag-header { top: 32px; }
@media screen and (max-width: 782px) {
	.admin-bar .ag-header { top: 46px; }
}

.ag-header__inner {
	max-width: var(--ag-max);
	margin: 0 auto;
	min-height: var(--ag-header-h);
	padding: 0 clamp(16px, 4vw, 40px);
	display: flex;
	align-items: center;
	gap: clamp(12px, 2vw, 28px);
	transition: min-height .3s ease;
}
.ag-header.is-scrolled .ag-header__inner { min-height: var(--ag-header-h-scrolled); }

/* ------------------------------------------------------------------ */
/* Logo                                                                */
/* ------------------------------------------------------------------ */
.ag-logo {
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	margin-right: auto;              /* empuja el menú a la derecha */
	line-height: 0;
}
.ag-logo img {
	display: block;
	width: auto;
	height: clamp(34px, 4.4vw, 44px);
	transition: height .3s ease;
}

/* ------------------------------------------------------------------ */
/* Navegación (desktop)                                                */
/* ------------------------------------------------------------------ */
.ag-nav {
	display: flex;
	align-items: center;
	gap: clamp(14px, 2.2vw, 34px);
}
.ag-menu {
	display: flex;
	align-items: center;
	gap: clamp(10px, 1.8vw, 30px);
	margin: 0;
	padding: 0;
	list-style: none;
}
.ag-menu__item { position: relative; margin: 0; }

.ag-menu__link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 2px;
	background: none;
	border: 0;
	cursor: pointer;
	font: 500 16px/1.2 'Poppins', sans-serif;
	color: var(--ag-white);
	text-decoration: none;
	white-space: nowrap;
	transition: color .2s ease;
}
.ag-menu__link:hover,
.ag-menu__link:focus-visible,
.ag-menu__item.is-active > .ag-menu__link {
	color: var(--ag-orange);
}
.ag-menu__toggle { font-family: inherit; }

.ag-caret { transition: transform .25s ease; margin-top: 1px; }

/* ------------------------------------------------------------------ */
/* Submenú (desktop: desplegable flotante)                             */
/* ------------------------------------------------------------------ */
.ag-submenu {
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 260px;
	margin: 0;
	padding: 8px 0;
	list-style: none;
	background: var(--ag-white);
	border-radius: 10px;
	box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
	z-index: 2;
}
/* Puente invisible para que el hover no se corte al bajar el ratón */
.ag-has-sub::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	height: 14px;
}
.ag-has-sub:hover > .ag-submenu,
.ag-has-sub:focus-within > .ag-submenu,
.ag-has-sub.is-open > .ag-submenu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}
.ag-has-sub:hover > .ag-menu__toggle .ag-caret,
.ag-has-sub.is-open > .ag-menu__toggle .ag-caret {
	transform: rotate(180deg);
}

.ag-submenu__link {
	display: block;
	padding: 11px 20px;
	font: 500 15px/1.35 'Poppins', sans-serif;
	color: #1a1a1a;
	text-decoration: none;
	transition: color .18s ease, background-color .18s ease;
}
.ag-submenu__link:hover,
.ag-submenu__link:focus-visible,
.ag-submenu__item.is-active > .ag-submenu__link {
	color: var(--ag-orange);
	background: rgba(255, 150, 0, .08);
}

/* ------------------------------------------------------------------ */
/* Acciones: teléfono + idiomas                                        */
/* ------------------------------------------------------------------ */
.ag-actions {
	display: flex;
	align-items: center;
	gap: clamp(12px, 1.6vw, 22px);
}
.ag-phone {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font: 600 16px/1 'Poppins', sans-serif;
	color: var(--ag-orange);
	text-decoration: none;
	white-space: nowrap;
	transition: opacity .2s ease;
}
.ag-phone:hover,
.ag-phone:focus-visible { opacity: .8; }
.ag-phone__icon { flex: 0 0 auto; }

.ag-lang {
	display: flex;
	align-items: center;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.ag-lang__item { display: inline-flex; align-items: center; }
.ag-lang__item + .ag-lang__item::before {
	content: "";
	width: 1px;
	height: 14px;
	margin: 0 8px;
	background: rgba(255, 255, 255, .4);
}
.ag-lang__item a {
	font: 500 14px/1 'Poppins', sans-serif;
	letter-spacing: .5px;
	color: rgba(255, 255, 255, .8);
	text-decoration: none;
	transition: color .2s ease;
}
.ag-lang__item a:hover,
.ag-lang__item a:focus-visible { color: var(--ag-white); }
.ag-lang__item.is-active a { color: var(--ag-orange); font-weight: 600; }

/* Cuando el header tiene fondo oscuro, el separador de idiomas queda igual */

/* ------------------------------------------------------------------ */
/* Botón hamburguesa (oculto en desktop)                               */
/* ------------------------------------------------------------------ */
.ag-burger {
	display: none;
	position: relative;
	width: 44px;
	height: 44px;
	margin-left: auto;
	padding: 0;
	background: none;
	border: 0;
	cursor: pointer;
	color: var(--ag-white);
}
.ag-burger__box { display: block; width: 26px; height: 20px; margin: 0 auto; position: relative; }
.ag-burger__lines,
.ag-burger__lines::before,
.ag-burger__lines::after {
	position: absolute;
	left: 0;
	width: 26px;
	height: 2.5px;
	background: currentColor;
	border-radius: 2px;
	transition: transform .3s ease, opacity .2s ease, top .3s ease;
}
.ag-burger__lines { top: 50%; transform: translateY(-50%); }
.ag-burger__lines::before { content: ""; top: -8px; }
.ag-burger__lines::after { content: ""; top: 8px; }

/* Estado abierto -> X */
.ag-nav-open .ag-burger__lines { background: transparent; }
.ag-nav-open .ag-burger__lines::before { top: 0; transform: rotate(45deg); }
.ag-nav-open .ag-burger__lines::after { top: 0; transform: rotate(-45deg); }

/* ==================================================================== */
/* RESPONSIVE: menú móvil / tablet (hasta 1024px)                       */
/* ==================================================================== */
@media (max-width: 1024px) {
	.ag-burger { display: block; }

	/* Barra superior (logo + X) siempre visible; el panel se abre debajo */
	body.ag-nav-open .ag-header { background-color: var(--ag-dark); }

	.ag-nav {
		position: fixed;
		top: var(--ag-header-h);
		right: 0;
		bottom: 0;
		width: min(86vw, 340px);
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		gap: 0;
		padding: 18px 24px 32px;
		background: var(--ag-dark);
		box-shadow: -12px 0 40px rgba(0, 0, 0, .4);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		transform: translateX(100%);
		transition: transform .32s cubic-bezier(.4, 0, .2, 1);
		visibility: hidden;
	}
	.ag-nav-open .ag-nav {
		transform: translateX(0);
		visibility: visible;
	}
	/* Compensar barra de admin de WordPress (usuario logueado) */
	.admin-bar .ag-nav { top: calc(var(--ag-header-h) + 32px); }

	.ag-menu {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		width: 100%;
	}
	.ag-menu__item { width: 100%; border-bottom: 1px solid rgba(255, 255, 255, .08); }

	.ag-menu__link {
		width: 100%;
		justify-content: space-between;
		padding: 16px 2px;
		font-size: 17px;
	}

	/* Submenú en móvil: acordeón estático, no flotante */
	.ag-has-sub::after { content: none; }
	.ag-submenu {
		position: static;
		min-width: 0;
		width: 100%;
		background: none;
		box-shadow: none;
		border-radius: 0;
		padding: 0;
		opacity: 1;
		visibility: visible;
		transform: none;
		overflow: hidden;
		max-height: 0;
		transition: max-height .32s ease;
	}
	.ag-has-sub.is-open > .ag-submenu { max-height: 600px; }
	.ag-submenu__link {
		color: rgba(255, 255, 255, .75);
		padding: 12px 2px 12px 16px;
		font-size: 15px;
	}
	.ag-submenu__link:hover,
	.ag-submenu__link:focus-visible,
	.ag-submenu__item.is-active > .ag-submenu__link {
		background: none;
		color: var(--ag-orange);
	}

	.ag-actions {
		flex-direction: column;
		align-items: flex-start;
		gap: 18px;
		margin-top: 24px;
		width: 100%;
	}
	.ag-phone { font-size: 18px; }
	.ag-lang { margin-top: 4px; }
	.ag-lang__item a { font-size: 15px; }

	/* Bloquear scroll del fondo con el menú abierto */
	body.ag-nav-open { overflow: hidden; }

	/* Velo oscuro detrás del panel */
	.ag-nav-open .ag-header::before {
		content: "";
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, .5);
		z-index: -1;
	}
}

/* Pantallas muy estrechas */
@media (max-width: 380px) {
	.ag-nav { width: 100vw; }
	.ag-header__inner { padding: 0 16px; }
}

/* Respeto a "reduce motion" */
@media (prefers-reduced-motion: reduce) {
	.ag-header, .ag-header__inner, .ag-logo img, .ag-nav,
	.ag-submenu, .ag-caret, .ag-burger__lines,
	.ag-burger__lines::before, .ag-burger__lines::after {
		transition: none !important;
	}
}

/* ==========================================================================
   AISLAMIENTO frente a los estilos globales de Elementor / tema
   Elementor aplica estilos de botón y color de enlace globales (a veces con
   !important) que pisaban el header. Estas reglas los neutralizan solo dentro
   del header, dejándolo idéntico al diseño original.
   ========================================================================== */

/* Nota: usamos el id #ag-header para ganar en especificidad a las reglas
   globales de Elementor (que llevaban !important y alta especificidad). */

/* El "Servicios" es un <button> y heredaba el botón naranja del sitio */
#ag-header .ag-menu__toggle {
	-webkit-appearance: none !important;
	appearance: none !important;
	background: none !important;
	background-color: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	padding: 10px 2px !important;
	min-height: 0 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	font-family: 'Poppins', sans-serif !important;
	font-weight: 500 !important;
	font-size: 16px !important;
	line-height: 1.2 !important;
	color: var(--ag-white) !important;
}

/* La hamburguesa es un <button> y heredaba el botón circular naranja del sitio */
#ag-header .ag-burger,
#ag-header .ag-burger:hover,
#ag-header .ag-burger:focus,
#ag-header .ag-burger:focus-visible {
	-webkit-appearance: none !important;
	appearance: none !important;
	background: none !important;
	background-color: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	padding: 0 !important;
	min-height: 0 !important;
	color: var(--ag-white) !important;
}

/* Enlaces del menú: blancos (Elementor los ponía naranja) */
#ag-header .ag-menu__link,
#ag-header a.ag-menu__link {
	color: var(--ag-white) !important;
	font-family: 'Poppins', sans-serif !important;
	text-decoration: none !important;
}
#ag-header .ag-menu__item.is-active > .ag-menu__link,
#ag-header .ag-menu__link:hover,
#ag-header .ag-menu__link:focus-visible,
#ag-header .ag-has-sub:hover > .ag-menu__toggle,
#ag-header .ag-has-sub.is-open > .ag-menu__toggle {
	color: var(--ag-orange) !important;
}

/* Submenú (fondo blanco): texto oscuro */
#ag-header .ag-submenu__link,
#ag-header a.ag-submenu__link {
	color: #1a1a1a !important;
	text-decoration: none !important;
}
#ag-header .ag-submenu__link:hover,
#ag-header .ag-submenu__link:focus-visible,
#ag-header .ag-submenu__item.is-active > .ag-submenu__link {
	color: var(--ag-orange) !important;
}

/* Teléfono en naranja */
#ag-header .ag-phone,
#ag-header a.ag-phone { color: var(--ag-orange) !important; text-decoration: none !important; }

/* Selector de idiomas */
#ag-header .ag-lang__item a { color: rgba(255, 255, 255, .8) !important; text-decoration: none !important; }
#ag-header .ag-lang__item a:hover,
#ag-header .ag-lang__item a:focus-visible { color: var(--ag-white) !important; }
#ag-header .ag-lang__item.is-active a { color: var(--ag-orange) !important; }

/* En el menú móvil, los enlaces del submenú van sobre fondo oscuro */
@media (max-width: 1024px) {
	#ag-header .ag-submenu__link,
	#ag-header a.ag-submenu__link { color: rgba(255, 255, 255, .75) !important; }
	#ag-header .ag-submenu__link:hover,
	#ag-header .ag-submenu__link:focus-visible,
	#ag-header .ag-submenu__item.is-active > .ag-submenu__link { color: var(--ag-orange) !important; }
}
