/*
 * Header global (header.php). Barra roja a todo el ancho, encima del primer bloque.
 * Desktop (≥1025px): logo, menú, Tienda y Postula en una sola fila.
 * Tablet y mobile: botón hamburguesa que abre un panel lateral rojo desde la derecha.
 */

.mol-header {
	position: relative;
	z-index: 100;
	background: var(--color-brand-red);
	color: #fff;
}

.mol-header__inner {
	display: flex;
	align-items: center;
	gap: var(--space-4);
	min-height: var(--header-h);
	padding: 12px clamp(20px, 4vw, 56px);
}

.mol-header__logo {
	flex: 0 0 auto;
	margin-right: auto;
}
.mol-header__logo img {
	display: block;
	height: 43px;
	width: auto;
	max-width: 170px;
	object-fit: contain;
}

/* ---- Botón hamburguesa ---- */
.mol-header__toggle {
	display: flex;
	flex: 0 0 48px;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, .55);
	border-radius: 12px;
	background: transparent;
	color: #fff;
	cursor: pointer;
}
.mol-header__bars { display: flex; flex-direction: column; gap: 5px; }
.mol-header__bars span { display: block; width: 21px; height: 2px; border-radius: 4px; background: currentColor; }

/* Pisa el hover rosado que el tema padre le pone a todos los <button>. */
.mol-header__toggle:hover,
.mol-header__toggle:focus,
.mol-header__close:hover,
.mol-header__close:focus { background: rgba(255, 255, 255, .14); color: #fff; }

/* ---- Panel lateral (tablet y mobile) ---- */
.mol-header__panel {
	position: fixed;
	top: 0;
	right: 0;
	z-index: 102;
	display: flex;
	flex-direction: column;
	width: min(86vw, 370px);
	height: 100dvh;
	padding: 78px 26px 36px;
	overflow-y: auto;
	background: var(--color-brand-red);
	color: #fff;
	box-shadow: -18px 0 50px rgba(0, 0, 0, .2);
	transform: translateX(105%);
	visibility: hidden;
	transition: transform .3s ease, visibility .3s;
}
/* Al abrir, visible de inmediato (para poder darle foco); al cerrar, se oculta al terminar de salir. */
.mol-header--open .mol-header__panel { transform: translateX(0); visibility: visible; transition: transform .3s ease, visibility 0s; }

.mol-header__close {
	position: absolute;
	top: 18px;
	right: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, .5);
	border-radius: 12px;
	background: transparent;
	color: #fff;
	font-size: 32px;
	line-height: 1;
	cursor: pointer;
	/* El tema padre anima "all" en los <button>: retrasaría la visibilidad heredada y no aceptaría foco al abrir. */
	transition: background-color .2s;
}

.mol-header__backdrop {
	position: fixed;
	inset: 0;
	z-index: 101;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: rgba(26, 20, 19, .48);
	opacity: 0;
	visibility: hidden;
	transition: opacity .3s, visibility .3s;
}
.mol-header__backdrop:hover,
.mol-header__backdrop:focus { background: rgba(26, 20, 19, .48); }
.mol-header--open .mol-header__backdrop { opacity: 1; visibility: visible; }

.mol-header__menu {
	margin: 0;
	padding: 0;
	list-style: none;
	font-weight: 600;
}

.mol-header__menu a,
.mol-header__shop {
	display: block;
	padding: 17px 2px;
	border-bottom: 1px solid rgba(255, 255, 255, .25);
	font-size: 16px;
	font-weight: 600;
	line-height: 1.35;
	color: #fff;
	text-decoration: none;
}
.mol-header__menu a:hover,
.mol-header__shop:hover { color: #fff; text-decoration: underline; text-underline-offset: 6px; }

/* En tablet y mobile Postula no va en el panel: "Trabaja con nosotros" ya está en el menú. */
.mol-header__cta { display: none; }

@media (min-width: 768px) {
	.mol-header__inner { padding-inline: clamp(20px, 3vw, 32px); }
	.mol-header__logo img { height: 50px; max-width: 190px; }
}

@media (min-width: 1025px) {
	.mol-header__inner { gap: clamp(18px, 2.2vw, 40px); padding-inline: clamp(20px, 4vw, 56px); }
	.mol-header__logo img { height: clamp(46px, 4.3vw, 64px); max-width: none; }

	.mol-header__toggle,
	.mol-header__close,
	.mol-header__backdrop { display: none; }

	.mol-header__panel {
		position: static;
		flex-direction: row;
		align-items: center;
		gap: clamp(18px, 2.2vw, 40px);
		width: auto;
		height: auto;
		padding: 0;
		overflow: visible;
		background: transparent;
		box-shadow: none;
		transform: none;
		visibility: visible;
		transition: none;
	}

	.mol-header__nav { display: flex; align-items: center; gap: clamp(12px, 1.6vw, 30px); }
	.mol-header__menu { display: flex; gap: clamp(12px, 1.6vw, 30px); }

	.mol-header__menu a,
	.mol-header__shop {
		padding: 8px 0;
		border: 0;
		font-size: clamp(12px, 1vw, 16px);
		line-height: 1.3;
		white-space: nowrap;
	}

	.mol-header__cta {
		display: inline-flex;
		align-items: center;
		padding: 13px 26px;
		border-radius: var(--radius-pill);
		background: #fff;
		color: var(--color-brand-red);
		font-weight: 700;
		white-space: nowrap;
		text-decoration: none;
		transition: transform var(--dur-fast) var(--ease-out), filter var(--dur-fast);
	}
	.mol-header__cta:hover { color: var(--color-brand-red); filter: brightness(.94); transform: translateY(-2px); }
}

@media (min-width: 1025px) and (max-width: 1150px) {
	.mol-header__cta { padding: 12px 19px; }
}

@media (prefers-reduced-motion: reduce) {
	.mol-header__panel,
	.mol-header__backdrop,
	.mol-header__cta { transition: none; }
}
