/**
 * WP Expertz — Layout Styles (Phase 3C)
 *
 * Global site-chrome only: header, primary/mobile navigation, footer.
 * Every value references an existing token — no raw colors, no new
 * arbitrary spacing values introduced. Component-level styling (buttons,
 * trust strip) stays in components.css and is reused here, not
 * duplicated.
 */

/* =================================================================
 * HEADER
 * ================================================================= */
.wpx-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background-color: var(--color-surface);
	border-bottom: 1px solid var(--color-border);
}

.wpx-header__inner {
	display: flex;
	align-items: center;
	gap: var(--space-24);
	height: var(--header-height-mobile);
	transition: height var(--transition-base);
}

@media (min-width: 768px) {
	.wpx-header__inner { height: var(--header-height-tablet); }
}
@media (min-width: 1200px) {
	.wpx-header__inner { height: var(--header-height-desktop); }
}

/* Condensed state, added by nav.js once scrolled past the header's own
   height (Phase 2 §6 sticky/condense behavior — see nav.js comments for
   the documented simplification vs. the full hide/reveal spec). */
.wpx-header.is-condensed .wpx-header__inner {
	height: var(--header-height-mobile);
}
@media (min-width: 768px) {
	.wpx-header.is-condensed .wpx-header__inner { height: 64px; }
}

.wpx-header__brand {
	display: flex;
	align-items: center;
	text-decoration: none;
	flex-shrink: 0;
}

.wpx-header__brand-text {
	font-family: var(--font-display);
	font-size: var(--text-h4-size);
	font-weight: 600;
	color: var(--color-primary);
}

/* Phase 3C correction 4: when a real Custom Logo exists, the_custom_logo()
   renders its own .custom-logo-link/.custom-logo markup directly inside
   .wpx-header__brand (no wrapping <a> added by this theme — see
   header.php). These rules keep it visually consistent with the text
   fallback without introducing a new arbitrary size value: max-height
   reuses the existing --space-48 token rather than a one-off pixel number. */
.wpx-header__brand .custom-logo-link {
	display: flex;
	align-items: center;
}

.wpx-header__brand .custom-logo {
	max-height: var(--space-48);
	width: auto;
}

.wpx-header__cta {
	display: none;
	margin-left: auto;
}

@media (min-width: 1200px) {
	.wpx-header__cta {
		display: block;
		margin-left: 0;
	}
}

/* =================================================================
 * DESKTOP PRIMARY NAV (hidden below 1200px)
 * ================================================================= */
.wpx-nav-primary {
	display: none;
}

@media (min-width: 1200px) {
	.wpx-nav-primary {
		display: block;
		margin-left: auto;
		margin-right: var(--space-32);
	}
}

.wpx-nav-primary__list {
	display: flex;
	align-items: center;
	gap: var(--space-24);
	list-style: none;
	margin: 0;
	padding: 0;
}

.wpx-nav-primary__item {
	position: relative;
}

.wpx-nav-primary__link {
	display: inline-block;
	padding: var(--space-8) 0;
	font-family: var(--font-body);
	font-size: var(--text-nav-size);
	line-height: var(--text-nav-line);
	font-weight: 500;
	color: var(--color-text-primary);
	text-decoration: none;
	border-bottom: 2px solid transparent;
	transition: border-color var(--transition-base), color var(--transition-base);
}

.wpx-nav-primary__link:hover {
	color: var(--color-accent);
}

/* Active state: never color alone — border + weight also change. */
.wpx-nav-primary__link.is-active {
	color: var(--color-accent);
	border-bottom-color: var(--color-accent);
	font-weight: 600;
}

/* --- Services flyout (CSS-only, no JS) ---
   Phase 3C correction 1: an invisible ::before "bridge" fills exactly
   the margin-top gap between the trigger and the flyout, so the cursor
   never leaves a hoverable box while moving from one to the other. The
   bridge is a child of .wpx-services-flyout (itself inside the trigger
   <li>), so hovering it keeps the ancestor :hover active — it does not
   enlarge the hit area beyond the flyout's own width/position, and
   :focus-within (keyboard) was never affected by this gap in the first
   place since it doesn't depend on pointer movement at all. */
.wpx-services-flyout {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 260px;
	margin-top: var(--space-8);
	padding: var(--space-16);
	background-color: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-card-hover);
}

.wpx-services-flyout::before {
	content: "";
	position: absolute;
	top: calc(-1 * var(--space-8));
	left: 0;
	right: 0;
	height: var(--space-8);
}

.wpx-nav-primary__item--has-flyout:hover .wpx-services-flyout,
.wpx-nav-primary__item--has-flyout:focus-within .wpx-services-flyout {
	display: block;
}

.wpx-services-flyout__eyebrow {
	font-family: var(--font-mono);
	font-size: var(--text-caption-size);
	color: var(--color-text-secondary);
	margin: 0 0 var(--space-8) 0;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.wpx-services-flyout__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wpx-services-flyout__list a {
	display: block;
	padding: var(--space-8) 0;
	font-size: var(--text-body-sm-size);
	color: var(--color-text-primary);
	text-decoration: none;
}

.wpx-services-flyout__list a:hover {
	color: var(--color-accent);
}

/* Individual service active state — Phase 3C correction 2. Never color
   alone: weight also changes, and the real signal for assistive tech is
   the aria-current="page" attribute in the markup, not this styling. */
.wpx-services-flyout__list a.is-active {
	color: var(--color-accent);
	font-weight: 600;
}

.wpx-services-flyout__divider {
	border: none;
	border-top: 1px solid var(--color-border);
	margin: var(--space-8) 0;
}

/* =================================================================
 * MOBILE MENU TOGGLE (hidden at desktop)
 * ================================================================= */
.wpx-menu-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin-left: auto;
	background: transparent;
	border: none;
	cursor: pointer;
}

@media (min-width: 1200px) {
	.wpx-menu-toggle {
		display: none;
	}
}

.wpx-menu-toggle__icon,
.wpx-menu-toggle__icon::before,
.wpx-menu-toggle__icon::after {
	display: block;
	width: 20px;
	height: 2px;
	background-color: var(--color-primary);
	transition: transform var(--transition-base), opacity var(--transition-base);
}

.wpx-menu-toggle__icon {
	position: relative;
}

.wpx-menu-toggle__icon::before,
.wpx-menu-toggle__icon::after {
	content: "";
	position: absolute;
	left: 0;
}

.wpx-menu-toggle__icon::before {
	top: -6px;
}

.wpx-menu-toggle__icon::after {
	top: 6px;
}

/* Turn the icon into an "X" when the menu is open. */
.wpx-menu-toggle[aria-expanded="true"] .wpx-menu-toggle__icon {
	background-color: transparent;
}
.wpx-menu-toggle[aria-expanded="true"] .wpx-menu-toggle__icon::before {
	transform: translateY(6px) rotate(45deg);
}
.wpx-menu-toggle[aria-expanded="true"] .wpx-menu-toggle__icon::after {
	transform: translateY(-6px) rotate(-45deg);
}

.wpx-menu-toggle:focus-visible {
	outline: 2px solid var(--color-accent);
	outline-offset: 2px;
}

/* =================================================================
 * MOBILE MENU PANEL (hidden at desktop)
 * ================================================================= */
.wpx-mobile-nav {
	background-color: var(--color-surface);
	border-top: 1px solid var(--color-border);
	padding: var(--space-16) var(--space-page-x-mobile) var(--space-24);
}

@media (min-width: 1200px) {
	.wpx-mobile-nav {
		display: none !important; /* Never shown at desktop, even if JS somehow un-hides it. */
	}
}

/* Lock body scroll while the mobile menu is open. */
body.wpx-menu-open {
	overflow: hidden;
}

.wpx-mobile-nav__list {
	list-style: none;
	margin: 0 0 var(--space-16) 0;
	padding: 0;
}

.wpx-mobile-nav__item {
	border-bottom: 1px solid var(--color-border);
}

.wpx-mobile-nav__link {
	display: block;
	padding: var(--space-16) 0;
	font-size: var(--text-nav-size-mobile);
	font-weight: 500;
	color: var(--color-text-primary);
	text-decoration: none;
}

.wpx-mobile-nav__link.is-active {
	color: var(--color-accent);
	font-weight: 600;
}

/* Mobile Services disclosure — styled native <details>/<summary>,
   matching the same zero-JS pattern used by the Phase 3B FAQ component. */
.wpx-mobile-nav__services-summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--space-16) 0;
	font-size: var(--text-nav-size-mobile);
	font-weight: 500;
	color: var(--color-text-primary);
	cursor: pointer;
	list-style: none;
}
.wpx-mobile-nav__services-summary::-webkit-details-marker {
	display: none;
}

/* Section-active state — Phase 3C correction 2 (visual only; the summary
   itself is never the exact current page, so no aria-current here). */
.wpx-mobile-nav__services-summary.is-active {
	color: var(--color-accent);
	font-weight: 600;
}

.wpx-mobile-nav__services-icon {
	width: 12px;
	height: 12px;
	border-right: 2px solid var(--color-accent);
	border-bottom: 2px solid var(--color-accent);
	transform: rotate(45deg);
	transition: transform var(--transition-base);
}

.wpx-mobile-nav__services[open] .wpx-mobile-nav__services-icon {
	transform: rotate(-135deg);
}

.wpx-mobile-nav__services-all {
	display: block;
	padding: var(--space-8) 0;
	font-size: var(--text-body-sm-size);
	font-weight: 600;
	color: var(--color-accent);
	text-decoration: none;
}

.wpx-mobile-nav__services-list {
	list-style: none;
	margin: 0 0 var(--space-8) 0;
	padding: 0 0 var(--space-8) var(--space-16);
}

.wpx-mobile-nav__services-list a {
	display: block;
	padding: var(--space-8) 0;
	font-size: var(--text-body-sm-size);
	color: var(--color-text-secondary);
	text-decoration: none;
}

.wpx-mobile-nav__services-list a:hover {
	color: var(--color-accent);
}

.wpx-mobile-nav__services-list a.is-active {
	color: var(--color-accent);
	font-weight: 600;
}

.wpx-mobile-nav__services-all[aria-current="page"] {
	text-decoration: underline;
}

.wpx-mobile-nav__cta .wpx-button {
	width: 100%;
}

/* =================================================================
 * FOOTER
 * ================================================================= */
.wpx-footer {
	background-color: var(--color-background);
	border-top: 1px solid var(--color-border);
	padding-top: var(--space-section-y-mobile);
	padding-bottom: var(--space-32);
}

@media (min-width: 768px) {
	.wpx-footer { padding-top: var(--space-section-y-tablet); }
}
@media (min-width: 1200px) {
	.wpx-footer { padding-top: var(--space-section-y-desktop); }
}

.wpx-footer__columns {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--space-32);
	margin-bottom: var(--space-48);
}

@media (min-width: 768px) {
	.wpx-footer__columns {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1200px) {
	.wpx-footer__columns {
		grid-template-columns: 1.5fr 1fr 1fr 1fr;
	}
}

.wpx-footer__brand-text {
	display: block;
	font-family: var(--font-display);
	font-size: var(--text-h4-size);
	font-weight: 600;
	color: var(--color-primary);
	margin-bottom: var(--space-8);
}

.wpx-footer__tagline {
	font-size: var(--text-body-sm-size);
	color: var(--color-text-secondary);
	margin: 0 0 var(--space-16) 0;
	max-width: 32ch;
}

.wpx-footer__heading {
	font-size: var(--text-caption-size);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--color-text-secondary);
	margin: 0 0 var(--space-16) 0;
}

.wpx-footer__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-8);
}

.wpx-footer__list a {
	font-size: var(--text-body-sm-size);
	color: var(--color-text-primary);
	text-decoration: none;
}

.wpx-footer__list a:hover {
	color: var(--color-accent);
}

.wpx-footer__legal {
	display: flex;
	flex-direction: column;
	gap: var(--space-16);
	padding-top: var(--space-32);
	border-top: 1px solid var(--color-border);
}

@media (min-width: 768px) {
	.wpx-footer__legal {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
}

.wpx-footer__legal-list {
	display: flex;
	gap: var(--space-16);
	list-style: none;
	margin: 0;
	padding: 0;
}

.wpx-footer__legal-list a {
	font-size: var(--text-caption-size);
	color: var(--color-text-secondary);
	text-decoration: none;
}

.wpx-footer__legal-list a:hover {
	color: var(--color-accent);
}

.wpx-footer__copyright {
	font-size: var(--text-caption-size);
	color: var(--color-text-secondary);
	margin: 0;
}

/* =================================================================
 * REDUCED MOTION
 * (base.css already globally collapses transition/animation durations;
 * nothing additional required here — noted for completeness.)
 * ================================================================= */
