/**
 * GR Connect — Landing premium, reutilizable por cualquier marca del Grupo.
 *
 * Solo --gr-color-primary, --gr-color-secondary, --gr-color-buttons,
 * --gr-background, --gr-font, --gr-text, --gr-cta-text y (opcional)
 * --gr-text-muted-override vienen de los campos de la marca (inline style
 * en Views/frontend/landing.php). Todo lo demás — espaciados, radios,
 * sombras, tipografía fluida, tiempos de animación — es un sistema de
 * tokens fijo para que cualquier marca luzca consistente y premium
 * cambiando únicamente su contenido e identidad visual.
 */

.gr-connect-landing {
	/* --- Identidad de marca (existente, sin cambios de contrato) --- */
	--gr-color-primary: #0f172a;
	--gr-color-secondary: #38bdf8;
	--gr-color-buttons: #38bdf8;
	--gr-background: #0b1120;
	--gr-font: system-ui, -apple-system, "Segoe UI", sans-serif;
	--gr-cta-text: #06070c;

	/* --- Escala de espaciado --- */
	--gr-space-1: 4px;
	--gr-space-2: 8px;
	--gr-space-3: 12px;
	--gr-space-4: 16px;
	--gr-space-5: 24px;
	--gr-space-6: 32px;
	--gr-space-7: 48px;
	--gr-space-8: 72px;

	/* --- Radios y movimiento --- */
	--gr-radius-sm: 12px;
	--gr-radius-md: 18px;
	--gr-radius-lg: 28px;
	--gr-radius-full: 999px;
	--gr-ease: cubic-bezier(0.22, 1, 0.36, 1);
	--gr-duration: 320ms;

	/* --- Superficies derivadas de la marca (con fallback estático antes
	     de la versión color-mix(), por si el navegador no la soporta) --- */
	--gr-surface: rgba(255, 255, 255, 0.055);
	--gr-surface: color-mix(in srgb, white 6%, transparent);
	--gr-surface-hover: rgba(255, 255, 255, 0.09);
	--gr-surface-hover: color-mix(in srgb, white 9%, transparent);
	--gr-border: rgba(255, 255, 255, 0.12);
	--gr-border: color-mix(in srgb, white 12%, transparent);
	--gr-border-hover: rgba(255, 255, 255, 0.32);
	--gr-border-hover: color-mix(in srgb, var(--gr-color-buttons) 55%, white 20%);
	--gr-ring: rgba(255, 255, 255, 0.4);
	--gr-ring: color-mix(in srgb, var(--gr-color-buttons) 70%, white 30%);

	/* --gr-text lo fija la marca (fallback claro si no se configuró). El
	   texto secundario/tenue se deriva automáticamente de --gr-text salvo
	   que la marca haya definido --gr-text-muted-override explícitamente. */
	--gr-text: #f8fafc;
	--gr-text-muted: rgba(248, 250, 252, 0.68);
	--gr-text-muted: var(--gr-text-muted-override, color-mix(in srgb, var(--gr-text) 68%, transparent));
	--gr-text-faint: rgba(248, 250, 252, 0.46);
	--gr-text-faint: color-mix(in srgb, var(--gr-text) 46%, transparent);

	/* Texto de los botones de la lista: reposo cae al texto general, hover
	   cae al color de acento de botones, salvo que la marca los defina. */
	--gr-link-text: var(--gr-link-text-override, var(--gr-text));
	--gr-link-text-hover: var(--gr-link-text-hover-override, var(--gr-color-buttons));

	--gr-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
	--gr-shadow-md: 0 12px 30px -14px rgba(0, 0, 0, 0.55);
	--gr-shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.6);

	position: relative;
	isolation: isolate;
	overflow: hidden;
	min-height: 100vh;
	display: flex;
	justify-content: center;
	align-items: flex-start;
	padding: var(--gr-space-8) var(--gr-space-5) var(--gr-space-7);
	background: var(--gr-background);
	font-family: var(--gr-font);
	color: var(--gr-text);
	box-sizing: border-box;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

.gr-connect-landing *,
.gr-connect-landing *::before,
.gr-connect-landing *::after {
	box-sizing: inherit;
}

/* --- Grano sutil: SVG inline (data URI), sin ninguna petición externa --- */
.gr-connect-landing::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	opacity: 0.035;
	mix-blend-mode: overlay;
	pointer-events: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- Fondo ambiental: dos resplandores tomados de los colores de marca,
       puramente decorativos, sin depender de datos adicionales --- */
.gr-connect-glow {
	position: absolute;
	z-index: 0;
	width: min(60vw, 640px);
	height: min(60vw, 640px);
	border-radius: 50%;
	filter: blur(90px);
	opacity: 0.28;
	pointer-events: none;
}

.gr-connect-glow--a {
	top: -18%;
	left: -12%;
	background: radial-gradient(circle, var(--gr-color-secondary), transparent 70%);
}

.gr-connect-glow--b {
	bottom: -22%;
	right: -14%;
	background: radial-gradient(circle, var(--gr-color-primary), transparent 70%);
	opacity: 0.24;
}

.gr-connect-card {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 528px;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: var(--gr-space-6);
}

/* --- Header: logo + título + descripción --- */
.gr-connect-header {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--gr-space-3);
	width: 100%;
}

/* Avatar cuadrado: la imagen rellena el marco por completo (object-fit:
   cover, sin padding ni fondo visible detrás) — sin recortes de logo
   funciona mejor subiendo un logo ya cuadrado/con su propio fondo, como es
   el uso habitual en herramientas de "link in bio". */
.gr-connect-logo-frame {
	display: inline-flex;
	width: 104px;
	height: 104px;
	overflow: hidden;
	margin-bottom: var(--gr-space-2);
	border-radius: var(--gr-radius-lg);
	border: 1px solid var(--gr-border);
	box-shadow: var(--gr-shadow-md);
}

.gr-connect-logo {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.gr-connect-title {
	font-size: clamp(1.75rem, 1.35rem + 1.8vw, 2.5rem);
	font-weight: 700;
	line-height: 1.15;
	margin: 0;
	letter-spacing: -0.02em;
	background: linear-gradient(120deg, var(--gr-text) 40%, color-mix(in srgb, var(--gr-color-secondary) 70%, var(--gr-text)));
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

@supports not (background-clip: text) {
	.gr-connect-title {
		color: var(--gr-text);
	}
}

.gr-connect-description {
	margin: 0;
	max-width: 42ch;
	color: var(--gr-text-muted);
	font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1.05rem);
	line-height: 1.6;
	font-weight: 400;
}

/* --- CTA principal --- */
.gr-connect-cta-wrap {
	width: 100%;
	display: flex;
	justify-content: center;
}

.gr-connect-cta {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--gr-space-2);
	padding: 16px 32px;
	border-radius: var(--gr-radius-full);
	background: linear-gradient(135deg, var(--gr-color-secondary), var(--gr-color-primary));
	background-size: 160% 160%;
	background-position: 0% 50%;
	color: var(--gr-cta-text);
	font-weight: 700;
	font-size: 1rem;
	letter-spacing: -0.01em;
	text-decoration: none;
	box-shadow: var(--gr-shadow-md), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
	transition: transform var(--gr-duration) var(--gr-ease),
		box-shadow var(--gr-duration) var(--gr-ease),
		background-position var(--gr-duration) var(--gr-ease);
}

.gr-connect-cta-arrow {
	width: 18px;
	height: 18px;
	flex: 0 0 auto;
	transition: transform var(--gr-duration) var(--gr-ease);
}

.gr-connect-cta:hover,
.gr-connect-cta:focus-visible {
	transform: translateY(-3px);
	background-position: 100% 50%;
	box-shadow: var(--gr-shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

.gr-connect-cta:hover .gr-connect-cta-arrow,
.gr-connect-cta:focus-visible .gr-connect-cta-arrow {
	transform: translateX(3px);
}

.gr-connect-cta:active {
	transform: translateY(-1px) scale(0.98);
}

/* --- Lista de botones --- */
.gr-connect-buttons {
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: var(--gr-space-3);
}

.gr-connect-button {
	position: relative;
	display: flex;
	align-items: center;
	gap: var(--gr-space-4);
	width: 100%;
	min-height: 64px;
	padding: 14px var(--gr-space-5);
	border-radius: var(--gr-radius-md);
	text-decoration: none;
	color: var(--gr-text);
	background: var(--gr-surface);
	border: 1px solid var(--gr-border);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	box-shadow: var(--gr-shadow-sm);
	transition: transform var(--gr-duration) var(--gr-ease),
		background var(--gr-duration) var(--gr-ease),
		border-color var(--gr-duration) var(--gr-ease),
		box-shadow var(--gr-duration) var(--gr-ease);
}

.gr-connect-button:hover {
	transform: translateY(-2px);
	background: var(--gr-surface-hover);
	border-color: var(--gr-border-hover);
	box-shadow: var(--gr-shadow-md);
}

.gr-connect-button:active {
	transform: translateY(0) scale(0.99);
}

.gr-connect-button-icon {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: var(--gr-radius-sm);
	background: color-mix(in srgb, var(--gr-color-buttons) 16%, transparent);
	color: var(--gr-color-buttons);
	transition: background var(--gr-duration) var(--gr-ease), transform var(--gr-duration) var(--gr-ease);
}

.gr-connect-button:hover .gr-connect-button-icon {
	background: color-mix(in srgb, var(--gr-color-buttons) 26%, transparent);
	transform: scale(1.05);
}

.gr-connect-button-icon svg {
	width: 20px;
	height: 20px;
}

.gr-connect-button-text {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	text-align: left;
	gap: 2px;
	min-width: 0;
}

.gr-connect-button-name {
	font-weight: 600;
	font-size: 0.98rem;
	line-height: 1.3;
	letter-spacing: -0.005em;
	color: var(--gr-link-text);
	transition: color var(--gr-duration) var(--gr-ease);
}

.gr-connect-button:hover .gr-connect-button-name,
.gr-connect-button:focus-visible .gr-connect-button-name {
	color: var(--gr-link-text-hover);
}

.gr-connect-button-desc {
	font-size: 0.82rem;
	line-height: 1.4;
	color: var(--gr-text-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.gr-connect-button-chevron {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	color: var(--gr-text-faint);
	transition: transform var(--gr-duration) var(--gr-ease), color var(--gr-duration) var(--gr-ease);
}

.gr-connect-button:hover .gr-connect-button-chevron {
	transform: translateX(3px);
	color: var(--gr-color-buttons);
}

/* --- Footer --- */
.gr-connect-footer {
	width: 100%;
	margin-top: var(--gr-space-2);
	padding-top: var(--gr-space-5);
	border-top: 1px solid var(--gr-border);
}

.gr-connect-footer p {
	margin: 0;
	font-size: 0.78rem;
	line-height: 1.5;
	color: var(--gr-text-faint);
}

/* --- Foco accesible: visible siempre, con o sin soporte de :focus-visible --- */
.gr-connect-cta:focus-visible,
.gr-connect-button:focus-visible {
	outline: 2px solid var(--gr-ring);
	outline-offset: 3px;
}

.gr-connect-landing a:focus:not(:focus-visible) {
	outline: none;
}

/* --- Modo de alto contraste forzado (Windows High Contrast / forced-colors) --- */
@media (forced-colors: active) {
	.gr-connect-button,
	.gr-connect-cta {
		border: 1px solid CanvasText;
	}

	.gr-connect-glow,
	.gr-connect-landing::before {
		display: none;
	}
}

/* --- Movimiento reducido --- */
@media (prefers-reduced-motion: reduce) {
	.gr-connect-landing *,
	.gr-connect-landing *::before,
	.gr-connect-landing *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}

	.gr-connect-button:hover,
	.gr-connect-cta:hover {
		transform: none;
	}
}

/* --- Responsive --- */
@media (min-width: 640px) {
	.gr-connect-landing {
		padding-top: var(--gr-space-8);
		padding-bottom: var(--gr-space-8);
	}

	.gr-connect-card {
		gap: var(--gr-space-7);
	}
}

@media (max-width: 380px) {
	.gr-connect-landing {
		padding: var(--gr-space-6) var(--gr-space-4) var(--gr-space-5);
	}

	.gr-connect-card {
		gap: var(--gr-space-5);
	}

	.gr-connect-logo-frame {
		width: 80px;
		height: 80px;
	}

	.gr-connect-button {
		padding: 12px var(--gr-space-4);
		min-height: 58px;
	}

	.gr-connect-cta {
		width: 100%;
		padding: 14px var(--gr-space-5);
	}
}
