/* ========== CABECERA DEL SITIO (barra institucional + barra principal + menú móvil) ========== */

/* La template-part <header> es la que se pega arriba: la barra superior se va con el scroll
   (top negativo = su altura) y la barra principal queda fija. */
header.wp-block-template-part:has(.mwm-site-header) {
	position: sticky;
	top: var(--mwm-adminbar, 0px);
	z-index: 50;
	margin: 0;
}
/* Con barra superior, esta se va con el scroll y solo queda fija la barra principal */
header.wp-block-template-part:has(.mwm-site-header__top) {
	top: calc(var(--mwm-adminbar, 0px) - var(--mwm-topbar-h, 40px));
}

.mwm-site-header { font-family: var(--mwm-font); }

/* 1. Barra institucional: «Servicio de Apoyo al Emprendimiento UCA | Contacto | Recibe actividades».
   Los separadores son líneas dibujadas con CSS (sin texto: no los lee el lector de pantalla). */
.mwm-site-header__top {
	background: var(--mwm-bg-dark);
	color: rgba(255, 255, 255, 0.9);
	font-size: 13px;
	line-height: 1.35;
	height: var(--mwm-topbar-h);
	display: flex;
	align-items: center;
	padding: 0;
	box-sizing: border-box;
	overflow: hidden;
}
.mwm-site-header__top-inner {
	width: 100%;
	max-width: var(--mwm-container-max);
	margin: 0 auto;
	padding-inline: var(--mwm-gutter);
	box-sizing: border-box;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	row-gap: 2px;
}
.mwm-site-header__top-label { margin: 0; font-weight: 400; }
.mwm-site-header__top-list { list-style: none; display: flex; align-items: center; margin: 0; padding: 0; }
.mwm-site-header__top-list li { display: flex; align-items: center; }
.mwm-site-header__top-list li::before,
.mwm-site-header__top-label + .mwm-site-header__top-list::before {
	content: "";
	display: block;
	width: 1px;
	height: 12px;
	margin: 0 14px;
	background: currentColor;
	opacity: 0.45;
}
.mwm-site-header__top-list li:first-child::before { display: none; }
.mwm-site-header__top-list a {
	color: inherit;
	text-decoration: none;
	font-weight: 700;
}
.mwm-site-header__top-list a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

/* 2. Barra principal */
.mwm-site-header__bar {
	background: rgba(255, 255, 255, 0.95);
	-webkit-backdrop-filter: saturate(140%) blur(8px);
	backdrop-filter: saturate(140%) blur(8px);
	box-shadow: var(--mwm-shadow-sticky);
}
.mwm-site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: var(--mwm-header-h, 80px);
	gap: 16px;
}
.mwm-site-header__logo { display: flex; align-items: center; flex-shrink: 0; }
.mwm-site-header__logo-img { height: 60px; width: auto; display: block; }

.mwm-site-header__menu { list-style: none; display: flex; align-items: center; gap: 28px; margin: 0; padding: 0; }
.mwm-site-header__nav .mwm-site-header__menu > li { display: flex; align-items: center; position: relative; }
.mwm-site-header__nav .mwm-site-header__menu > li > a {
	color: var(--mwm-text);
	font-weight: 700;
	font-size: 15px;
	text-decoration: none;
	padding-block: 6px;
	border-bottom: 2px solid transparent;
	transition: color var(--mwm-dur-fast) ease, border-color var(--mwm-dur-fast) ease;
	white-space: nowrap;
}
.mwm-site-header__nav .mwm-site-header__menu > li > a:hover,
.mwm-site-header__nav .mwm-site-header__menu > li.is-open > a { color: var(--mwm-primary); }
.mwm-site-header__nav .mwm-site-header__menu > .current-menu-item > a,
.mwm-site-header__nav .mwm-site-header__menu > .current-menu-ancestor > a,
.mwm-site-header__nav .mwm-site-header__menu > .current_page_parent > a {
	color: var(--mwm-accent);
	border-bottom-color: var(--mwm-accent);
}

/* 2a. Desplegables de escritorio (patrón disclosure: enlace + botón chevron) */
.mwm-site-header__nav .mwm-site-header__sub-toggle {
	width: 28px;
	height: 28px;
	margin-left: 2px;
	padding: 0;
	border: none;
	border-radius: var(--mwm-radius-sm);
	background: transparent;
	color: var(--mwm-text-secondary);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background var(--mwm-dur-fast) ease, color var(--mwm-dur-fast) ease;
}
.mwm-site-header__nav .mwm-site-header__sub-toggle:hover,
.mwm-site-header__nav .is-open > .mwm-site-header__sub-toggle { background: var(--mwm-brand-tint); color: var(--mwm-primary); }
.mwm-site-header__nav .current-menu-ancestor > .mwm-site-header__sub-toggle { color: var(--mwm-accent); }
.mwm-site-header__sub-toggle .mwm-icon { transition: transform var(--mwm-dur) var(--mwm-ease-out); }
.mwm-site-header__nav .mwm-site-header__sub-toggle[aria-expanded="true"] .mwm-icon { transform: rotate(180deg); }

.mwm-site-header__nav .mwm-site-header__submenu {
	display: none;
	position: absolute;
	top: calc(100% + 12px);
	left: -16px;
	z-index: 60;
	min-width: 260px;
	margin: 0;
	padding: 8px;
	list-style: none;
	background: #fff;
	border: 1px solid var(--mwm-border-subtle);
	border-radius: var(--mwm-radius-lg);
	box-shadow: var(--mwm-shadow-lg);
}
/* Puente invisible para que el ratón no «caiga» en el hueco entre el enlace y el panel. */
.mwm-site-header__nav .mwm-site-header__submenu::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 100%;
	height: 14px;
}
.mwm-site-header__nav .is-open > .mwm-site-header__submenu { display: block; }
/* Sin JS: el panel se abre con hover y con foco dentro. */
.mwm-site-header__nav:not(.is-js) .menu-item-has-children:hover > .mwm-site-header__submenu,
.mwm-site-header__nav:not(.is-js) .menu-item-has-children:focus-within > .mwm-site-header__submenu { display: block; }

.mwm-site-header__nav .mwm-site-header__submenu a {
	display: block;
	padding: 10px 14px;
	border-radius: var(--mwm-radius-md);
	color: var(--mwm-text);
	font-weight: 700;
	font-size: 15px;
	line-height: 1.35;
	text-decoration: none;
	white-space: nowrap;
	transition: background var(--mwm-dur-fast) ease, color var(--mwm-dur-fast) ease;
}
.mwm-site-header__nav .mwm-site-header__submenu a:hover,
.mwm-site-header__nav .mwm-site-header__submenu a:focus-visible { background: var(--mwm-brand-tint); color: var(--mwm-primary); }
.mwm-site-header__nav .mwm-site-header__submenu .current-menu-item > a { position: relative; color: var(--mwm-accent); }
.mwm-site-header__nav .mwm-site-header__submenu .current-menu-item > a::before {
	content: "";
	position: absolute;
	left: 0;
	top: 10px;
	bottom: 10px;
	width: 3px;
	border-radius: 2px;
	background: var(--mwm-accent);
}

/* 2b. Acciones: buscador, botón principal y hamburguesa */
.mwm-site-header__actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.mwm-site-header__search-toggle {
	width: 40px; height: 40px;
	border-radius: 50%;
	border: none;
	background: transparent;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--mwm-primary);
	cursor: pointer;
	transition: background var(--mwm-dur-fast);
}
.mwm-site-header__search-toggle:hover,
.mwm-site-header__search-toggle[aria-expanded="true"] { background: var(--mwm-brand-tint); }
.mwm-site-header__cta { white-space: nowrap; }

.mwm-site-header__burger {
	width: 44px; height: 44px;
	border-radius: var(--mwm-radius-md);
	border: 1px solid var(--mwm-border-subtle);
	background: #fff;
	display: none;
	align-items: center;
	justify-content: center;
	color: var(--mwm-primary);
	cursor: pointer;
	flex-shrink: 0;
}
.mwm-site-header__burger .mwm-burger-close { display: none; }
.mwm-site-header__burger[aria-expanded="true"] .mwm-burger-open { display: none; }
.mwm-site-header__burger[aria-expanded="true"] .mwm-burger-close { display: inline; }

/* 3. Buscador desplegable (escritorio) */
.mwm-site-header__search { border-top: 1px solid var(--mwm-border-subtle); background: #fff; }
.mwm-site-header__search-form { display: flex; align-items: center; gap: 12px; padding-block: 14px; color: var(--mwm-text-secondary); }
.mwm-site-header__search-form input[type="search"] {
	flex: 1;
	font-family: var(--mwm-font);
	font-size: 16px;
	border: none;
	outline: none;
	padding: 8px 0;
	background: transparent;
	color: var(--mwm-text);
	min-width: 0;
}
.mwm-site-header__search-form:focus-within { box-shadow: inset 0 -2px 0 var(--mwm-accent); }

/* 4. Menú móvil (acordeón) */
.mwm-site-header__mobile {
	border-top: 1px solid var(--mwm-border-subtle);
	background: #fff;
	max-height: calc(100vh - var(--mwm-header-h, 64px) - var(--mwm-adminbar, 0px));
	max-height: calc(100dvh - var(--mwm-header-h, 64px) - var(--mwm-adminbar, 0px));
	overflow-y: auto;
	overscroll-behavior: contain;
}
.mwm-site-header__mobile .mwm-site-header__menu { flex-direction: column; align-items: stretch; gap: 0; padding: 0 16px 16px; }
.mwm-site-header__mobile .mwm-site-header__menu > li { border-bottom: 1px solid var(--mwm-border-subtle); }
.mwm-site-header__mobile .menu-item-has-children {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
}
.mwm-site-header__mobile a {
	display: block;
	padding: 14px 8px;
	color: var(--mwm-text);
	font-weight: 700;
	font-size: 16px;
	text-decoration: none;
}
.mwm-site-header__mobile .current-menu-item > a,
.mwm-site-header__mobile .current-menu-ancestor > a { color: var(--mwm-accent); }
.mwm-site-header__mobile .mwm-site-header__sub-toggle {
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--mwm-border-subtle);
	border-radius: var(--mwm-radius-md);
	background: #fff;
	color: var(--mwm-primary);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.mwm-site-header__mobile .mwm-site-header__sub-toggle[aria-expanded="true"] { background: var(--mwm-brand-tint); border-color: transparent; }
.mwm-site-header__mobile .mwm-site-header__sub-toggle[aria-expanded="true"] .mwm-site-header__sub-icon-v { display: none; }
.mwm-site-header__mobile .mwm-site-header__submenu {
	display: none;
	grid-column: 1 / -1;
	list-style: none;
	margin: 0 0 12px;
	padding: 4px 0 4px 12px;
	border-left: 2px solid var(--mwm-border-subtle);
}
.mwm-site-header__mobile .is-open > .mwm-site-header__submenu { display: block; }
.mwm-site-header__mobile .mwm-site-header__submenu a { padding: 11px 8px; font-size: 15px; font-weight: 400; }
.mwm-site-header__mobile .mwm-site-header__submenu .current-menu-item > a { font-weight: 700; }

/* Buscador dentro del menú móvil (el de la barra se oculta con la hamburguesa) */
.mwm-site-header__mobile-search { display: flex; gap: 8px; padding: 16px 16px 8px; }
.mwm-site-header__mobile-search input[type="search"] {
	flex: 1;
	min-width: 0;
	font-family: var(--mwm-font);
	font-size: 16px;
	padding: 10px 14px;
	border: 1px solid var(--mwm-border);
	border-radius: var(--mwm-radius-md);
	color: var(--mwm-text);
}

/* Responsive. La hamburguesa entra a 1080px (breakpoint general): por encima caben logo + 5 ítems
   (2 con chevron, ~655px) + buscador + «Pide cita» con holgura (medido de 1081 a 1440px). Sincronizado con view.js. */
@media (max-width: 1280px) {
	.mwm-site-header__menu { gap: 22px; }
}
@media (max-width: 1080px) {
	.mwm-site-header__nav { display: none; }
	.mwm-site-header__burger { display: inline-flex; }
	.mwm-site-header__search-toggle,
	.mwm-site-header__search { display: none !important; }
}
@media (min-width: 1081px) {
	.mwm-site-header__mobile { display: none !important; }
}
@media (max-width: 760px) {
	.mwm-site-header__top { font-size: 12px; }
	.mwm-site-header__top-inner { justify-content: flex-start; }
	.mwm-site-header__top-label { flex-basis: 100%; }
	.mwm-site-header__top-label + .mwm-site-header__top-list::before { display: none; }
	.mwm-site-header__inner { gap: 10px; }
	.mwm-site-header__logo-img { height: 44px; }
	.mwm-site-header__actions { gap: 8px; }
}
@media (max-width: 360px) {
	.mwm-site-header__cta.mwm-btn { padding-inline: 12px; }
}

/* Plantilla de búsqueda: formulario «Buscar de nuevo» bajo el hero (core/search). */
.mwm-search-again { background: var(--mwm-bg); margin: 0 !important; padding: 0; }
.mwm-search-again .wp-block-search {
	max-width: var(--mwm-container-max);
	margin: 0 auto;
	padding-inline: var(--mwm-gutter);
	box-sizing: border-box;
}
.mwm-search-again + .mwm-blog-grid { margin-top: 0 !important; }
.mwm-search-again .wp-block-search__label { font-weight: 700; font-size: var(--mwm-fs-body-sm); color: var(--mwm-text); margin-bottom: 8px; display: block; }
.mwm-search-again .wp-block-search__inside-wrapper { display: flex; gap: 8px; max-width: 560px; }
.mwm-search-again .wp-block-search__input {
	flex: 1;
	min-width: 0;
	font-family: var(--mwm-font);
	font-size: 16px;
	padding: 12px 16px;
	border: 1px solid var(--mwm-border);
	border-radius: var(--mwm-radius-md);
	color: var(--mwm-text);
	background: #fff;
}
.mwm-search-again .wp-block-search__button {
	margin: 0;
	font-family: var(--mwm-font);
	font-weight: 700;
	font-size: 15px;
	padding: 12px 20px;
	border: none;
	border-radius: var(--mwm-radius-md);
	background: var(--mwm-primary);
	color: #fff;
	cursor: pointer;
}
.mwm-search-again .wp-block-search__button:hover { background: var(--mwm-primary-hover, var(--mwm-primary)); }
/* Sin resultados, la rejilla ya trae su propio formulario: no se duplica. */
.mwm-search-again:has(+ .mwm-blog-grid .mwm-blog-grid__empty) { display: none; }

/* Foco visible del buscador desplegable: el campo no tiene borde, se marca la fila del formulario */
.mwm-site-header__search-form:focus-within { box-shadow: inset 0 -2px 0 var(--mwm-primary); }
