/* ── Elemance Nav Menu Widget ─────────────────── */

/* Theme-compatibility hardening: themes love to restyle <ul>, <a> and
   <button> globally, and a nav is made of all three. Scope our own
   box-sizing and reset the pieces a theme is most likely to touch. */
.elmc-nav,
.elmc-nav *,
.elmc-nav *::before,
.elmc-nav *::after {
	box-sizing: border-box;
}

.elmc-nav {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	width: 100%;
	--elmc-nav-underline: #6c63ff;
	--elmc-nav-item-hover-bg: rgba(108,99,255,0.1);
	--elmc-nav-item-active-bg: transparent;
	--elmc-nav-sub-width: 220px;
	--elmc-nav-sub-offset: 4px;
	--elmc-nav-panel-bg: #ffffff;
	--elmc-nav-panel-item-padding: 14px 16px;
}

.elmc-nav__panel {
	flex: 1 1 auto;
	min-width: 0;
}

/* ── List & items ─────────────────────────────── */
.elmc-nav__list,
.elmc-nav__submenu {
	list-style: none;
	margin: 0;
	padding: 0;
}

.elmc-nav__list {
	display: flex;
	gap: 8px;
}

.elmc-nav--horizontal .elmc-nav__list {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
}

.elmc-nav--vertical .elmc-nav__list {
	flex-direction: column;
	align-items: flex-start;
}

.elmc-nav__item {
	position: relative;
	display: flex;
	align-items: center;
	margin: 0;
}

.elmc-nav__link {
	position: relative;
	display: block;
	padding: 10px 14px;
	border-radius: 8px;
	color: #111827;
	font-size: 15px;
	line-height: 1.4;
	text-decoration: none;
	transition: color 0.2s, background-color 0.2s;
}

.elmc-nav__link:hover,
.elmc-nav__link:focus {
	text-decoration: none;
}

.elmc-nav__link:focus-visible,
.elmc-nav__toggle:focus-visible,
.elmc-nav__sub-toggle:focus-visible {
	outline: 2px solid #6c63ff;
	outline-offset: 2px;
}

/* ── Hover / active effects ───────────────────── */
.elmc-nav--effect-underline .elmc-nav__link::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 2px;
	background: var(--elmc-nav-underline);
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 0.22s ease;
}

.elmc-nav--effect-underline .elmc-nav__link:hover::after,
.elmc-nav--effect-underline .elmc-nav__link:focus-visible::after,
.elmc-nav--effect-underline .elmc-nav__link.is-current::after {
	transform: scaleX(1);
}

.elmc-nav--effect-background .elmc-nav__link:hover,
.elmc-nav--effect-background .elmc-nav__link:focus-visible {
	background-color: var(--elmc-nav-item-hover-bg);
}

.elmc-nav--effect-background .elmc-nav__link.is-current {
	background-color: var(--elmc-nav-item-active-bg);
}

/* ── Buttons (toggle + submenu toggle) ────────── */
/* Both are real <button> elements for keyboard and touch support, so the
   theme's global button styling has to be pushed off them explicitly. */
.elmc-nav__toggle,
.elmc-nav__toggle:hover,
.elmc-nav__toggle:focus,
.elmc-nav__toggle:active,
.elmc-nav__sub-toggle,
.elmc-nav__sub-toggle:hover,
.elmc-nav__sub-toggle:focus,
.elmc-nav__sub-toggle:active {
	border: none !important;
	box-shadow: none !important;
	cursor: pointer;
	font: inherit;
	color: inherit;
	margin: 0;
	-webkit-appearance: none;
	appearance: none;
}

.elmc-nav__toggle {
	display: none;
	align-items: center;
	justify-content: center;
	padding: 8px;
	border-radius: 8px;
	background: transparent;
	color: #111827;
}

.elmc-nav__toggle svg,
.elmc-nav__sub-toggle svg {
	display: block;
}

/* Beats ".elmc-nav__toggle svg" above, which would otherwise show both icons at once. */
.elmc-nav__toggle .elmc-nav__toggle-close { display: none; }

.elmc-nav__toggle[aria-expanded="true"] .elmc-nav__toggle-open  { display: none; }
.elmc-nav__toggle[aria-expanded="true"] .elmc-nav__toggle-close { display: block; }

.elmc-nav__sub-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 6px;
	background: transparent;
	border-radius: 6px;
	margin-left: -6px;
}

.elmc-nav__sub-toggle svg {
	transition: transform 0.22s ease;
}

.elmc-nav__item.is-open > .elmc-nav__sub-toggle svg {
	transform: rotate(180deg);
}

/* Indicator off: the chevron disappears on pointer devices (where hover and
   :focus-within open the dropdown) but stays on touch, which has neither. */
.elmc-nav:not(.elmc-nav--indicator) .elmc-nav__sub-toggle {
	display: none;
}

@media (hover: none) {
	.elmc-nav:not(.elmc-nav--indicator) .elmc-nav__sub-toggle {
		display: inline-flex;
	}
}

/* ── Submenu ──────────────────────────────────── */
.elmc-nav__submenu {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 99;
	width: var(--elmc-nav-sub-width);
	margin-top: var(--elmc-nav-sub-offset);
	padding: 8px 0;
	border-radius: 10px;
	background: #ffffff;
	box-shadow: 0 12px 32px rgba(17,24,39,0.12);
	text-align: left;
}

/* The class is the source of truth — JS sets it on click, keyboard and
   touch. Hover below is an extra, never the only way in. */
.elmc-nav__item.is-open > .elmc-nav__submenu {
	display: block;
}

@media (hover: hover) and (pointer: fine) {
	.elmc-nav__item--has-children:hover > .elmc-nav__submenu,
	.elmc-nav__item--has-children:focus-within > .elmc-nav__submenu {
		display: block;
	}
}

.elmc-nav__submenu .elmc-nav__item {
	width: 100%;
}

.elmc-nav__submenu .elmc-nav__link {
	flex: 1 1 auto;
	border-radius: 0;
	color: #374151;
	font-size: 14px;
}

.elmc-nav--vertical .elmc-nav__submenu {
	top: 0;
	left: 100%;
	margin-top: 0;
	margin-left: var(--elmc-nav-sub-offset);
}

/* ── Mobile panel: collapse at 767px ──────────── */
@media (max-width: 767px) {
	.elmc-nav--mobile-mobile .elmc-nav__toggle {
		display: inline-flex;
	}

	.elmc-nav--mobile-mobile .elmc-nav__panel {
		display: none;
		flex: 0 0 100%;
		width: 100%;
		margin-top: 8px;
		border-radius: 10px;
		background: var(--elmc-nav-panel-bg);
	}

	.elmc-nav--mobile-mobile .elmc-nav__panel.is-open {
		display: block;
	}

	.elmc-nav--mobile-mobile .elmc-nav__list {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.elmc-nav--mobile-mobile .elmc-nav__item {
		flex-wrap: wrap;
		width: 100%;
	}

	.elmc-nav--mobile-mobile .elmc-nav__link {
		flex: 1 1 auto;
		padding: var(--elmc-nav-panel-item-padding);
		border-radius: 0;
	}

	.elmc-nav--mobile-mobile .elmc-nav__sub-toggle {
		display: inline-flex;
		margin-left: 0;
		margin-right: 8px;
	}

	.elmc-nav--mobile-mobile .elmc-nav__submenu {
		position: static;
		width: 100%;
		margin: 0;
		padding: 0 0 8px 16px;
		border-radius: 0;
		box-shadow: none;
		background: transparent;
	}
}

/* ── Mobile panel: collapse at 1024px ─────────── */
@media (max-width: 1024px) {
	.elmc-nav--mobile-tablet .elmc-nav__toggle {
		display: inline-flex;
	}

	.elmc-nav--mobile-tablet .elmc-nav__panel {
		display: none;
		flex: 0 0 100%;
		width: 100%;
		margin-top: 8px;
		border-radius: 10px;
		background: var(--elmc-nav-panel-bg);
	}

	.elmc-nav--mobile-tablet .elmc-nav__panel.is-open {
		display: block;
	}

	.elmc-nav--mobile-tablet .elmc-nav__list {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.elmc-nav--mobile-tablet .elmc-nav__item {
		flex-wrap: wrap;
		width: 100%;
	}

	.elmc-nav--mobile-tablet .elmc-nav__link {
		flex: 1 1 auto;
		padding: var(--elmc-nav-panel-item-padding);
		border-radius: 0;
	}

	.elmc-nav--mobile-tablet .elmc-nav__sub-toggle {
		display: inline-flex;
		margin-left: 0;
		margin-right: 8px;
	}

	.elmc-nav--mobile-tablet .elmc-nav__submenu {
		position: static;
		width: 100%;
		margin: 0;
		padding: 0 0 8px 16px;
		border-radius: 0;
		box-shadow: none;
		background: transparent;
	}
}

/* ── Editor-only notice ───────────────────────── */
.elmc-nav--notice {
	display: block;
	padding: 14px 16px;
	border: 1px dashed #c7c9d1;
	border-radius: 8px;
	background: #f9fafb;
}

.elmc-nav__notice {
	color: #6b7280;
	font-size: 14px;
	line-height: 1.5;
}

/* ── Reduced motion ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	.elmc-nav__link,
	.elmc-nav__link::after,
	.elmc-nav__sub-toggle svg {
		transition: none !important;
	}
}
