/**
 * Header Styles — v7-inspired redesign
 *
 * Layout: logo + nav in a LEFT cluster; CTA buttons + hamburger in a RIGHT cluster.
 * Default theme: SOLID DARK. Light + transparent are per-page opt-in variants.
 * Desktop: full-width mega panel — link list (left) + featured media card (right).
 * Mobile: full-screen drawer, hamburger toggle, accordion submenus.
 * All colors via theme.json slugs / custom properties. Font family: Sohne.
 * Dynamic content via MEGA_NAV, HEADER_CTA, MENU_TOGGLE token replacement.
 */

/* -----------------------------------------------
   Variables
   ----------------------------------------------- */

/* Header height lives on :root so rules outside .ad-header (like the
   .wp-site-blocks spacer below) can read it. CSS custom properties only
   cascade to descendants; .wp-site-blocks is the header's parent. */
:root {
	--ad-header-height: 4.5rem;
}

/* Default theme = solid dark. */
.ad-header {
	--ad-header-bg: var(--wp--preset--color--primary);
	--ad-header-text: var(--wp--preset--color--secondary);
	--ad-header-accent: var(--wp--preset--color--accent);
	--ad-header-muted: rgba(255, 255, 255, 0.14);
	--ad-header-radius: 0.5rem;
	--ad-header-transition: 0.25s ease;
	--ad-header-padding-x: clamp(1rem, 4vw, 4rem);
}

/* Fixed header. Lenis uses native scroll, so this behaves as expected.
   Only .ad-header is fixed — the .wp-block-template-part wrapper (when
   WP renders it) stays in normal flow and collapses to zero height since
   its only child has position:fixed. Fixing both caused a visible gap
   between the admin bar and the header when logged in. */
.ad-header {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	z-index: 1000;
}

/* Admin bar offset. The fixed header sits just below the WP admin bar. We
   track the bar's live on-screen bottom edge in JS and expose it as
   --ad-adminbar-offset (see header.js). This works at every breakpoint —
   including <=600px, where WP makes the admin bar position:absolute so it
   SCROLLS AWAY: the offset then eases from 46px down to 0 as the bar leaves
   the viewport, so the header is never covered at the top and never leaves a
   gap once the bar is gone. Static fallbacks (32/46) cover the no-JS case.
   Transparent-header pages offset the fixed WRAPPER instead — see below. */
body.admin-bar:not(.has-transparent-header) .ad-header {
	top: var(--ad-adminbar-offset, 32px);
}
@media (max-width: 782px) {
	body.admin-bar:not(.has-transparent-header) .ad-header {
		top: var(--ad-adminbar-offset, 46px);
	}
}

/* Reserve header space on non-transparent pages so content starts below it. */
body:not(.has-transparent-header) .wp-site-blocks {
	padding-top: var(--ad-header-height);
}

/* -----------------------------------------------
   Reveal-on-Scroll-Up (all variants)
   ----------------------------------------------- */

/* Transform-based hide. `transform` is relative to laid-out position, so
   admin-bar `top` offsets above continue to work. The transparent variant
   transforms its wrapper instead — see the transparent block below.
   No `will-change: transform` — it forms a containing block for fixed
   descendants (the mobile drawer), collapsing the drawer to zero height. */
.ad-header {
	transition: transform 0.3s ease;
}

body.ad-nav-hidden .ad-header {
	transform: translateY(-100%);
}

/* -----------------------------------------------
   Bar + clusters
   ----------------------------------------------- */

.ad-header__bar {
	height: var(--ad-header-height);
}

.ad-header__left {
	align-items: center;
	gap: clamp(1rem, 3vw, 2.5rem);
	min-width: 0;
}

.ad-header__right {
	align-items: center;
	gap: 0.5rem;
	flex: 0 0 auto;
}

.ad-header__buttons {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

/*
 * Desktop CTA buttons inherit from .ad-btn (global.css).
 * Header-specific sizing + default (dark) treatment.
 */
.ad-header__buttons .ad-btn {
	padding: 0.625rem 0.9rem;
	font-size: var(--wp--preset--font-size--sm);
}

/* Default (dark) button treatment. */
.ad-header__buttons .ad-btn--outline {
	color: var(--wp--preset--color--secondary);
	border-color: rgba(255, 255, 255, 0.25);
	background-color: transparent;
}

.ad-header__buttons .ad-btn--outline:hover {
	background-color: rgba(255, 255, 255, 0.08);
}

.ad-header__buttons .ad-btn--filled {
	background-color: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--primary);
}

@media (max-width: 1023px) {
	/* Collapse desktop-only elements so they don't affect flex layout. The
	   drawer is NOT display:none'd here — it stays hidden via visibility/opacity
	   (+ inert) so its open/close fade works. */
	.ad-header__nav-desktop,
	.ad-header__mega-panel {
		display: none !important;
	}

	.ad-header__buttons .ad-btn {
		padding: 0.5rem 0.75rem;
		font-size: var(--wp--preset--font-size--sm);
	}
}

/* -----------------------------------------------
   Logo
   ----------------------------------------------- */

.ad-header__logo {
	flex: 0 0 auto;
}

.ad-header__logo a {
	display: flex;
	align-items: center;
	text-decoration: none;
}

.ad-header__logo a:focus-visible {
	outline: 2px solid var(--ad-header-accent);
	outline-offset: 2px;
}

.ad-header__logo img {
	display: block;
	width: auto;
	height: 14px;
}

/* -----------------------------------------------
   Desktop Nav (left, next to logo)
   ----------------------------------------------- */

.ad-header__nav-desktop {
	display: none;
}

@media (min-width: 1024px) {
	.ad-header__nav-desktop {
		display: block;
	}
}

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

.ad-header__menu-item {
	display: flex;
	align-items: center;
}

.ad-header__menu-link {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.5rem 0.75rem;
	border: none;
	border-radius: 0;
	background: none;
	font-family: var(--wp--preset--font-family--sohne);
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 400;
	line-height: 1;
	color: var(--ad-header-text);
	text-decoration: none;
	cursor: pointer;
	transition: opacity var(--ad-header-transition), color var(--ad-header-transition);
}

.ad-header__menu-link:focus-visible {
	outline: 2px solid var(--ad-header-accent);
	outline-offset: 2px;
}

/* Dim the sibling top-level items while a mega panel is open (v7 behavior). */
.ad-header__nav-desktop:has(.ad-header__menu-link--trigger[aria-expanded="true"]) .ad-header__menu-link:not([aria-expanded="true"]) {
	opacity: 0.5;
}

.ad-header__chevron {
	transition: transform var(--ad-header-transition);
}

.ad-header__menu-link--trigger[aria-expanded="true"] .ad-header__chevron {
	transform: rotate(180deg);
}

/* -----------------------------------------------
   Full-width Mega Panel
   ----------------------------------------------- */

/* Absolutely positioned against .ad-header (the fixed/relative ancestor).
   .ad-header carries the global gutter padding, so a left:0/right:0 panel
   would inset by the gutter. Break out to full viewport width with the
   100vw + center-translate trick; the inner wrapper re-applies the gutter
   so content stays aligned with the header bar. */
/* Open/close motion is GSAP-driven in header.js (height reveal + staggered
   item fade — eases match the site's accordion: power3.out / power2.inOut /
   power2.out). CSS only sets the resting closed state so there's no flash
   before JS; GSAP writes inline visibility/opacity/height, which override it. */
.ad-header__mega-panel {
	/* Panel coloring follows the header variant (overridden in .has-light-header
	   below). Defaults = dark panel for the dark + transparent headers. */
	--ad-mega-bg: var(--wp--preset--color--primary);
	--ad-mega-eyebrow: var(--wp--preset--color--nav-muted);
	--ad-mega-label: var(--wp--preset--color--tone-dark);
	--ad-mega-label-active: var(--wp--preset--color--secondary);
	--ad-mega-desc: var(--wp--preset--color--nav-muted);
	--ad-mega-accent: var(--wp--preset--color--secondary);
	--ad-mega-hairline: rgba(255, 255, 255, 0.14);
	position: absolute;
	top: 100%;
	left: 50%;
	width: 100vw;
	transform: translateX(-50%);
	z-index: 999;
	background-color: var(--ad-mega-bg);
	/* Offset down + negative spread so the shadow only falls BELOW the panel —
	   a plain blur would bleed up over the header (panel top is flush to it). */
	box-shadow: 0 22px 30px -16px rgba(0, 0, 0, 0.45);
	visibility: hidden;
	overflow: hidden;
}

/* Re-apply the site gutter explicitly. WP zeroes `has-global-padding` when it
   is nested inside another `has-global-padding` element (.ad-header), so the
   inner can't reuse that class — match the bar's gutter via the root var. */
.ad-header__mega-inner {
	display: flex;
	align-items: stretch;
	gap: clamp(2rem, 5vw, 4rem);
	padding-block: 2.5rem;
	padding-left: var(--wp--style--root--padding-left, clamp(1rem, 4vw, 4rem));
	padding-right: var(--wp--style--root--padding-right, clamp(1rem, 4vw, 4rem));
}

/* Link columns (left). Grouped under eyebrows for 3-level menus (Services);
   a single column for flat 2-level menus (Industries). */
.ad-header__mega-groups {
	display: flex;
	flex: 1 1 auto;
	gap: clamp(2rem, 4vw, 5rem);
	min-width: 0;
}

.ad-header__mega-group {
	flex: 1 1 0;
	min-width: 0;
}

.ad-header__mega-eyebrow {
	display: block;
	padding: 0 1.25rem 0.75rem;
	font-family: var(--wp--preset--font-family--sohne);
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 400;
	letter-spacing: 0.04em;
	color: var(--ad-mega-eyebrow);
}

.ad-header__mega-panel-links {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0;
}

.ad-header__mega-link {
	display: block;
	padding: 0.5rem 1.25rem;
	border-left: 2px solid transparent;
	text-decoration: none;
	white-space: normal;
	transition: border-color 0.15s ease;
}

.ad-header__mega-link-label {
	display: block;
	font-family: var(--wp--preset--font-family--sohne);
	font-size: var(--wp--preset--font-size--md);
	font-weight: 400;
	line-height: 1.3;
	color: var(--ad-mega-label);
	transition: color 0.15s ease;
}

.ad-header__mega-link-desc {
	display: block;
	font-family: var(--wp--preset--font-family--sohne);
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 400;
	line-height: 1.35;
	color: var(--ad-mega-desc);
}

.ad-header__mega-link.ad-mega-active,
.ad-header__mega-link:hover {
	border-left-color: var(--ad-mega-accent);
}

.ad-header__mega-link.ad-mega-active .ad-header__mega-link-label,
.ad-header__mega-link:hover .ad-header__mega-link-label {
	color: var(--ad-mega-label-active);
}

.ad-header__mega-link:focus-visible {
	outline: 2px solid var(--ad-header-accent);
	outline-offset: 2px;
}

/* Link area (groups) + the "All X" footer link stack vertically so the footer
   link sits flush to the bottom of the panel, beside the featured card. */
.ad-header__mega-main {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-width: 0;
}

/* "All Services" / "All Industries" — a full-width footer link at the bottom of
   the panel, set off from the columns by a hairline. Reuses .ad-header__mega-link
   so header.js manages its tabindex + keyboard order; overrides the inline look. */
.ad-header__mega-all {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-top: 1.5rem;
	padding: 1.1rem 1.25rem 0.25rem;
	border-left: 0;
	border-top: 1px solid var(--ad-mega-hairline, rgba(255, 255, 255, 0.14));
}

.ad-header__mega-all .ad-header__mega-link-label {
	font-size: var(--wp--preset--font-size--md);
	letter-spacing: 0.01em;
}

.ad-header__mega-all-arrow {
	display: inline-flex;
	flex: 0 0 auto;
	color: var(--ad-mega-accent);
	transition: transform 0.2s ease;
}

.ad-header__mega-all:hover .ad-header__mega-all-arrow {
	transform: translateX(4px);
}

/* Featured CTA card (right column): the latest "Atomicdust Insights" posts are
   stacked; header.js reveals one at random per load via .is-active. Each item
   is a full-card link to the post. Caption sits over the image, so its
   light-on-dark text works on any header variant. */
.ad-mega-featured {
	position: relative;
	flex: 0 0 clamp(360px, 36%, 560px);
	min-height: 340px;
	border-radius: 0.25rem;
	overflow: hidden;
	/* Hairline keeps a pale post image delineated on the white panel; invisible
	   on the dark/transparent panels where light images already contrast. */
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.ad-mega-featured-link {
	position: absolute;
	inset: 0;
	display: block;
	text-decoration: none;
}

.ad-mega-featured-link:focus-visible {
	outline: 2px solid var(--ad-header-accent);
	outline-offset: -4px;
}

.ad-mega-featured-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ad-mega-featured-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.5rem;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
}

.ad-mega-featured-text {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	min-width: 0;
}

.ad-mega-featured-eyebrow {
	font-family: var(--wp--preset--font-family--sohne);
	font-size: var(--wp--preset--font-size--xs);
	letter-spacing: 0.04em;
	color: rgba(255, 255, 255, 0.75);
}

.ad-mega-featured-label {
	font-family: var(--wp--preset--font-family--sohne);
	font-size: var(--wp--preset--font-size--md);
	line-height: 1.25;
	color: var(--wp--preset--color--secondary);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ad-mega-featured-arrow {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background-color: var(--wp--preset--color--secondary);
	color: var(--wp--preset--color--primary);
	transition: transform var(--ad-header-transition);
}

.ad-mega-featured-link:hover .ad-mega-featured-arrow {
	transform: translateX(3px);
}

/* Services panel variant: a muted, looping brand video fills the same card the
   Insights post card occupies elsewhere, with a custom pause/play control. */
.ad-mega-featured-video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	/* Knock the brightness back a touch so the video reads darker/quieter in the
	   panel — raise toward 1 for brighter, lower for darker. */
	filter: brightness(0.7);
}

/* Pause/play toggle — the shared b-roll control (.ad-pause-btn, subtle dark
   square) parked in the bottom-left corner, matching the work-grid videos. */
.ad-mega-featured__pause {
	position: absolute;
	bottom: 0.75rem;
	left: 0.75rem;
	z-index: 2;
}

/* -----------------------------------------------
   Hamburger Toggle (mobile only)
   ----------------------------------------------- */

.ad-header__drawer-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: none;
	background: none;
	cursor: pointer;
}

.ad-header__drawer-toggle:focus-visible {
	outline: 2px solid var(--ad-header-accent);
	outline-offset: 2px;
}

@media (min-width: 1024px) {
	.ad-header__drawer-toggle {
		display: none;
	}
}

.ad-header__hamburger {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 24px;
	height: 24px;
}

.ad-header__hamburger span {
	display: block;
	width: 100%;
	height: 2px;
	background-color: var(--ad-header-text);
	border-radius: 1px;
	transition: transform var(--ad-header-transition), opacity var(--ad-header-transition);
}

.ad-header__drawer-toggle[aria-expanded="true"] .ad-header__hamburger span:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.ad-header__drawer-toggle[aria-expanded="true"] .ad-header__hamburger span:nth-child(2) {
	opacity: 0;
	/* Collapse the middle bar to zero width as well as fading it. It's wider
	   (24px) than the rotated X (~18px), so opacity alone leaves its rounded
	   end-caps poking out as two stray "dots" beside the X whenever the fade
	   hasn't fully settled (mid-transition or a throttled repaint). scaleX(0)
	   keeps it inside the X bounds at every frame. */
	transform: scaleX(0);
}

.ad-header__drawer-toggle[aria-expanded="true"] .ad-header__hamburger span:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* -----------------------------------------------
   Mobile Drawer (always solid dark)
   ----------------------------------------------- */

.ad-header__drawer {
	/* Self-sufficient token set: the drawer is portaled to <body> (see header.js),
	   so it can't inherit the --ad-header-* tokens scoped to .ad-header. Redeclare
	   everything its subtree consumes here. The mobile drawer is always the dark
	   primary surface regardless of the header variant (light / transparent). */
	--ad-header-bg: var(--wp--preset--color--primary);
	--ad-header-text: var(--wp--preset--color--secondary);
	--ad-header-muted: rgba(255, 255, 255, 0.12);
	--ad-header-accent: var(--wp--preset--color--accent);
	--ad-header-transition: 0.25s ease;
	position: fixed;
	top: var(--ad-header-height);
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1001;
	background-color: var(--ad-header-bg);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

/* Account for WP admin bar */
.admin-bar .ad-header__drawer {
	top: calc(var(--ad-header-height) + var(--wp-admin--admin-bar--height, 32px));
}

.ad-header__drawer.is-open {
	opacity: 1;
	visibility: visible;
}

.ad-header__drawer-inner {
	/* Align side padding to the site gutter so menu items line up with the logo. */
	padding-top: 1.5rem;
	padding-bottom: 2rem;
	padding-left: var(--wp--style--root--padding-left, 1rem);
	padding-right: var(--wp--style--root--padding-right, 1rem);
}

.ad-header__drawer-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
}

.ad-header__drawer-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	min-height: 44px;
	padding: 1rem 0;
	border: none;
	border-bottom: 1px solid var(--ad-header-muted);
	background: none;
	font-family: var(--wp--preset--font-family--sohne);
	font-size: var(--wp--preset--font-size--lg);
	font-weight: 400;
	color: var(--ad-header-text);
	text-decoration: none;
	text-align: left;
	cursor: pointer;
}

.ad-header__drawer-link:focus-visible {
	outline: 2px solid var(--ad-header-accent);
	outline-offset: 2px;
}

.ad-header__drawer-accordion-trigger .ad-header__chevron {
	transition: transform var(--ad-header-transition);
}

.ad-header__drawer-accordion-trigger[aria-expanded="true"] .ad-header__chevron {
	transform: rotate(180deg);
}

/* Accordion submenu */

.ad-header__drawer-submenu {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 0;
	overflow: hidden;
	transition: max-height var(--ad-header-transition);
}

/* Open height is set inline by JS (= scrollHeight) so it never clips when
   labels wrap on narrow screens — see header.js accordion handler. */
.ad-header__drawer-submenu.is-open {
	padding-bottom: 1.5rem;
}

.ad-header__drawer-eyebrow {
	/* Hidden in the drawer per request — mobile shows a flat list of links with
	   no Foundation/Growth group labels. Remove this line to bring them back. */
	display: none;
	padding: 1rem 0 0.25rem 1rem;
	font-family: var(--wp--preset--font-family--sohne);
	font-size: var(--wp--preset--font-size--sm);
	letter-spacing: 0.04em;
	color: var(--wp--preset--color--nav-muted);
}

.ad-header__drawer-submenu a {
	display: flex;
	align-items: center;
	min-height: 44px;
	padding: 0.75rem 0 0.75rem 1rem;
	font-family: var(--wp--preset--font-family--sohne);
	font-size: var(--wp--preset--font-size--md);
	font-weight: 400;
	color: var(--wp--preset--color--nav-muted);
	text-decoration: none;
	border-bottom: 1px solid var(--ad-header-muted);
}

.ad-header__drawer-submenu a:hover,
.ad-header__drawer-submenu a:focus-visible {
	color: var(--ad-header-text);
}

.ad-header__drawer-submenu a:focus-visible {
	outline: 2px solid var(--ad-header-accent);
	outline-offset: 2px;
}

/* -----------------------------------------------
   Light Header Variant (opt-in per page)
   ----------------------------------------------- */

.has-light-header .ad-header {
	--ad-header-bg: var(--wp--preset--color--secondary);
	--ad-header-text: var(--wp--preset--color--primary);
	--ad-header-muted: rgba(14, 14, 14, 0.12);
	background-color: var(--wp--preset--color--secondary) !important;
	color: var(--wp--preset--color--primary);
}

/* Nav links: char-stagger adds `.ad-char-split { color: inherit }`, which
   out-specifies .ad-header__menu-link and inherits the bar's textColor (white,
   set !important by the block's has-secondary-color). Force dark on the light
   variant so the links are visible on the white bar (chars inherit the link). */
.has-light-header .ad-header__menu-link {
	color: var(--wp--preset--color--primary) !important;
}

/* White drawer on light-header pages. The drawer is portaled to <body> (see
   header.js), but `has-light-header` sits on <body> so it still reaches it.
   Flip the surface to white with dark text + hairlines, mirroring the light bar
   above. Contrast on #fff: primary #0e0e0e 19:1, body #505050 7.5:1 — both AA;
   the accent focus outline #1a6fd4 clears the 3:1 non-text threshold. */
.has-light-header .ad-header__drawer {
	--ad-header-bg: var(--wp--preset--color--secondary);
	--ad-header-text: var(--wp--preset--color--primary);
	--ad-header-muted: rgba(14, 14, 14, 0.12);
}

/* Submenu links read muted-resting → emphasized-on-hover. The dark drawer's
   resting color (nav-muted #9e9e9e ≈ 2.8:1) would fail on white, so use the
   body color (#505050, 7.5:1); hover still resolves to --ad-header-text (dark). */
.has-light-header .ad-header__drawer-submenu a {
	color: var(--wp--preset--color--body);
}

/* Dropdown panel matches a white header: white surface, dark text. Contrasts
   on #fff — body #505050 7.5:1, gray #757575 4.5:1, primary #0e0e0e 19:1. */
.has-light-header .ad-header__mega-panel {
	--ad-mega-bg: var(--wp--preset--color--secondary);
	--ad-mega-eyebrow: var(--wp--preset--color--gray);
	--ad-mega-label: var(--wp--preset--color--body);
	--ad-mega-label-active: var(--wp--preset--color--primary);
	--ad-mega-desc: var(--wp--preset--color--gray);
	--ad-mega-accent: var(--wp--preset--color--primary);
	--ad-mega-hairline: rgba(14, 14, 14, 0.12);
	box-shadow: 0 22px 30px -16px rgba(0, 0, 0, 0.15);
}

.has-light-header .ad-header__buttons .ad-btn--outline {
	color: var(--wp--preset--color--primary);
	border-color: rgba(14, 14, 14, 0.2);
	background-color: transparent;
}

.has-light-header .ad-header__buttons .ad-btn--outline:hover {
	background-color: rgba(14, 14, 14, 0.05);
}

.has-light-header .ad-header__buttons .ad-btn--filled {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--secondary);
}

/* -----------------------------------------------
   Transparent Header Variant (opt-in per page)
   ----------------------------------------------- */

/* Frosted-glass backdrop lives on a ::before pseudo, not on .ad-header itself.
   `backdrop-filter` (and `filter`/`transform`/`will-change`) on .ad-header forms
   a containing block for fixed descendants, which collapses the mobile drawer
   to zero height. The pseudo provides the same visual effect without trapping
   the drawer's positioning. */
.has-transparent-header .ad-header {
	--ad-header-bg: rgba(14, 14, 14, 0.6);
	--ad-header-text: var(--wp--preset--color--secondary);
	--ad-header-muted: rgba(255, 255, 255, 0.12);
	--ad-frost-bg: rgba(14, 14, 14, 0.6);
	/* Paint the frost tint as a REAL background-color on the bar itself (not on
	   the ::before below). WAVE reads background-color up the ancestor chain to
	   compute contrast; a ::before/backdrop-filter background is invisible to it,
	   so a transparent bar reported white-on-white for every nav link. A plain
	   background-color does NOT form a containing block for fixed descendants
	   (only filter/transform/backdrop-filter do), so the mobile drawer stays
	   intact — only the blur lives on the ::before. White on rgba(14,14,14,0.6)
	   composited over the page ≈ 5.1:1, passing AA. */
	background-color: var(--ad-frost-bg, rgba(14, 14, 14, 0.6)) !important;
	color: var(--wp--preset--color--secondary);
	isolation: isolate;
	transition: background-color 0.3s ease, transform 0.3s ease;
}

/* Blur only — the dark tint now lives on .ad-header (above) so WAVE can read it.
   The ::before paints behind the bar's own background, blurring the hero. */
.has-transparent-header .ad-header::before {
	content: "";
	position: absolute;
	inset: 0;
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	z-index: -1;
	pointer-events: none;
}

/* The dropdown panel takes the bar's frosted treatment (semi-transparent dark
   over the hero). When a dropdown is OPEN, the bar AND the panel darken
   together for focus + readability — the panel only ever shows in this
   "triggered" state, so it carries the darker value. */
.has-transparent-header .ad-header__mega-panel {
	--ad-mega-bg: rgba(14, 14, 14, 0.9);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
}

/* .ad-header--dropdown-open is toggled in header.js while any mega panel is
   open. Darkening is driven through --ad-frost-bg, now consumed directly by
   .ad-header's own background-color (above) — changing a var on the element
   re-resolves its own background reliably, unlike re-resolving a ::before
   pseudo, which Chromium does not always invalidate. */
.has-transparent-header .ad-header--dropdown-open {
	--ad-frost-bg: rgba(14, 14, 14, 0.9);
}

/* Transparent header variant — same fixed positioning as base but
   layered above the hero on transparent-header pages. */
.has-transparent-header .wp-block-template-part:has(.ad-header) {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	z-index: 1000;
}

/* Same JS-tracked admin-bar offset as the non-transparent header, applied to
   the fixed wrapper (here .ad-header itself is position:relative). */
.admin-bar.has-transparent-header .wp-block-template-part:has(.ad-header) {
	top: var(--ad-adminbar-offset, 32px);
}

@media (max-width: 782px) {
	.admin-bar.has-transparent-header .wp-block-template-part:has(.ad-header) {
		top: var(--ad-adminbar-offset, 46px);
	}
}

.has-transparent-header .ad-header {
	position: relative;
}

/* Reveal-on-scroll-up — transparent variant transforms the wrapper, since
   .ad-header itself is position:relative here. No `will-change: transform`
   — it forms a containing block for the fixed mobile drawer descendant. */
.has-transparent-header .wp-block-template-part:has(.ad-header) {
	transition: transform 0.3s ease;
}

body.ad-nav-hidden.has-transparent-header .wp-block-template-part:has(.ad-header) {
	transform: translateY(-100%);
}

/* Don't double-translate the inner relative header on the transparent variant. */
body.ad-nav-hidden.has-transparent-header .ad-header {
	transform: none;
}

/* -----------------------------------------------
   Reduced Motion
   ----------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.ad-header,
	.has-transparent-header .wp-block-template-part:has(.ad-header),
	.ad-header__mega-panel,
	.ad-header__mega-panel-links li,
	.ad-header__mega-eyebrow,
	.ad-mega-featured,
	.ad-mega-featured-arrow,
	.ad-header__mega-all-arrow,
	.ad-header__drawer,
	.ad-header__drawer-submenu,
	.ad-header__hamburger span,
	.ad-header__chevron,
	.ad-header__menu-link,
	.ad-header__mega-link,
	.ad-header__drawer-link,
	.ad-btn {
		transition: none;
	}
}
