/*
 * PF Cabecera — «header» + «category nav bar» de Hardware Store Homepage.dc.html.
 * Punto de quiebre: 1024 px. Por debajo, una sola barra (☰ · logo · cuenta ·
 * carrito), el buscador a todo el ancho y un cajón con las categorías.
 */

.pf-hdr {
	--pf-logo-h: 44px;
	--pf-hdr-pad: 40px;
	--pf-box: 1440px;
	position: relative;
	background: #fff;
}

/* ---------- Barra blanca ---------- */

/* Fondo de lado a lado; contenido en la caja (mismo ancho que el sitio). */
.pf-hdr__bar {
	background: #fff;
	border-bottom: 1px solid var(--pf-line);
}

.pf-hdr__barin {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 24px;
	max-width: calc(var(--pf-box) + var(--pf-hdr-pad) * 2);
	margin: 0 auto;
	padding: 16px var(--pf-hdr-pad);
}

.pf-hdr-root .pf-hdr__burger {
	display: none;
}

.pf-hdr__logo {
	display: block;
	flex: none;
	line-height: 0;
}

.pf-hdr-root .pf-hdr__logo-img {
	display: block;
	width: auto;
	height: var(--pf-logo-h);
	max-width: 220px;
	object-fit: contain;
}

.pf-hdr__logo-text {
	font-family: var(--pf-font-display);
	font-weight: 800;
	font-size: 22px;
	line-height: 1;
	color: var(--pf-ink);
}

.pf-hdr__search {
	width: 100%;
	max-width: 760px;
	margin: 0 auto;
}

.pf-hdr__tools {
	display: flex;
	align-items: center;
	gap: 24px;
	flex: none;
}

.pf-hdr__tool {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	min-width: 44px;
	color: var(--pf-ink);
}

.pf-hdr__tool:hover {
	color: var(--pf-orange);
}

.pf-hdr__toollabel {
	font-size: 11px;
	line-height: 1.3;
	color: var(--pf-text-2);
	white-space: nowrap;
}

.pf-hdr__carticon {
	position: relative;
	display: block;
	line-height: 0;
}

.pf-hdr__badge {
	position: absolute;
	top: -6px;
	right: -10px;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 9px;
	background: var(--pf-orange);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
}

.pf-hdr__badge[hidden] {
	display: none;
}

.pf-hdr__cartwrap {
	position: relative;
}

/* ---------- Buscador ---------- */

.pf-search {
	position: relative;
	margin: 0;
}

.pf-hdr-root .pf-search__input {
	width: 100%;
	height: auto;
	margin: 0;
	padding: 13px 48px 13px 18px;
	border: 1.5px solid var(--pf-line-2);
	border-radius: 10px;
	background: var(--pf-soft);
	color: var(--pf-ink);
	font-family: var(--pf-font-body);
	font-size: 15px;
	line-height: 1.3;
	box-shadow: none;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.pf-hdr-root .pf-search__input::placeholder {
	color: var(--pf-muted);
	opacity: 1;
}

.pf-hdr-root .pf-search__input:focus {
	border-color: var(--pf-navy);
	background: #fff;
}

.pf-hdr-root .pf-search__input::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

.pf-hdr-root .pf-search__submit {
	position: absolute;
	top: 50%;
	right: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin-top: -22px;
	border-radius: 8px;
	color: var(--pf-muted);
}

.pf-hdr-root .pf-search__submit:hover,
.pf-hdr-root .pf-search__submit:focus {
	color: var(--pf-orange);
}

.pf-search__panel {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	z-index: 60;
	max-height: min(70vh, 560px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 8px 0;
	border: 1px solid var(--pf-line);
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 20px 40px rgba(18, 23, 58, 0.16);
}

.pf-search__panel[hidden] {
	display: none;
}

.pf-search__group {
	margin: 0;
	padding: 8px 16px 4px;
	font-family: var(--pf-font-display);
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--pf-muted);
}

.pf-search__opt {
	display: grid;
	grid-template-columns: 44px minmax(0, 1fr) auto;
	align-items: center;
	gap: 12px;
	min-height: 52px;
	padding: 6px 16px;
	color: var(--pf-ink);
}

.pf-search__opt--cat {
	grid-template-columns: minmax(0, 1fr) auto;
}

.pf-search__opt:hover,
.pf-search__opt.is-active {
	background: #f2f4ff;
	color: var(--pf-ink);
}

.pf-search__thumb {
	width: 44px;
	height: 44px;
	border-radius: 8px;
	object-fit: contain;
	background: #fff;
	border: 1px solid var(--pf-line);
}

.pf-search__name {
	display: block;
	overflow: hidden;
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.3;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pf-search__name mark {
	background: none;
	color: var(--pf-orange);
}

.pf-search__meta {
	display: block;
	font-size: 11.5px;
	color: var(--pf-muted);
}

.pf-search__price {
	font-family: var(--pf-font-display);
	font-weight: 800;
	font-size: 13.5px;
	white-space: nowrap;
}

.pf-search__count {
	font-size: 12px;
	color: var(--pf-muted);
}

.pf-search__all {
	display: block;
	margin: 6px 12px 4px;
	padding: 12px;
	border-radius: 8px;
	background: var(--pf-ink);
	color: #fff;
	font-size: 13.5px;
	font-weight: 600;
	text-align: center;
}

.pf-search__all:hover,
.pf-search__all.is-active {
	background: var(--pf-navy);
	color: #fff;
}

.pf-search__none {
	margin: 0;
	padding: 18px 16px;
	font-size: 13.5px;
	color: var(--pf-text-3);
	text-align: center;
}

/* ---------- Mini-carrito ---------- */

.pf-minicart {
	position: absolute;
	top: calc(100% + 12px);
	right: -8px;
	z-index: 70;
	width: 340px;
	padding: 18px;
	border: 1px solid var(--pf-line);
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 20px 40px rgba(18, 23, 58, 0.16);
	animation: pf-fade 0.15s ease;
}

.pf-minicart[hidden] {
	display: none;
}

.pf-minicart__title {
	margin: 0 0 12px;
	font-family: var(--pf-font-display);
	font-weight: 700;
	font-size: 15px;
	color: var(--pf-ink);
}

.pf-minicart__empty {
	margin: 0;
	padding: 16px 0;
	font-size: 13px;
	color: var(--pf-muted);
	text-align: center;
}

.pf-minicart__list {
	max-height: 50vh;
	overflow-y: auto;
}

.pf-minicart__item {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto 32px;
	align-items: center;
	gap: 8px;
	padding: 8px 0;
	border-bottom: 1px solid #f2f2f6;
	font-size: 13px;
	color: var(--pf-ink);
}

.pf-minicart__name a {
	color: var(--pf-ink);
}

.pf-minicart__qty {
	margin-left: 4px;
	color: var(--pf-muted);
}

.pf-minicart__amount {
	font-weight: 600;
	white-space: nowrap;
}

.pf-minicart__remove {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 6px;
	color: #c7c9d6;
	font-size: 18px;
}

.pf-minicart__remove:hover {
	background: var(--pf-soft);
	color: var(--pf-orange);
}

.pf-minicart__total {
	display: flex;
	justify-content: space-between;
	margin-top: 14px;
	font-family: var(--pf-font-display);
	font-weight: 700;
	font-size: 15px;
	color: var(--pf-ink);
}

a.pf-minicart__checkout,
a.pf-minicart__checkout:visited {
	display: block;
	margin-top: 12px;
	padding: 13px;
	border-radius: 9px;
	background: var(--pf-ink);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	text-align: center;
}

a.pf-minicart__checkout:hover,
a.pf-minicart__checkout:focus {
	background: var(--pf-navy);
	color: #fff;
}

a.pf-minicart__cart,
a.pf-minicart__cart:visited {
	display: block;
	padding: 10px 0 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--pf-navy);
	text-align: center;
	text-decoration: underline;
}

/* ---------- Barra azul ---------- */

.pf-hdr__nav {
	position: relative;
	z-index: 30;
	background: var(--pf-navy);
}

.pf-hdr__navinner {
	position: relative;
	display: flex;
	align-items: center;
	gap: 28px;
	height: 46px;
	max-width: calc(var(--pf-box) + var(--pf-hdr-pad) * 2);
	margin: 0 auto;
	padding: 0 var(--pf-hdr-pad);
}

.pf-hdr-root .pf-hdr__all {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: none;
	height: 46px;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
}

.pf-hdr-root .pf-hdr__all svg {
	width: 18px;
	height: 18px;
}

.pf-hdr-root .pf-hdr__all:hover,
.pf-hdr-root .pf-hdr__all[aria-expanded="true"] {
	color: #ffb088;
}

.pf-hdr__navlist {
	display: flex;
	align-items: center;
	gap: 20px;
	flex: 1;
	min-width: 0;
	overflow: hidden;
}

.pf-hdr__navitem.is-overflow {
	visibility: hidden;
}

.pf-hdr__navextra {
	display: flex;
	align-items: center;
	gap: 28px;
	flex: none;
}

.pf-hdr__navlink {
	display: block;
	padding: 13px 0;
	font-size: 13.5px;
	font-weight: 400;
	line-height: 20px;
	color: #cdd3f0;
	white-space: nowrap;
}

.pf-hdr__navlink:hover,
.pf-hdr__navlink:focus-visible {
	color: #fff;
}

.pf-hdr__navlink.is-current,
.pf-hdr__navlink.is-hot {
	color: #ffb088;
	font-weight: 700;
}

/* ---------- Mega menú ---------- */

.pf-mega {
	position: absolute;
	top: 46px;
	left: var(--pf-hdr-pad);
	z-index: 31;
	display: flex;
	width: min(760px, calc(100% - var(--pf-hdr-pad) * 2));
	min-height: 320px;
	border-radius: 0 0 14px 14px;
	background: #fff;
	box-shadow: 0 24px 48px rgba(18, 23, 58, 0.22);
	overflow: hidden;
	animation: pf-fade 0.12s ease;
}

.pf-mega[hidden] {
	display: none;
}

.pf-mega__cats {
	flex: none;
	width: 250px;
	max-height: 70vh;
	overflow-y: auto;
	padding: 10px 0;
	border-right: 1px solid var(--pf-line);
	background: var(--pf-soft);
}

.pf-mega__cat {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 12px 20px;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--pf-ink);
}

.pf-mega__cat svg {
	color: #c7c9d6;
	flex: none;
}

.pf-mega__cat.is-on,
.pf-mega__cat:hover,
.pf-mega__cat:focus-visible {
	background: #f2f4ff;
	color: var(--pf-ink);
}

.pf-mega__pane {
	flex: 1;
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 20px;
	padding: 24px;
	max-height: 70vh;
	overflow-y: auto;
}

.pf-mega__pane[hidden] {
	display: none;
}

.pf-mega__kicker {
	margin: 0 0 12px;
	font-family: var(--pf-font-display);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--pf-muted);
}

.pf-mega__subs li a {
	display: block;
	padding: 8px 0;
	font-size: 13.5px;
	color: var(--pf-text);
}

.pf-mega__subs li a:hover {
	color: var(--pf-orange);
}

.pf-mega__all {
	display: inline-block;
	margin-top: 12px;
	font-size: 13px;
	font-weight: 700;
	color: var(--pf-orange);
}

.pf-mega__promolink {
	display: flex;
	flex-direction: column;
	gap: 10px;
	color: var(--pf-text-2);
}

.pf-hdr-root .pf-mega__promoimg {
	display: block;
	width: 100%;
	height: 110px;
	border-radius: 10px;
	object-fit: cover;
}

.pf-hdr-root .pf-mega__catimg {
	display: block;
	width: 96px;
	height: 96px;
	border-radius: 50%;
	object-fit: cover;
}

.pf-mega__promotext {
	font-size: 12.5px;
	line-height: 1.4;
	color: var(--pf-text-2);
}

/* ---------- Cajón (tablet y teléfono) ---------- */

.pf-drawer {
	position: fixed;
	inset: 0;
	z-index: 100000;
}

.pf-drawer[hidden] {
	display: none;
}

.pf-drawer__scrim {
	position: absolute;
	inset: 0;
	background: rgba(18, 23, 58, 0.45);
	animation: pf-fade 0.2s ease;
}

.pf-drawer__panel {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	display: flex;
	flex-direction: column;
	width: min(86vw, 360px);
	padding-bottom: env(safe-area-inset-bottom, 0);
	overflow-y: auto;
	overscroll-behavior: contain;
	background: #fff;
	box-shadow: 8px 0 32px rgba(18, 23, 58, 0.2);
	animation: pf-slide 0.22s ease;
}

.pf-drawer__head {
	position: sticky;
	top: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 6px 6px 20px;
	background: var(--pf-navy);
	color: #fff;
}

.pf-drawer__title {
	font-family: var(--pf-font-display);
	font-weight: 800;
	font-size: 16px;
}

.pf-hdr-root .pf-drawer__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	color: #fff;
}

.pf-hdr-root .pf-drawer__close:hover,
.pf-hdr-root .pf-drawer__close:focus {
	color: #ffb088;
}

.pf-drawer__item {
	border-bottom: 1px solid var(--pf-line);
}

.pf-drawer__row {
	display: flex;
	align-items: stretch;
}

.pf-drawer__link {
	flex: 1;
	display: flex;
	align-items: center;
	min-height: 52px;
	padding: 0 20px;
	font-size: 15px;
	font-weight: 600;
	color: var(--pf-ink);
}

.pf-drawer__link.is-current {
	color: var(--pf-orange);
}

.pf-hdr-root .pf-drawer__toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 52px;
	border-left: 1px solid var(--pf-line);
	color: var(--pf-muted);
}

.pf-hdr-root .pf-drawer__toggle svg {
	transition: transform 0.2s ease;
}

.pf-hdr-root .pf-drawer__toggle[aria-expanded="true"] svg {
	transform: rotate(90deg);
}

.pf-drawer__sub {
	padding: 4px 0 10px;
	background: var(--pf-soft);
}

.pf-drawer__sub[hidden] {
	display: none;
}

.pf-drawer__sub a {
	display: flex;
	align-items: center;
	min-height: 44px;
	padding: 0 20px 0 32px;
	font-size: 14px;
	color: var(--pf-text);
}

.pf-drawer__sub a.is-current {
	color: var(--pf-orange);
	font-weight: 600;
}

.pf-drawer__extra {
	padding: 12px 0 24px;
}

.pf-drawer__extra a {
	display: flex;
	align-items: center;
	min-height: 48px;
	padding: 0 20px;
	font-size: 15px;
	font-weight: 600;
	color: var(--pf-navy);
}

.pf-drawer__extra a.is-hot {
	color: var(--pf-orange);
}

body.pf-noscroll {
	overflow: hidden;
}

/* ---------- Cabecera fija ---------- */

.pf-sticky-host {
	position: sticky;
	top: 0;
	z-index: 999;
	transition: transform 0.25s ease;
}

body.admin-bar .pf-sticky-host {
	top: 32px;
}

@media (max-width: 782px) {
	body.admin-bar .pf-sticky-host {
		top: 46px;
	}
}

@media (max-width: 600px) {
	/* La barra de admin deja de ser fija en teléfono. */
	body.admin-bar .pf-sticky-host {
		top: 0;
	}
}

@keyframes pf-fade {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes pf-slide {
	from {
		transform: translateX(-100%);
	}
	to {
		transform: none;
	}
}

/* ---------- Tablet y teléfono ---------- */

@media (max-width: 1024px) {
	.pf-hdr {
		--pf-logo-h: 34px;
		--pf-hdr-pad: 16px;
	}

	.pf-hdr__barin {
		grid-template-columns: auto minmax(0, 1fr) auto;
		grid-template-areas:
			"burger logo tools"
			"search search search";
		gap: 8px 4px;
		padding: 8px var(--pf-hdr-pad) 12px;
	}

	.pf-hdr-root .pf-hdr__burger {
		grid-area: burger;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		margin-left: -10px;
		color: var(--pf-ink);
	}

	/* La celda del logo es todo el espacio entre ☰ y los íconos; el enlace
	   la llena (si se ajustara al contenido, max-width:100% sería circular
	   y el logo mediría 0 px, v1.9.2). */
	.pf-hdr__logo {
		grid-area: logo;
		justify-self: stretch;
		min-width: 0;
	}

	/* El alto de escritorio (control del widget) pesa más que --pf-logo-h de
	   este bloque: aquí se limita por alto Y por el espacio libre de la fila,
	   para que nunca se monte sobre la cuenta y el carrito. */
	.pf-hdr-root .pf-hdr__logo-img {
		width: auto;
		height: min(var(--pf-logo-h), 40px);
		max-width: 100%;
		object-fit: contain;
		object-position: left center;
	}

	.pf-hdr__tools {
		grid-area: tools;
		justify-content: flex-end;
		gap: 4px;
	}

	.pf-hdr__search {
		grid-area: search;
		max-width: none;
	}

	.pf-hdr__tool {
		justify-content: center;
		width: 44px;
		height: 44px;
	}

	.pf-hdr__toollabel {
		display: none;
	}

	.pf-hdr-root .pf-search__input {
		padding-top: 11px;
		padding-bottom: 11px;
		font-size: 16px; /* 16 px: iOS no hace zoom al enfocar. */
	}

	.pf-hdr__nav {
		display: none;
	}

	.pf-minicart {
		position: fixed;
		top: auto;
		left: 12px;
		right: 12px;
		width: auto;
		margin-top: 8px;
	}

	/* Escondida al bajar (la pone el JS solo en este rango). */
	.pf-sticky-host.pf-hdr-hidden {
		transform: translateY(-100%);
	}
}

@media (min-width: 1025px) {
	.pf-drawer {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pf-minicart,
	.pf-mega,
	.pf-drawer__scrim,
	.pf-drawer__panel,
	.pf-sticky-host {
		animation: none;
		transition: none;
	}
}
