/* Site-wide header. Everything is scoped under .wpm-header (plus the #header host it sits in);
   tokens match the landing pages and the footer. */

/* ---- Host: Flatsome's <header id="header"> becomes the sticky element ---- */
#header.wpm-header-host {
	position: sticky;
	top: 0;
	z-index: 990;
	width: 100%;
	background: none;
	box-shadow: none;
}

#header.wpm-header-host .header-wrapper {
	position: static;
	background: none;
	box-shadow: none;
}

body.admin-bar #header.wpm-header-host {
	top: 32px;
}

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

/* Under 600px the admin bar scrolls away with the page. */
@media (max-width: 600px) {
	body.admin-bar #header.wpm-header-host {
		top: 0;
	}
}

.wpm-header {
	--wpm-bg: #FAFAF9;
	--wpm-surface: #FFFFFF;
	--wpm-surface-alt: #F5F3F0;
	--wpm-border: #E8E5E1;
	--wpm-text: #1A1918;
	--wpm-text-secondary: #6B6560;
	--wpm-primary: #2D7A4F;
	--wpm-primary-dark: #1E5A38;
	--wpm-primary-light: #E8F5EE;
	--wpm-accent-light: #FFF6EC;
	--wpm-accent-text: #8A4A0F;
	--wpm-pro-light: #F3F0FF;
	--wpm-pro-text: #5B3FD6;
	--wpm-bar-h: 72px;

	font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	font-size: 15px;
	font-weight: 400; /* Flatsome's typography sets body to 300 */
	line-height: 1.4;
	color: var(--wpm-text);
	text-align: left;
	-webkit-font-smoothing: antialiased;
}

.wpm-header *,
.wpm-header *::before,
.wpm-header *::after {
	box-sizing: border-box;
}

/* Resets against Flatsome's global element styles (lists, links, bare <button>). The site also has
   `body.single-post li { font-size: 18px !important }`, so list items pin their own size. */
.wpm-header ul,
.wpm-header li {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wpm-header li {
	font-size: 15px !important;
}

.wpm-header a {
	text-decoration: none;
}

.wpm-header button {
	margin: 0;
	padding: 0;
	min-height: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	letter-spacing: normal;
	line-height: inherit;
	text-transform: none;
	text-shadow: none;
	cursor: pointer;
}

.wpm-header svg {
	display: block;
	flex: none;
}

.wpm-header a:focus-visible,
.wpm-header button:focus-visible {
	outline: 2px solid var(--wpm-primary);
	outline-offset: 2px;
}

/* ---- Bar ---- */
.wpm-header__bar {
	position: relative;
	height: var(--wpm-bar-h);
	background: rgba(250, 250, 249, .92);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--wpm-border);
}

.wpm-header__inner {
	display: flex;
	align-items: center;
	height: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 24px;
}

.wpm-header__logo {
	display: block;
	flex: none;
	margin-right: 40px;
	border-radius: 6px;
}

.wpm-header__logo-img {
	display: block;
	width: 140px;
	height: auto;
	max-width: none;
}

.wpm-header__nav {
	flex: 1 1 auto;
	min-width: 0;
}

.wpm-header__actions {
	display: flex;
	align-items: center;
	gap: 20px;
	flex: none;
	margin-left: 24px;
}

.wpm-header .wpm-header__account {
	display: inline-flex;
	align-items: center;
	height: 40px;
	padding: 0 4px;
	border-radius: 8px;
	color: var(--wpm-text-secondary);
	font-size: 15px;
	font-weight: 500;
	transition: color .15s ease;
}

.wpm-header .wpm-header__account:hover {
	color: var(--wpm-text);
}

.wpm-header .wpm-header__cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 40px;
	padding: 0 18px;
	border-radius: 6px;
	background: var(--wpm-primary);
	color: #FFFFFF;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	transition: background-color .15s ease;
}

.wpm-header .wpm-header__cta:hover {
	background: var(--wpm-primary-dark);
	color: #FFFFFF;
}

.wpm-header .wpm-header__toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin-left: auto;
	margin-right: -10px;
	border-radius: 10px;
	color: var(--wpm-text);
}

.wpm-header .wpm-header__toggle:hover {
	background: var(--wpm-surface-alt);
}

.wpm-header__toggle-close,
.wpm-header__toggle[aria-expanded="true"] .wpm-header__toggle-open {
	display: none !important;
}

.wpm-header__toggle[aria-expanded="true"] .wpm-header__toggle-close {
	display: block !important;
}

.wpm-header__sheet[hidden] {
	display: none !important;
}

/* ---- Phone ---- */
@media (max-width: 899px) {
	.wpm-header {
		--wpm-bar-h: 64px;
	}

	.wpm-header__inner {
		padding: 0 20px;
	}

	.wpm-header__logo {
		margin-right: 0;
	}

	.wpm-header__logo-img {
		width: 120px;
	}

	.wpm-header__nav,
	.wpm-header__actions {
		display: none;
	}

	.wpm-header .wpm-header__toggle {
		display: inline-flex;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wpm-header *,
	.wpm-header *::before,
	.wpm-header *::after {
		transition: none !important;
		animation: none !important;
	}
}

/* ---- Desktop nav ---- */
.wpm-header .wpm-hnav {
	display: flex;
	align-items: center;
	gap: 2px;
}

.wpm-hnav__item {
	position: relative;
}

.wpm-header .wpm-hnav__link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	height: 40px;
	padding: 0 12px;
	border-radius: 8px;
	color: var(--wpm-text-secondary);
	font-size: 15px;
	font-weight: 500;
	line-height: 1;
	white-space: nowrap;
	transition: color .15s ease, background-color .15s ease;
}

.wpm-header .wpm-hnav__link:hover,
.wpm-header .wpm-hnav__link[aria-current="page"],
.wpm-header .wpm-hnav__link.is-current,
.wpm-header .wpm-hnav__btn[aria-expanded="true"] {
	color: var(--wpm-text);
}

.wpm-header .wpm-hnav__btn[aria-expanded="true"] {
	background: var(--wpm-surface-alt);
}

.wpm-hnav__btn svg {
	margin-right: -4px;
	transition: transform .15s ease;
}

.wpm-hnav__btn[aria-expanded="true"] svg {
	transform: rotate(180deg);
}

/* ---- Plugins panel ---- */
.wpm-hpanel {
	display: none;
	position: absolute;
	top: calc(100% + 8px);
	left: -10px;
	z-index: 10;
	width: 540px;
	padding: 10px;
	background: var(--wpm-surface);
	border: 1px solid var(--wpm-border);
	border-radius: 16px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .08), 0 16px 48px rgba(0, 0, 0, .04);
}

/* An invisible bridge over the 8px gap, so moving the pointer down doesn't close a hover-opened panel. */
.wpm-hpanel::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: -10px;
	height: 10px;
}

.wpm-hnav__item.is-open .wpm-hpanel,
.wpm-header:not(.wpm-js) .wpm-hnav__item--panel:hover .wpm-hpanel,
.wpm-header:not(.wpm-js) .wpm-hnav__item--panel:focus-within .wpm-hpanel {
	display: block;
	animation: wpm-panel-in .14s ease-out;
}

@keyframes wpm-panel-in {
	from { opacity: 0; transform: translateY(-4px); }
	to { opacity: 1; transform: none; }
}

.wpm-header .wpm-hpanel__list {
	display: grid;
	gap: 2px;
}

.wpm-header .wpm-hpanel__row {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	padding: 12px;
	border-radius: 10px;
	color: var(--wpm-text);
	transition: background-color .15s ease;
}

.wpm-header .wpm-hpanel__row:hover,
.wpm-header .wpm-hpanel__row:focus-visible {
	background: var(--wpm-surface-alt);
}

.wpm-header .wpm-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 10px;
}

.wpm-header .wpm-icon--grid { background: var(--wpm-primary-light); color: var(--wpm-primary-dark); }
.wpm-header .wpm-icon--sliders { background: var(--wpm-accent-light); color: var(--wpm-accent-text); }
.wpm-header .wpm-icon--sparkle { background: var(--wpm-pro-light); color: var(--wpm-pro-text); }

.wpm-hpanel__text {
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
	padding-top: 1px;
}

.wpm-header .wpm-hpanel__name {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.35;
	color: var(--wpm-text);
}

.wpm-header .wpm-hpanel__desc {
	font-size: 13.5px;
	line-height: 1.45;
	color: var(--wpm-text-secondary);
}

.wpm-header .wpm-pill {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 11.5px;
	font-weight: 600;
	line-height: 1.5;
	white-space: nowrap;
}

.wpm-header .wpm-pill--freepro { background: var(--wpm-primary-light); color: var(--wpm-primary-dark); }
.wpm-header .wpm-pill--new { background: var(--wpm-accent-light); color: var(--wpm-accent-text); }

.wpm-header .wpm-hpanel__legacy {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 16px;
	margin: 8px -10px -10px;
	padding: 12px 22px;
	background: var(--wpm-surface-alt);
	border-top: 1px solid var(--wpm-border);
	border-radius: 0 0 16px 16px;
	font-size: 13.5px;
	color: var(--wpm-text-secondary);
}

.wpm-header .wpm-legacy-link {
	color: var(--wpm-primary-dark);
	font-size: 13.5px;
	font-weight: 600;
}

.wpm-header .wpm-legacy-link:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ---- Phone sheet ---- */
.wpm-header__sheet {
	position: fixed;
	left: 0;
	right: 0;
	top: var(--wpm-sheet-top, 64px);
	bottom: 0;
	z-index: 989;
	display: flex;
	flex-direction: column;
	background: var(--wpm-bg);
	animation: wpm-sheet-in .16s ease-out;
}

@keyframes wpm-sheet-in {
	from { opacity: 0; transform: translateY(-6px); }
	to { opacity: 1; transform: none; }
}

.wpm-sheet__nav {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 20px 20px 24px;
}

.wpm-header .wpm-sheet__label {
	display: block;
	margin: 0 0 6px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--wpm-text-secondary);
}

.wpm-header .wpm-sheet__product {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 56px;
	padding: 10px 8px;
	margin: 0 -8px;
	border-radius: 10px;
	color: var(--wpm-text);
}

.wpm-header .wpm-sheet__product:hover {
	background: var(--wpm-surface-alt);
}

.wpm-header .wpm-sheet__product .wpm-icon {
	width: 36px;
	height: 36px;
}

.wpm-header .wpm-sheet__product-name {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	font-size: 16px;
	font-weight: 600;
}

/* The sheet shows a pill on Advanced Bulk Edit only. */
.wpm-header .wpm-sheet__product .wpm-pill--new {
	display: none;
}

.wpm-header .wpm-sheet__legacy {
	display: flex;
	flex-wrap: wrap;
	gap: 0 20px;
	margin-top: 4px;
}

.wpm-header .wpm-sheet__legacy .wpm-legacy-link {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	font-size: 15px;
}

.wpm-header .wpm-sheet__links {
	margin-top: 16px;
	padding-top: 8px;
	border-top: 1px solid var(--wpm-border);
}

.wpm-header .wpm-sheet__links li {
	font-size: 17px !important;
}

.wpm-header .wpm-sheet__link {
	display: flex;
	align-items: center;
	min-height: 54px;
	color: var(--wpm-text);
	font-size: 17px;
	font-weight: 500;
	border-bottom: 1px solid var(--wpm-border);
}

.wpm-header .wpm-sheet__links li:last-child .wpm-sheet__link {
	border-bottom: 0;
}

.wpm-header .wpm-sheet__link[aria-current="page"] {
	color: var(--wpm-primary-dark);
}

.wpm-sheet__cta {
	flex: none;
	padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
	background: var(--wpm-bg);
	border-top: 1px solid var(--wpm-border);
}

.wpm-header .wpm-header__cta--block {
	display: flex;
	width: 100%;
	height: 50px;
	border-radius: 10px;
	font-size: 16px;
}

/* The sheet only exists on phones. */
@media (min-width: 900px) {
	.wpm-header__sheet {
		display: none !important;
	}
}

/* Scroll lock on <html> only: overflow on <body> would make it the scroll container and unstick the bar. */
html.wpm-sheet-open {
	overflow: hidden;
}

/* ---- Anchor offsets: the one place in-page anchors clear the sticky bar ----
   Plain anchors use scroll-padding-top on <html> (Flatsome's own value comes from its sticky JS,
   which no longer runs). The /bulk-edit/ and /product-options/ landing pages scroll with their own
   JS, which reads --wcabe-g2-scroll-offset / --wpm-pcf-scroll-offset as a number (parseFloat), so
   these must stay plain px values, not calc(). Offset = bar height + 16px breathing room
   (+ the admin bar where it is fixed). */
:root {
	--wpm-anchor-offset: 88px;
	--wcabe-g2-scroll-offset: 88px;
	--wpm-pcf-scroll-offset: 88px;
}

html:root {
	scroll-padding-top: var(--wpm-anchor-offset);
}

:root:has(> body.admin-bar) {
	--wpm-anchor-offset: 120px;
	--wcabe-g2-scroll-offset: 120px;
	--wpm-pcf-scroll-offset: 120px;
}

@media (max-width: 899px) {
	:root {
		--wpm-anchor-offset: 80px;
		--wcabe-g2-scroll-offset: 80px;
		--wpm-pcf-scroll-offset: 80px;
	}

	:root:has(> body.admin-bar) {
		--wpm-anchor-offset: 112px;
		--wcabe-g2-scroll-offset: 112px;
		--wpm-pcf-scroll-offset: 112px;
	}
}

@media (max-width: 782px) {
	:root:has(> body.admin-bar) {
		--wpm-anchor-offset: 126px;
		--wcabe-g2-scroll-offset: 126px;
		--wpm-pcf-scroll-offset: 126px;
	}
}

@media (max-width: 600px) {
	:root:has(> body.admin-bar) {
		--wpm-anchor-offset: 80px;
		--wcabe-g2-scroll-offset: 80px;
		--wpm-pcf-scroll-offset: 80px;
	}
}
