/*
 * Header Vecturex
 *
 * Calcado al milimetro de vecturex (6).html, adaptado a las clases
 * del template part vexturex/header. Se enquea desde functions.php
 * con el handle "vecturex-header", dependiendo de vecturex-style.
 *
 * Convenciones:
 *   - Selectores prefijados con .vtx-... para no contaminar el resto.
 *   - Las CSS variables locales reproducen los tokens del diseno
 *     original (--brand, --accent, --slate-d, etc.) para que las
 *     reglas sean declarativas y faciles de mantener.
 */

.vtx-header-shell {
	--brand:    #3e3a5f;
	--brand-2:  #4b466f;
	--accent:   #6c63d6;
	--accent-2: #8f87f0;
	--mist:     #e5e4f1;
	--mist-2:   #eeedf7;
	--slate:    #6c6b86;
	--slate-d:  #4a4966;
	--font-d:   "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--font-b:   "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--font-m:   "Space Mono", "SFMono-Regular", ui-monospace, Menlo, monospace;
	--ease:     cubic-bezier(.22, .61, .36, 1);

	background: rgba(244, 245, 251, 0.82);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	border-bottom: 1px solid transparent;
	font-family: var(--font-b);
	position: sticky;
	top: 0;
	transition: border-color 0.3s ease, background 0.3s ease;
	z-index: 60;
}

.vtx-header-shell.vtx-scrolled {
	background: rgba(244, 245, 251, 0.96);
	border-bottom-color: var(--mist);
}

.vtx-header-shell *,
.vtx-header-shell *::before,
.vtx-header-shell *::after {
	box-sizing: border-box;
}

/* -----------------------------------------------------------------
 * Wrap + Nav principal
 * ----------------------------------------------------------------- */

.vtx-header-shell .vtx-wrap {
	margin: 0 auto;
	max-width: 1200px;
	padding: 0 28px;
	width: 100%;
}

.vtx-header-shell .vtx-nav {
	align-items: center;
	display: flex;
	height: 76px;
	justify-content: space-between;
}

/* -----------------------------------------------------------------
 * Brand
 * ----------------------------------------------------------------- */

.vtx-header-shell .vtx-brand {
	align-items: center;
	color: var(--brand);
	display: flex;
	flex: none;
	font-family: var(--font-d);
	font-size: 1.4rem;
	font-weight: 700;
	gap: 0.6rem;
	letter-spacing: -0.03em;
	line-height: 1;
	text-decoration: none;
}

.vtx-header-shell .vtx-brand-img {
	display: block;
	flex: none;
	height: 30px;
	max-width: 100%;
	width: auto;
}

.vtx-header-shell .vtx-brand-word {
	color: var(--brand);
	display: inline-block;
	font-family: var(--font-d);
	font-size: 1.4rem;
	font-weight: 700;
	letter-spacing: -0.03em;
	line-height: 1;
}

/*
 * Cuando el <img> NO esta roto, ocultamos el texto duplicado.
 * :has() no es 100% compatible; usamos el patron clasico: si la
 * imagen tiene tamaño natural valido (complete), la marca visible
 * es la imagen y el texto se oculta.
 */
.vtx-header-shell .vtx-brand {
	position: relative;
}

.vtx-header-shell .vtx-brand-img:not([src=""]) {
	display: block;
}

/* Si la imagen carga correctamente (estado natural), el texto
   desaparece detras. Sin JS, lo mas limpio es mostrar siempre
   AMBOS y dejar que el texto funcione como refuerzo accesible
   cuando el PNG falle. Por defecto ambos visibles. */

.vtx-header-shell .vtx-brand-img {
	order: 1;
}

.vtx-header-shell .vtx-brand-word {
	order: 2;
}

/* -----------------------------------------------------------------
 * Nav links
 * ----------------------------------------------------------------- */

.vtx-header-shell .vtx-nav-links {
	align-items: center;
	display: flex;
	gap: 1.7rem;
}

.vtx-header-shell .vtx-nav-links a {
	align-items: center;
	color: var(--slate-d);
	display: inline-flex;
	font-family: var(--font-b);
	font-size: 0.95rem;
	font-weight: 500;
	line-height: 1.1;
	min-height: 40px;
	padding: 8px 2px 10px;
	position: relative;
	text-decoration: none;
	transition: color 0.2s ease;
	z-index: 1;
}

.vtx-header-shell .vtx-nav-links a::after {
	background: var(--accent);
	bottom: 6px;
	content: "";
	height: 2px;
	left: 0;
	pointer-events: none;
	position: absolute;
	transition: width 0.25s var(--ease);
	width: 0;
}

.vtx-header-shell .vtx-nav-links a:hover,
.vtx-header-shell .vtx-nav-links a:focus-visible,
.vtx-header-shell .vtx-nav-links a.is-active {
	color: var(--brand);
}

.vtx-header-shell .vtx-nav-links a:hover::after,
.vtx-header-shell .vtx-nav-links a:focus-visible::after,
.vtx-header-shell .vtx-nav-links a.is-active::after {
	width: 100%;
}

/* -----------------------------------------------------------------
 * CTA cluster (switch + login + cta + burger)
 * ----------------------------------------------------------------- */

.vtx-header-shell .vtx-nav-cta {
	align-items: center;
	display: flex;
	gap: 1rem;
}

/* -----------------------------------------------------------------
 * Language switch (ES / EN)
 * ----------------------------------------------------------------- */

.vtx-header-shell .vtx-lang-switch {
	align-items: center;
	background: #fff;
	border: 1.5px solid var(--mist);
	border-radius: 999px;
	display: inline-flex;
	overflow: hidden;
}

.vtx-header-shell .vtx-lang {
	background: none;
	border: none;
	border-radius: 999px;
	color: var(--slate);
	cursor: pointer;
	display: inline-flex;
	font-family: var(--font-m);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1;
	padding: 0.42rem 0.7rem;
	text-decoration: none;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.vtx-header-shell .vtx-lang.is-active {
	background: var(--brand);
	color: #fff;
}

.vtx-header-shell .vtx-lang:not(.is-active):hover {
	background: var(--mist-2);
	color: var(--brand);
}

/* -----------------------------------------------------------------
 * Login
 * ----------------------------------------------------------------- */

.vtx-header-shell .vtx-login {
	align-items: center;
	color: var(--brand);
	display: inline-flex;
	font-family: var(--font-d);
	font-size: 0.95rem;
	font-weight: 600;
	min-height: 40px;
	padding: 6px 2px;
	text-decoration: none;
	transition: color 0.2s ease;
}

.vtx-header-shell .vtx-login:hover,
.vtx-header-shell .vtx-login:focus-visible {
	color: var(--accent);
}

/* -----------------------------------------------------------------
 * CTA "Pide tu demo" (.btn .btn-primary del original)
 * ----------------------------------------------------------------- */

.vtx-header-shell .vtx-btn {
	align-items: center;
	border: none;
	border-radius: 999px;
	cursor: pointer;
	display: inline-flex;
	font-family: var(--font-d);
	font-size: 0.98rem;
	font-weight: 600;
	gap: 0.5rem;
	justify-content: center;
	padding: 0.85rem 1.5rem;
	text-decoration: none;
	transition: transform 0.2s var(--ease), box-shadow 0.25s var(--ease), background-color 0.2s ease;
	white-space: nowrap;
}

.vtx-header-shell .vtx-btn:focus-visible {
	outline: 3px solid var(--accent-2);
	outline-offset: 3px;
}

.vtx-header-shell .vtx-btn-primary {
	background: linear-gradient(135deg, var(--accent), #584fc6);
	box-shadow: 0 10px 28px -10px rgba(108, 99, 214, 0.75);
	color: #fff;
}

.vtx-header-shell .vtx-btn-primary:hover,
.vtx-header-shell .vtx-btn-primary:focus-visible {
	box-shadow: 0 16px 34px -12px rgba(108, 99, 214, 0.9);
	color: #fff;
	transform: translateY(-2px);
}

/* -----------------------------------------------------------------
 * Burger (movil)
 * ----------------------------------------------------------------- */

.vtx-header-shell .vtx-burger {
	align-items: center;
	background: none;
	border: none;
	cursor: pointer;
	display: none;
	flex-direction: column;
	gap: 5px;
	padding: 8px;
}

.vtx-header-shell .vtx-burger span {
	background: var(--brand);
	border-radius: 2px;
	display: block;
	height: 2px;
	transition: transform 0.3s ease, opacity 0.3s ease;
	width: 24px;
}

/* -----------------------------------------------------------------
 * Responsive
 * ----------------------------------------------------------------- */

@media (max-width: 1100px) {
	.vtx-header-shell .vtx-nav-links {
		gap: 1.2rem;
	}
}

@media (max-width: 980px) {
	.vtx-header-shell .vtx-nav {
		height: 64px;
	}
}

@media (max-width: 820px) {
	.vtx-header-shell .vtx-nav-links,
	.vtx-header-shell .vtx-login,
	.vtx-header-shell .vtx-lang-switch {
		display: none;
	}

	.vtx-header-shell .vtx-burger {
		display: flex;
	}
}

/*
 * Movil estrecho: la marca (logo + palabra) y el CTA no caben juntos.
 * Reducimos ambos para que el header nunca desborde horizontalmente.
 */
@media (max-width: 560px) {
	.vtx-header-shell .vtx-nav {
		gap: 8px;
	}

	.vtx-header-shell .vtx-brand {
		font-size: 1.1rem;
		gap: 0.4rem;
		min-width: 0;
	}

	.vtx-header-shell .vtx-brand-img {
		height: 24px;
	}

	.vtx-header-shell .vtx-brand-word {
		font-size: 1.1rem;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.vtx-header-shell .vtx-nav-cta {
		gap: 0.5rem;
	}

	.vtx-header-shell .vtx-btn {
		font-size: 0.85rem;
		padding: 0.6rem 0.95rem;
	}

	.vtx-header-shell .vtx-burger {
		padding: 6px;
	}
}

@media (max-width: 380px) {
	.vtx-header-shell .vtx-brand-word {
		display: none;
	}

	.vtx-header-shell .vtx-btn {
		font-size: 0.8rem;
		padding: 0.55rem 0.8rem;
	}
}

/* -----------------------------------------------------------------
 * Burger estados (animacion a X cuando esta abierto)
 * ----------------------------------------------------------------- */

.vtx-header-shell .vtx-burger.is-open span:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.vtx-header-shell .vtx-burger.is-open span:nth-child(2) {
	opacity: 0;
}

.vtx-header-shell .vtx-burger.is-open span:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* -----------------------------------------------------------------
 * Menu movil full-screen (drawer)
 *
 * Patron robusto:
 *   - Ocupa 100vw x 100vh con position:fixed y top:0.
 *   - La cabecera interna (.vtx-mmenu-bar) es sticky dentro del
 *     propio menu, no en el documento.
 *   - El scroll ocurre DENTRO del menu (.vtx-mmenu-body con
 *     overflow-y:auto), no en el body. Esto elimina el scroll
 *     chaining en iOS: el body queda completamente quieto.
 *   - Renderizado fuera del <header> para evitar el bug de iOS con
 *     backdrop-filter + position:fixed.
 * ----------------------------------------------------------------- */

.vtx-mobile-menu {
	--brand:    #3e3a5f;
	--brand-2:  #4b466f;
	--accent:   #6c63d6;
	--accent-2: #8f87f0;
	--mist:     #e5e4f1;
	--mist-2:   #eeedf7;
	--slate:    #6c6b86;
	--slate-d:  #4a4966;
	--font-d:   "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--font-b:   "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--font-m:   "Space Mono", "SFMono-Regular", ui-monospace, Menlo, monospace;
	--ease:     cubic-bezier(.22, .61, .36, 1);

	background: #fff;
	display: none;
	flex-direction: column;
	height: 100vh;
	height: 100dvh;
	left: 0;
	overflow: hidden;
	position: fixed;
	top: 0;
	width: 100vw;
	z-index: 70;
}

/*
 * Al abrir el drawer móvil ocultamos visualmente la barra del header
 * principal para evitar que se vea por debajo (logo/CTA duplicados).
 */
body.vtx-mmenu-open .vtx-header-shell {
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
	background: transparent;
	border-bottom-color: transparent;
}

body.vtx-mmenu-open .vtx-header-shell .vtx-wrap {
	visibility: hidden;
}

.vtx-mobile-menu.is-open {
	display: flex;
}

/* -----------------------------------------------------------------
 * Barra superior del menu (sticky dentro del propio menu)
 *
 * 56px de alto. Contiene: logo | CTA "Pide tu demo" | X cerrar.
 * Todos los elementos caben con align-items:center en un viewport
 * de 360px+. El CTA no tiene box-shadow para no distorsionar la
 * alineacion vertical dentro de la barra.
 * ----------------------------------------------------------------- */

.vtx-mobile-menu .vtx-mmenu-bar {
	align-items: center;
	background: #f4f5fb;
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	border-bottom: 1px solid var(--mist);
	box-sizing: border-box;
	display: flex;
	flex-shrink: 0;
	gap: 10px;
	height: 56px;
	min-height: 56px;
	padding: 0 12px 0 16px;
	position: sticky;
	top: 0;
	z-index: 2;
}

/* Marca dentro del menu: sin underline, mas pequena que la del header. */
.vtx-mobile-menu .vtx-mmenu-brand {
	align-items: center;
	color: var(--brand);
	display: inline-flex;
	flex: 1 1 auto;
	font-family: var(--font-d);
	font-size: 1.1rem;
	font-weight: 700;
	gap: 0.5rem;
	letter-spacing: -0.03em;
	line-height: 1;
	min-width: 0;
	text-decoration: none;
}

.vtx-mobile-menu .vtx-mmenu-brand:hover,
.vtx-mobile-menu .vtx-mmenu-brand:focus-visible {
	color: var(--brand);
}

.vtx-mobile-menu .vtx-mmenu-brand .vtx-brand-img {
	display: block;
	flex: none;
	height: 24px;
	max-height: 24px;
	max-width: 130px;
	object-fit: contain;
	width: auto;
}

.vtx-mobile-menu .vtx-mmenu-brand .vtx-brand-word {
	color: var(--brand);
	display: inline-block;
	font-family: var(--font-d);
	font-size: 1.1rem;
	font-weight: 700;
	letter-spacing: -0.03em;
	line-height: 1;
}

/* CTA del menu: compacto, sin box-shadow para que no distorsione
   la alineacion vertical dentro de la barra de 56px. */
.vtx-mobile-menu .vtx-mmenu-cta {
	align-items: center;
	background: linear-gradient(135deg, var(--accent), #584fc6);
	border: none;
	border-radius: 999px;
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	flex: 0 0 auto;
	font-family: var(--font-d);
	font-size: 0.84rem;
	font-weight: 600;
	justify-content: center;
	line-height: 1;
	padding: 0.5rem 0.85rem;
	text-decoration: none;
	transition: transform 0.2s var(--ease);
	white-space: nowrap;
}

.vtx-mobile-menu .vtx-mmenu-cta:hover,
.vtx-mobile-menu .vtx-mmenu-cta:focus-visible {
	color: #fff;
	transform: translateY(-1px);
}

/* Boton cerrar (X) del menu: cuadro 36x36 con dos rayitas cruzadas
   formando una X. Sin flex-direction column ni gap: las dos rayitas
   se posicionan absolutamente centradas. */
.vtx-mobile-menu .vtx-burger {
	align-items: center;
	background: #fff;
	border: 1px solid var(--mist);
	border-radius: 10px;
	box-sizing: border-box;
	cursor: pointer;
	display: flex;
	flex: 0 0 auto;
	height: 36px;
	justify-content: center;
	padding: 0;
	position: relative;
	transition: border-color 0.2s ease, background-color 0.2s ease;
	width: 36px;
}

.vtx-mobile-menu .vtx-burger:hover,
.vtx-mobile-menu .vtx-burger:focus-visible {
	background: #fff;
	border-color: var(--accent);
}

/* Las dos rayitas visibles (los span:nth-child 1 y 3) se posicionan
   centradas y rotadas para formar una X. La del medio (2) se oculta. */
.vtx-mobile-menu .vtx-burger span {
	background: var(--brand);
	border-radius: 2px;
	display: block;
	height: 2px;
	position: absolute;
	top: 50%;
	left: 50%;
	width: 18px;
}

.vtx-mobile-menu .vtx-burger span:nth-child(1) {
	transform: translate(-50%, -50%) rotate(45deg);
}

.vtx-mobile-menu .vtx-burger span:nth-child(2) {
	display: none;
}

.vtx-mobile-menu .vtx-burger span:nth-child(3) {
	transform: translate(-50%, -50%) rotate(-45deg);
}

/* -----------------------------------------------------------------
 * Cuerpo scrolleable del menu
 * ----------------------------------------------------------------- */

.vtx-mobile-menu .vtx-mmenu-body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

/* Lista de enlaces. */
.vtx-mobile-menu .vtx-mmenu-links {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	padding: 8px 20px 24px;
}

.vtx-mobile-menu .vtx-mlink {
	border-bottom: 1px solid var(--mist-2);
	color: var(--brand);
	display: block;
	font-family: var(--font-d);
	font-size: 1.08rem;
	font-weight: 600;
	padding: 18px 4px;
	text-decoration: none;
	transition: color 0.2s ease;
}

.vtx-mobile-menu .vtx-mlink:first-child {
	border-top: 1px solid var(--mist-2);
}

.vtx-mobile-menu .vtx-mlink:hover,
.vtx-mobile-menu .vtx-mlink:focus-visible {
	color: var(--accent);
}

/* Pie del menu (switch de idioma). */
.vtx-mobile-menu .vtx-mmenu-foot {
	background: #fff;
	border-top: 1px solid var(--mist);
	flex-shrink: 0;
	padding: 16px 20px 24px;
}

@media (max-width: 380px) {
	.vtx-mobile-menu .vtx-mmenu-cta {
		font-size: 0.8rem;
		padding: 0.45rem 0.7rem;
	}

	.vtx-mobile-menu .vtx-mmenu-brand .vtx-brand-word,
	.vtx-mobile-menu .vtx-mmenu-brand {
		font-size: 1.05rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.vtx-header-shell,
	.vtx-header-shell *,
	.vtx-mobile-menu,
	.vtx-mobile-menu * {
		animation-duration: 0s !important;
		transition-duration: 0s !important;
	}
}
