/*
 * Groowleck — Top Bar y Header responsive.
 *
 * Escritorio:
 * Logo | Navegación | EDD | Carrito | Usuario | Plus
 *
 * Móvil y tableta:
 * Logo | Carrito | Menú
 */

:root {
	/*
	 * Dimensiones.
	 */
	--groowleck-topbar-height: 64px;
	--groowleck-header-height: 54px;

	--groowleck-header-stack-height: calc(
		var(--groowleck-topbar-height) +
		var(--groowleck-header-height)
	);

	/*
	 * Contenedor.
	 */
	--groowleck-header-container: 1400px;
	--groowleck-header-gutter: clamp(16px, 3vw, 32px);

	/*
	 * Separaciones.
	 */
	--groowleck-identity-gap: clamp(22px, 2.5vw, 40px);
	--groowleck-navigation-gap: clamp(14px, 1.5vw, 26px);
	--groowleck-edd-gap: clamp(20px, 2vw, 34px);
	--groowleck-commerce-gap: clamp(16px, 1.8vw, 28px);
	--groowleck-actions-gap: 20px;
	--groowleck-user-links-gap: 16px;

	/*
	 * Animaciones.
	 */
	--groowleck-header-transition:
		620ms cubic-bezier(0.16, 1, 0.3, 1);

	--groowleck-panel-transition:
		420ms cubic-bezier(0.16, 1, 0.3, 1);

	/*
	 * Capas.
	 */
	--groowleck-header-z: 1000;
	--groowleck-panel-z: 999;

	--groowleck-header-font-size: 15px;
	--groowleck-color-on-brand: #ffffff;
}


/* =========================================================
   Documento
   ========================================================= */

html {
	scroll-padding-top: var(--groowleck-header-stack-height);
}

body {
	padding-block-start: var(--groowleck-header-stack-height);
}


/* =========================================================
   Barra de administración de WordPress
   ========================================================= */

body.admin-bar {
	--groowleck-adminbar-height: 32px;
}

@media (max-width: 782px) {
	body.admin-bar {
		--groowleck-adminbar-height: 46px;
	}
}


/* =========================================================
   Posición global
   ========================================================= */

.site-topbar,
.site-header {
	position: fixed;
	inset-inline: 0;
}


/* =========================================================
   Top Bar
   ========================================================= */

.site-topbar {
	top: var(--groowleck-adminbar-height, 0px);
	z-index: calc(var(--groowleck-header-z) + 1);
	min-height: var(--groowleck-topbar-height);
	background: var(--groowleck-status-premium, #f4c95d);
}

.site-topbar__inner,
.site-header__inner {
	width: min(
		100% - (2 * var(--groowleck-header-gutter)),
		var(--groowleck-header-container)
	);
	margin-inline: auto;
}

.site-topbar__inner {
	display: grid;
	grid-template-columns:
		minmax(0, 1fr)
		minmax(0, 1fr);
	align-items: center;
	gap: 24px;
	min-height: var(--groowleck-topbar-height);
	color: var(--groowleck-color-on-brand, #ffffff);
	font-size: 1rem;
	line-height: 1.35;
}

.site-topbar__information,
.site-topbar__promotion {
	min-width: 0;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.site-topbar__information {
	text-align: start;
}

.site-topbar__promotion {
	text-align: end;
}

.site-topbar__text {
	margin: 0;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.site-topbar__promotion-link {
	color: inherit;
	font-weight: 700;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}


/* =========================================================
   Header
   ========================================================= */

.site-header {
	top: calc(
		var(--groowleck-adminbar-height, 0px) +
		var(--groowleck-topbar-height)
	);
	z-index: var(--groowleck-header-z);
	height: var(--groowleck-header-height);
	background: var(--groowleck-color-brand, #15233c);
	color: var(--groowleck-color-on-brand, #ffffff);
	box-shadow: 0 1px 0 rgb(255 255 255 / 0.08);
	transform: translate3d(0, 0, 0);

	font-size: var(--groowleck-header-font-size);

	transition:
		transform var(--groowleck-header-transition),
		box-shadow 280ms ease;
	will-change: transform;
}

.site-header.is-hidden {
	transform: translate3d(
		0,
		calc(-1 * var(--groowleck-header-height)),
		0
	);
}

.site-header.is-visible {
	transform: translate3d(0, 0, 0);
}

.site-header.is-scrolled {
	box-shadow: 0 12px 30px rgb(0 0 0 / 0.16);
}

.site-header__inner {
	display: flex;
	align-items: center;
	height: 100%;
}


/* =========================================================
   Identidad
   ========================================================= */

.site-header__identity {
	flex: 0 0 auto;
	min-width: 0;
	margin-inline-end: var(--groowleck-identity-gap);
}

.site-header__brand {
	display: inline-flex;
	align-items: center;
	min-width: 0;
	color: inherit;
	text-decoration: none;
}

.site-header__brand .custom-logo-link {
	display: inline-flex;
	align-items: center;
}

.site-header__brand .custom-logo,
.site-header__logo {
	display: block;
	width: auto;
	max-width: clamp(132px, 13vw, 190px);
	max-height: calc(var(--groowleck-header-height) - 18px);
	object-fit: contain;
}

.site-header__site-name {
	font-size: 1.125rem;
	font-weight: 800;
	line-height: 1;
	white-space: nowrap;
}


/* =========================================================
   Navegación principal
   ========================================================= */

.site-header__navigation {
	flex: 1 1 auto;
	min-width: 0;
}

.site-header__menu,
.site-header__menu ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-header__menu {
	display: flex;
	align-items: center;
	gap: var(--groowleck-navigation-gap);
	white-space: nowrap;
}

.site-header__menu a {
	display: inline-flex;
	align-items: center;
	min-height: 42px;
	color: inherit;
	font-weight: 600;
	text-decoration: none;
}

.site-header__menu a:hover,
.site-header__menu a:focus-visible,
.site-header__menu .current-menu-item > a,
.site-header__menu .current-menu-ancestor > a {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.35em;
}


/* =========================================================
   Navegación EDD
   ========================================================= */

.site-header__edd-navigation {
	flex: 0 0 auto;
	margin-inline-start: var(--groowleck-edd-gap);
}

.site-header__edd-menu,
.site-header__edd-menu ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-header__edd-menu {
	display: flex;
	align-items: center;
	white-space: nowrap;
}

.site-header__edd-menu a {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	color: inherit;
	font-weight: 700;
	text-decoration: none;
}

.site-header__edd-menu a:hover,
.site-header__edd-menu a:focus-visible,
.site-header__edd-menu .current-menu-item > a,
.site-header__edd-menu .current-menu-ancestor > a {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.35em;
}


/* =========================================================
   Carrito
   ========================================================= */

.site-header__commerce {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	margin-inline-start: var(--groowleck-commerce-gap);
}

.site-header__cart {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	min-height: 40px;
	padding-inline: 10px;
	border-radius: 8px;
	color: inherit;
	text-decoration: none;
	white-space: nowrap;
}

.site-header__cart:hover,
.site-header__cart:focus-visible {
	background: rgb(255 255 255 / 0.08);
}

.site-header__cart-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.site-header__cart-count {
	display: inline-grid;
	place-items: center;
	min-width: 20px;
	height: 20px;
	padding-inline: 5px;
	border-radius: 999px;
	background: var(--groowleck-status-premium, #f4c95d);
	color: var(--groowleck-color-brand, #15233c);
	font-size: 0.75rem;
	font-weight: 800;
	line-height: 1;
}


/* =========================================================
   Acciones del usuario
   ========================================================= */

.site-header__actions {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	gap: var(--groowleck-actions-gap);
	margin-inline-start: var(--groowleck-commerce-gap);
}

/*
 * Mi cuenta, Entrar y Cerrar sesión son enlaces simples.
 */
.site-header__user-links {
	display: flex;
	align-items: center;
	gap: var(--groowleck-user-links-gap);
	white-space: nowrap;
}

.site-header__account,
.site-header__logout {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 0;
	border: 0;
	background: transparent;
	color: rgb(255 255 255 / 0.82);
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
}

.site-header__account:hover,
.site-header__account:focus-visible,
.site-header__logout:hover,
.site-header__logout:focus-visible {
	color: var(--groowleck-color-on-brand, #ffffff);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.3em;
}

.site-header__logout {
	position: relative;
	padding-inline-start: 17px;
}

.site-header__logout::before {
	position: absolute;
	inset-block: 28%;
	inset-inline-start: 0;
	width: 1px;
	background: rgb(255 255 255 / 0.25);
	content: "";
}

/*
 * Plus es la única acción con apariencia de botón.
 * Tiene mayor anchura, pero conserva la altura del Header.
 */
.site-header__plus {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 124px;
	min-height: 40px;
	padding-inline: 30px;
	border-radius: 8px;
	font-weight: 700;
	line-height: 1;
	text-align: center;
	text-decoration: none;
	white-space: nowrap;
}


/* =========================================================
   Botón del menú móvil
   ========================================================= */

.site-header__menu-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 42px;
	min-height: 40px;
	padding: 0;
	border: 1px solid currentColor;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.site-header__menu-toggle:hover,
.site-header__menu-toggle:focus-visible {
	background: rgb(255 255 255 / 0.08);
}

.site-header__menu-toggle-lines,
.site-header__menu-toggle-lines::before,
.site-header__menu-toggle-lines::after {
	display: block;
	width: 20px;
	height: 2px;
	border-radius: 2px;
	background: currentColor;
	transition: transform 260ms ease;
}

.site-header__menu-toggle-lines {
	position: relative;
}

.site-header__menu-toggle-lines::before,
.site-header__menu-toggle-lines::after {
	position: absolute;
	inset-inline-start: 0;
	content: "";
}

.site-header__menu-toggle-lines::before {
	transform: translateY(-6px);
}

.site-header__menu-toggle-lines::after {
	transform: translateY(6px);
}

.site-header__menu-toggle[aria-expanded="true"]
.site-header__menu-toggle-lines {
	background: transparent;
}

.site-header__menu-toggle[aria-expanded="true"]
.site-header__menu-toggle-lines::before {
	transform: rotate(45deg);
}

.site-header__menu-toggle[aria-expanded="true"]
.site-header__menu-toggle-lines::after {
	transform: rotate(-45deg);
}


/* =========================================================
   Navegación móvil
   ========================================================= */

.mobile-navigation {
	position: fixed;
	inset:
		calc(
			var(--groowleck-adminbar-height, 0px) +
			var(--groowleck-topbar-height) +
			var(--groowleck-header-height)
		)
		0
		0;
	z-index: var(--groowleck-panel-z);
	display: none;
	pointer-events: none;
}

.mobile-navigation__backdrop {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	background: rgb(0 0 0 / 0.46);
	opacity: 0;
	cursor: pointer;
	transition: opacity 220ms ease;
}

.mobile-navigation__panel {
	position: absolute;
	inset-block: 0;
	inset-inline-end: 0;
	width: min(88vw, 420px);
	padding: 24px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--groowleck-color-surface, #ffffff);
	color: var(--groowleck-color-text, #172033);
	box-shadow: -20px 0 50px rgb(0 0 0 / 0.18);
	transform: translate3d(100%, 0, 0);
	transition: transform var(--groowleck-panel-transition);
}

body.mobile-navigation-is-open {
	overflow: hidden;
}

body.mobile-navigation-is-open .mobile-navigation {
	pointer-events: auto;
}

body.mobile-navigation-is-open .mobile-navigation__backdrop {
	opacity: 1;
}

body.mobile-navigation-is-open .mobile-navigation__panel {
	transform: translate3d(0, 0, 0);
}


/* =========================================================
   Menús móviles
   ========================================================= */

.mobile-navigation__menu,
.mobile-navigation__menu ul,
.mobile-navigation__actions {
	margin: 0;
	padding: 0;
	list-style: none;
}

.mobile-navigation__menu a,
.mobile-navigation__actions a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 48px;
	border-bottom: 1px solid rgb(0 0 0 / 0.08);
	color: inherit;
	font-weight: 650;
	text-decoration: none;
}

.mobile-navigation__menu a:hover,
.mobile-navigation__menu a:focus-visible,
.mobile-navigation__actions a:hover,
.mobile-navigation__actions a:focus-visible {
	color: var(--groowleck-color-brand, #15233c);
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.3em;
}

.mobile-navigation__edd {
	margin-block-start: 24px;
	padding-block-start: 20px;
	border-top: 1px solid rgb(0 0 0 / 0.12);
}

.mobile-navigation__menu--edd a {
	font-weight: 700;
}

.mobile-navigation__actions {
	margin-block-start: 24px;
	padding-block-start: 20px;
	border-top: 1px solid rgb(0 0 0 / 0.12);
}

.mobile-navigation__plus {
	color: var(--groowleck-color-brand, #15233c);
	font-weight: 800;
}

.mobile-navigation__logout {
	color: var(--groowleck-color-danger, #a12424);
}


/* =========================================================
   Tableta y móvil
   ========================================================= */

@media (max-width: 1100px) {
	:root {
		--groowleck-topbar-height: 38px;
		--groowleck-header-height: 56px;
	}

	.site-topbar__inner {
		grid-template-columns: 1fr;
	}

	.site-topbar__information {
		display: none;
	}

	.site-topbar__promotion {
		text-align: center;
	}

	/*
	 * Oculta completamente todos los elementos exclusivos
	 * del Header de escritorio.
	 *
	 * Se aumenta la especificidad para evitar que las clases
	 * globales .button y .button--primary muestren Plus.
	 */
	.site-header .site-header__navigation,
	.site-header .site-header__edd-navigation,
	.site-header .site-header__user-links,
	.site-header .site-header__account,
	.site-header .site-header__logout,
	.site-header .site-header__plus {
		display: none !important;
	}

	.site-header__identity {
		margin-inline-end: 0;
	}

	/*
	 * El carrito se mantiene a la derecha del logo.
	 */
	.site-header__commerce {
		margin-inline-start: auto;
	}

	/*
	 * El bloque de acciones contiene exclusivamente
	 * el botón del menú móvil.
	 */
	.site-header__actions {
		display: flex;
		align-items: center;
		flex: 0 0 auto;
		gap: 0;
		margin-inline-start: 10px;
	}

	.site-header__cart {
		display: inline-flex;
		min-height: 36px;
		padding-inline: 8px;
	}

	.site-header__cart-label {
		display: none;
	}

	.site-header__menu-toggle {
		display: inline-flex;
		width: 40px;
		min-height: 36px;
		padding: 0;
	}

	.mobile-navigation {
		display: block;
	}

	/*
	 * Menor altura para los enlaces del panel móvil.
	 * El espaciado vertical baja de 12px a 10px.
	 */
	.mobile-navigation__menu a,
	.mobile-navigation__actions a {
		min-height: auto;
		padding-block: 10px;
	}
}

/* =========================================================
   Móviles pequeños
   ========================================================= */

@media (max-width: 480px) {
	:root {
		--groowleck-topbar-height: 36px;
		--groowleck-header-height: 54px;
	}

	.site-topbar__inner,
	.site-header__inner {
		width: min(
			100% - 28px,
			var(--groowleck-header-container)
		);
	}

	.site-topbar__inner {
		font-size: 0.8125rem;
	}

	.site-header__brand .custom-logo,
	.site-header__logo {
		max-width: 145px;
	}

	.site-header__commerce {
		margin-inline-start: auto;
	}

	.site-header__actions {
		margin-inline-start: 10px;
	}

	.site-header__cart {
		min-height: 34px;
	}

	.site-header__menu-toggle {
		width: 38px;
		min-height: 34px;
	}

	.mobile-navigation__panel {
		width: min(92vw, 380px);
		padding: 20px;
	}
}

/* =========================================================
   Reducción de movimiento
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
	.site-header,
	.mobile-navigation__panel,
	.mobile-navigation__backdrop,
	.site-header__menu-toggle-lines,
	.site-header__menu-toggle-lines::before,
	.site-header__menu-toggle-lines::after {
		transition-duration: 1ms !important;
	}
}