/**
 * PIMEM — Header sticky + UX móvil
 *
 * Tokens globales: --isla-red, --isla-ink, --isla-white, --isla-red-hover,
 *                  --isla-font-primary, --isla-transit-fast, --isla-radius-*
 *
 * @package Astra Child
 * @since   1.0.0
 */

/* ── Scroll compensation ── */
html { scroll-padding-top: 90px; }
html.pm-lock,
body.pm-lock { overflow: hidden; }

/* ── Base container ── */
#pmHd {
	/* Variables locales de componente */
	--pm-hd-shadow: 0 6px 26px rgba(0, 0, 0, .30);
	--pm-hd-hover-bg: rgba(255, 255, 255, .14);
	--pm-hd-sub-text: #cfd4da;

	position: sticky;
	top: 0;
	z-index: 9990;
	font-family: var(--isla-font-primary);
}
body.admin-bar #pmHd { top: 32px; }

/* ── Top bar ── */
#pmHd .pm-bar {
	background: var(--isla-ink);
	transition: box-shadow var(--isla-transit-fast);
}
#pmHd.pm-scrolled .pm-bar {
	box-shadow: var(--pm-hd-shadow);
}

/* ── Inner wrapper ── */
#pmHd .pm-in {
	max-width: 1500px;
	margin: 0 auto;
	padding: 0 var(--isla-space-lg);
	height: 84px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--isla-space-lg);
}

/* ── Logo ── */
#pmHd .pm-logo {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	line-height: 1;
}
#pmHd .pm-logo .pm-logo-img {
	height: 46px;
	width: auto;
}

/* ── Focus ring ── */
#pmHd a:focus-visible,
#pmHd button:focus-visible {
	outline: 3px solid var(--isla-white);
	outline-offset: 2px;
	border-radius: var(--isla-radius-sm);
}

/* ── Desktop menu ── */
#pmHd .pm-menu {
	display: flex;
	align-items: center;
	gap: 2px;
	list-style: none;
	margin: 0;
	padding: 0;
}
#pmHd .pm-menu > li { position: relative; }

#pmHd .pm-top {
	display: block;
	padding: 10px 13px;
	font-size: .95rem;
	font-weight: 600;
	color: var(--isla-white);
	border-radius: var(--isla-radius-sm);
	text-decoration: none;
	white-space: nowrap;
}
#pmHd .pm-top:hover { background: var(--pm-hd-hover-bg); }

/* Chevron after parent items */
#pmHd .pm-has > .pm-top::after {
	content: "";
	display: inline-block;
	width: .42em;
	height: .42em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	margin: -3px 0 0 7px;
	vertical-align: middle;
	opacity: .7;
}

/* Mobile toggle (hidden on desktop) */
#pmHd .pm-toggle { display: none; }

/* ── Submenus (desktop) ── */
#pmHd .pm-sub {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	min-width: 264px;
	background: var(--isla-white);
	border-radius: var(--isla-radius-md);
	box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
	border-top: 3px solid var(--isla-red);
	padding: var(--isla-space-sm);
	list-style: none;
	margin: 0;
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity var(--isla-transit-fast), transform var(--isla-transit-fast), visibility var(--isla-transit-fast);
}
#pmHd .pm-has:hover .pm-sub,
#pmHd .pm-has:focus-within .pm-sub {
	opacity: 1;
	visibility: visible;
	transform: none;
}
#pmHd .pm-sub a {
	display: block;
	padding: 10px var(--isla-space-md);
	font-size: .9rem;
	color: var(--isla-text);
	border-radius: var(--isla-radius-sm);
	text-decoration: none;
}
#pmHd .pm-sub a:hover,
#pmHd .pm-sub a:focus-visible {
	background: var(--isla-bg-alt);
	color: var(--isla-red);
}

/* ── Actions (CTA + burger) ── */
#pmHd .pm-actions {
	display: flex;
	align-items: center;
	gap: var(--isla-space-md);
}
#pmHd .pm-cta {
	display: inline-flex;
	align-items: center;
	background: var(--isla-red);
	color: var(--isla-white);
	font-weight: 800;
	font-size: .95rem;
	padding: 13px var(--isla-space-lg);
	border-radius: var(--isla-radius-pill);
	text-decoration: none;
	white-space: nowrap;
	transition: background var(--isla-transit-fast);
}
#pmHd .pm-cta:hover { background: var(--isla-red-hover); }

/* ── Language switcher (header) ── */
#pmHd .pm-lang-hd {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	margin-right: 6px;
}
#pmHd .pm-lang-hd a {
	font-weight: 700;
	padding: 4px 8px;
	border-radius: 6px;
	color: var(--isla-white);
	text-decoration: none;
	transition: background var(--isla-transit-fast), color var(--isla-transit-fast);
}
#pmHd .pm-lang-hd a:hover {
	color: var(--isla-red);
}
#pmHd .pm-lang-hd a.on {
	background: var(--isla-white);
	color: var(--isla-ink);
}
#pmHd .pm-lang-hd .sep {
	color: rgba(255,255,255,0.3);
}

/* Hide mobile language selector by default (desktop) */
#pmHd .pm-lang-mobile {
	display: none;
}


/* ── Burger icon ── */
#pmHd .pm-burger {
	display: none;
	width: 46px;
	height: 46px;
	border: 0;
	background: transparent;
	cursor: pointer;
	position: relative;
}
#pmHd .pm-burger span {
	position: absolute;
	left: 11px;
	right: 11px;
	height: 2px;
	background: var(--isla-white);
	border-radius: 2px;
	transition: all var(--isla-transit-fast);
}
#pmHd .pm-burger span:nth-child(1) { top: 16px; }
#pmHd .pm-burger span:nth-child(2) { top: 22px; }
#pmHd .pm-burger span:nth-child(3) { top: 28px; }
#pmHd .pm-burger[aria-expanded="true"] span:nth-child(1) { top: 22px; transform: rotate(45deg); }
#pmHd .pm-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
#pmHd .pm-burger[aria-expanded="true"] span:nth-child(3) { top: 22px; transform: rotate(-45deg); }

/* ── Mobile (≤ 1100px) ──
   Breakpoint de navegación: punto donde el menú horizontal no cabe */
@media (max-width: 1100px) {
	#pmHd .pm-burger { display: block; }

	#pmHd .pm-panel {
		position: fixed;
		left: 0;
		right: 0;
		top: 84px;
		bottom: 0;
		background: var(--isla-ink);
		transform: translateX(100%);
		transition: transform var(--isla-transit-fast);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
	}
	body.admin-bar #pmHd .pm-panel { top: 116px; }
	#pmHd.pm-open .pm-panel { transform: none; }

	/* Fix: Evitar que el header desaparezca (por el sticky + overflow:hidden) */
	#pmHd.pm-open {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		width: 100%;
	}
	body.admin-bar #pmHd.pm-open { top: 32px; }
	
	@media screen and (max-width: 782px) {
		body.admin-bar #pmHd { top: 46px; }
		body.admin-bar #pmHd.pm-open { top: 46px; }
		body.admin-bar #pmHd .pm-panel { top: 130px; }
	}

	#pmHd .pm-menu {
		flex-direction: column;
		align-items: stretch;
		padding: var(--isla-space-sm) 14px 40px;
		gap: 0;
	}
	#pmHd .pm-menu > li {
		border-bottom: 1px solid rgba(255, 255, 255, .08);
		display: grid;
		grid-template-columns: 1fr auto;
		align-items: center;
	}
	#pmHd .pm-top {
		padding: var(--isla-space-md) var(--isla-space-sm);
		font-size: 1.06rem;
		border-radius: 0;
	}
	#pmHd .pm-has > .pm-top::after { display: none; }

	/* Toggle chevron */
	#pmHd .pm-toggle {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 52px;
		height: 54px;
		background: transparent;
		border: 0;
		cursor: pointer;
	}
	#pmHd .pm-toggle .car {
		width: .6em;
		height: .6em;
		border-right: 2px solid var(--isla-white);
		border-bottom: 2px solid var(--isla-white);
		transform: rotate(45deg);
		transition: transform var(--isla-transit-fast);
		opacity: .85;
	}
	#pmHd .pm-toggle[aria-expanded="true"] .car { transform: rotate(-135deg); }

	/* Hide the desktop language switcher */
	#pmHd .pm-actions > .pm-lang { display: none; }

	/* Show and style the mobile language switcher */
	#pmHd .pm-lang-mobile {
		display: flex;
		padding: var(--isla-space-md) var(--isla-space-sm);
		align-items: center;
	}
	#pmHd .pm-lang-mobile .pm-lang {
		margin: 0;
	}

	/* Submenu mobile */
	#pmHd .pm-sub {
		position: static;
		opacity: 1;
		visibility: visible;
		transform: none;
		box-shadow: none;
		background: transparent;
		border-top: none;
		padding: 0;
		margin: 0 0 var(--isla-space-sm);
		grid-column: 1 / -1;
		max-height: 0;
		overflow: hidden;
		transition: max-height var(--isla-transit-fast);
	}
	#pmHd li.pm-open > .pm-sub { max-height: 640px; }
	#pmHd .pm-sub a {
		color: var(--pm-hd-sub-text);
		padding: 13px 14px 13px 22px;
		font-size: .98rem;
		border-radius: var(--isla-radius-sm);
	}
	#pmHd .pm-sub a:hover {
		background: rgba(255, 255, 255, .06);
		color: var(--isla-white);
	}
	#pmHd .pm-actions .pm-cta {
		padding: 11px 18px;
		font-size: .9rem;
	}
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
	#pmHd *,
	#pmHd .pm-panel { transition: none !important; }
}

/* ── Hide Astra original header ──
   Override: Astra/Elementor headers requieren !important */
header.site-header,
#masthead,
.ast-above-header-wrap,
.ast-below-header-wrap,
.ast-main-header-wrap,
[data-elementor-type="header"],
.elementor-location-header {
	display: none !important;
}
body { margin-top: 0 !important; }

/* Override: Astra renders an empty <header class="entry-header"> inside
   articles on page-builder pages. Hide it to avoid duplicate landmarks. */
.entry-header.ast-header-without-markup {
	display: none !important;
}

/* ── Mega Menús (Ayudas y Formación) ── */
#pmHd .pm-mega {
	position: absolute;
	top: calc(100% + 8px);
	left: -20px;
	width: 820px;
	max-width: 90vw;
	background: var(--isla-white, #fff);
	border-radius: var(--isla-radius-md, 14px);
	box-shadow: 0 28px 50px rgba(0,0,0,.18);
	border-top: 3px solid var(--isla-red);
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity var(--isla-transit-fast), transform var(--isla-transit-fast), visibility var(--isla-transit-fast);
	z-index: 1000;
}

/* Alineación inteligente para que la columna izquierda caiga bajo el cursor pero no desborde la pantalla */
#pmHd .pm-menu > li:nth-last-child(4) .pm-mega, /* Agenda */
#pmHd .pm-menu > li:nth-last-child(5) .pm-mega { /* Formación */
	left: -180px;
}
#pmHd .pm-menu > li:nth-last-child(2) .pm-mega, /* Recursos */
#pmHd .pm-menu > li:nth-last-child(3) .pm-mega { /* Actualidad */
	left: -350px;
}

/* Mostrar megamenu en hover */
#pmHd .pm-mega-wrap:hover .pm-mega,
#pmHd .pm-mega-wrap:focus-within .pm-mega {
	opacity: 1;
	visibility: visible;
	transform: none;
}

#pmHd .pm-megin {
	display: grid;
	grid-template-columns: 1.25fr 1fr;
	gap: 0;
}

#pmHd .pm-mleft {
	padding: 32px 36px;
}
#pmHd .pm-lbl {
	font-size: 11.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 1.4px;
	color: var(--isla-red);
	margin-bottom: 16px;
}

#pmHd .pm-mitem {
	display: flex;
	gap: 14px;
	align-items: flex-start;
	padding: 13px 12px;
	border-radius: 12px;
	cursor: pointer;
	text-decoration: none;
	color: var(--isla-ink);
	transform: translateZ(0);
	transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1), background-color .25s cubic-bezier(0.4, 0, 0.2, 1);
}
#pmHd .pm-mitem:hover {
	background: #f0f0f4;
	transform: translateX(6px);
}
#pmHd .pm-ic {
	width: 38px;
	height: 38px;
	border-radius: 10px;
	background: transparent;
	color: var(--isla-red);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	flex: none;
	transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1);
}
#pmHd .pm-ic svg {
	width: 22px;
	height: 22px;
}
#pmHd .pm-ic svg path,
#pmHd .pm-ic svg circle,
#pmHd .pm-ic svg rect,
#pmHd .pm-ic svg line,
#pmHd .pm-ic svg polyline,
#pmHd .pm-ic svg polygon {
	fill: none !important;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}
#pmHd .pm-mitem:hover .pm-ic {
	transform: scale(1.1) rotate(-3deg);
}
#pmHd .pm-mitem .pm-mh {
	font-size: 15px;
	font-weight: 700;
	margin: 0;
	transition: color .2s ease;
}
#pmHd .pm-mitem:hover .pm-mh {
	color: var(--isla-red);
}
#pmHd .pm-mitem p {
	font-size: 12.5px;
	color: var(--isla-muted, #5c5c66);
	margin: 1px 0 0;
	line-height: 1.35;
}

/* Lado derecho del megamenu (Tarjetas) */
#pmHd .pm-mright {
	background: var(--isla-ink, #0e0e10);
	color: #fff;
	padding: 32px 36px;
	border-radius: 0 var(--isla-radius-md, 14px) var(--isla-radius-md, 14px) 0;
	position: relative;
	overflow: hidden;
	z-index: 1;
}
#pmHd .pm-lbl, #pmHd .pm-all, #pmHd .pm-empty {
	position: relative;
	z-index: 1;
}
#pmHd .pm-sq {
	position: absolute;
	right: 0;
	bottom: -10px;
	top: auto;
	width: 240px;
	height: 240px;
	background: url('/wp-content/uploads/2026/06/header-capa-pimem.png') no-repeat bottom right;
	background-size: contain;
	opacity: 0.35;
	pointer-events: none;
	z-index: 0;
}
#pmHd .pm-badge-dias {
	position: absolute;
	top: -12px;
	right: -12px;
	background: #fff;
	color: var(--isla-red);
	border-radius: 10px;
	padding: 4px 9px;
	text-align: center;
	font-weight: 900;
	font-size: 13px;
	line-height: 1;
	box-shadow: 0 6px 16px rgba(0,0,0,.3);
	z-index: 3;
}
#pmHd .pm-badge-dias small {
	display: block;
	font-size: 7px;
	font-weight: 800;
	text-transform: uppercase;
	color: #1d6fb8; /* Azul PIMEM para la palabra DÍAS */
}

/* Card de Ayuda (acard) */
#pmHd .pm-acard {
	background: #17171c;
	border: 1px solid #2a2a31;
	border-top: 3px solid var(--isla-green, #1d8a5e);
	border-radius: 14px;
	padding: 18px 18px 16px;
	position: relative;
	z-index: 1;
	transition: transform var(--isla-transit-fast, .2s), border-color var(--isla-transit-fast, .2s), box-shadow var(--isla-transit-fast, .2s);
}
#pmHd .pm-acard:hover {
	transform: translateY(-4px);
	border-color: #3f3f4a;
	box-shadow: 0 14px 28px rgba(0,0,0,.25);
}
#pmHd .pm-est {
	font-size: 10.5px;
	font-weight: 700;
	padding: 3px 9px;
	border-radius: 20px;
	display: inline-block;
}
#pmHd .pm-acard .pm-mh {
	font-size: 15.5px;
	font-weight: 700;
	margin: 11px 0 0;
	line-height: 1.25;
}
#pmHd .pm-acard .pm-mh a {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
#pmHd .pm-acard .pm-mh a:hover {
	color: var(--isla-red) !important;
}
#pmHd .pm-acard .pm-mh a::after,
#pmHd .pm-ncard .pm-mh a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 10;
}
#pmHd .pm-ent {
	font-size: 12px;
	color: #9a9aa4;
	margin-top: 6px;
}
#pmHd .pm-meta {
	font-size: 12px;
	color: #c9c9d2;
	margin-top: 10px;
}

/* Card de Curso (ncard) */
#pmHd .pm-ncard {
	background: #17171c;
	border: 1px solid #2a2a31;
	border-radius: 14px;
	overflow: hidden;
	position: relative;
	z-index: 1;
	transition: transform var(--isla-transit-fast, .2s), border-color var(--isla-transit-fast, .2s), box-shadow var(--isla-transit-fast, .2s);
}
#pmHd .pm-ncard:hover {
	transform: translateY(-4px);
	border-color: #3f3f4a;
	box-shadow: 0 14px 28px rgba(0,0,0,.25);
}
#pmHd .pm-top-card {
	height: 80px;
	position: relative;
	background: linear-gradient(135deg, #1b1b20, #33333c);
}
#pmHd .sc-card__top--digital     { background: linear-gradient(135deg, #2a1d3a, #522a6e); }
#pmHd .sc-card__top--fiscal      { background: linear-gradient(135deg, #102a3a, #1d5170); }
#pmHd .sc-card__top--prevencion  { background: linear-gradient(135deg, #0e2e25, #1d6e54); }
#pmHd .sc-card__top--marketing   { background: linear-gradient(135deg, #3a1d1d, #6e2a2a); }
#pmHd .sc-card__top--habilidades { background: linear-gradient(135deg, #1d2a3a, #2a4a6e); }
#pmHd .sc-card__top--sostenibilidad { background: linear-gradient(135deg, #1a2e1a, #2d5e2d); }
#pmHd .sc-card__top--sectorial   { background: linear-gradient(135deg, #2a2a1d, #5e5e2a); }

#pmHd .sc-card__sq {
	position: absolute;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	background-image: url('/wp-content/uploads/2026/06/header-capa-pimem.png');
	background-size: 80px auto;
	background-position: bottom right;
	background-repeat: no-repeat;
	pointer-events: none;
}
#pmHd .pm-top-card .pm-m {
	position: absolute;
	left: 12px;
	top: 12px;
	background: rgba(255,255,255,.18);
	font-size: 10.5px;
	font-weight: 600;
	padding: 3px 9px;
	border-radius: 20px;
	z-index: 2;
}
#pmHd .pm-b {
	padding: 14px 16px 16px;
}
#pmHd .pm-t {
	color: #ff7a74;
	font-size: 10.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 1px;
}
#pmHd .pm-ncard .pm-mh {
	font-size: 15.5px;
	font-weight: 700;
	margin: 5px 0 0;
	line-height: 1.25;
}
#pmHd .pm-ncard .pm-mh a {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
#pmHd .pm-ncard .pm-mh a:hover {
	color: var(--isla-red) !important;
}
#pmHd .pm-pr {
	margin-top: 10px;
	font-weight: 700;
	font-size: 14px;
}
#pmHd .pm-pr em {
	font-style: normal;
	color: #9a9aa4;
	font-weight: 500;
	font-size: 12px;
}

/* Botón Ver todo */
#pmHd .pm-all {
	display: inline-block;
	margin-top: 16px;
	color: #fff;
	font-weight: 600;
	font-size: 13.5px;
	text-decoration: none;
}
#pmHd .pm-all:hover {
	color: var(--isla-red);
}
#pmHd .pm-empty {
	font-size: 13px;
	color: #9a9aa4;
	margin: 20px 0;
}

/* Mobile Adaptation para Megamenu */
@media (max-width: 1100px) {
	#pmHd .pm-mega {
		position: static;
		width: 100%;
		box-shadow: none;
		border: none;
		border-radius: 0;
		opacity: 1;
		visibility: visible;
		transform: none;
		background: transparent;
		display: none;
	}
	#pmHd li.pm-open > .pm-mega {
		display: block;
	}
	#pmHd .pm-megin {
		grid-template-columns: 1fr;
		gap: 20px;
		padding-bottom: 20px;
	}
	#pmHd .pm-mleft {
		padding: 0 14px;
	}
	#pmHd .pm-mright {
		margin: 0;
		border-radius: 0;
		padding: 0 14px;
		background: transparent;
	}
	#pmHd .pm-sq,
	#pmHd .pm-mleft .pm-lbl {
		display: none;
	}
	#pmHd .pm-mitem {
		padding: 10px 0;
	}
	#pmHd .pm-mitem .pm-mh {
		color: var(--isla-sub-text, #cfd4da);
	}
	#pmHd .pm-mitem:hover {
		background: transparent;
	}
	#pmHd .pm-mitem:hover .pm-mh {
		color: var(--isla-white);
	}
	#pmHd .pm-ic {
		width: 32px;
		height: 32px;
		font-size: 15px;
	}
	#pmHd .pm-ic svg {
		width: 16px;
		height: 16px;
	}
}

/* menu labels: span.pm-mh replaces former h4 (heading semantics removed for SEO) */
#pmHd .pm-mh{display:block;margin:0;font-size:22px;font-weight:500;line-height:1.3;}
