.pg-header {
	--pg-header-h: 76px;
	position: fixed;
	inset: 0 0 auto 0;
	z-index: 100;
	transition: background-color 400ms ease, border-color 400ms ease, backdrop-filter 400ms ease;
}

.admin-bar .pg-header {
	top: 32px;
}

@media (max-width: 782px) {
	.admin-bar .pg-header {
		top: 46px;
	}
}

.pg-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	position: relative;
	z-index: 2;
	/* 20px padding on all sides (inline comes from .pg-container). */
	padding-block: 20px;
	border: 1px solid transparent;
	border-radius: 0;
	color: var(--wp--preset--color--fg, #18181b);
	transition:
		max-width 600ms cubic-bezier(0.4, 0, 0.2, 1),
		margin 600ms cubic-bezier(0.4, 0, 0.2, 1),
		padding 600ms cubic-bezier(0.4, 0, 0.2, 1),
		background-color 450ms ease,
		border-color 450ms ease,
		border-radius 550ms cubic-bezier(0.4, 0, 0.2, 1),
		box-shadow 450ms ease,
		color 300ms ease,
		backdrop-filter 450ms ease;
}

/* ---- Non-hero pages, not stuck: subtle glass bar ------------------------ */
body:not(.pg-has-hero) .pg-header:not(.is-stuck) {
	background: color-mix(in srgb, var(--wp--preset--color--bg, #fafafa) 82%, transparent);
	-webkit-backdrop-filter: saturate(180%) blur(12px);
	backdrop-filter: saturate(180%) blur(12px);
	border-bottom: 1px solid var(--wp--preset--color--border, #e4e4e7);
}

/* ---- Hero pages, not stuck: transparent, auto-contrast via blend -------- */
body.pg-has-hero .pg-header:not(.is-stuck) {
	background: transparent;
}

body.pg-has-hero .pg-header:not(.is-stuck) .pg-header__inner {
	color: #fff;
	mix-blend-mode: difference;
}

/* The custom logo is a dark monochrome PNG on transparent. On hero pages the
   inner uses mix-blend:difference so its currentColor text inverts to light; a
   raster can't pick up currentColor, so we invert the logo first — the dark
   marks flip to white and the parent difference then lifts them light over the
   hero, matching the inline lockup. On every light-background state (non-hero,
   stuck pill, open menu) there is no difference, so the dark logo shows as-is. */
body.pg-has-hero .pg-header:not(.is-stuck) .pg-header__logo {
	filter: invert(1);
}

/* ---- Stuck (any page): floating glass pill ----------------------------- */
.pg-header.is-stuck {
	background: transparent;
	border-bottom-color: transparent;
}

.pg-header.is-stuck .pg-header__inner {
	/* Keep the .pg-container box (max-width 1280 + its padding) so the logo and
	   menu stay aligned with the page body in the stuck state too — only the
	   chrome (glass pill) changes. The pill floats because its background sits on
	   the centered inner, not on the full-width header. */
	margin-top: 0.7rem;
	border-radius: 999px;
	background: color-mix(in srgb, var(--wp--preset--color--bg, #fafafa) 68%, transparent);
	-webkit-backdrop-filter: saturate(180%) blur(18px);
	backdrop-filter: saturate(180%) blur(18px);
	border-color: color-mix(in srgb, var(--wp--preset--color--fg, #18181b) 10%, transparent);
	box-shadow: 0 12px 34px -14px rgba(9, 9, 11, 0.28);
	color: var(--wp--preset--color--fg, #18181b);
}

/* ---- Mobile menu open: force a solid, readable header ------------------- */
.pg-header.is-open:not(.is-stuck) {
	background: var(--wp--preset--color--bg, #fafafa);
	border-bottom: 1px solid var(--wp--preset--color--border, #e4e4e7);
}

.pg-header.is-open .pg-header__inner {
	color: var(--wp--preset--color--fg, #18181b);
	mix-blend-mode: normal;
}

/* ---- Brand / nav ------------------------------------------------------- */
.pg-header__brand {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	color: inherit;
}

.pg-header__logo {
	max-height: 34px;
	width: auto;
	height: auto;
	display: block;
}

.pg-header__wordmark {
	font-weight: 600;
	font-size: 1.15rem;
	letter-spacing: -0.02em;
}

/* Brand lockup (mark + wordmark) shown when no custom logo image is set. */
.pg-header__logo-lockup {
	display: inline-flex;
	align-items: center;
	gap: 0.62rem;
}

.pg-logo-mark {
	display: block;
	width: 1.72em;
	height: 1.72em;
	flex: 0 0 auto;
}

.pg-header__logo-lockup .pg-logo__word {
	font-weight: 600;
	font-size: 1.2rem;
	letter-spacing: -0.035em;
	line-height: 1;
}

.pg-header__nav {
	margin-left: auto;
}

.pg-header__menu {
	display: flex;
	align-items: center;
	gap: 1.75rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.pg-header__menu a {
	color: inherit;
	text-decoration: none;
	font-size: 0.95rem;
	letter-spacing: -0.01em;
	padding: 0.25rem 0;
	position: relative;
	opacity: 0.85;
	transition: opacity 200ms ease;
}

.pg-header__menu a:hover,
.pg-header__menu .current-menu-item > a {
	opacity: 1;
}

.pg-header__menu a::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -2px;
	width: 0;
	height: 1px;
	background: currentColor;
	transition: width 250ms ease;
}

.pg-header__menu a:hover::after,
.pg-header__menu .current-menu-item > a::after {
	width: 100%;
}

/* Contacto — rendered as a distinctive pill button. An outline works in every
   header state (including the mix-blend hero overlay); a filled hover applies
   only where there is no blend (stuck pill / non-hero bar). */
.pg-header__menu .pg-nav-cta {
	margin-left: 0.35rem;
}

.pg-header__menu .pg-nav-cta a {
	border: 1px solid currentColor;
	border-radius: 999px;
	padding: 0.5rem 1.15rem;
	opacity: 1;
}

.pg-header__menu .pg-nav-cta a::after {
	display: none;
}

.pg-header.is-stuck .pg-header__menu .pg-nav-cta a:hover,
body:not(.pg-has-hero) .pg-header__menu .pg-nav-cta a:hover {
	background: var(--wp--preset--color--fg, #18181b);
	color: var(--wp--preset--color--bg, #fafafa);
}

/* Desktop: actions only holds the mobile toggle, so keep it out of the flow
   entirely — otherwise its empty box + the inner gap push the menu off the
   right edge. It is re-shown at the mobile breakpoint below. */
.pg-header__actions {
	display: none;
	align-items: center;
	gap: 1rem;
}

.pg-header__toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 6px;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	cursor: pointer;
	position: relative;
	z-index: 3;
	transition: transform 200ms ease;
}

.pg-header__toggle:hover .pg-header__toggle-bar {
	width: 26px;
}

.pg-header__toggle-bar {
	display: block;
	width: 24px;
	height: 2px;
	border-radius: 2px;
	background: currentColor;
	transition:
		transform 350ms cubic-bezier(0.76, 0, 0.24, 1),
		opacity 200ms ease,
		width 250ms cubic-bezier(0.22, 1, 0.36, 1);
}

.pg-header__toggle-bar:last-child {
	width: 17px;
	align-self: center;
	margin-left: 7px;
}

.pg-header__toggle:hover .pg-header__toggle-bar:last-child {
	width: 26px;
	margin-left: 0;
}

.pg-header__panel {
	display: none;
}

@media (max-width: 860px) {
	.pg-header__nav {
		display: none;
	}

	/* Base the stuck-pill width on the viewport (100%) rather than the 1280px
	   frame, so the side compression animates over the whole transition instead
	   of snapping in the last few pixels — smooth on both scroll down and up.
	   Two classes to outrank .pg-container's max-width / padding regardless of
	   load order. Tighter 10px padding on all sides for the compact mobile bar. */
	.pg-header .pg-header__inner {
		max-width: 100%;
		padding: 10px;
	}

	.pg-header__actions {
		display: flex;
	}

	.pg-header__toggle {
		display: flex;
	}

	/* Full-screen overlay menu, revealed with a circular clip from the toggle. */
	.pg-header__panel,
	.pg-header__panel[hidden] {
		display: flex;
		flex-direction: column;
		justify-content: center;
		gap: 0;
		position: fixed;
		inset: 0;
		z-index: 1;
		padding: clamp(6rem, 20vh, 10rem) clamp(1.75rem, 8vw, 4rem) 3rem;
		background: color-mix(in srgb, var(--wp--preset--color--bg, #fafafa) 92%, transparent);
		-webkit-backdrop-filter: blur(24px) saturate(150%);
		backdrop-filter: blur(24px) saturate(150%);
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		clip-path: circle(0px at calc(100% - 2.4rem) 2.25rem);
		transition:
			clip-path 560ms cubic-bezier(0.76, 0, 0.24, 1),
			opacity 240ms ease,
			visibility 0s linear 560ms;
	}

	.pg-header.is-open .pg-header__panel {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		clip-path: circle(150% at calc(100% - 2.4rem) 2.25rem);
		transition:
			clip-path 640ms cubic-bezier(0.76, 0, 0.24, 1),
			opacity 240ms ease,
			visibility 0s;
	}

	/* When open, dissolve the top bar so it reads as part of the overlay. */
	.pg-header.is-open:not(.is-stuck),
	.pg-header.is-open.is-stuck .pg-header__inner {
		background: transparent;
		border-color: transparent;
		box-shadow: none;
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
	}

	.pg-header__menu--mobile {
		flex-direction: column;
		align-items: stretch;
		gap: 0.1rem;
		color: var(--wp--preset--color--fg, #18181b);
	}

	.pg-header__menu--mobile li {
		border: 0;
		opacity: 0;
		transform: translateY(28px);
		transition:
			opacity 500ms ease,
			transform 640ms cubic-bezier(0.22, 1, 0.36, 1);
	}

	.pg-header.is-open .pg-header__menu--mobile li {
		opacity: 1;
		transform: none;
	}

	.pg-header.is-open .pg-header__menu--mobile li:nth-child(1) { transition-delay: 200ms; }
	.pg-header.is-open .pg-header__menu--mobile li:nth-child(2) { transition-delay: 260ms; }
	.pg-header.is-open .pg-header__menu--mobile li:nth-child(3) { transition-delay: 320ms; }
	.pg-header.is-open .pg-header__menu--mobile li:nth-child(4) { transition-delay: 380ms; }
	.pg-header.is-open .pg-header__menu--mobile li:nth-child(5) { transition-delay: 440ms; }
	.pg-header.is-open .pg-header__menu--mobile li:nth-child(6) { transition-delay: 500ms; }
	.pg-header.is-open .pg-header__menu--mobile li:nth-child(7) { transition-delay: 560ms; }

	.pg-header__menu--mobile a {
		display: inline-block;
		width: auto;
		padding: 0.35rem 0;
		font-size: clamp(2.1rem, 10vw, 3.25rem);
		font-weight: 500;
		line-height: 1.12;
		letter-spacing: -0.03em;
		opacity: 1;
	}

	.pg-header__menu--mobile a::after {
		display: none;
	}

	.pg-header__menu--mobile .current-menu-item > a {
		text-decoration: underline;
		text-underline-offset: 6px;
		text-decoration-thickness: 2px;
	}

	.pg-header__menu--mobile .pg-nav-cta {
		margin-left: 0;
	}

	.pg-header__menu--mobile .pg-nav-cta a {
		border: 0;
		border-radius: 0;
		padding: 0.35rem 0;
	}

	.pg-header__panel-cta {
		margin-top: clamp(2rem, 6vh, 3.5rem);
		align-self: flex-start;
		opacity: 0;
		transform: translateY(28px);
		transition:
			opacity 500ms ease 560ms,
			transform 640ms cubic-bezier(0.22, 1, 0.36, 1) 560ms;
	}

	.pg-header.is-open .pg-header__panel-cta {
		opacity: 1;
		transform: none;
	}

	/* Toggle → X (normalise the shorter bar first). */
	.pg-header.is-open .pg-header__toggle-bar {
		width: 24px;
	}

	.pg-header.is-open .pg-header__toggle-bar:first-child {
		transform: translateY(4px) rotate(45deg);
	}

	.pg-header.is-open .pg-header__toggle-bar:last-child {
		margin-left: 0;
		transform: translateY(-4px) rotate(-45deg);
	}

	/* Lock the page behind the overlay. */
	html.pg-menu-open,
	html.pg-menu-open body {
		overflow: hidden;
	}

	/* Admin bar is not fixed on mobile — don't leave a gap once the header sticks. */
	.admin-bar .pg-header.is-stuck {
		top: 0;
	}

	/* On mobile keep the stuck pill visibly floating (small side inset). On
	   desktop it spans the .pg-container frame so it aligns with page content. */
	.pg-header.is-stuck .pg-header__inner {
		max-width: calc(100% - 1.5rem);
		margin-inline: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pg-header,
	.pg-header__inner,
	.pg-header__panel,
	.pg-header__menu--mobile li,
	.pg-header__panel-cta,
	.pg-header__toggle-bar {
		transition-duration: 1ms !important;
	}

	.pg-header__panel {
		clip-path: none !important;
	}
}
