/**
 * Site header (inc/header.php): white bar, ☰ left, black Parker logo in the exact centre, icons right;
 * full-width mega menu under the bar (5 columns on desktop, accordions on mobile); search panel.
 */

/* Sticky: the header stays at the top of the screen while the page scrolls. */
body.pcm-header #masthead {
	position: sticky;
	top: 0;
	z-index: 100;
	background: #fff;
	border-bottom: 1px solid #ececec;
	box-shadow: none;
}

/* logged-in: below the WordPress admin bar (fixed 32px / 46px; it scrolls away under 601px) */
body.admin-bar.pcm-header #masthead {
	top: 32px;
}

@media (max-width: 782px) {
	body.admin-bar.pcm-header #masthead {
		top: 46px;
	}
}

@media (max-width: 600px) {
	body.admin-bar.pcm-header #masthead {
		top: 0;
	}
}

/* in-page anchors are not hidden under the header */
html:has(body.pcm-header) {
	scroll-padding-top: 90px;
}

body.pcm-header.pcm-hdr-open #masthead {
	z-index: 1000;
}

/* the whole header row (full width) sits above the dimmed backdrop */
.pcm-hdr {
	position: relative;
	z-index: 2;
	background: #fff;
	color: #000;
}

/* ---------- Bar: equal side columns, so the logo is centred whatever the icon groups are ---------- */
.pcm-hdr__bar {
	position: relative;
	z-index: 2;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	max-width: 1760px;
	height: 80px;
	margin: 0 auto;
	padding: 0 64px;
	background: #fff;
}

.pcm-hdr__left {
	display: flex;
	align-items: center;
	justify-self: start;
	margin-left: -10px;
}

.pcm-hdr__right {
	display: flex;
	align-items: center;
	justify-self: end;
	gap: 2px;
	margin-right: -10px;
}

body.pcm-header .pcm-hdr .pcm-hdr__btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0;
	background: transparent !important;
	box-shadow: none !important;
	color: #000 !important;
	line-height: 1;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

body.pcm-header .pcm-hdr .pcm-hdr__btn:hover {
	opacity: 0.6;
}

.pcm-hdr__icon {
	display: block;
	width: 24px;
	height: 24px;
}

/* second search button next to ☰ — mobile only (see the ≤767px block) */
body.pcm-header .pcm-hdr .pcm-hdr__search-btn--left {
	display: none;
}

/* ☰ → ✕ */
.pcm-hdr__burger-lines {
	position: relative;
	display: block;
	width: 22px;
	height: 14px;
}

.pcm-hdr__burger-lines span {
	position: absolute;
	left: 0;
	width: 100%;
	height: 1.4px;
	background: currentColor;
	transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
}

.pcm-hdr__burger-lines span:nth-child(1) { top: 0; }
.pcm-hdr__burger-lines span:nth-child(2) { top: 6.3px; }
.pcm-hdr__burger-lines span:nth-child(3) { top: 12.6px; }

.pcm-hdr.is-menu-open .pcm-hdr__burger-lines span:nth-child(1) {
	top: 6.3px;
	transform: rotate(45deg);
}

.pcm-hdr.is-menu-open .pcm-hdr__burger-lines span:nth-child(2) {
	opacity: 0;
}

.pcm-hdr.is-menu-open .pcm-hdr__burger-lines span:nth-child(3) {
	top: 6.3px;
	transform: rotate(-45deg);
}

/* logo */
.pcm-hdr__logo {
	display: block;
	color: #000 !important;
	line-height: 0;
	text-decoration: none;
}

.pcm-hdr__logo-svg {
	display: block;
	width: auto;
	height: 44px;
}

/* cart count */
.pcm-hdr__count {
	position: absolute;
	top: 5px;
	right: 3px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 8px;
	background: #000;
	color: #fff;
	font-size: 10px;
	font-weight: 600;
	line-height: 16px;
	text-align: center;
	box-sizing: border-box;
}

.pcm-hdr__count.is-empty {
	display: none;
}

/* ---------- Panels under the bar ---------- */
.pcm-search,
.pcm-mega {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 3;
	background: #fff;
	border-top: 1px solid #ececec;
	visibility: hidden;
	opacity: 0;
	transform: translateY(-6px);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

.pcm-hdr.is-search-open .pcm-search,
.pcm-hdr.is-menu-open .pcm-mega {
	visibility: visible;
	opacity: 1;
	transform: none;
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
}

.pcm-hdr-backdrop {
	position: fixed;
	inset: 0;
	z-index: 1;
	background: rgba(0, 0, 0, 0.28);
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

body.pcm-hdr-open .pcm-hdr-backdrop {
	visibility: visible;
	opacity: 1;
	transition: opacity 0.2s ease, visibility 0s;
}

/* search */
.pcm-search {
	box-shadow: 0 24px 40px -28px rgba(0, 0, 0, 0.25);
}

.pcm-search__form {
	display: flex;
	align-items: center;
	gap: 8px;
	max-width: 880px;
	margin: 0 auto;
	padding: 28px 64px 32px;
}

body.pcm-header .pcm-search__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 48px;
	margin: 0;
	padding: 0 !important;
	border: 0 !important;
	border-bottom: 1px solid #000 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	color: #000;
	font-size: 20px;
	outline: none;
}

body.pcm-header .pcm-search__input::placeholder {
	color: #9a9a9a;
}

body.pcm-header .pcm-search__submit,
body.pcm-header .pcm-search__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0 !important;
	border: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	color: #000 !important;
	cursor: pointer;
}

/* mega menu */
.pcm-mega {
	max-height: calc(100vh - 80px);
	overflow-y: auto;
	box-shadow: 0 30px 50px -30px rgba(0, 0, 0, 0.25);
}

.pcm-mega__inner {
	max-width: 1760px;
	margin: 0 auto;
	padding: 48px 64px 60px;
}

.pcm-mega__cols {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 40px;
}

.pcm-mega__head {
	margin: 0 0 18px;
}

body.pcm-header .pcm-mega__title {
	display: inline-block;
	color: #000;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.16em;
	line-height: 1.4;
	text-decoration: none;
	text-transform: uppercase;
}

body.pcm-header a.pcm-mega__title:hover {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.pcm-mega__toggle {
	display: none;
}

.pcm-mega__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.pcm-mega__list li {
	margin: 0;
	padding: 0;
}

body.pcm-header .pcm-mega__list a {
	display: inline-block;
	padding: 5px 0;
	color: #262626;
	font-size: 15px;
	line-height: 1.45;
	text-decoration: none;
}

body.pcm-header .pcm-mega__list a:hover {
	color: #000;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
}

.pcm-mega__extra {
	display: none;
}

/* ---------- Home page, desktop: transparent header over the full-width hero ----------
 * White logo/icons on the picture; on hover (or keyboard focus, or an open menu/search panel)
 * the header turns white and its contents black. Fixed, so it stays on screen; once the page is
 * scrolled (body.pcm-hdr-scrolled from header.js) it is white like on every other page.
 * Tablet and mobile keep the white sticky header. */
@media (min-width: 1025px) {
	body.pcm-hdr-overlay #masthead {
		--pcm-hdr-fg: #fff;
		--pcm-hdr-bg: transparent;
		--pcm-hdr-badge-bg: #fff;
		--pcm-hdr-badge-fg: #000;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		background: transparent;
		border-bottom-color: rgba(255, 255, 255, 0.2);
		transition: background-color 0.25s ease, border-color 0.25s ease;
	}

	body.admin-bar.pcm-hdr-overlay #masthead {
		top: 32px;
	}

	body.pcm-hdr-overlay #masthead:hover,
	body.pcm-hdr-overlay #masthead:has(:focus-visible),
	body.pcm-hdr-overlay.pcm-hdr-scrolled #masthead,
	body.pcm-hdr-overlay.pcm-hdr-open #masthead {
		--pcm-hdr-fg: #000;
		--pcm-hdr-bg: #fff;
		--pcm-hdr-badge-bg: #000;
		--pcm-hdr-badge-fg: #fff;
		background: #fff;
		border-bottom-color: #ececec;
	}

	body.pcm-hdr-overlay .pcm-hdr,
	body.pcm-hdr-overlay .pcm-hdr__bar {
		background: var(--pcm-hdr-bg);
		color: var(--pcm-hdr-fg);
		transition: background-color 0.25s ease, color 0.25s ease;
	}

	body.pcm-hdr-overlay .pcm-hdr .pcm-hdr__logo,
	body.pcm-header.pcm-hdr-overlay .pcm-hdr .pcm-hdr__btn {
		color: var(--pcm-hdr-fg) !important;
		transition: color 0.25s ease, opacity 0.2s ease;
	}

	body.pcm-hdr-overlay .pcm-hdr__count {
		background: var(--pcm-hdr-badge-bg);
		color: var(--pcm-hdr-badge-fg);
	}
}

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
	.pcm-hdr__bar {
		padding: 0 28px;
	}

	.pcm-mega__inner {
		padding: 36px 28px 44px;
	}

	.pcm-mega__cols {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		row-gap: 36px;
	}

	.pcm-search__form {
		padding: 24px 28px 28px;
	}
}

/* ---------- Mobile: ☰ LOGO 🔍 ♡ 🛍, menu = full-screen accordions ---------- */
@media (max-width: 767px) {
	.pcm-hdr__bar {
		height: 60px;
		padding: 0 8px;
	}

	.pcm-hdr__left,
	.pcm-hdr__right {
		margin: 0;
	}

	.pcm-hdr__right {
		gap: 0;
	}

	body.pcm-header .pcm-hdr .pcm-hdr__btn {
		width: 40px;
		height: 40px;
	}

	body.pcm-header .pcm-hdr .pcm-hdr__account {
		display: none;
	}

	/* search moves next to ☰ */
	body.pcm-header .pcm-hdr .pcm-hdr__search-btn--right {
		display: none;
	}

	body.pcm-header .pcm-hdr .pcm-hdr__search-btn--left {
		display: inline-flex;
	}

	.pcm-hdr__logo-svg {
		height: 31px;
	}

	.pcm-search__form {
		padding: 12px 16px 16px;
	}

	body.pcm-header .pcm-search__input {
		font-size: 16px;
	}

	.pcm-mega {
		position: fixed;
		top: var(--pcm-mega-top, 60px);
		bottom: 0;
		max-height: none;
		overscroll-behavior: contain;
		box-shadow: none;
	}

	.pcm-mega__inner {
		padding: 4px 20px 40px;
	}

	.pcm-mega__cols {
		display: block;
	}

	.pcm-mega__col {
		border-bottom: 1px solid #ececec;
	}

	.pcm-mega__head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		min-height: 56px;
		margin: 0;
		cursor: pointer;
	}

	body.pcm-header .pcm-mega__title {
		font-size: 13px;
	}

	body.pcm-header .pcm-mega__toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		margin: 0 -10px 0 0;
		padding: 0 !important;
		border: 0 !important;
		background: transparent !important;
		box-shadow: none !important;
		color: #000 !important;
		cursor: pointer;
	}

	.pcm-mega__toggle .pcm-hdr__icon {
		width: 20px;
		height: 20px;
		transition: transform 0.2s ease;
	}

	.pcm-mega__col.is-open .pcm-mega__toggle .pcm-hdr__icon {
		transform: rotate(180deg);
	}

	.pcm-mega__list {
		display: none;
		padding: 0 0 16px;
	}

	.pcm-mega__col.is-open .pcm-mega__list {
		display: block;
	}

	body.pcm-header .pcm-mega__list a {
		padding: 8px 0;
		font-size: 16px;
	}

	.pcm-mega__extra {
		display: block;
		padding: 24px 0 0;
	}

	body.pcm-header .pcm-mega__extra a {
		display: inline-flex;
		align-items: center;
		gap: 10px;
		color: #000;
		font-size: 15px;
		text-decoration: none;
	}

	html.pcm-lock,
	html.pcm-lock body {
		overflow: hidden;
	}
}

@media (max-width: 380px) {
	body.pcm-header .pcm-hdr .pcm-hdr__btn {
		width: 36px;
		height: 36px;
	}

	.pcm-hdr__logo-svg {
		height: 29px;
	}
}

@media (max-width: 340px) {
	.pcm-hdr__logo-svg {
		height: 23px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pcm-search,
	.pcm-mega,
	.pcm-hdr-backdrop,
	.pcm-hdr__burger-lines span {
		transition: none !important;
	}
}
