/*
 * Site header — fully custom, replaces Astra's Header Builder output.
 * Depends on custom properties from variables.css / main.css
 * (--azpma-*, --ast-global-color-6 border tint, --azpma-radius).
 */

.site-header {
	position: sticky;
	top: 0;
	z-index: 999;
	background: var(--azpma-white);
	border-bottom: 1px solid transparent;
	transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.site-header.scrolled {
	border-bottom-color: var(--ast-global-color-6);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.site-header-inner {
	max-width: var(--ast-normal-container-width, 1200px);
	margin: 0 auto;
	padding: 0 1.5em;
	min-height: 72px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 2em;
}

/* Logo */
.site-branding {
	flex-shrink: 0;
}

.site-branding img {
	display: block;
	height: 52px;
	width: auto;
}

.site-title-link {
	font-weight: 700;
	font-size: 1.25rem;
	color: var(--azpma-text);
	text-decoration: none;
}

/* Primary nav */
.site-nav {
	flex: 1 1 auto;
	display: flex;
	justify-content: center;
}

.primary-menu {
	list-style: none;
	display: flex;
	align-items: center;
	margin: 0;
	padding: 0;
}

.primary-menu li {
	position: relative;
}

.primary-menu > li > a {
	display: block;
	padding: 0 1em;
	line-height: 72px;
	color: var(--azpma-text);
	text-decoration: none;
	font-size: 0.85rem;
	white-space: nowrap;
}

.primary-menu > li > a:hover,
.primary-menu > li.current-menu-item > a,
.primary-menu > li.current-menu-ancestor > a {
	color: var(--azpma-primary);
}

/* Dropdown submenus — desktop hover */
.primary-menu .sub-menu {
	list-style: none;
	margin: 0;
	padding: 0.5em 0;
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 240px;
	background: var(--azpma-white);
	border: 1px solid var(--ast-global-color-6);
	border-radius: var(--azpma-radius-sm);
	opacity: 0;
	visibility: hidden;
	transform: translateY(4px);
	transition: opacity 0.15s ease, transform 0.15s ease;
	z-index: 20;
}

.primary-menu .menu-item-has-children:hover > .sub-menu,
.primary-menu .menu-item-has-children:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.primary-menu .sub-menu li {
	border: none;
}

.primary-menu .sub-menu a {
	display: block;
	padding: 0.6em 1em;
	line-height: 1.3;
	white-space: nowrap;
	color: var(--azpma-text);
	text-decoration: none;
	font-size: 0.9rem;
}

.primary-menu .sub-menu a:hover {
	background: var(--azpma-bg-light);
	color: var(--azpma-primary);
}

/* Contact / Əlaqə — solid button, tagged via the "nav-cta" menu item CSS class */
.primary-menu .nav-cta {
	margin-left: 0.5em;
}

.primary-menu .nav-cta > a {
	background: var(--azpma-primary);
	color: var(--azpma-white);
	padding: 0.6em 1.4em;
	line-height: 1.4;
	border-radius: var(--azpma-radius);
}

.primary-menu .nav-cta > a:hover {
	background: var(--azpma-primary-dark);
	color: var(--azpma-white);
}

/* Language toggle + hamburger */
.site-header-actions {
	display: flex;
	align-items: center;
	gap: 1em;
	flex-shrink: 0;
}

.lang-switch {
	display: inline-flex;
	line-height: 0;
}

.lang-switch .flag-icon {
	display: block;
	width: 22px;
	height: 15px;
	border-radius: 2px;
	border: 1px solid var(--ast-global-color-6);
}

/* Duplicate flag toggle rendered inside the mobile drawer; hidden on desktop. */
.lang-switch--mobile {
	display: none;
}

/*
 * Hamburger — custom 3-bar icon, no background/box, animates into an X when
 * open. Astra's dynamic CSS styles every literal <button> element (base +
 * hover/focus/active) as a solid brand-color button; since this toggle IS a
 * <button>, that leaks through on interaction unless explicitly reset here
 * for every state, not just the default one.
 */
.menu-toggle {
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 5px;
	width: 44px;
	height: 44px;
	border: none;
	padding: 0;
	cursor: pointer;
}

.menu-toggle,
.menu-toggle:hover,
.menu-toggle:focus,
.menu-toggle:focus-visible,
.menu-toggle:active {
	background: none;
	box-shadow: none;
	border-radius: 0;
	color: inherit;
}

.menu-toggle-bar {
	display: block;
	width: 22px;
	height: 2px;
	background: var(--azpma-text);
	border-radius: 1px;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.site-header.nav-open .menu-toggle-bar:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.site-header.nav-open .menu-toggle-bar:nth-child(2) {
	opacity: 0;
}

.site-header.nav-open .menu-toggle-bar:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* Mobile */
@media (max-width: 900px) {
	.site-nav {
		position: fixed;
		top: 72px;
		left: 0;
		right: 0;
		bottom: 0;
		background: var(--azpma-bg-light);
		flex-direction: column;
		justify-content: flex-start;
		padding: 1em 1.5em 2em;
		overflow-y: auto;
		transform: translateX(-100%);
		transition: transform 0.2s ease;
	}

	.site-header.nav-open .site-nav {
		transform: translateX(0);
	}

	.primary-menu {
		flex-direction: column;
		align-items: stretch;
		width: 100%;
	}

	/* No divider lines anywhere in the mobile menu — spacing only. */
	.primary-menu > li {
		border-bottom: none;
	}

	.primary-menu > li.menu-item-has-children {
		padding-bottom: 0.5em;
		margin-bottom: 0.5em;
	}

	.primary-menu > li > a {
		line-height: normal;
		padding: 1em 0;
		font-size: 0.95rem;
		white-space: normal;
		word-break: break-word;
	}

	/* Accordion parents (Haqqında / Sertifikasiya only — anything with a .sub-menu
	   gets this automatically via .menu-item-has-children). Tap toggles open/closed
	   instead of navigating; chevron rotates to indicate state. */
	.primary-menu > li.menu-item-has-children > a {
		position: relative;
		padding-right: 1.75em;
	}

	.primary-menu > li.menu-item-has-children > a::after {
		content: '';
		position: absolute;
		right: 0.25em;
		top: 50%;
		width: 8px;
		height: 8px;
		border-right: 2px solid var(--azpma-text);
		border-bottom: 2px solid var(--azpma-text);
		transform: translateY(-70%) rotate(45deg);
		transition: transform 0.2s ease;
	}

	.primary-menu > li.menu-item-has-children.sub-open > a::after {
		transform: translateY(-30%) rotate(-135deg);
	}

	/* Collapsed by default; slides open via max-height when .sub-open is toggled. */
	.primary-menu .sub-menu {
		position: static;
		opacity: 1;
		visibility: visible;
		transform: none;
		border: none;
		margin: 0;
		padding-left: 1em;
		max-height: 0;
		overflow: hidden;
		transition: max-height 0.25s ease;
	}

	.primary-menu > li.menu-item-has-children.sub-open > .sub-menu {
		max-height: 400px;
	}

	.primary-menu .sub-menu a {
		white-space: normal;
		word-break: break-word;
	}

	.primary-menu .nav-cta {
		margin-left: 0;
	}

	.primary-menu .nav-cta > a {
		display: inline-block;
		margin: 0.75em 0;
	}

	.menu-toggle {
		display: inline-flex;
	}

	/* Flag toggle moves from the top bar into the drawer on mobile. */
	.site-header-actions > .lang-switch {
		display: none;
	}

	.lang-switch--mobile {
		display: inline-flex;
		margin-top: 1.5em;
	}
}
