/* Bigham Agency Header widget — scoped styles for `.bigham-header`.
 * All colors, typography, spacing, and radii consume tokens from the CSS Manager
 * (mirrored in elementor/global.css). Zero hardcoded hex / font-family / numeric
 * spacing values.
 *
 * Allowed exceptions (see references/token-system.md):
 *   - 2px focus-outline width / offset (project-wide focus-ring convention).
 *   - 1px / -1px visually-hidden clip primitive (standard a11y idiom).
 *   - 1024px / 1025px media queries: custom properties cannot be used in media
 *     queries; these match Elementor's tablet breakpoint (viewport_lg 1025).
 *   - 20% / 50% / 80% / 45deg burger-line geometry (relative to the burger box).
 *
 * Toggle hardening: Hello Elementor and the kit's `.elementor-kit-N button` rule
 * restyle every <button>, so the toggle's visual properties carry !important
 * (references/css-hardening.md).
 *
 * Mobile menu is progressive: until header.js adds `.is-ready`, the menu stays
 * visible (stacked) and the toggle stays hidden, so it works without JS.
 */

.bigham-header {
	font-family: var(--font-family-secondary);
	position: relative;
	z-index: var(--header-z);
}

.bigham-header__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	column-gap: var(--space-4);
	padding-block: var(--space-2);
}

/* --- Logo --- */

.bigham-header__logo {
	display: inline-flex;
	flex-shrink: 0;
}

.bigham-header__logo-img {
	display: block;
	width: auto;
	height: var(--header-logo-height);
	max-width: none;
}

/* --- Menu group (nav + socials) --- */

.bigham-header__menu {
	display: flex;
	align-items: center;
	gap: var(--space-6);
	margin-inline-start: auto;
}

.bigham-header__list,
.bigham-header__socials {
	display: flex;
	align-items: center;
	margin: 0;
	padding: 0;
	list-style: none;
}

.bigham-header__list {
	gap: var(--space-5);
}

.bigham-header__socials {
	gap: var(--space-3);
}

/* --- Links --- */

.bigham-header__link {
	color: var(--header-link-color);
	font-size: var(--font-size-text-small);
	font-weight: var(--font-weight-medium);
	line-height: var(--line-height-text-small);
	letter-spacing: var(--tracking-normal);
	text-decoration-line: underline;
	text-decoration-color: transparent;
	text-decoration-thickness: var(--border-width-main);
	text-underline-offset: var(--space-1);
	transition: text-decoration-color var(--duration-fast) var(--ease-standard);
}

/* Links alternate by position: odd links take the accent token, even links the
 * link colour, so a new menu item needs nothing set. On the navy bar both
 * tokens are off-white. */
.bigham-header__item:nth-child(odd) > .bigham-header__link {
	color: var(--header-link-accent);
}

.bigham-header__link:hover,
.bigham-header__link:focus-visible,
.bigham-header__link[aria-current="page"] {
	color: var(--header-link-color);
	text-decoration-color: currentColor;
}

.bigham-header__item:nth-child(odd) > .bigham-header__link:hover,
.bigham-header__item:nth-child(odd) > .bigham-header__link:focus-visible,
.bigham-header__item:nth-child(odd) > .bigham-header__link[aria-current="page"] {
	color: var(--header-link-accent);
}

/* Desktop menu underline: a line that draws in from the left on hover and
 * leaves to the right on hover out. It is a ::after scaled on X; the trick is
 * the origin: `right` at rest (so the line shrinks towards the right as it
 * leaves) and `left` while hovered (so it grows from the left). The current
 * page keeps its line drawn. Touch screens and the mobile menu keep the plain
 * text underline above. */
@media (min-width: 1025px) and (hover: hover) {
	.bigham-header__link {
		position: relative;
		text-decoration-line: none;
	}

	.bigham-header__link::after {
		content: "";
		position: absolute;
		inset-inline: 0;
		inset-block-end: calc(-1 * var(--space-1));
		block-size: var(--border-width-main);
		background-color: currentColor;
		transform: scaleX(0);
		transform-origin: right center;
		transition: transform var(--duration-medium) var(--ease-standard);
	}

	.bigham-header__link:hover::after,
	.bigham-header__link:focus-visible::after {
		transform: scaleX(1);
		transform-origin: left center;
	}

	.bigham-header__link[aria-current="page"]::after {
		transform: scaleX(1);
		transition: none;
	}
}

/* --- Social chips --- */

.bigham-header__social {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--social-chip-size);
	height: var(--social-chip-size);
	border-radius: var(--radius-round);
	background-color: var(--social-chip-bg);
	color: var(--social-chip-icon);
	transition: background-color var(--duration-fast) var(--ease-standard);
}

/* Off-white ring on the navy bar. Two classes, so Elementor's `.elementor a`
 * (box-shadow: none) doesn't win. */
.bigham-header .bigham-header__social {
	box-shadow: inset 0 0 0 var(--border-width-main) var(--header-social-ring);
}

.bigham-header__social:hover,
.bigham-header__social:focus-visible {
	background-color: var(--social-chip-bg-hover);
	color: var(--social-chip-icon);
}

.bigham-header__social svg {
	display: block;
	width: var(--social-glyph-size);
	height: var(--social-glyph-size);
	fill: currentColor;
}

/* No logo in the bar (the home page hero carries it): keep the toggle right. */
.bigham-header--no-logo .bigham-header__toggle {
	margin-inline-start: auto !important;
}

/* --- Burger toggle (mobile only) --- */

.bigham-header__toggle {
	display: none !important;
	position: relative !important;
	align-items: center !important;
	justify-content: center !important;
	width: var(--social-chip-size) !important;
	height: var(--social-chip-size) !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: var(--radius-small) !important;
	background: var(--transparent) !important;
	color: var(--header-link-color) !important;
	cursor: pointer !important;
	box-shadow: none !important;
}

.bigham-header__toggle-lines {
	position: relative;
	display: block;
	width: var(--header-burger-size);
	height: var(--header-burger-size);
}

.bigham-header__toggle-lines span {
	position: absolute;
	left: 0;
	width: 100%;
	height: var(--border-width-main);
	background-color: currentColor;
	transform: translateY(-50%);
	transition:
		transform var(--duration-fast) var(--ease-standard),
		opacity var(--duration-fast) var(--ease-standard),
		top var(--duration-fast) var(--ease-standard);
}

.bigham-header__toggle-lines span:nth-child(1) { top: 20%; }
.bigham-header__toggle-lines span:nth-child(2) { top: 50%; }
.bigham-header__toggle-lines span:nth-child(3) { top: 80%; }

.bigham-header.is-open .bigham-header__toggle-lines span:nth-child(1) {
	top: 50%;
	transform: translateY(-50%) rotate(45deg);
}

.bigham-header.is-open .bigham-header__toggle-lines span:nth-child(2) {
	opacity: 0;
}

.bigham-header.is-open .bigham-header__toggle-lines span:nth-child(3) {
	top: 50%;
	transform: translateY(-50%) rotate(-45deg);
}

/* --- Mobile / tablet (≤ Elementor tablet breakpoint) ---
 * Without JS the menu stacks in flow under the bar. Once header.js marks the
 * header `.is-ready`, the menu becomes a fixed overlay below the bar
 * (`--bigham-header-offset` is set by JS to the bar's bottom edge), hidden with
 * visibility so closed links leave the tab order and accessibility tree. */

@media (max-width: 1024px) {
	.bigham-header.is-ready .bigham-header__toggle {
		display: inline-flex !important;
	}

	.bigham-header__menu {
		flex-basis: 100%;
		flex-direction: column;
		align-items: flex-start;
		gap: var(--space-6);
		margin-inline-start: 0;
		padding-block: var(--space-5) var(--space-6);
	}

	.bigham-header.is-ready .bigham-header__menu {
		position: fixed;
		inset: var(--bigham-header-offset, 0) 0 0 0;
		z-index: var(--header-z);
		justify-content: flex-start;
		padding: var(--space-5) var(--site--margin) var(--space-8);
		overflow-y: auto;
		overscroll-behavior: contain;
		background-color: var(--header-background);
		visibility: hidden;
		opacity: 0;
		transform: translateY(calc(var(--space-2) * -1));
		transition:
			opacity var(--duration-fast) var(--ease-standard),
			transform var(--duration-fast) var(--ease-standard),
			visibility 0s linear var(--duration-fast);
	}

	.bigham-header.is-ready.is-open .bigham-header__menu {
		visibility: visible;
		opacity: 1;
		transform: none;
		transition:
			opacity var(--duration-fast) var(--ease-standard),
			transform var(--duration-fast) var(--ease-standard),
			visibility 0s;
	}

	.bigham-header__nav {
		width: 100%;
	}

	.bigham-header__list {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--space-4);
	}

	.bigham-header__link {
		font-size: var(--font-size-text-large);
		line-height: var(--line-height-text-large);
	}
}

/* Background scroll lock while the mobile menu is open (set by header.js). */
html.bigham-menu-open {
	overflow: hidden;
}

/* --- Utilities --- */

.bigham-header__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Reduced-motion: instant state changes for visitors who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
	.bigham-header,
	.bigham-header *,
	.bigham-header__link::after {
		transition: none !important;
		animation: none !important;
	}
}

/* Focus indicators: the link colour, so the ring shows on the navy bar. */
.bigham-header :focus-visible {
	outline: 2px solid var(--header-link-color);
	outline-offset: 2px;
}
