/* AKA Header Menu — desktop + off-canvas (akareal.vn style) */

.ahm {
	--ahm-accent: #c8102e;
	--ahm-text: #333333;
	--ahm-border: #eeeeee;
	position: relative;
	width: 100%;
}

.ahm-editor-notice {
	padding: 10px 14px;
	font-size: 13px;
	line-height: 1.4;
	color: #856404;
	background: #fff3cd;
	border-radius: 4px;
}

/* ── Desktop nav ─────────────────────────────────────────── */

.ahm-desktop {
	display: flex;
	align-items: center;
	width: 100%;
}

.ahm-desktop__list {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	list-style: none;
	margin: 0;
	padding: 0;
	gap: 28px;
}

.ahm-desktop__item {
	position: relative;
	list-style: none;
	margin: 0;
}

.ahm-desktop__link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 12px 0;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.3;
	text-decoration: none;
	color: #1a1a1a;
	transition: color 0.2s ease;
	white-space: nowrap;
}

.ahm-desktop__caret {
	display: inline-block;
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid currentColor;
	opacity: 0.7;
	transition: transform 0.2s ease;
}

.ahm-desktop__item:hover>.ahm-desktop__link .ahm-desktop__caret,
.ahm-desktop__item:focus-within>.ahm-desktop__link .ahm-desktop__caret {
	transform: rotate(180deg);
}

.ahm-desktop__sub {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 1000;
	min-width: 220px;
	max-height: 300px;
	overflow-y: auto;
	margin: 0;
	padding: 8px 0;
	list-style: none;
	background: #fff;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.1);
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.ahm-desktop__item:hover>.ahm-desktop__sub,
.ahm-desktop__item:focus-within>.ahm-desktop__sub {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.ahm-desktop__sub-item {
	position: relative;
	list-style: none;
	margin: 0;
}

.ahm-desktop__sub-link {
	display: block;
	padding: 10px 18px;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	color: #333;
	transition: color 0.15s ease, background 0.15s ease;
}

.ahm-desktop__sub-link:hover {
	color: var(--ahm-accent);
	background: #fafafa;
}

.ahm-desktop__sub--nested {
	top: 0;
	left: 100%;
	margin-left: 4px;
}

/* ── Toggle (hamburger) ──────────────────────────────────── */

.ahm-toggle-wrap {
	display: none;
	align-items: center;
	width: 100%;
}

.ahm-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px;
	margin: 0;
	border: 0;
	background: transparent;
	color: #1a1a1a;
	cursor: pointer;
	line-height: 1;
	appearance: none;
	-webkit-appearance: none;
}

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

.ahm-toggle i,
.ahm-toggle svg {
	display: block;
	pointer-events: none;
}

/* ── Off-canvas ──────────────────────────────────────────── */

.ahm-offcanvas {
	position: fixed;
	inset: 0;
	z-index: 99999;
	pointer-events: none;
	visibility: hidden;
}

.ahm-offcanvas.is-open {
	pointer-events: auto;
	visibility: visible;
}

.ahm-offcanvas__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	opacity: 0;
	transition: opacity 0.3s ease;
	cursor: pointer;
}

.ahm-offcanvas.is-open .ahm-offcanvas__overlay {
	opacity: 1;
}

.ahm-offcanvas__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 88%;
	max-width: 420px;
	background: #fff;
	box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
	transform: translateX(100%);
	transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.ahm-offcanvas.is-open .ahm-offcanvas__panel {
	transform: translateX(0);
}

.ahm-offcanvas__inner {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 24px;
}

.ahm-offcanvas__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 20px;
	border-bottom: 1px solid #e8e8e8;
	flex-shrink: 0;
}

.ahm-offcanvas__logo {
	display: flex;
	align-items: center;
	min-width: 0;
}

.ahm-offcanvas__logo a {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	color: inherit;
}

.ahm-offcanvas__logo img {
	display: block;
	width: 120px;
	height: auto;
	max-width: 100%;
}

.ahm-offcanvas__logo-text {
	font-size: 18px;
	font-weight: 700;
	letter-spacing: 0.02em;
	color: #1a1a1a;
}

.ahm-offcanvas__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	color: #1a1a1a;
	cursor: pointer;
	line-height: 1;
	appearance: none;
	-webkit-appearance: none;
}

.ahm-offcanvas__close:focus-visible {
	outline: 2px solid var(--ahm-accent);
	outline-offset: 2px;
}

.ahm-offcanvas__nav {
	flex-shrink: 0;
}

.ahm-offcanvas__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ahm-offcanvas__item {
	list-style: none;
	margin: 0;
	border-bottom: 1px solid var(--ahm-border, #eee);
}

.ahm-offcanvas__row {
	display: flex;
	align-items: stretch;
	min-height: 52px;
}

.ahm-offcanvas__link {
	flex: 1;
	display: flex;
	align-items: center;
	padding: 16px 20px;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.35;
	text-decoration: none;
	color: #333;
	transition: color 0.15s ease;
}

.ahm-offcanvas__caret {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 48px;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	color: var(--ahm-accent, #c8102e);
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	transition: transform 0.25s ease;
}

.ahm-offcanvas__item.is-open>.ahm-offcanvas__row .ahm-offcanvas__caret {
	transform: rotate(180deg);
}

.ahm-offcanvas__sub {
	display: none;
	list-style: none;
	margin: 0;
	padding: 0 0 8px;
	background: #fafafa;
}

.ahm-offcanvas__item.is-open>.ahm-offcanvas__sub {
	display: block;
}

.ahm-offcanvas__sub-item {
	list-style: none;
	margin: 0;
}

.ahm-offcanvas__sub-link {
	display: block;
	padding: 10px 20px 10px 28px;
	font-size: 14px;
	font-weight: 400;
	text-decoration: none;
	color: #555;
	transition: color 0.15s ease;
}

.ahm-offcanvas__sub-link:hover {
	color: var(--ahm-accent, #c8102e);
}

/* Nested Elementor drop zone under menu */
.ahm-offcanvas__footer {
	flex-shrink: 0;
	padding: 28px 20px 8px;
	margin-top: auto;
}

.ahm-offcanvas__footer .e-con,
.ahm-offcanvas__footer .elementor-element {
	width: 100%;
}

/* Body lock when open */
html.ahm-lock,
html.ahm-lock body {
	overflow: hidden;
}

/* ── Responsive via CSS custom property --ahm-bp ─────────── */
/* Default fallback: 1024px. Inline --ahm-bp from widget overrides. */

@media (max-width: 1024px) {
	.ahm:not([style*="--ahm-bp"]) .ahm-desktop {
		display: none;
	}

	.ahm:not([style*="--ahm-bp"]) .ahm-toggle-wrap {
		display: flex;
	}
}

/* Dynamic breakpoint: JS adds .ahm--mobile / .ahm--desktop
   as reliable fallback; CSS container also uses matchMedia via class. */

.ahm.ahm--mobile .ahm-desktop {
	display: none !important;
}

.ahm.ahm--mobile .ahm-toggle-wrap {
	display: flex !important;
}

.ahm.ahm--desktop .ahm-desktop {
	display: flex !important;
}

.ahm.ahm--desktop .ahm-toggle-wrap {
	display: none !important;
}

.ahm.ahm--desktop .ahm-offcanvas.is-open {
	/* Keep panel usable in editor if forced open; normally closed on desktop */
}

/* Editor: panel open + footer drop zone visible */
.elementor-editor-active .ahm--editor .ahm-toggle-wrap {
	display: flex !important;
}

.elementor-editor-active .ahm-offcanvas.is-editor-open {
	pointer-events: auto;
	visibility: visible;
	/* Don't cover the whole canvas — dock as a right preview strip */
	position: relative;
	inset: auto;
	z-index: 10;
	margin-top: 12px;
	min-height: 320px;
}

.elementor-editor-active .ahm-offcanvas.is-editor-open .ahm-offcanvas__overlay {
	display: none;
}

.elementor-editor-active .ahm-offcanvas.is-editor-open .ahm-offcanvas__panel {
	position: relative;
	top: auto;
	right: auto;
	bottom: auto;
	width: 100% !important;
	max-width: 420px;
	margin-left: auto;
	transform: none;
	box-shadow: 0 0 0 1px #e5e5e5;
	min-height: 320px;
}

.elementor-editor-active .ahm-offcanvas__footer {
	min-height: 64px;
	outline: 1px dashed #c8102e;
	outline-offset: -1px;
}