/*
 * Site header + navigation — scoped under .bmx-site-header and .bmx-nav.
 * Reproduces the reference's header.css: nav links font-size 18px /
 * weight 700 / padding 35px 0, and a 2-level cascading FLYOUT dropdown
 * (not a column grid) — hovering "Services" reveals 4 category items,
 * hovering a category flies out its service links to the right.
 * Collapses to an off-canvas mobile menu at the reference's 1023px
 * cutoff.
 */

.bmx-site-header {
	position: relative;
	z-index: 100;
	background-color: var( --wp--preset--color--base );
}

.bmx-site-header__inner {
	padding-top: var( --wp--preset--spacing--10 );
	padding-bottom: var( --wp--preset--spacing--10 );
	align-items: center;
}

.bmx-site-header__logo img {
	width: 280px;
	max-width: 100%;
	height: auto;
}

.bmx-nav {
	display: flex;
	align-items: center;
	gap: var( --wp--preset--spacing--40 );
}

.bmx-nav__menu {
	display: flex;
	align-items: center;
	gap: var( --wp--preset--spacing--40 );
	margin: 0;
	padding: 0;
	list-style: none;
}

.bmx-nav__menu > li {
	position: relative;
}

.bmx-nav__menu > li > a {
	display: block;
	padding: 35px 0;
	font-family: 'Inter', sans-serif;
	font-weight: 700;
	font-size: 18px;
	line-height: 30px;
	color: var( --wp--preset--color--bmx-heading );
	text-decoration: none;
	text-transform: capitalize;
}

.bmx-nav__menu > li > a:hover,
.bmx-nav__menu > li > a:focus-visible {
	color: var( --wp--preset--color--bmx-primary );
}

/* Dropdown (both the first flyout level and, via .bmx-dropdown--flyout, the second) */

.bmx-dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 200;
	width: 16rem;
	margin: 0;
	padding: 25px 30px 30px;
	list-style: none;
	background-color: var( --wp--preset--color--base );
	box-shadow: 0 0 10px rgba( 0, 0, 0, 0.1 );
	transform: scaleY( 0 );
	transform-origin: top;
	opacity: 0;
	visibility: hidden;
	transition: all 300ms ease;
}

.bmx-has-dropdown {
	position: relative;
}

.bmx-has-dropdown:hover > .bmx-dropdown,
.bmx-has-dropdown:focus-within > .bmx-dropdown {
	transform: scaleY( 1 );
	opacity: 1;
	visibility: visible;
}

.bmx-dropdown > li {
	margin-bottom: 15px;
	opacity: 0;
	transform: translateY( 11px );
	transition: all 500ms ease;
}

.bmx-dropdown > li:last-child {
	margin-bottom: 0;
}

.bmx-has-dropdown:hover > .bmx-dropdown > li,
.bmx-has-dropdown:focus-within > .bmx-dropdown > li {
	opacity: 1;
	transform: translateY( 0 );
}

.bmx-dropdown > li:nth-child( 1 ) { transition-delay: 70ms; }
.bmx-dropdown > li:nth-child( 2 ) { transition-delay: 140ms; }
.bmx-dropdown > li:nth-child( 3 ) { transition-delay: 210ms; }
.bmx-dropdown > li:nth-child( 4 ) { transition-delay: 280ms; }
.bmx-dropdown > li:nth-child( 5 ) { transition-delay: 350ms; }
.bmx-dropdown > li:nth-child( 6 ) { transition-delay: 420ms; }
.bmx-dropdown > li:nth-child( 7 ) { transition-delay: 490ms; }
.bmx-dropdown > li:nth-child( 8 ) { transition-delay: 560ms; }
.bmx-dropdown > li:nth-child( 9 ) { transition-delay: 630ms; }

@media ( max-width: 1023px ) {
	.bmx-dropdown > li {
		opacity: 1;
		transform: none;
		transition: none;
	}
}

.bmx-dropdown > li > a {
	display: block;
	font-family: 'Inter', sans-serif;
	font-weight: 500;
	font-size: 15px;
	line-height: 24px;
	color: var( --wp--preset--color--bmx-heading );
	text-decoration: none;
}

.bmx-dropdown > li > a:hover,
.bmx-dropdown > li > a:focus-visible {
	color: var( --wp--preset--color--bmx-primary );
}

.bmx-dropdown--flyout {
	top: 0;
	left: 100%;
}

/*
 * Per-service thumbnail in the flyout submenu — the service's own
 * Featured Image (see bmx_service_menu_thumbnail() in inc/mega-menu.php),
 * the same image already used on the service archive card and detail
 * page. Overrides the plain-text .bmx-dropdown > li > a block layout
 * with a flex row; align-items is flex-start (not center) so a label
 * that wraps to two lines still sits flush with the thumbnail's top
 * edge instead of looking off-balance.
 */
.bmx-dropdown--flyout > li > a {
	display: flex;
	align-items: flex-start;
	gap: 12px;
}

.bmx-dropdown__thumb {
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	margin: 0;
	border-radius: 8px;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.bmx-dropdown--flyout > li > a:hover .bmx-dropdown__thumb,
.bmx-dropdown--flyout > li > a:focus-visible .bmx-dropdown__thumb {
	transform: scale( 1.08 );
}

.bmx-dropdown__label {
	padding-top: 2px;
}

/*
 * Category icons for the first-level dropdown headings (User Experience,
 * Mobile App Development, Digital Marketing, Web Development, By Industry,
 * By Technology). Reuses the BMXFlaticon font already bundled with the
 * theme (assets/fonts/flaticon_kashIT-flat.*) — same @font-face declared
 * in home.css, repeated here since mega-menu.css loads site-wide while
 * home.css only loads on the homepage/about/faq/testimonials.
 */
@font-face {
	font-family: 'BMXFlaticon';
	src: url( '../fonts/flaticon_kashIT-flat.woff' ) format( 'woff' ),
		url( '../fonts/flaticon_kashIT-flat.ttf' ) format( 'truetype' );
	font-weight: normal;
	font-style: normal;
	font-display: block;
}

.bmx-dropdown > li.bmx-has-dropdown > a {
	display: flex;
	align-items: center;
	gap: 10px;
}

.bmx-dropdown > li.bmx-has-dropdown > a [class^='bmx-flaticon-'] {
	flex-shrink: 0;
	font-family: 'BMXFlaticon';
	font-size: 16px;
	line-height: 1;
	color: var( --wp--preset--color--bmx-primary );
}

.bmx-flaticon-full-screen::before { content: '\f155'; }
.bmx-flaticon-iphone::before { content: '\f159'; }
.bmx-flaticon-megaphone::before { content: '\f135'; }
.bmx-flaticon-web-programming::before { content: '\f189'; }
.bmx-flaticon-briefcase::before { content: '\f148'; }
.bmx-flaticon-server::before { content: '\f1a6'; }

.bmx-nav__cta {
	flex-shrink: 0;
}

.bmx-nav__toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 32px;
	height: 32px;
	padding: 0;
	background: none;
	border: none;
	cursor: pointer;
}

.bmx-nav__toggle-bar {
	display: block;
	flex: 0 0 2px;
	width: 100%;
	min-height: 2px;
	background-color: var( --wp--preset--color--bmx-heading );
}

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

@media ( max-width: 1023px ) {
	.bmx-nav__toggle {
		display: flex;
	}

	.bmx-nav__cta {
		display: none;
	}

	.bmx-nav__menu {
		display: none;
		position: fixed;
		inset: 0 0 0 auto;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		width: 300px;
		max-width: 85vw;
		height: 100vh;
		margin: 0;
		padding: var( --wp--preset--spacing--70 ) var( --wp--preset--spacing--30 ) var( --wp--preset--spacing--30 );
		background-color: var( --wp--preset--color--base );
		box-shadow: -12px 0 32px rgba( 0, 0, 0, 0.15 );
		overflow-y: auto;
	}

	.bmx-nav__menu.is-open {
		display: flex;
	}

	.bmx-nav__menu > li {
		border-bottom: 1px solid var( --wp--preset--color--bmx-surface-alt );
	}

	.bmx-nav__menu > li > a {
		padding: 0.9em 0;
		font-size: 16px;
	}

	.bmx-dropdown {
		position: static;
		display: none;
		width: 100%;
		transform: none;
		opacity: 1;
		visibility: visible;
		box-shadow: none;
		padding: 0 0 0.75em 1em;
	}

	.bmx-has-dropdown:hover > .bmx-dropdown {
		transform: none;
		opacity: 1;
		visibility: visible;
	}

	.bmx-has-dropdown.is-open > .bmx-dropdown {
		display: block;
	}

	.bmx-dropdown--flyout {
		padding-left: 1em;
	}
}
