/**
 * SemiConecta — header y navegación.
 */

.skip-link {
	position: fixed;
	z-index: 9999;
	top: 12px;
	left: 12px;
	padding: 10px 14px;
	color: var(--ink);
	background: var(--yellow);
	font-weight: 800;
	transform: translateY(-160%);
	transition: transform .2s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* --- Header contenedor --- */
.site-header {
	position: fixed;
	z-index: 1000;
	inset: 0 0 auto;
	height: var(--header-h);
	color: var(--white);
	border-bottom: 1px solid transparent;
	transition: background .28s, border-color .28s, color .28s, box-shadow .28s;
}
.site-header.is-scrolled,
.site-header.has-open-menu,
body:not(.sc-home) .site-header {
	color: var(--ink);
	background: rgba(255, 255, 255, .975);
	border-color: var(--gray-200);
	box-shadow: 0 8px 30px rgba(0, 0, 0, .045);
	backdrop-filter: saturate(1.5) blur(6px);
}

.header-inner {
	width: var(--container);
	height: 100%;
	margin-inline: auto;
	display: grid;
	grid-template-columns: 205px 1fr auto;
	align-items: center;
	gap: 26px;
}

/* --- Logo --- */
.brand-logo { display: inline-flex; width: 180px; align-items: center; text-decoration: none; }
.brand-logo img { width: 100%; height: auto; }
.brand-logo .logo-dark { display: none; }
.site-header.is-scrolled .brand-logo .logo-light,
.site-header.has-open-menu .brand-logo .logo-light,
body:not(.sc-home) .site-header .brand-logo .logo-light { display: none; }
.site-header.is-scrolled .brand-logo .logo-dark,
.site-header.has-open-menu .brand-logo .logo-dark,
body:not(.sc-home) .site-header .brand-logo .logo-dark { display: block; }

/* --- Nav escritorio --- */
.desktop-nav { display: flex; justify-content: center; align-items: center; gap: 2px; }
.nav-link, .nav-trigger {
	position: relative;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	border-radius: var(--radius-xs);
	padding: 10px 12px;
	color: inherit;
	text-decoration: none;
	font-family: var(--font-body);
	font-size: .9rem;
	font-weight: 750;
	cursor: pointer;
}
.nav-link::after, .nav-trigger::after {
	content: "";
	position: absolute;
	left: 12px; right: 12px; bottom: 5px;
	height: 2px;
	background: var(--yellow);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform .22s var(--ease);
}
.nav-link:hover::after,
.nav-trigger:hover::after,
.nav-trigger[aria-expanded="true"]::after { transform: scaleX(1); }
.nav-trigger svg { width: 13px; height: 13px; transition: transform .2s; }
.nav-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }

/* --- Header actions --- */
.header-actions { display: flex; align-items: center; gap: 9px; }
.header-login { padding: 10px 8px; font-size: .88rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.header-actions .button { min-height: 42px; padding: 9px 14px; font-size: .86rem; }

/* --- Menu button (móvil) --- */
.menu-button {
	display: none;
	width: 46px; height: 46px;
	place-items: center;
	border: 1px solid currentColor;
	background: transparent;
}
.menu-button span,
.menu-button::before,
.menu-button::after {
	content: "";
	display: block;
	width: 20px; height: 2px;
	background: currentColor;
	transition: transform .25s, opacity .25s;
}
.menu-button span { margin: 4px 0; }
.menu-button[aria-expanded="true"]::before { transform: translateY(6px) rotate(45deg); }
.menu-button[aria-expanded="true"] span { opacity: 0; }
.menu-button[aria-expanded="true"]::after { transform: translateY(-6px) rotate(-45deg); }

/* --- Mega menu --- */
.mega-shell {
	position: fixed;
	z-index: 990;
	top: var(--header-h);
	left: 0; right: 0;
	visibility: hidden;
	opacity: 0;
	transform: translateY(-12px);
	pointer-events: none;
	transition: opacity .22s, transform .28s var(--ease), visibility .22s;
}
.mega-shell.is-open { visibility: visible; opacity: 1; transform: translateY(0); pointer-events: auto; }
.mega-panel {
	display: none;
	width: var(--container);
	margin-inline: auto;
	color: var(--ink);
	background: var(--white);
	border: 1px solid var(--gray-200);
	border-top: 3px solid var(--yellow);
	box-shadow: var(--shadow-panel);
	border-radius: 0 0 14px 14px;
}
.mega-panel.is-active { display: grid; grid-template-columns: 300px 1fr 280px; align-items: stretch; animation: megaIn .26s var(--sc-ease-tech, ease); }
@keyframes megaIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Intro OSCURA (arregla el blanco-sobre-blanco: fondo grafito, texto claro) */
.mega-intro {
	position: relative;
	padding: 38px;
	background: linear-gradient(160deg, var(--grafito), #000);
	color: var(--white);
	overflow: hidden;
}
.mega-intro::before {
	content: "";
	position: absolute; inset: 0;
	background-image: radial-gradient(rgba(255,255,255,.14) 1px, transparent 1.4px);
	background-size: 22px 22px;
	mask-image: linear-gradient(140deg, #000, transparent 70%);
	opacity: .5;
	pointer-events: none;
}
.mega-intro > * { position: relative; z-index: 1; }
.mega-intro .area-code { color: var(--yellow); font-family: var(--font-mono, monospace); font-weight: 700; font-size: .7rem; letter-spacing: .16em; }
.mega-intro h2 { margin: 20px 0 12px; font-size: 1.7rem; color: var(--white); line-height: 1.12; }
.mega-intro p { color: rgba(255,255,255,.7); font-size: .92rem; line-height: 1.55; }
.mega-intro .text-link { display: inline-block; margin-top: 18px; color: var(--yellow); font-weight: 800; text-decoration: none; font-size: .9rem; }
.mega-intro .text-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Links: tarjetas con índice mono y flecha que aparece */
.mega-links {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	align-content: start;
	gap: 4px 16px;
	padding: 26px 30px;
}
.mega-links > a {
	position: relative;
	display: grid;
	grid-template-columns: 30px 1fr auto;
	gap: 11px;
	align-items: center;
	padding: 14px 12px;
	border-bottom: 1px solid var(--gray-100);
	text-decoration: none;
	font-weight: 700;
	color: var(--ink);
	border-radius: 8px;
	transition: background .18s, transform .18s;
}
.mega-links > a::after { content: "→"; color: var(--gray-300); font-weight: 900; transition: color .18s, transform .18s; }
.mega-links > a:hover { background: var(--yellow-soft); transform: translateX(3px); }
.mega-links > a:hover::after { color: var(--ink); transform: translateX(2px); }
.mega-links > a span:first-child { color: var(--ink-strong); font-family: var(--font-mono, monospace); font-size: .72rem; font-weight: 700; letter-spacing: .06em; }

/* Visual PCB */
.mega-visual {
	position: relative;
	overflow: hidden;
	padding: 30px;
	color: var(--white);
	background: linear-gradient(150deg, var(--grafito), #000);
}
.mega-visual svg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .82; }
.mega-visual-content { position: relative; z-index: 1; display: flex; min-height: 260px; flex-direction: column; justify-content: flex-end; }
.mega-visual strong { font-family: var(--font-display); font-size: 1.3rem; }
.mega-visual small { margin-top: 9px; color: rgba(255, 255, 255, .6); font-family: var(--font-mono, monospace); font-size: .72rem; letter-spacing: .06em; }
.mega-backdrop {
	position: fixed; z-index: 980; inset: var(--header-h) 0 0;
	display: none; background: rgba(8,8,10, .32);
}
.mega-backdrop.is-visible { display: block; }

/* --- Mobile drawer --- */
.mobile-drawer {
	position: fixed;
	z-index: 1200;
	inset: 0 0 0 auto;
	width: min(440px, 100%);
	overflow: auto;
	color: var(--ink);
	background: var(--white);
	transform: translateX(105%);
	transition: transform .36s var(--ease);
	box-shadow: -20px 0 60px rgba(0, 0, 0, .2);
}
.mobile-drawer.is-open { transform: translateX(0); }
.mobile-drawer-head { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--gray-200); }
.mobile-drawer-head img { width: 166px; }
.mobile-drawer-head .logo-light { display: none !important; }
.mobile-drawer-head .logo-dark { display: block !important; }
.mobile-close { width: 44px; height: 44px; border: 1px solid var(--gray-300); background: transparent; font-size: 1.6rem; }
.mobile-nav { padding: 18px 20px 36px; }
.mobile-home { display: flex; align-items: center; min-height: 54px; padding: 0 8px; border-bottom: 1px solid var(--gray-200); font-weight: 850; text-decoration: none; }
.mobile-branch { border-bottom: 1px solid var(--gray-200); }
.mobile-branch > button { width: 100%; min-height: 58px; display: flex; justify-content: space-between; align-items: center; padding: 0 8px; background: transparent; font-weight: 850; text-align: left; }
.mobile-branch > button span:last-child { font-size: 1.4rem; transition: transform .2s; }
.mobile-branch > button[aria-expanded="true"] span:last-child { transform: rotate(45deg); }
.mobile-branch-links { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease); }
.mobile-branch-links > div { overflow: hidden; }
.mobile-branch-links.is-open { grid-template-rows: 1fr; }
.mobile-branch-links a { display: block; padding: 10px 12px 10px 24px; color: var(--gray-700); text-decoration: none; font-size: .94rem; }
.mobile-auth { display: grid; gap: 10px; padding-top: 26px; }
.mobile-backdrop { position: fixed; z-index: 1150; inset: 0; visibility: hidden; opacity: 0; background: rgba(8,8,10, .55); transition: .25s; }
.mobile-backdrop.is-visible { visibility: visible; opacity: 1; }

/* --- Responsive --- */
@media (max-width: 1080px) {
	.desktop-nav, .header-actions { display: none; }
	.menu-button { display: grid; }
	.header-inner { grid-template-columns: 1fr auto; }
}

/* --- Notification bell --- */
.header-bell {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	color: inherit;
	text-decoration: none;
	transition: color .2s;
}
.header-bell:hover { color: var(--yellow); }
.header-bell-badge {
	position: absolute;
	top: 2px; right: 2px;
	min-width: 18px;
	height: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
	background: var(--danger);
	color: var(--white);
	font-size: .65rem;
	font-weight: 900;
	border-radius: 9px;
	line-height: 1;
}

/* ============================================================
   REFINAMIENTO HEADER + MEGA MENÚ (v0.9)
   ============================================================ */

/* Header en el landing: barra glass sutil desde el inicio, más presencia */
.sc-home .site-header:not(.is-scrolled):not(.has-open-menu) {
	background: linear-gradient(180deg, rgba(14,14,17,.55), transparent);
	backdrop-filter: blur(2px);
}

/* Links con más aire y peso tipográfico */
.nav-link, .nav-trigger {
	font-size: .95rem;
	font-weight: 700;
	letter-spacing: .01em;
	padding: 10px 4px;
}
/* Subrayado animado más fino y elegante (amarillo) */
.nav-link::after, .nav-trigger::after {
	height: 2px;
	background: var(--yellow);
	border-radius: 2px;
}

/* Botón login/CTA header más pulido */
.header-actions .button--primary {
	box-shadow: 0 6px 18px rgba(255,213,0,.28);
	transition: transform .2s, box-shadow .2s;
}
.header-actions .button--primary:hover {
	transform: translateY(-1px);
	box-shadow: 0 10px 26px rgba(255,213,0,.4);
}

/* Campana con animación sutil al haber notificaciones */
.header-bell-badge { animation: bellPop .4s ease; }
@keyframes bellPop { 0% { transform: scale(0); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* --- MEGA PANEL: más profundidad y transición --- */
.mega-panel {
	border-radius: 0 0 16px 16px;
	box-shadow: 0 30px 80px rgba(8,8,10,.16);
	border-top: 3px solid var(--yellow);
	animation: megaIn .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes megaIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.mega-intro { background: linear-gradient(160deg, var(--navy-3), var(--ink-strong)); color: var(--white); padding: 34px 30px; border-radius: 0; }
.mega-intro .area-code { color: var(--yellow); }
.mega-intro h2 { color: var(--white); font-size: 1.7rem; line-height: 1.15; }
.mega-intro p { color: rgba(255,255,255,.7); }

/* Enlaces del mega con hover de tarjeta */
.mega-links > a {
	border-radius: 10px;
	padding: 14px 16px;
	transition: background .18s, transform .18s;
}
.mega-links > a:hover { background: var(--yellow-soft); transform: translateX(3px); }
.mega-links a span:first-child { color: var(--ink-strong); font-weight: 900; }

/* Panel visual derecho del mega */
.mega-visual { background: var(--gray-50); border-left: 1px solid var(--gray-200); }
.mega-visual strong { color: var(--ink-strong); }

@media (max-width: 980px) {
	.nav-link, .nav-trigger { font-size: 1.05rem; }
}

/* ===== Mega-menú: subgrupos padre-hijo (v0.33) ===== */
.mega-links { align-content: start; }
.mega-links:has(.mega-group) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 28px; }
.mega-group { display: flex; flex-direction: column; }
.mega-group-head {
	display: grid; grid-template-columns: 30px 1fr; gap: 11px; align-items: center;
	padding: 10px 12px; margin-bottom: 4px; text-decoration: none; font-weight: 800;
	color: var(--ink); border-bottom: 2px solid var(--yellow);
}
.mega-group-head span:first-child { color: var(--ink-strong); font-family: var(--font-mono, monospace); font-size: .72rem; font-weight: 700; }
.mega-group-head:hover { color: var(--yellow-dark); }
.mega-sublinks { list-style: none; margin: 2px 0 0; padding: 0; }
.mega-sublinks li { margin: 0; }
.mega-sublinks a {
	display: flex; align-items: center; gap: 8px;
	padding: 9px 12px 9px 41px; text-decoration: none;
	color: var(--gray-600); font-size: .9rem; font-weight: 600;
	border-radius: 6px; transition: background .16s, color .16s, padding .16s;
}
.mega-sublinks a::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--gray-300); flex-shrink: 0; transition: background .16s; margin-left: -12px; }
.mega-sublinks a:hover { background: var(--yellow-soft); color: var(--ink); padding-left: 45px; }
.mega-sublinks a:hover::before { background: var(--yellow); }
