/* ------------------------------------------------------------------
 * PMBO - global front-end styles
 * Loaded on every page. Keep this file tiny; heavy styles belong in
 * feature-specific stylesheets (home.css, wizard.css).
 * ------------------------------------------------------------------ */

/* --- "Start my site" CTA in the primary navigation --------------- */
/*
 * Matches BOTH:
 *  - theme-managed nav items that link to the start page (slug-based)
 *  - our dynamically injected <li class="pmbo-menu-cta">
 */
.menu-item.pmbo-menu-cta,
.menu-item:has(> a[href*="/start-my-site"]) {
	display: flex;
	align-items: center;
}

.menu-item.pmbo-menu-cta > a,
.menu-item a[href*="/start-my-site"],
.menu-item a[href$="/start-my-site/"],
.menu-item a[href*="redirect_to=%2Fstart-my-site"] {
	display: inline-flex;
	align-items: center;
	align-self: center;
	justify-content: center;
	padding: 13px 22px !important;
	min-height: 0;
	height: auto !important;
	flex: 0 0 auto;
	line-height: 1.2 !important;
	/* Match the hero `.pmbo-home .pmbo-btn-primary` lockup so the nav CTA
	 * reads as the same "Build my shop" button reused in the header. */
	background: linear-gradient(135deg, #111827 0%, #4338ca 100%);
	color: #ffffff !important;
	border: 0;
	border-radius: 12px;
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	white-space: nowrap;
	box-shadow: 0 6px 16px rgba(67, 56, 202, 0.28);
	transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
	text-decoration: none !important;
}

.menu-item.pmbo-menu-cta > a:hover,
.menu-item a[href*="/start-my-site"]:hover,
.menu-item a[href$="/start-my-site/"]:hover,
.menu-item a[href*="redirect_to=%2Fstart-my-site"]:hover {
	filter: brightness(1.08);
	color: #ffffff !important;
	box-shadow: 0 8px 22px rgba(67, 56, 202, 0.38);
}

.menu-item.pmbo-menu-cta > a:focus,
.menu-item a[href*="/start-my-site"]:focus,
.menu-item a[href$="/start-my-site/"]:focus,
.menu-item a[href*="redirect_to=%2Fstart-my-site"]:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.4), 0 6px 16px rgba(67, 56, 202, 0.28);
}

.menu-item.pmbo-menu-cta > a:active,
.menu-item a[href*="/start-my-site"]:active,
.menu-item a[href$="/start-my-site/"]:active,
.menu-item a[href*="redirect_to=%2Fstart-my-site"]:active {
	filter: brightness(0.96);
	color: #ffffff !important;
	transform: translateY(1px);
	box-shadow: 0 3px 10px rgba(67, 56, 202, 0.3);
}

/* Current-page state: keep the pill filled, don't invert colors. */
.menu-item.current-menu-item.pmbo-menu-cta > a,
.menu-item.current-menu-item a[href*="/start-my-site"],
.menu-item.current_page_item a[href*="/start-my-site"] {
	background: linear-gradient(135deg, #0b1020 0%, #312e81 100%);
	color: #ffffff !important;
}

/* --- Marketing-site brand wordmark ------------------------------- *
 * Replaces Astra's default site title (or empty branding wrapper)
 * with an all-lowercase, bold "putmybusinessonline" lockup. The
 * `online` portion is painted with the same indigo \u2192 pink gradient
 * the hero `<h1><em>online</em></h1>` uses, so the brand and the
 * headline echo each other. Filter lives in `class-pmbo-shortcodes.php`.
 * ------------------------------------------------------------------ */
.pmbo-platform-brand {
	display: inline-flex;
	align-items: baseline;
	gap: 0;
	text-decoration: none !important;
	font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-weight: 800;
	font-size: clamp(1.25rem, 1.6vw, 1.6rem);
	letter-spacing: -0.02em;
	text-transform: lowercase;
	line-height: 1;
	color: #0f172a;
	white-space: nowrap;
}

.pmbo-platform-brand:hover,
.pmbo-platform-brand:focus-visible {
	text-decoration: none !important;
	filter: brightness(1.08);
}

.pmbo-platform-brand:focus-visible {
	outline: 2px solid rgba(99, 102, 241, 0.6);
	outline-offset: 4px;
	border-radius: 4px;
}

.pmbo-platform-brand__base {
	color: #0f172a;
}

.pmbo-platform-brand__accent {
	background: linear-gradient(90deg, #6366f1, #ec4899);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

/* Astra paints `.site-title` and `.site-description` as siblings of the
 * branding markup we replace via the `astra_logo` filter; suppress them
 * on the platform site so our wordmark is the single source of truth. */
body:not(.pmbo-managed) .ast-site-identity .site-title,
body:not(.pmbo-managed) .ast-site-identity .site-description {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* --- Platform header behavior ------------------------------------ */
/* Keep the marketing-site top nav persistently visible during scroll.
 * In this Astra layout, `position: sticky` is unreliable, so we use a
 * fixed header + explicit content offset. Managed subsites are excluded
 * (they have a separate PMBO topbar system). */
body:not(.pmbo-managed) {
	--pmbo-platform-header-h: 80px;
	--pmbo-platform-admin-offset: 0px;
	padding-top: var(--pmbo-platform-header-h);
}

body:not(.pmbo-managed) #masthead {
	position: fixed;
	left: 0;
	right: 0;
	top: 0;
	z-index: 1001;
}

/* Respect WP admin bar offsets for logged-in sessions. */
body:not(.pmbo-managed).admin-bar {
	--pmbo-platform-admin-offset: 32px;
	padding-top: var(--pmbo-platform-header-h);
}

body:not(.pmbo-managed).admin-bar #masthead {
	top: 32px;
}

@media (max-width: 782px) {
	body:not(.pmbo-managed).admin-bar {
		--pmbo-platform-admin-offset: 46px;
		padding-top: var(--pmbo-platform-header-h);
	}

	body:not(.pmbo-managed).admin-bar #masthead {
		top: 46px;
	}
}

/* Mobile-menu UX: keep the CTA visually grouped with menu items and away
 * from the hero copy below. */
@media (max-width: 921px) {
	body:not(.pmbo-managed) .ast-mobile-header-wrap {
		position: relative;
	}

	body:not(.pmbo-managed) #ast-mobile-site-navigation.toggled {
		position: absolute;
		left: 0;
		right: 0;
		top: 100% !important;
		z-index: 1003;
		background: #ffffff;
		border-top: 1px solid #e2e8f0;
		box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
		height: auto !important;
		max-height: calc(100vh - 140px) !important;
		overflow-y: auto !important;
	}

	body:not(.pmbo-managed) #ast-mobile-site-navigation .main-header-menu {
		padding: 4px 0 14px;
	}

	body:not(.pmbo-managed).ast-main-header-nav-open {
		overflow: hidden;
	}

	body:not(.pmbo-managed).ast-main-header-nav-open::before {
		content: "";
		position: fixed;
		left: 0;
		right: 0;
		top: calc(var(--pmbo-platform-admin-offset) + var(--pmbo-platform-header-h));
		bottom: 0;
		z-index: 1000;
		background: rgba(15, 23, 42, 0.36);
		backdrop-filter: blur(1px);
	}

	body:not(.pmbo-managed) #ast-mobile-site-navigation .menu-item.pmbo-menu-cta {
		display: list-item;
		padding: 0;
	}

	body:not(.pmbo-managed) #ast-mobile-site-navigation .menu-item:has(> a[href*="/start-my-site"]),
	body:not(.pmbo-managed) #ast-mobile-site-navigation .menu-item:has(> a[href$="/start-my-site/"]),
	body:not(.pmbo-managed) #ast-mobile-site-navigation .menu-item:has(> a[href*="redirect_to=%2Fstart-my-site"]) {
		display: list-item;
		align-items: normal;
	}

	body:not(.pmbo-managed) #ast-mobile-site-navigation .menu-item.pmbo-menu-cta > a,
	body:not(.pmbo-managed) #ast-mobile-site-navigation .menu-item a[href*="/start-my-site"],
	body:not(.pmbo-managed) #ast-mobile-site-navigation .menu-item a[href$="/start-my-site/"],
	body:not(.pmbo-managed) #ast-mobile-site-navigation .menu-item a[href*="redirect_to=%2Fstart-my-site"] {
		display: block;
		width: 100%;
		justify-content: flex-start;
		align-self: auto;
		flex: 1 1 auto;
		padding: 0.9em 1em !important;
		margin: 0 !important;
		text-align: left !important;
		background: transparent !important;
		color: #0f172a !important;
		border: 0 !important;
		border-radius: 0;
		box-shadow: none;
		font-weight: 400;
	}

	body:not(.pmbo-managed) #ast-mobile-site-navigation .menu-item.current-menu-item.pmbo-menu-cta > a,
	body:not(.pmbo-managed) #ast-mobile-site-navigation .menu-item.current-menu-item a[href*="/start-my-site"],
	body:not(.pmbo-managed) #ast-mobile-site-navigation .menu-item.current_page_item a[href*="/start-my-site"] {
		background: #eef2ff !important;
		color: #1d4ed8 !important;
	}
}

/* --- Hide the host page's <h1> when it just hosts the wizard shortcode --- */
.pmbo-hide-page-title .entry-title,
.pmbo-hide-page-title .page-title,
.pmbo-hide-page-title .ast-archive-title,
.pmbo-hide-page-title .ast-single-post-title,
.pmbo-hide-page-title h1.entry-title,
.pmbo-hide-page-title .wp-block-post-title{display:none !important}

/* --- Kill the white gap between the site header and the first PMBO hero
 * on shortcode pages (export-my-shop, hire-us, wizard).
 * Astra applies #primary { margin-top: 60px } and the article carries an
 * empty .entry-header that still occupies vertical space even after the
 * title text is hidden. We zero those out and full-bleed the article
 * wrappers so our shortcode's full-bleed sections (`width: 100vw`) sit
 * flush against the header. Mirrors the equivalent rules in home.css.
 * ----------------------------------------------------------------- */
.pmbo-hide-page-title .site-content > .ast-container,
.pmbo-hide-page-title .site-content #primary,
.pmbo-hide-page-title .site-content .entry-content,
.pmbo-hide-page-title .site-content article.post,
.pmbo-hide-page-title .site-content article.page{
	max-width:none !important;
	width:100% !important;
	padding-left:0 !important;
	padding-right:0 !important;
	margin-left:0 !important;
	margin-right:0 !important;
}
.pmbo-hide-page-title #content,
.pmbo-hide-page-title .site-content,
.pmbo-hide-page-title .site-content > .ast-container,
.pmbo-hide-page-title .site-content #primary,
.pmbo-hide-page-title .site-content .entry-content,
.pmbo-hide-page-title .site-content article.post,
.pmbo-hide-page-title .site-content article.page,
.pmbo-hide-page-title .site-content article.page > .entry-header,
.pmbo-hide-page-title .ast-single-post-order{
	padding-top:0 !important;
	margin-top:0 !important;
}
.pmbo-hide-page-title .site-content article.page > .entry-header{display:none !important}

/* --- Account dropdown in primary nav (logged-in users) -----------
 * Scoped + !important on link styles to defeat Astra's
 * `.main-header-menu a` rules which would otherwise inject huge
 * vertical padding and the primary-button background on hover.
 */
.pmbo-account-menu-item {
	display: inline-flex;
	align-items: center;
	margin-left: 6px;
}

/* Plain "My account" text link sits before the avatar - match
 * Astra's nav typography and neutralise the blue current-page
 * highlight WC's "is_account_page" body class triggers. */
.pmbo-menu-account > a,
.pmbo-menu-account.current-menu-item > a,
.pmbo-menu-account.current_page_item > a {
	color: inherit !important;
	font-weight: 500;
}
.pmbo-menu-wizard > a {
	font-weight: 500;
}

.pmbo-account-dropdown {
	position: relative;
	list-style: none;
	margin: 0;
	line-height: 1;
}

.pmbo-account-trigger {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 4px 2px 2px;
	border-radius: 999px;
	cursor: pointer;
	list-style: none;
	border: 1px solid transparent;
	background: transparent;
	transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
	user-select: none;
	line-height: 1;
	vertical-align: middle;
}
.pmbo-account-trigger::-webkit-details-marker { display: none; }
.pmbo-account-trigger::marker { display: none; content: ""; }

.pmbo-account-trigger:hover,
.pmbo-account-trigger:focus-visible,
.pmbo-account-dropdown[open] > .pmbo-account-trigger {
	background: #f3f4f6;
	border-color: #e5e7eb;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
	outline: none;
}

.pmbo-account-avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	overflow: hidden;
	flex-shrink: 0;
	background: linear-gradient(135deg, #6366f1, #ec4899);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}
.pmbo-account-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	display: block;
}
.pmbo-account-initial {
	color: #fff;
	font-weight: 700;
	font-size: 0.78rem;
	line-height: 1;
	font-family: inherit;
}

.pmbo-account-caret {
	font-size: 0.7rem;
	line-height: 1;
	color: #6b7280;
	transition: transform 0.2s;
}
.pmbo-account-dropdown[open] .pmbo-account-caret {
	transform: rotate(180deg);
}

/* --- Panel ------------------------------------------------------ */
.pmbo-account-panel {
	position: absolute;
	right: 0;
	top: calc(100% + 10px);
	width: 280px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 14px;
	box-shadow:
		0 20px 40px -12px rgba(15, 23, 42, 0.18),
		0 4px 12px rgba(15, 23, 42, 0.06);
	z-index: 1100;
	overflow: hidden;
	animation: pmboDropIn 0.16s ease-out;
	font-family: inherit;
}

@keyframes pmboDropIn {
	from { opacity: 0; transform: translateY(-6px); }
	to   { opacity: 1; transform: translateY(0); }
}

.pmbo-account-head {
	padding: 14px 18px 12px;
	border-bottom: 1px solid #f1f5f9;
	background: linear-gradient(180deg, #fafafa, #fff);
}
.pmbo-account-head strong {
	display: block;
	font-size: 0.95rem;
	color: #0f172a;
	font-weight: 600;
	line-height: 1.3;
}
.pmbo-account-head small {
	display: block;
	font-size: 0.78rem;
	color: #6b7280;
	margin-top: 3px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 400;
}

/* Reset Astra's deep `ul li` rules inside the panel */
.pmbo-account-panel ul.pmbo-account-links,
.pmbo-account-links {
	list-style: none !important;
	margin: 0 !important;
	padding: 6px 0 !important;
	display: block !important;
}
.pmbo-account-links li {
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	display: block !important;
	width: 100% !important;
	background: transparent !important;
}
.pmbo-account-links li > a,
.pmbo-account-panel a[role="menuitem"] {
	display: block !important;
	padding: 9px 18px !important;
	font-size: 0.88rem !important;
	line-height: 1.35 !important;
	color: #374151 !important;
	text-decoration: none !important;
	background: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	font-weight: 500 !important;
	letter-spacing: 0 !important;
	text-transform: none !important;
	box-shadow: none !important;
	transition: background 0.1s, color 0.1s !important;
}
.pmbo-account-links li > a:hover,
.pmbo-account-links li > a:focus-visible,
.pmbo-account-panel a[role="menuitem"]:hover,
.pmbo-account-panel a[role="menuitem"]:focus-visible {
	background: #f8fafc !important;
	color: #111827 !important;
	outline: none;
}

/* Sign out — subtle separator + danger color */
.pmbo-account-links li:last-child {
	border-top: 1px solid #f1f5f9 !important;
	margin-top: 4px !important;
	padding-top: 4px !important;
}
.pmbo-account-links li:last-child > a {
	color: #b91c1c !important;
}
.pmbo-account-links li:last-child > a:hover,
.pmbo-account-links li:last-child > a:focus-visible {
	background: #fef2f2 !important;
	color: #991b1b !important;
}

/* Mobile: hide the avatar dropdown entirely - the plain
 * "My account" link already covers everything in the slide-out
 * drawer, and the inline-rendered <details> looks broken. */
@media (max-width: 921px) {
	#ast-mobile-site-navigation .pmbo-account-menu-item,
	.ast-mobile-popup-drawer .pmbo-account-menu-item {
		display: none !important;
	}
}

