/* ==========================================================================
   CABECERA (header.php)
   - Sin fondo y en absoluto sobre la cabecera de cada página.
   - Al pasar el umbral de scroll (data-fixed-offset) pasa a fixed con fondo.
   - Menú lateral (hamburguesa) con overlay y bloqueo del scroll de la página.
   ========================================================================== */

:root {
	--mim-header-blue: #005888;
	--mim-header-top: 0px;
}

.admin-bar {
	--mim-header-top: 32px;
}

@media screen and (max-width: 782px) {
	.admin-bar {
		--mim-header-top: 46px;
	}
}

/* --- Barra superior ------------------------------------------------------ */

.mim-header {
	position: absolute;
	top: var(--mim-header-top);
	left: 0;
	right: 0;
	z-index: 1000;
	background-color: transparent;
	transition: background-color .3s ease;
}

.mim-header.is-fixed {
	position: fixed;
	background-color: var(--mim-header-blue);
	box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
	animation: mimHeaderSlideDown .3s ease;
}

@keyframes mimHeaderSlideDown {
	from {
		transform: translateY(-100%);
	}

	to {
		transform: translateY(0);
	}
}

.mim-header-inner {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 30px;
	padding: 8px 41px;
}

.mim-header-logo {
	display: block;
	flex: 0 0 auto;
}

.mim-header-logo img {
	display: block;
	width: 270px;
	max-width: 100%;
	height: auto;
}

.mim-header-actions {
	display: flex;
	align-items: center;
	gap: 22px;
}

/* --- Menú principal (con desplegable al hacer hover) --------------------- */

.mim-header-menu {
	display: flex;
	align-items: center;
	gap: 25px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.mim-header-menu > li {
	position: relative;
}

.mim-header-menu > li > a {
	display: inline-flex;
	align-items: center;
	gap: 13px;
	padding: 10px 0;
	font-family: 'Montserrat', sans-serif;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.05;
	text-transform: uppercase;
	color: #fff;
}

.mim-header-menu > .menu-item-has-children > a::after {
	content: '';
	width: 12px;
	height: 10px;
	background: url('../img/header/icon-arrow.svg') no-repeat center / contain;
	transform: rotate(180deg);
	transition: transform .2s ease;
}

.mim-header-menu > .menu-item-has-children:hover > a::after,
.mim-header-menu > .menu-item-has-children:focus-within > a::after {
	transform: rotate(0deg);
}

.mim-header-menu .sub-menu {
	position: absolute;
	top: 100%;
	right: 0;
	min-width: 220px;
	margin: 0;
	padding: 15px 0;
	list-style: none;
	background-color: #fff;
	border-radius: 0 0 20px 0;
	box-shadow: 0 10px 25px rgba(0, 0, 0, .15);
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: opacity .2s ease, transform .2s ease, visibility .2s;
}

.mim-header-menu > li:hover > .sub-menu,
.mim-header-menu > li:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.mim-header-menu .sub-menu a {
	display: block;
	padding: 8px 25px;
	font-family: 'Montserrat', sans-serif;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	color: var(--mim-header-blue);
	white-space: nowrap;
}

.mim-header-menu .sub-menu a:hover,
.mim-header-menu .sub-menu .current-menu-item > a {
	background-color: #DDECF4;
}

/* --- Botón hamburguesa ----------------------------------------------------- */

.mim-header-burger {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin-right: -6px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

.mim-header-burger img {
	display: block;
}

/* --- Overlay y panel lateral ------------------------------------------- */

html.mim-menu-open,
html.mim-menu-open body {
	overflow: hidden;
}

.mim-menu-overlay {
	position: fixed;
	inset: 0;
	z-index: 1001;
	background-color: rgba(0, 88, 136, .9);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity .3s ease, visibility .3s;
}

html.mim-menu-open .mim-menu-overlay {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.mim-menu-panel {
	position: fixed;
	top: 0;
	right: 0;
	z-index: 1002;
	width: 40%;
	min-width: 420px;
	height: 100vh;
	height: 100dvh;
	padding: 30px 50px 50px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background-color: #fff;
	transform: translateX(100%);
	visibility: hidden;
	transition: transform .35s ease, visibility .35s;
}

html.mim-menu-open .mim-menu-panel {
	transform: translateX(0);
	visibility: visible;
}

.mim-menu-close {
	position: absolute;
	top: 25px;
	right: 30px;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

.mim-menu-close::before,
.mim-menu-close::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 30px;
	height: 3px;
	border-radius: 3px;
	background-color: var(--mim-header-blue);
}

.mim-menu-close::before {
	transform: translate(-50%, -50%) rotate(45deg);
}

.mim-menu-close::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.mim-menu-logo {
	display: inline-block;
	margin: 70px 0 40px;
}

.mim-menu-logo img {
	display: block;
	width: 270px;
	max-width: 100%;
	height: auto;
}

/* Menú del panel: preparado para hijos (sangría y letra más pequeña). */
.mim-menu-list,
.mim-menu-list .sub-menu {
	margin: 0;
	padding: 0;
	list-style: none;
}

.mim-menu-list > li + li {
	margin-top: 12px;
}

.mim-menu-list a {
	display: inline-block;
	font-family: 'Roboto Condensed', sans-serif;
	font-weight: 700;
	line-height: 1.1;
	color: var(--mim-header-blue);
	transition: opacity .2s ease;
}

.mim-menu-list a:hover {
	opacity: .7;
}

.mim-menu-list > li > a {
	font-size: 35px;
	text-transform: uppercase;
}

.mim-menu-list .sub-menu {
	margin-top: 8px;
	padding-left: 20px;
}

.mim-menu-list .sub-menu li + li {
	margin-top: 6px;
}

.mim-menu-list .sub-menu a {
	font-size: 22px;
	font-weight: 500;
}

.mim-menu-list .current-menu-item > a {
	text-decoration: underline;
	text-underline-offset: 4px;
}

/* --- Móvil --------------------------------------------------------------- */

@media only screen and (max-width: 767px) {
	.mim-header-nav {
		display: none;
	}

	.mim-header-inner {
		padding: 10px 23px;
	}

	.mim-header-logo img {
		width: 211px;
	}

	.mim-menu-panel {
		width: 100%;
		min-width: 0;
		padding: 20px 23px 40px;
	}

	.mim-menu-close {
		top: 15px;
		right: 15px;
	}

	.mim-menu-logo {
		margin: 55px 0 30px;
	}

	.mim-menu-logo img {
		width: 211px;
	}

	.mim-menu-list > li > a {
		font-size: 26px;
	}

	.mim-menu-list .sub-menu a {
		font-size: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mim-header.is-fixed,
	.mim-menu-panel,
	.mim-menu-overlay {
		animation: none;
		transition: none;
	}
}
