/* =========================================================
   Home v2 — Nexo Advisors
   Solo se carga en páginas con la sección marcadora .nexo-home-v2 (ver inc/home-v2.php).
   Paleta y tipografías del tema; todo el movimiento respeta prefers-reduced-motion.
   ========================================================= */

/* ---------- Comunes ---------- */
.nexo-v2 .nexo-v2-eyebrow {
	text-transform: uppercase;
	letter-spacing: .14em;
	font-size: 13px !important;
	margin-bottom: clamp(1.25rem, 3vw, 2rem) !important;
}
/* Microinteracción de botones: flecha que avanza al pasar el cursor */
.nexo-v2 .wp-block-button__link::after {
	content: "\2192";
	display: inline-block;
	margin-left: .55em;
	transition: transform .25s ease;
}
.nexo-v2 .wp-block-button__link:hover::after,
.nexo-v2 .wp-block-button__link:focus-visible::after { transform: translateX(3px); }

/* ---------- 1. Hero (oscuro) ---------- */
.nexo-v2-hero .nexo-v2-hero__grid { gap: clamp(2.75rem, 5vw, 4.5rem); }
.nexo-v2-hero .nexo-v2-hero__texto > * { margin-block: 0; }
.nexo-v2-hero .nexo-v2-hero__texto > * + * { margin-top: clamp(1.25rem, 2.6vw, 1.9rem); }
.nexo-editorial .nexo-v2-hero .nexo-hero-title {
	padding-right: 0;
	font-size: clamp(2.5rem, 1.55rem + 3.3vw, 4.25rem) !important;
	letter-spacing: -0.03em;
	line-height: 1.04;
	text-wrap: balance;
}
.nexo-v2-hero .nexo-lead { max-width: 34rem; }
.nexo-v2-hero .nexo-v2-hero__texto .wp-block-buttons { margin-top: clamp(1.75rem, 3.4vw, 2.5rem) !important; }
.nexo-v2-hero .nexo-v2-hero__img { margin: 0; }
.nexo-v2 .nexo-v2-hero__img picture,
.nexo-v2 .nexo-v2-card__img picture { display: block; }
.nexo-v2-hero .nexo-v2-hero__img img {
	display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover;
	background: var(--nexo-graphite);
	/* Fundido suave de los bordes con el grafito de la sección (la figura deja ≥3 % libre a los lados y ≥13 % arriba/abajo) */
	-webkit-mask-image: linear-gradient(to right, transparent, #000 2.5%, #000 97.5%, transparent), linear-gradient(to bottom, transparent, #000 9%, #000 91%, transparent);
	-webkit-mask-composite: source-in;
	mask-image: linear-gradient(to right, transparent, #000 2.5%, #000 97.5%, transparent), linear-gradient(to bottom, transparent, #000 9%, #000 91%, transparent);
	mask-composite: intersect;
}
@media (max-width: 781px) {
	.nexo-v2-hero .nexo-v2-hero__grid { gap: 2rem; }
	.nexo-v2-hero .nexo-v2-hero__visual { max-width: 400px; width: 100%; margin-inline: auto; }
	/* Móvil: el render (cuadrado) tiene ~25 % de fondo vacío arriba y ~13 % abajo, idéntico al grafito de la sección.
	   Se muestran solo las filas 260–1140 del original para acercar la figura al texto; la figura (y 320–1084) queda completa. */
	.nexo-v2-hero .nexo-v2-hero__img img {
		aspect-ratio: 1254 / 880;
		object-position: 50% 69.5%;
		-webkit-mask-image: linear-gradient(to right, transparent, #000 2.5%, #000 97.5%, transparent), linear-gradient(to bottom, transparent, #000 4%, #000 96%, transparent);
		mask-image: linear-gradient(to right, transparent, #000 2.5%, #000 97.5%, transparent), linear-gradient(to bottom, transparent, #000 4%, #000 96%, transparent);
	}
}

/* ---------- 2. El Desafío (claro) + diagrama ---------- */
/* Separación fina solo si la sección anterior también es oscura */
.has-contrast-background-color + .nexo-desafio.has-contrast-background-color { border-top: 1px solid color-mix(in srgb, var(--nexo-mineral-white) 12%, transparent); }

/* Colores del diagrama. Por defecto: fondo claro (blanco mineral), grafito + oliva oscuro.
   Oliva #566419: contraste 6,05:1 sobre #F7F7F2 y 5,46:1 sobre el relleno del nodo (AA). */
.nexo-diagrama {
	--nd-olive: #566419;
	--nd-ink: var(--nexo-graphite);
	--nd-label: color-mix(in srgb, var(--nexo-graphite) 72%, transparent);
	--nd-track: color-mix(in srgb, var(--nexo-graphite) 14%, transparent);
	--nd-track-out: color-mix(in srgb, var(--nd-olive) 30%, transparent);
	--nd-flow: color-mix(in srgb, var(--nexo-graphite) 55%, transparent);
	--nd-accent: var(--nd-olive);
	--nd-dot-fill: var(--nexo-mineral-white);
	--nd-dot-stroke: color-mix(in srgb, var(--nexo-graphite) 65%, transparent);
	--nd-node-fill: color-mix(in srgb, var(--nexo-mineral-lime) 22%, var(--nexo-mineral-white));
}
/* Variante sobre fondo grafito (referencia original) */
.has-contrast-background-color .nexo-diagrama {
	--nd-ink: var(--nexo-mineral-white);
	--nd-label: color-mix(in srgb, var(--nexo-mineral-white) 72%, transparent);
	--nd-track: color-mix(in srgb, var(--nexo-mineral-white) 16%, transparent);
	--nd-track-out: color-mix(in srgb, var(--nexo-mineral-lime) 30%, transparent);
	--nd-flow: color-mix(in srgb, var(--nexo-mineral-white) 58%, transparent);
	--nd-accent: var(--nexo-mineral-lime);
	--nd-dot-fill: var(--nexo-graphite);
	--nd-dot-stroke: color-mix(in srgb, var(--nexo-mineral-white) 70%, transparent);
	--nd-node-fill: color-mix(in srgb, var(--nexo-mineral-lime) 14%, var(--nexo-graphite));
}

.nexo-desafio__grid {
	display: grid;
	gap: clamp(2.75rem, 6vw, 4.5rem);
	align-items: center;
}
@media (min-width: 1024px) {
	.nexo-desafio__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); }
}
.nexo-desafio__texto > * { margin-block: 0; }
.nexo-desafio__texto > * + * { margin-top: clamp(1.25rem, 2.4vw, 1.75rem); }
.nexo-desafio h2 { max-width: 15em; text-wrap: balance; }
.nexo-desafio .nexo-lead { max-width: 34rem; }

/* ---------- Figura ---------- */
.nexo-diagrama { margin: 0; width: 100%; max-width: 640px; justify-self: center; }
.nexo-diagrama__svg { display: block; width: 100%; height: auto; overflow: visible; }
.nexo-diagrama__svg--v { display: none; }
@media (max-width: 599px) {
	.nexo-diagrama__svg--h { display: none; }
	.nexo-diagrama__svg--v { display: block; max-width: 360px; margin-inline: auto; }
}

.nexo-diagrama text {
	font-family: var(--wp--preset--font-family--inter), sans-serif;
	font-size: 17px;
	fill: var(--nd-label);
}
.nexo-diagrama__svg--v text { font-size: 15.5px; }
.nexo-diagrama .nd-label-out { fill: var(--nd-ink); font-weight: 500; }
.nexo-diagrama .nd-label-node { fill: var(--nd-accent); font-weight: 600; }

/* Líneas: base fija + flujo discontinuo encima */
.nexo-diagrama path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nexo-diagrama .nd-track { stroke: var(--nd-track); }
.nexo-diagrama .nd-track--out { stroke: var(--nd-track-out); }
.nexo-diagrama .nd-flow { stroke: var(--nd-flow); stroke-dasharray: 10 16; }
.nexo-diagrama .nd-flow--out { stroke: var(--nd-accent); }
.nexo-diagrama .nd-arrow { stroke: var(--nd-accent); stroke-width: 2.5; }

.nexo-diagrama .nd-input circle {
	fill: var(--nd-dot-fill);
	stroke: var(--nd-dot-stroke);
	stroke-width: 2;
}
.nexo-diagrama .nd-node > rect:first-child {
	fill: var(--nd-node-fill);
	stroke: var(--nd-accent);
	stroke-width: 2;
}
.nexo-diagrama .nd-bar { fill: var(--nd-accent); }

/* ---------- Movimiento (solo si el usuario no pide reducirlo) ---------- */
@media (prefers-reduced-motion: no-preference) {
	/* Flujo continuo y pausado: un tramo de 26 unidades cada 2,6 s */
	.nexo-diagrama .nd-flow { animation: nd-flujo 2.6s linear infinite; }
	@keyframes nd-flujo { to { stroke-dashoffset: -26; } }

	/* El nodo «respira» con las barras, muy suave y desfasado */
	.nexo-diagrama .nd-bar {
		transform-box: fill-box;
		transform-origin: 50% 100%;
		animation: nd-barra 5.4s ease-in-out infinite;
	}
	.nexo-diagrama .nd-bar:nth-of-type(3) { animation-delay: -1.8s; }
	.nexo-diagrama .nd-bar:nth-of-type(4) { animation-delay: -3.6s; }
	@keyframes nd-barra { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.8); } }

	/* Entrada única (solo si el diagrama estaba fuera de pantalla al cargar: clase is-armed por JS) */
	.nexo-diagrama.is-armed .nd-track { stroke-dasharray: 1; stroke-dashoffset: 1; }
	.nexo-diagrama.is-armed .nd-reveal,
	.nexo-diagrama.is-armed .nd-flows { opacity: 0; }
	.nexo-diagrama.is-armed .nd-node { transform-box: fill-box; transform-origin: 50% 50%; }

	.nexo-diagrama.is-armed.is-in .nd-track { animation: nd-trazo 1.1s cubic-bezier(.45, 0, .2, 1) var(--d, 0s) forwards; }
	.nexo-diagrama.is-armed.is-in .nd-reveal { animation: nd-aparece .7s ease-out var(--d, 0s) forwards; }
	.nexo-diagrama.is-armed.is-in .nd-node { animation-name: nd-aparece-nodo; }
	.nexo-diagrama.is-armed.is-in .nd-flows { animation: nd-aparece 1s ease-out 1.7s forwards; }
	@keyframes nd-trazo { to { stroke-dashoffset: 0; } }
	@keyframes nd-aparece { to { opacity: 1; } }
	@keyframes nd-aparece-nodo { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }

	/* Fuera de pantalla no se anima nada (ahorro de batería) */
	.nexo-diagrama.is-armed:not(.is-visible) .nd-flow,
	.nexo-diagrama.is-armed:not(.is-visible) .nd-bar { animation-play-state: paused; }
}
.nexo-desafio .nexo-desafio__grid > * { margin-block: 0; }

/* ---------- «El Desafío» como figura estática (PNG 1536×1024) ----------
   El archivo web tiene el fondo en blanco puro y se funde con multiply: blanco × #F7F7F2 = el fondo exacto de la sección.
   La figura (con sombras) ocupa x 172–1386 · y 294–772 del original. */
.nexo-desafio .nexo-desafio__img { margin: 0; width: 100%; max-width: 680px; justify-self: center; }
.nexo-desafio .nexo-desafio__img picture { display: block; }
.nexo-desafio .nexo-desafio__img img {
	display: block; width: 100%; height: auto; aspect-ratio: 3 / 2;
	mix-blend-mode: multiply;
	/* Fundido suave de bordes (márgenes libres: 11 % a los lados, ≥25 % arriba/abajo) */
	-webkit-mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent), linear-gradient(to bottom, transparent, #000 8%, #000 92%, transparent);
	-webkit-mask-composite: source-in;
	mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent), linear-gradient(to bottom, transparent, #000 8%, #000 92%, transparent);
	mask-composite: intersect;
}
@media (max-width: 599px) {
	/* Móvil: a sangre (todo el ancho de la pantalla) y sin el fondo vacío: se ven las columnas 148–1410
	   y las filas 258–814 del original: todas las piezas y sus sombras completas (la sombra termina en ~800). */
	.nexo-desafio .nexo-desafio__img {
		position: relative; overflow: hidden;
		width: 100vw; max-width: none; margin-inline: calc(50% - 50vw);
		aspect-ratio: 1262 / 556;
	}
	.nexo-desafio .nexo-desafio__img img {
		position: absolute; max-width: none;
		width: 121.712%; left: -11.727%; top: -46.403%;
		-webkit-mask-image: linear-gradient(to bottom, transparent, #000 6%, #000 94%, transparent);
		mask-image: linear-gradient(to bottom, transparent, #000 6%, #000 94%, transparent);
	}
}

/* ---------- 3. Nexo Mapa 360 (oscuro): tarjetas de entregables ---------- */
.nexo-v2-servicio .nexo-v2-servicio__cabecera { gap: clamp(2rem, 5vw, 4rem); }
.nexo-v2-servicio .nexo-v2-servicio__cabecera > .wp-block-column > * { margin-block: 0; }
.nexo-v2-servicio .nexo-v2-servicio__cabecera > .wp-block-column > * + * { margin-top: 1.1rem; }
.nexo-v2-servicio .nexo-v2-servicio__cabecera .wp-block-buttons { margin-top: 1.75rem !important; }

.nexo-v2 .nexo-v2-cards {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: clamp(1rem, 1.8vw, 1.5rem);
	margin-top: clamp(3rem, 6vw, 4.5rem) !important;
}
.nexo-v2 .nexo-v2-card {
	margin: 0 !important;
	display: flex; flex-direction: column;
	border: 1px solid color-mix(in srgb, var(--nexo-mineral-white) 12%, transparent);
	border-radius: 6px;
	/* Mismo grafito que la sección: el render continúa el fondo sin un recuadro más claro */
	background: var(--nexo-graphite);
	overflow: hidden;
	padding-bottom: 1.6rem;
	transition: transform .4s cubic-bezier(.2, .7, .2, 1), border-color .4s ease;
}
.nexo-v2 .nexo-v2-card > * { margin-block: 0 !important; padding-inline: 1.3rem; }
.nexo-v2 .nexo-v2-card > .nexo-v2-card__img { padding: 0; margin-bottom: 1.3rem !important; overflow: hidden; aspect-ratio: 1 / 1; }
.nexo-v2 .nexo-v2-card__img img {
	display: block; width: 100%; height: 100%; aspect-ratio: 1 / 1; object-fit: cover;
	transition: transform .8s cubic-bezier(.2, .7, .2, 1);
	/* Las figuras dejan ≥10 % libre a los lados y ≥14 % arriba/abajo: el fundido no las toca */
	-webkit-mask-image: linear-gradient(to right, transparent, #000 9%, #000 91%, transparent), linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent);
	-webkit-mask-composite: source-in;
	mask-image: linear-gradient(to right, transparent, #000 9%, #000 91%, transparent), linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent);
	mask-composite: intersect;
}
.nexo-v2 .nexo-v2-card__num {
	font-family: var(--wp--preset--font-family--urbanist); font-weight: 700; font-size: 14px;
	letter-spacing: .04em; color: var(--nexo-mineral-lime);
}
.nexo-v2 .nexo-v2-card h3 { margin-top: .55rem !important; font-size: clamp(1.05rem, .98rem + .3vw, 1.2rem); line-height: 1.3; font-weight: 600; text-wrap: balance; }
.nexo-v2 .nexo-v2-card .nexo-muted { margin-top: .65rem !important; font-size: 15px; line-height: 1.55; }
@media (hover: hover) {
	.nexo-v2 .nexo-v2-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--nexo-mineral-lime) 55%, transparent); }
	.nexo-v2 .nexo-v2-card:hover .nexo-v2-card__img img { transform: scale(1.03); }
}
@media (max-width: 1023px) {
	.nexo-v2 .nexo-v2-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 599px) {
	/* Carrusel deslizable con la siguiente tarjeta asomando */
	.nexo-v2 .nexo-v2-cards {
		grid-template-columns: none;
		grid-auto-flow: column;
		grid-auto-columns: 80%;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
		margin-inline: calc(-1 * var(--wp--style--root--padding-left, 1.25rem)) calc(-1 * var(--wp--style--root--padding-right, 1.25rem)) !important;
		padding-inline: var(--wp--style--root--padding-left, 1.25rem) var(--wp--style--root--padding-right, 1.25rem);
		scroll-padding-inline: var(--wp--style--root--padding-left, 1.25rem);
		max-width: none !important;
	}
	.nexo-v2 .nexo-v2-cards::-webkit-scrollbar { display: none; }
	.nexo-v2 .nexo-v2-card { scroll-snap-align: start; }
}

/* ---------- 4. Nuestro Enfoque (claro): línea de metodología ---------- */
.nexo-v2 .nexo-v2-steps {
	--paso-gap: clamp(1rem, 2vw, 1.75rem);
	list-style: none; padding: 0; position: relative;
	display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--paso-gap);
	margin-top: clamp(3rem, 6vw, 4.5rem) !important;
}
.nexo-v2 .nexo-v2-steps::before {
	content: ""; position: absolute; top: 7px; left: 7px;
	right: calc((100% - 4 * var(--paso-gap)) / 5 - 7px);
	height: 2px; background: color-mix(in srgb, var(--nexo-graphite) 16%, transparent);
	transform-origin: left center;
}
.nexo-v2 .nexo-v2-steps li { position: relative; margin: 0; padding-top: 2.4rem; }
.nexo-v2 .nexo-v2-steps li::before {
	content: ""; position: absolute; top: 0; left: 0; width: 16px; height: 16px; box-sizing: border-box;
	border-radius: 50%; border: 2px solid color-mix(in srgb, var(--nexo-graphite) 55%, transparent);
	background: var(--nexo-mineral-white);
}
.nexo-v2 .nexo-v2-steps li:last-child::before { background: #566419; border-color: #566419; }
.nexo-v2 .nexo-v2-steps strong {
	display: block; font-family: var(--wp--preset--font-family--urbanist); font-weight: 600;
	font-size: clamp(1.02rem, .98rem + .25vw, 1.15rem); line-height: 1.3; color: var(--nexo-graphite);
}
.nexo-v2 .nexo-v2-steps span { display: block; margin-top: .5rem; font-size: 15px; line-height: 1.55; color: var(--nexo-muted); }
@media (max-width: 781px) {
	.nexo-v2 .nexo-v2-steps { grid-template-columns: 1fr; gap: 1.6rem; }
	.nexo-v2 .nexo-v2-steps::before { top: 8px; bottom: 8px; left: 7px; right: auto; width: 2px; height: auto; transform-origin: center top; }
	.nexo-v2 .nexo-v2-steps li { padding-top: 0; padding-left: 2.4rem; }
	.nexo-v2 .nexo-v2-steps li::before { top: .2rem; }
}

/* ---------- 5. CTA final (oscuro): líneas que convergen ---------- */
.nexo-v2-cta { position: relative; overflow: hidden; }
.nexo-v2-cta > :not(.nexo-v2-cta__lineas) { position: relative; z-index: 1; }
.nexo-v2-cta .nexo-v2-cta__lineas {
	position: absolute; z-index: 0; top: 50%; right: max(-2vw, -24px); transform: translateY(-50%);
	width: min(44vw, 600px); margin: 0 !important; pointer-events: none;
}
.nexo-v2-cta__lineas svg { display: block; width: 100%; height: auto; }
.nexo-v2-cta__lineas path { fill: none; stroke-width: 1.5; stroke-linecap: round; }
.nexo-v2-cta__lineas .cl-track { stroke: color-mix(in srgb, var(--nexo-mineral-white) 10%, transparent); }
.nexo-v2-cta__lineas .cl-flow { stroke: color-mix(in srgb, var(--nexo-mineral-white) 30%, transparent); stroke-dasharray: 8 18; }
.nexo-v2-cta__lineas .cl-dot { fill: var(--nexo-mineral-lime); }
@media (min-width: 900px) {
	/* El texto ocupa la parte izquierda; las líneas, la derecha */
	.nexo-v2-cta > .alignwide { box-sizing: border-box; padding-right: min(42%, 34rem); }
}
@media (max-width: 899px) { .nexo-v2-cta .nexo-v2-cta__lineas { display: none; } }

/* ---------- Movimiento ---------- */
@media (prefers-reduced-motion: no-preference) {
	/* Hero: la imagen flota muy despacio */
	.nexo-v2-hero .nexo-v2-hero__img img { animation: nv2-flota 9s ease-in-out infinite alternate; }
	@keyframes nv2-flota { from { transform: translateY(0); } to { transform: translateY(-10px); } }

	/* CTA: flujo lento hacia el punto lima */
	.nexo-v2-cta__lineas .cl-flow { animation: nv2-flujo 3.2s linear infinite; }
	@keyframes nv2-flujo { to { stroke-dashoffset: -26; } }

	/* Aparición al hacer scroll (JS añade .nv2-armed solo a lo que está fuera de pantalla) */
	.nv2-armed { opacity: 0; transform: translateY(16px); }
	.nv2-armed.nv2-in { opacity: 1; transform: none; transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--nv2-d, 0s); }

	/* Metodología: la línea se dibuja y los pasos aparecen en orden */
	.nexo-v2 .nexo-v2-steps.nv2-armed { opacity: 1; transform: none; }
	.nexo-v2 .nexo-v2-steps.nv2-armed::before { transform: scaleX(0); }
	.nexo-v2 .nexo-v2-steps.nv2-armed li { opacity: 0; transform: translateY(10px); }
	.nexo-v2 .nexo-v2-steps.nv2-armed.nv2-in::before { transform: none; transition: transform 1.4s cubic-bezier(.45, 0, .2, 1); }
	.nexo-v2 .nexo-v2-steps.nv2-armed.nv2-in li { opacity: 1; transform: none; transition: opacity .6s ease, transform .6s ease; }
	.nexo-v2 .nexo-v2-steps.nv2-armed.nv2-in li:nth-child(2) { transition-delay: .25s; }
	.nexo-v2 .nexo-v2-steps.nv2-armed.nv2-in li:nth-child(3) { transition-delay: .5s; }
	.nexo-v2 .nexo-v2-steps.nv2-armed.nv2-in li:nth-child(4) { transition-delay: .75s; }
	.nexo-v2 .nexo-v2-steps.nv2-armed.nv2-in li:nth-child(5) { transition-delay: 1s; }
	@media (max-width: 781px) {
		.nexo-v2 .nexo-v2-steps.nv2-armed::before { transform: scaleY(0); }
	}
}
