/* OnPage Menu Widget — frontend styles.
 * Layout, indicator, icon, toggle and drawer are driven by CSS custom
 * properties that Elementor writes on `.opm-menu` (responsive per device).
 * Only logical properties are used so RTL flips automatically.
 */

.opm-menu {
	/* Defaults; Elementor overrides these per device. */
	--opm-dir-sign: 1;
	--opm-mode: vertical;
	--opm-dir: column;
	--opm-overflow-x: visible;
	--opm-item-shrink: 1;
	--opm-item-width: 100%;
	--opm-white-space: normal;
	--opm-justify: var(--opm-align-v);
	--opm-align-v: flex-start;
	--opm-align-h: flex-start;
	--opm-text-align: start;
	--opm-link-justify: flex-start;
	--opm-gap: 4px;
	--opm-transition: 0.25s;
	--opm-color-normal: #6b7280;
	--opm-color-active: #f97316;
	--opm-icon-size: 18px;
	--opm-icon-gap: 10px;
	--opm-item-dir: row;
	--opm-ind-color: #f97316;
	--opm-ind-thickness: 3px;
	--opm-ind-length: 100%;
	--opm-ind-offset: 0px;
	--opm-ind-m1: auto;
	--opm-ind-m2: auto;
	--opm-ind-display: block;
	--opm-ind-inset-start: var(--opm-ind-offset);
	--opm-ind-inset-end: auto;
	--opm-ind-top: 0;
	--opm-ind-bottom: 0;
	--opm-ind-w: var(--opm-ind-thickness);
	--opm-ind-h: var(--opm-ind-length);
	--opm-ind-mb: var(--opm-ind-m1) var(--opm-ind-m2);
	--opm-ind-mi: 0;
	--opm-div-width: 1px;
	--opm-div-style: solid;
	--opm-div-color: #e5e7eb;
	--opm-divider: 0;
	--opm-div-block: var(--opm-divider);
	--opm-div-inline: 0;
	--opm-toggle-display: none;
	--opm-toggle-icon-size: 16px;
	--opm-icon-dd: none;
	--opm-icon-sb: none;
	--opm-panel-position: static;
	--opm-panel-block: auto;
	--opm-panel-is: auto;
	--opm-panel-ie: auto;
	--opm-panel-w: auto;
	--opm-panel-maxh: none;
	--opm-panel-open-maxh: none;
	--opm-panel-overflow: visible;
	--opm-panel-transform: none;
	--opm-panel-z: auto;
	--opm-panel-bg: transparent;
	--opm-panel-padding: 0;
	--opm-panel-max-h: 70vh;
	--opm-close-display: none;
	--opm-close-size: 20px;
	--opm-close-justify: flex-end;
	--opm-drawer-width: 280px;
	--opm-drawer-side-start: 0;
	--opm-drawer-side-end: auto;
	--opm-drawer-hidden: translateX(calc(-100% * var(--opm-dir-sign)));
	--opm-drawer-transition: 0.3s;
	--opm-backdrop: rgba(0, 0, 0, 0.5);
	--opm-title-color: inherit;
	--opm-title-align: start;
	--opm-title-justify: space-between;
	--opm-title-standalone: block;
	--opm-viewall-gap: 0px;
	--opm-count-color: inherit;
	--opm-count-bg: transparent;
	--opm-count-gap: 6px;

	position: relative;
	display: block;
	box-sizing: border-box;
	max-width: 100%;
}

[dir="rtl"] .opm-menu,
.rtl .opm-menu {
	--opm-dir-sign: -1;
}

.opm-divider-yes .opm-menu {
	--opm-divider: var(--opm-div-width) var(--opm-div-style) var(--opm-div-color);
}

/* Toggle (Dropdown / Sidebar layouts) ---------------------------------- */

.opm-toggle {
	display: var(--opm-toggle-display);
	align-items: center;
	justify-content: space-between;
	gap: var(--opm-toggle-icon-gap, var(--opm-icon-gap));
	width: 100%;
	margin: 0;
	border: 0;
	background: var(--opm-toggle-open-bg, var(--opm-toggle-bg, transparent));
	color: var(--opm-toggle-open-color, var(--opm-toggle-color, var(--opm-color-active)));
	font: inherit;
	text-align: start;
	cursor: pointer;
	box-sizing: border-box;
	transition: color var(--opm-transition), background-color var(--opm-transition);
}

/*
 * Hover / focus guard. Theme resets (e.g. Hello Elementor's `button:hover`)
 * paint every <button> on hover; these rules out-rank them (three classes)
 * and always resolve to the widget's own colors: Hover tab -> Open tab -> Normal tab.
 */
.opm-menu .opm-toggle:focus,
.opm-menu .opm-toggle:focus-visible {
	background: var(--opm-toggle-open-bg, var(--opm-toggle-bg, transparent));
	color: var(--opm-toggle-open-color, var(--opm-toggle-color, var(--opm-color-active)));
	text-decoration: none;
	box-shadow: none;
}

.opm-menu .opm-toggle:hover {
	background: var(--opm-toggle-hover-bg, var(--opm-toggle-open-bg, var(--opm-toggle-bg, transparent)));
	color: var(--opm-toggle-hover-color, var(--opm-toggle-open-color, var(--opm-toggle-color, var(--opm-color-active))));
	text-decoration: none;
	box-shadow: none;
}

.opm-menu .opm-toggle:focus:not(:focus-visible) {
	outline: none;
}

.opm-menu .opm-toggle:hover .opm-toggle-icon {
	color: var(--opm-toggle-hover-icon-color, var(--opm-toggle-open-icon-color, var(--opm-toggle-icon-color, inherit)));
}

.opm-toggle-label {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.opm-toggle-icon {
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	color: var(--opm-toggle-open-icon-color, var(--opm-toggle-icon-color, inherit));
	font-size: var(--opm-toggle-icon-size);
	line-height: 1;
	transition: transform var(--opm-transition);
}

.opm-toggle-icon-dd {
	display: var(--opm-icon-dd);
}

.opm-toggle-icon-sb {
	display: var(--opm-icon-sb);
}

.opm-menu.is-open .opm-toggle-icon-dd {
	transform: rotate(180deg);
}

.opm-toggle-icon svg,
.opm-close svg,
.opm-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

/* Backdrop + panel ------------------------------------------------------- */

.opm-backdrop {
	position: fixed;
	inset: 0;
	z-index: 9998;
	background: var(--opm-backdrop);
}

.opm-backdrop[hidden] {
	display: none;
}

.opm-panel {
	position: var(--opm-panel-position);
	inset-block: var(--opm-panel-block);
	inset-inline-start: var(--opm-panel-is);
	inset-inline-end: var(--opm-panel-ie);
	z-index: var(--opm-panel-z);
	display: flex;
	flex-direction: column;
	width: var(--opm-panel-w);
	max-width: 100vw;
	max-height: var(--opm-panel-maxh);
	overflow: var(--opm-panel-overflow);
	padding: var(--opm-panel-padding);
	background-color: var(--opm-panel-bg);
	transform: var(--opm-panel-transform);
	box-sizing: border-box;
	transition: transform var(--opm-drawer-transition), max-height var(--opm-drawer-transition);
}

.opm-menu.is-open .opm-panel {
	max-height: var(--opm-panel-open-maxh);
	overflow: auto;
	transform: none;
}

.opm-close {
	display: var(--opm-close-display);
	align-self: var(--opm-close-justify);
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 8px;
	border: 0;
	background: transparent;
	color: var(--opm-close-color, var(--opm-color-normal));
	font-size: var(--opm-close-size);
	line-height: 1;
	cursor: pointer;
	transition: color var(--opm-transition), background-color var(--opm-transition);
}

.opm-menu .opm-close:focus,
.opm-menu .opm-close:focus-visible {
	background: transparent;
	color: var(--opm-close-color, var(--opm-color-normal));
	text-decoration: none;
	box-shadow: none;
}

.opm-menu .opm-close:hover {
	background: var(--opm-close-hover-bg, transparent);
	color: var(--opm-close-hover-color, var(--opm-close-color, var(--opm-color-normal)));
	text-decoration: none;
	box-shadow: none;
}

.opm-menu .opm-close:focus:not(:focus-visible) {
	outline: none;
}

body.opm-drawer-open {
	overflow: hidden;
}

/* List + items ---------------------------------------------------------- */

.opm-list {
	display: flex;
	flex-direction: var(--opm-dir);
	flex-wrap: nowrap;
	gap: var(--opm-gap);
	justify-content: var(--opm-justify);
	overflow-x: var(--opm-overflow-x);
	margin: 0;
	padding: 0;
	list-style: none;
	scrollbar-width: none;
	-ms-overflow-style: none;
	-webkit-overflow-scrolling: touch;
}

.opm-list::-webkit-scrollbar {
	display: none;
}

.opm-item {
	flex: 0 var(--opm-item-shrink) auto;
	width: var(--opm-item-width);
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	box-sizing: border-box;
}

.opm-item + .opm-item {
	border-block-start: var(--opm-div-block);
	border-inline-start: var(--opm-div-inline);
}

.opm-link {
	position: relative;
	display: flex;
	flex-direction: var(--opm-item-dir);
	align-items: center;
	justify-content: var(--opm-link-justify);
	gap: var(--opm-icon-gap);
	color: var(--opm-color-normal);
	text-align: var(--opm-text-align);
	text-decoration: none;
	white-space: var(--opm-white-space);
	cursor: pointer;
	box-sizing: border-box;
	transition: color var(--opm-transition), background-color var(--opm-transition), border-color var(--opm-transition), box-shadow var(--opm-transition);
}

.opm-link:hover,
.opm-link:focus {
	text-decoration: none;
}

.opm-link:focus-visible {
	outline: 2px solid var(--opm-color-active);
	outline-offset: 2px;
}

.opm-item:not(.is-active) .opm-link:hover {
	color: var(--opm-color-hover, var(--opm-color-active));
}

.opm-item.is-active .opm-link {
	color: var(--opm-color-active);
}

.opm-static .opm-link {
	cursor: default;
}

.opm-placeholder .opm-link {
	opacity: 0.6;
	font-style: italic;
}

.opm-label {
	display: inline-block;
	min-width: 0;
}

/* Menu title ------------------------------------------------------------- */

/*
 * The title is reset to a plain box on purpose. A theme styles h2-h6 with its
 * own margins, padding and sometimes a background, and all of that used to
 * bleed into the widget and make the title look nothing like the menu under
 * it. Everything below the font is handed to the Style tab instead; the tag
 * still decides the font, so an untouched H3 still reads as a heading.
 */
.opm-title {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--opm-title-color);
	text-align: var(--opm-title-align);
}

/*
 * "Title Opens The Menu": in Dropdown and Sidebar the toggle button stands in
 * for the title, so the plain heading above it would just repeat the same
 * words in a second row. Both are always in the markup — the layout mode is a
 * per-device CSS decision that the server cannot predict — and exactly one of
 * them is ever on screen, which is why the button can safely wear the .opm-title
 * class and take the whole of Style > Title with it.
 */
.opm-title-toggle-yes .opm-title-standalone {
	display: var(--opm-title-standalone, block);
}

/* The button is a flex row, so the Title alignment has to move the row, not
 * the text inside it. Without a chosen alignment the icon keeps its usual
 * place at the far end. */
.opm-title-toggle-yes .opm-toggle {
	justify-content: var(--opm-title-justify, space-between);
}

/* Taxonomy filter items -------------------------------------------------- */

/* A filter item is an ordinary item on purpose: it inherits every Items
 * style — gap, typography, the normal / hover / active states, the indicator
 * and the dividers — so the row stays one consistent design. */

.opm-count {
	display: inline-block;
	flex: 0 0 auto;
	margin-inline-start: var(--opm-count-gap);
	color: var(--opm-count-color);
	background: var(--opm-count-bg);
	line-height: 1;
}

/* Optional breathing room between "View All" and the terms. The margin is set
 * on whichever side the button actually sits, so it works at both ends and in
 * both text directions. */
.opm-viewall:first-child {
	margin-inline-end: var(--opm-viewall-gap);
}

.opm-viewall:last-child {
	margin-inline-start: var(--opm-viewall-gap);
}

/* In a column the gap belongs on the block axis instead. */
.opm-menu[data-opm-mode="vertical"] .opm-viewall:first-child,
.opm-menu[data-opm-mode="sidebar"] .opm-viewall:first-child,
.opm-menu[data-opm-mode="dropdown"] .opm-viewall:first-child {
	margin-inline-end: 0;
	margin-block-end: var(--opm-viewall-gap);
}

.opm-menu[data-opm-mode="vertical"] .opm-viewall:last-child,
.opm-menu[data-opm-mode="sidebar"] .opm-viewall:last-child,
.opm-menu[data-opm-mode="dropdown"] .opm-viewall:last-child {
	margin-inline-start: 0;
	margin-block-start: var(--opm-viewall-gap);
}

/* While the grid is fetching: the menu dims and stops taking clicks, so a
 * second click cannot race the first. */
.opm-menu.is-loading .opm-list {
	opacity: 0.6;
	transition: opacity var(--opm-transition) ease;
}

.opm-menu.is-loading .opm-filter .opm-link {
	pointer-events: none;
}

/* Active indicator ------------------------------------------------------- */

.opm-link::before {
	content: "";
	position: absolute;
	display: var(--opm-ind-display);
	inset-inline-start: var(--opm-ind-inset-start);
	inset-inline-end: var(--opm-ind-inset-end);
	top: var(--opm-ind-top);
	bottom: var(--opm-ind-bottom);
	width: var(--opm-ind-w);
	height: var(--opm-ind-h);
	margin-block: var(--opm-ind-mb);
	margin-inline: var(--opm-ind-mi);
	background: var(--opm-ind-color);
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--opm-transition), background-color var(--opm-transition);
}

.opm-item.is-active .opm-link::before {
	opacity: 1;
}

.opm-ind-hover-yes .opm-item:not(.is-active) .opm-link:hover::before {
	opacity: 1;
	background: var(--opm-ind-color-hover, var(--opm-ind-color));
}

.opm-static .opm-link::before,
.opm-placeholder .opm-link::before {
	display: none;
}

/* Icon ------------------------------------------------------------------- */

.opm-icon {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	font-size: var(--opm-icon-size);
	line-height: 1;
	color: var(--opm-icon-color-normal, currentColor);
	transition: color var(--opm-transition);
}

.opm-item:not(.is-active) .opm-link:hover .opm-icon {
	color: var(--opm-icon-color-hover, var(--opm-icon-color-normal, currentColor));
}

.opm-item.is-active .opm-icon {
	color: var(--opm-icon-color-active, var(--opm-icon-color-normal, currentColor));
}

/* Sections focused programmatically after a menu click: no default ring. */
[data-opm-focus-target]:focus {
	outline: none;
}

/* While a dropdown/drawer is open, lift the widget above sticky headers
 * (a sticky wrapper forms its own stacking context). */
.elementor-widget-opm-onpage-menu.opm-overlay-open {
	position: relative;
	z-index: 9999;
}

.elementor-widget-opm-onpage-menu.opm-sticky-yes.opm-overlay-open {
	position: sticky;
	z-index: 9999;
}

/* The active item, indicator and toggle label change while the page scrolls.
 * If that changes the widget height, browser scroll anchoring would shift the
 * page to compensate, the spy would pick another section and the page would
 * keep jumping. Opt the widget out of anchoring. */
.elementor-widget-opm-onpage-menu,
.opm-menu {
	overflow-anchor: none;
}

/* Sticky ----------------------------------------------------------------- */

.elementor-widget-opm-onpage-menu.opm-sticky-yes {
	position: sticky;
	top: var(--opm-sticky-top, 100px);
	z-index: var(--opm-sticky-z, 10);
	align-self: flex-start;
}

/* Reduced motion --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.opm-menu,
	.opm-menu *,
	.opm-menu *::before {
		transition-duration: 0s !important;
	}
}
