/**
 * gp-header.css — Header custom de Global Printed.
 * Mobile-first. Breakpoint principal: 992px.
 * Todos los selectores usan el prefijo gp- (o clases WP del menú) para no
 * afectar a las barras promocionales superiores (.gp-banner) ni al resto del tema.
 */

:root {
	--gp-pink: #ff3067;
	--gp-ink: #2b2a63;
	--gp-ink-soft: #4a4880;
	--gp-violet: #6a35d6;
	--gp-lav: #e6e3f6;
	--gp-nav: #4b419e;
	--gp-icon: #111827; /* trazo de los iconos cuenta/carrito (Figma 186-9856) */
	--gp-border: #e5e7eb;
	--gp-sub-bg: #f5f5f5;
	--gp-header-h: 72px;
}

/* Escala de z-index (referencia):
 *   999    → banners superiores (.gp-banner, en banner-promocional.php)
 *   1000   → header en reposo (#masthead.gp-header) — POR ENCIMA del banner para
 *            que el badge "New" del menú (.gp-menu-new::before), que sobresale
 *            hacia arriba del header, no quede tapado por el banner.
 *   Dentro del header al abrir el panel móvil:
 *     1000  → overlay (.gp-overlay) · 1001 → panel (.gp-panel)
 *   9999   → header al abrir el panel (#masthead.gp-header.is-open)
 *   99999  → banners expuestos sobre el panel (.gp-no-scroll .gp-banner)
 */

/* Reset defensivo: corta el CSS de Storefront sobre el <header>. */
#masthead.gp-header {
	background: #fff;
	box-shadow: none;
	padding: 0;
	margin: 0;
	border: 0;
	position: relative;
	z-index: 1000;
	font-family: 'Outfit', system-ui, sans-serif;
}

#masthead.gp-header * {
	box-sizing: border-box;
}

#masthead.gp-header button:focus {
	outline: none;
}

/* Bloqueo de scroll del body cuando el panel móvil está abierto. */
.gp-no-scroll {
	overflow: hidden;
}

/* ---------------------------------------------------------------------------
 * BASE (móvil, < 992px)
 * ------------------------------------------------------------------------- */

.gp-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--gp-border);
}

/* El logo no debe encogerse ni deformarse cuando la fila se estrecha:
   el contenedor mantiene su ancho natural (flex-shrink:0) y la imagen
   conserva proporción (height:auto + object-fit:contain). */
.gp-header__logo,
.gp-panel__logo {
	flex-shrink: 0;
}

.gp-header__logo img,
.gp-panel__logo img {
	display: block;
	max-height: 34px;
	width: auto;
	height: auto;
	max-width: 100%;
	object-fit: contain;
}

.gp-header__logo .gp-logo__text,
.gp-panel__logo .gp-logo__text {
	font-weight: 800;
	font-size: 20px;
	color: var(--gp-ink);
	text-decoration: none;
}

.gp-header__burger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 6px;
	color: var(--gp-nav);
	background: none;
	border: 0;
	cursor: pointer;
}

/* Cluster derecho de la barra superior en móvil: cuenta + carrito + menú
   (Figma 408-16836). En desktop se oculta (esos accesos van en .gp-header__actions). */
.gp-header__mobile-right {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.gp-header__mobile-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

/* Iconos de cuenta/carrito en círculo */
.gp-header__m-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 20px;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	color: var(--gp-icon);
	cursor: pointer;
	text-decoration: none;
}

.gp-header__m-icon:hover {
	border-color: var(--gp-ink-soft);
}

.gp-header__m-icon .gp-icon {
	width: 20px;
	height: 20px;
}

/* Overlay del panel */
.gp-overlay {
	position: fixed;
	inset: 0;
	background: rgba(20, 18, 45, 0.45);
	opacity: 0;
	transition: opacity 0.25s ease;
	z-index: 1000;
}

.gp-header.is-open .gp-overlay {
	display: block !important;
	opacity: 1;
}

/* Panel off-canvas: SIEMPRE a pantalla completa en móvil (sin tope de ancho,
   para que llene el 100% también en 412/430px como Pixel 7 o iPhone 14 Pro Max).
   En desktop (>=992px) se sobreescribe a width:auto más abajo. */
.gp-panel {
	position: fixed;
	top: 0;
	left: 0;
	height: 100vh;
	height: 100dvh;
	width: 100%;
	background: #fff;
	transform: translateX(-100%);
	transition: transform 0.3s ease;
	z-index: 1001;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.gp-header.is-open .gp-panel {
	transform: translateX(0);
}

/* Al abrir, elevar el header por encima del banner (z-index:999) para que el
   panel y el overlay tapen todo (el #masthead crea su propio contexto). */
#masthead.gp-header.is-open {
	z-index: 9999;
}

/* Los banners superiores permanecen visibles cuando el panel está abierto.
   Se elevan por encima del stacking context del header (z-index: 9999).
   Depende de gp-header.js: openPanel() mide su altura (.gp-banner) y desplaza
   el panel/overlay justo debajo. Si cambia el selector, actualizar ambos. */
.gp-no-scroll .gp-banner {
	z-index: 99999;
}

.gp-panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
	height: 72px;
	padding: 0 16px;
	border-bottom: 1px solid var(--gp-border);
}

.gp-panel__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	background: none;
	border: 0;
	outline: none;
	color: var(--gp-nav);
	cursor: pointer;
}

.gp-panel__close .gp-icon {
	overflow: visible;
}

/* Barra rosa de contacto */
.gp-panel__contact {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 15px;
	padding: 8px 40px;
	background: var(--gp-pink);
	color: #fff;
	font-weight: 600;
	font-size: 16px;
	flex-shrink: 0;
}

.gp-panel__contact-item {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	color: #fff;
	text-decoration: none;
}

.gp-panel__contact-sep {
	font-weight: 300;
}

/* Menú (compartido). Base = acordeón vertical móvil. */
.gp-nav {
	display: block;
}

.gp-nav__list,
.gp-nav .sub-menu {
	list-style: none;
	margin: 0;
	padding: 0;
}

.gp-nav__list > .menu-item {
	border-bottom: 1px solid #e5e7eb;
}

.gp-nav__list .menu-item-has-children {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
}

.gp-nav__list .menu-item > a {
	display: block;
	flex: 1 1 auto;
	padding: 16px;
	color: #3b2a82;
	font-weight: 500;
	font-size: 16px;
	line-height: normal;
	text-decoration: none;
}

.gp-nav__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: none;
	border: 0;
	color: var(--gp-ink);
	cursor: pointer;
}

/* Chevron: colapsado apunta a la derecha (>), expandido hacia abajo (v). */
.gp-nav__toggle svg {
	transition: transform 0.2s ease;
	transform: rotate(-90deg);
}

.gp-nav__list .menu-item-has-children.is-expanded > .gp-nav__toggle svg {
	transform: rotate(0deg);
}

.gp-nav .sub-menu {
	width: 100%;
	background: var(--gp-sub-bg);
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease;
}

.gp-nav__list .menu-item-has-children.is-expanded > .sub-menu {
	max-height: 720px;
}

.gp-nav .sub-menu .menu-item {
	border-bottom: 1px solid #e5e7eb;
}

.gp-nav .sub-menu .menu-item:last-child {
	border-bottom: 0;
}

.gp-nav .sub-menu a {
	display: block;
	padding: 16px;
	color: var(--gp-nav);
	font-weight: 600;
	font-size: 18px;
	line-height: normal;
	text-decoration: none;
}

/* Acciones */
.gp-header__actions {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 12px 16px;
	flex-shrink: 0;
}

.gp-btn--personalizar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 14px 26px;
	background: var(--gp-pink);
	color: #fff;
	font-weight: 600;
	font-size: 18px;
	border-radius: 8px;
	text-decoration: none;
	border: 0;
	cursor: pointer;
}

.gp-btn--personalizar:hover {
	filter: brightness(0.96);
}

.gp-btn--calculator {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 12px 26px;
	border: 2px solid var(--gp-calculator-color, var(--gp-nav));
	border-radius: 8px;
	background: #fff;
	color: var(--gp-calculator-color, var(--gp-nav));
	font-size: 18px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.gp-btn--calculator:hover {
	background: #f8f7fc;
}

.gp-btn--calculator .gp-icon {
	flex-shrink: 0;
}

.gp-header__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	background: #f9fafb;
	border: 1px solid var(--gp-border);
	border-radius: 50%;
	color: var(--gp-icon);
	text-decoration: none;
}

.gp-header__icon:hover {
	border-color: var(--gp-ink-soft);
}

/* El carrito no navega (sin href): dispara el carrito deslizante de FunnelKit por
   la clase de trigger. Se mantiene el cursor de puntero (debe coincidir con
   GP_HEADER_CART_TRIGGER_CLASS en inc/gp-header.php). */
#masthead.gp-header .fkcart-mini-cart-icon {
	cursor: pointer;
}

/* En móvil, los iconos de cuenta y carrito van en la sección secundaria (texto). */
.gp-header__account,
.gp-header__cart {
	display: none;
}

/* Sección secundaria móvil: Mi cuenta + Carrito como enlaces con texto */
.gp-header__secondary {
	display: flex;
	flex-direction: column;
	flex: 1 0 0;
	min-height: 1px;
	background: #f9fafb;
	padding: 12px 0;
}

.gp-header__secondary-link {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 14px 16px;
	color: #6b7280;
	font-size: 16px;
	font-weight: 500;
	text-decoration: none;
	line-height: normal;
}

.gp-header__secondary-link:hover {
	color: var(--gp-ink);
}

/* Los iconos van más oscuros que el texto (Figma 408-5935): trazo #111827. */
.gp-header__secondary-link svg {
	color: var(--gp-icon);
}

/* ---------------------------------------------------------------------------
 * DESKTOP (>= 992px)
 * ------------------------------------------------------------------------- */

@media (min-width: 992px) {

	.gp-header__inner {
		justify-content: flex-start;
		gap: 40px;
		padding: 16px 40px;
	}

	.gp-header__logo img {
		max-height: 40px;
	}

	/* Ocultar chrome móvil */
	.gp-header__burger,
	.gp-header__mobile-right,
	.gp-overlay,
	.gp-panel__head,
	.gp-panel__contact {
		display: none !important;
	}

	/* El panel deja de ser off-canvas y se vuelve la fila del header */
	.gp-panel {
		position: static;
		transform: none;
		width: auto;
		height: auto;
		flex: 1;
		display: flex;
		flex-direction: row;
		align-items: center;
		gap: 24px;
		background: none;
		overflow: visible;
	}

	.gp-nav {
		display: flex;
		justify-content: center;
		align-items: center;
		gap: 24px;
		flex: 1 0 0;
		align-self: stretch;
	}

	.gp-nav__list {
		display: flex;
		align-items: center;
		gap: 24px;
	}

	.gp-nav__list > .menu-item {
		border: 0;
		position: relative;
		display: block;
	}

	.gp-nav__list .menu-item > a {
		padding: 8px 0;
		font-size: 16px;
		font-weight: 500;
		color: var(--gp-nav);
	}

	.gp-nav__list > .menu-item > a:hover {
		color: var(--gp-ink);
	}

	/* Subrayado activo + hover */
	.gp-nav__list > .menu-item > a::after {
		content: "";
		position: absolute;
		left: 0;
		right: 0;
		bottom: -20px;
		height: 6px;
		background: var(--gp-nav);
		opacity: 0;
		transition: opacity 0.15s ease;
	}

	.gp-nav__list > .menu-item > a:hover::after,
	.gp-nav__list > .current-menu-item > a::after,
	.gp-nav__list > .current-menu-ancestor > a::after,
	.gp-nav__list > .current_page_item > a::after {
		opacity: 1;
	}

	/* El chevron/acordeón no aplica en desktop */
	.gp-nav__toggle {
		display: none;
	}

	/* Dropdown como tarjeta flotante */
	.gp-nav .sub-menu {
		position: absolute;
		top: calc(100% + 14px);
		left: 0;
		width: max-content;
		min-width: 316px;
		max-height: none;
		background: #fff;
		border: 1px solid #e9eaeb;
		border-radius: 16px;
		box-shadow: 0 4px 4px -1px rgba(12, 12, 13, 0.10), 0 4px 4px -1px rgba(12, 12, 13, 0.05);
		padding: 8px;
		opacity: 0;
		visibility: hidden;
		transform: translateY(8px);
		transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
	}

	.gp-nav__list > .menu-item-has-children:hover > .sub-menu,
	.gp-nav__list > .menu-item-has-children:focus-within > .sub-menu {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
	}

	.gp-nav .sub-menu .menu-item {
		border: 0;
	}

	.gp-nav .sub-menu a {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 8px;
		padding: 12px 16px;
		border-radius: 10px;
		font-size: 18px;
		font-weight: 600;
		white-space: nowrap;
	}

	/* Chevron › decorativo a la derecha de cada item del dropdown */
	.gp-nav .sub-menu a::after {
		content: "";
		flex: none;
		width: 7px;
		height: 7px;
		border-top: 2px solid currentColor;
		border-right: 2px solid currentColor;
		transform: rotate(45deg);
		opacity: 0.5;
	}

	.gp-nav .sub-menu a:hover {
		background: var(--gp-lav);
	}

	/* Acciones a la derecha */
	.gp-header__actions {
		flex-direction: row;
		align-items: center;
		gap: 12px;
		padding: 0;
		margin: 0 0 0 auto;
	}

	.gp-btn--personalizar {
		width: auto;
		min-width: 174px;
		padding: 9px 16px;
		font-size: 16px;
	}

	.gp-btn--calculator {
		width: auto;
		min-width: 224px;
		padding: 8px 16px;
		font-size: 16px;
		white-space: nowrap;
	}

	.gp-header__account,
	.gp-header__cart {
		display: inline-flex;
	}

	.gp-header__secondary {
		display: none;
	}
}

@media (min-width: 992px) and (max-width: 1200px) {
	.gp-header__inner {
		gap: 20px;
		padding: 14px 24px;
	}

	.gp-panel,
	.gp-nav,
	.gp-nav__list {
		gap: 14px;
	}

	.gp-header__actions {
		gap: 8px;
	}

	.gp-btn--personalizar,
	.gp-btn--calculator {
		min-width: 0;
		padding: 8px 10px;
		font-size: 14px;
	}
}
