/* Orbitalia Mega Menu — full structural CSS (external, cacheable).
   Loads only on pages where the widget renders (conditional enqueue). */

/* ----------------------------------------------------- Reveal -------- */

.omm-l1-item:hover > .omm-panel,
.omm-l1-item:focus-within > .omm-panel,
.omm-l1-item.is-open > .omm-panel,
.omm-toggle[aria-expanded="true"] ~ .omm-panel {
	visibility: visible;
	opacity: 1;
	transform: translateY(0);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

/* ---------------------------------------------- Panel layout -------- */

/* Background band: spans the panel width (full-bleed in wide mode). */
.omm-panel__inner {
	background: #fff;
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
	border-radius: 0 0 10px 10px;
	overflow: hidden;
}

/* Content layer: the actual sidebar | grids grid, constrained + centered. */
.omm-panel__content {
	display: grid;
	grid-template-columns: var(--omm-sidebar-w) 1fr;
}

/* ----------------------------------------- Full-width panel --------- */
/* Background reaches the viewport edges; content stays constrained.
   The panel breaks out of whatever container the menu sits in WITHOUT assuming
   the menu is centered in the viewport (it often isn't — e.g. a flex header
   with a logo beside the menu). JS measures each root's left offset
   (--omm-bleed-left) and the visible viewport width (--omm-bleed-w) so the
   panel can anchor at viewport x=0 and span the full visible width. The X
   offset lives on `left`, so it never collides with the reveal's translateY.
   No-JS fallback: left 0 + width 100% = panel stays within the menu box (no
   overflow), just not full-bleed.

   DESKTOP ONLY: gated to the non-drawer breakpoint so this positioning never
   leaks into the mobile drawer (where the panel/grid are repositioned for the
   accordion or drilldown). Below 1025px the drawer rules fully own layout. */
@media (min-width: 1025px) {
	.omm[data-fullwidth="1"] .omm-panel {
		left: calc(-1 * var(--omm-bleed-left, 0px));
		right: auto;
		width: var(--omm-bleed-w, 100%);
	}

	.omm[data-fullwidth="1"] .omm-panel__inner {
		border-radius: 0;
	}

	.omm[data-fullwidth="1"] .omm-panel__content {
		/* Manual control wins; else the JS-measured Elementor box width; else 1200px. */
		max-width: var(--omm-content-w, var(--omm-content-auto, 1200px));
		margin-inline: auto;
	}

	/* Last bar item as a button — DESKTOP ONLY (this @media excludes the drawer
	   breakpoint, so on tablet/mobile the item keeps its normal link format). */
	.omm[data-last-btn="1"] .omm-l1 > .omm-l1-item:last-child {
		margin-inline-start: var(--omm-lastbtn-gap, 0);
	}

	.omm[data-last-btn="1"] .omm-l1 > .omm-l1-item:last-child .omm-l1-link {
		background: var(--omm-lastbtn-bg, transparent);
		color: var(--omm-lastbtn-color, inherit);
		border-radius: var(--omm-lastbtn-radius, 6px);
		padding: var(--omm-lastbtn-pad, 8px 18px);
		font-weight: var(--omm-lastbtn-fw, inherit);
		text-transform: var(--omm-lastbtn-tt, none);
		font-size: var(--omm-lastbtn-fs, inherit);
		letter-spacing: var(--omm-lastbtn-ls, normal);
		transition: background-color 0.15s ease, color 0.15s ease;
	}

	.omm[data-last-btn="1"] .omm-l1 > .omm-l1-item:last-child .omm-l1-link:hover,
	.omm[data-last-btn="1"] .omm-l1 > .omm-l1-item:last-child .omm-l1-link:focus-visible {
		background: var(--omm-lastbtn-bg-h, var(--omm-lastbtn-bg, transparent));
		color: var(--omm-lastbtn-color-h, var(--omm-lastbtn-color, inherit));
	}

	/* ---------------------------------------- Hover stability --------- */
	/* The bar links are only as tall as their text (~23px), so a slow
	   downward move can leave the item before reaching the panel and the
	   menu closes. Two reinforcing fixes, desktop only:

	   1) Fill the bar's available height so each item's hover zone spans the
	      full bar, not a thin text strip. Pure best-effort: if the header
	      container passes no explicit height down, percentage heights resolve
	      to auto and nothing changes (harmless). NOTE: do NOT position the
	      <li> — the panel is absolute relative to .omm for the full-width
	      bleed; making the item a containing block would re-anchor it. */
	.omm,
	.omm-nav,
	.omm-l1 {
		height: 100%;
	}

	/* Stretch the items to the full bar height instead of centering them as a
	   thin text strip (critical.css sets .omm-l1 align-items:center). Without
	   this the <li> stays ~text-height and a ~half-bar band between the item
	   and the panel belongs to .omm but to NO <li> — moving the pointer there
	   drops :hover and closes the menu. With stretch, the item bottom meets the
	   panel top (only the at-rest translateY gap remains, covered by the bridge
	   below). The item itself becomes a flex box that vertically centers its
	   link, so the text position is visually unchanged. */
	.omm-l1 {
		align-items: stretch;
		/* Keep the bar on a single row: wrapping (critical.css default) lets a
		   wide last item — e.g. the highlighted button with padding/margin —
		   drop to a second line when space is tight. A menu bar is meant to stay
		   in one row on desktop. */
		flex-wrap: nowrap;
		/* Horizontal alignment of the bar within the widget box, fed by the
		   editor's "Alineación de la barra" control (left/center/right). */
		justify-content: var(--omm-l1-justify, flex-start);
	}

	.omm-l1-item {
		display: flex;
		align-items: center;
	}

	/* 2) Hover bridge: an invisible strip just above the open panel that spans
	      the at-rest reveal gap (translateY) + the band between bar bottom and
	      panel top. It lives on the panel (already positioned) and, being a
	      descendant of the <li>, keeping the pointer over it keeps
	      .omm-l1-item:hover alive via ancestor bubbling. Only present while the
	      panel is rendered, so it never blocks header clicks at rest. */
	.omm-panel::before {
		content: "";
		position: absolute;
		left: 0;
		right: 0;
		bottom: 100%;
		height: 18px;
	}
}

.omm-l2 {
	display: flex;
	flex-direction: column;
	gap: var(--omm-l2-gap, 2px);
	margin: 0;
	padding: 12px;
	list-style: none;
	border-inline-end: 1px solid rgba(0, 0, 0, 0.08);
	/* Per-device solid background (desktop var; tablet/mobile override below). */
	background-color: var(--omm-l2bg, transparent);
}

/* Sidebar separators -------------------------------------------------- */

.omm-l2-sep {
	list-style: none;
}

/* Heading variant (e.g. "POR TIPO"). */
.omm-l2-sep--label .omm-l2-sep__label {
	display: block;
	padding: 8px 12px 4px;
	font-size: 0.72em;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--omm-sep-color, rgba(0, 0, 0, 0.45));
}

/* Plain divider line variant. */
.omm-l2-sep--line {
	height: 0;
	margin: 8px 12px;
	border-top: 1px solid var(--omm-sep-line, rgba(0, 0, 0, 0.1));
}

.omm-l2-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	width: 100%;
	margin: 0;
	padding: 10px 12px;
	border: 0;
	border-radius: 8px;
	background: none;
	font: inherit;
	color: inherit;
	text-align: start;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.omm-l2-item.is-current .omm-l2-link,
.omm-l2-link:hover,
.omm-l2-link:focus-visible {
	background: rgba(0, 0, 0, 0.05);
}

.omm-chevron {
	width: 0.5em;
	height: 0.5em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	flex: none;
}

.omm-chevron--sm {
	width: 0.42em;
	height: 0.42em;
}

.omm-chevron--back {
	transform: rotate(135deg);
}

/* Close (X) button — only shown inside the mobile drawer. */
.omm-close {
	display: none;
}

/* Mobile logo — only shown inside the mobile drawer (top of the nav). */
.omm-mobile-logo {
	display: none;
}

/* Drilldown "back" header — injected by JS, only shown in drilldown mode. */
.omm-dd-back {
	display: none;
	align-items: center;
	gap: 8px;
	width: 100%;
	margin: 0;
	padding: 14px 16px;
	border: 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	background: none;
	font: inherit;
	color: inherit;
	text-align: start;
	cursor: pointer;
}

.omm-dd-back__label {
	color: var(--omm-sep-color, rgba(0, 0, 0, 0.55));
}

.omm-grids {
	position: relative;
	padding: 16px;
	/* Per-device solid background (desktop var; tablet/mobile override below). */
	background-color: var(--omm-gbg, transparent);
}

.omm-grid {
	width: 100%;
}

.omm-panel-fallback {
	padding: 16px;
	color: #888;
	font-size: 0.9em;
}

/* --------------------------------------------------- Images --------- */

.omm-img {
	max-width: 100%;
	height: auto;
}

/* -------------------------------------------------- Stagger --------- */

@media (prefers-reduced-motion: no-preference) {
	/* Per-card cascade (when the L3 template's cards carry the .omm-card class).
	   First declaration uses the JS-provided --omm-i (all browsers); the second
	   uses sibling-index() where supported and silently wins. */
	.omm[data-stagger="1"] .omm-grid.is-active .omm-card {
		animation: omm-slide var(--omm-dur) var(--omm-ease) both;
		animation-delay: calc(min(var(--omm-i, 0), var(--omm-cap)) * var(--omm-step));
		animation-delay: calc(min(sibling-index(), var(--omm-cap)) * var(--omm-step));
		will-change: transform, opacity;
	}

	/* Baseline reveal for grids without tagged cards. */
	.omm[data-stagger="1"] .omm-grid.is-active:not(:has(.omm-card)) {
		animation: omm-slide var(--omm-dur) var(--omm-ease) both;
	}

	/* Stagger disabled -> simple fade. */
	.omm[data-stagger="0"] .omm-grid.is-active {
		animation: omm-fade 0.2s ease both;
	}
}

@media (prefers-reduced-motion: reduce) {
	.omm .omm-grid.is-active,
	.omm .omm-grid.is-active .omm-card {
		animation: none;
		opacity: 1;
		transform: none;
	}
}

/* -------------------------------------------------- Focus ----------- */

.omm-l1-link:focus-visible,
.omm-l2-link:focus-visible,
.omm-toggle:focus-visible,
.omm-burger:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
	border-radius: 4px;
}

/* -------------------------------------------- Mobile drawer --------- */

@media (max-width: 1024px) {
	.omm-burger {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 0;
		background: none;
		color: inherit;
		cursor: pointer;
	}

	.omm-burger__bars,
	.omm-burger__bars::before,
	.omm-burger__bars::after {
		content: "";
		display: block;
		width: 22px;
		height: 2px;
		background: currentColor;
		position: relative;
	}

	.omm-burger__bars::before {
		position: absolute;
		top: -7px;
	}

	.omm-burger__bars::after {
		position: absolute;
		top: 7px;
	}

	.omm-nav {
		position: fixed;
		inset: 0 0 0 auto;
		/* Default lateral drawer; --omm-drawer-w lets the widget force 100%. */
		width: var(--omm-drawer-w, min(86vw, 380px));
		max-width: 100%;
		background: #fff;
		transform: translateX(100%);
		transition: transform 0.25s ease;
		overflow-y: auto;
		/* Keep scroll/overscroll inside the drawer (no chaining to the page). */
		overscroll-behavior: contain;
		/* Sit above sticky headers/bars (often z-index in the tens/hundreds). */
		z-index: 2147483000;
		visibility: hidden;
		padding: 64px 16px 24px;
	}

	.omm.is-open .omm-nav {
		transform: translateX(0);
		visibility: visible;
	}

	.omm.is-open::before {
		content: "";
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.45);
		z-index: 2147482999;
	}

	/* Logo/image at the top of the mobile drawer. Alignment via the control
	   (text-align); image is inline-block so it honours the alignment. Reserves
	   space on the right so a centred/right logo doesn't sit under the X. */
	.omm-mobile-logo {
		display: block;
		margin: 0 0 12px;
		padding-right: 44px;
		text-align: left;
	}

	.omm-mobile-logo__img {
		display: inline-block;
		max-width: 100%;
		height: auto;
		vertical-align: middle;
	}

	/* Close (X), pinned top-right of the drawer, above sliding drilldown pages. */
	.omm-close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		position: absolute;
		top: 10px;
		right: 12px;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 0;
		background: none;
		color: inherit;
		cursor: pointer;
		z-index: 6;
	}

	.omm-close__x,
	.omm-close__x::before,
	.omm-close__x::after {
		content: "";
		display: block;
		width: 22px;
		height: 2px;
		background: currentColor;
	}

	.omm-close__x {
		background: none;
		position: relative;
	}

	.omm-close__x::before {
		position: absolute;
		top: 0;
		left: 0;
		transform: rotate(45deg);
	}

	.omm-close__x::after {
		position: absolute;
		top: 0;
		left: 0;
		transform: rotate(-45deg);
	}

	.omm-l1 {
		flex-direction: column;
		align-items: stretch;
		/* Own vertical-gap var so the desktop (horizontal) bar gap never leaks
		   into the stacked mobile menu. Controlled separately in the editor. */
		gap: var(--omm-l1-gap-m, 0px);
	}

	.omm-l1-item {
		border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	}

	.omm-l1-link {
		padding: 14px 4px;
	}

	/* Panels become inline accordion sections on mobile. */
	.omm-panel {
		position: static;
		display: none;
		visibility: visible;
		opacity: 1;
		transform: none;
		box-shadow: none;
		z-index: auto;
	}

	.omm-l1-item.is-open > .omm-panel,
	.omm-toggle[aria-expanded="true"] ~ .omm-panel {
		display: block;
	}

	.omm-panel__inner {
		box-shadow: none;
		border-radius: 0;
	}

	.omm-panel__content {
		grid-template-columns: 1fr;
	}

	.omm-l2 {
		border-inline-end: 0;
		padding: 0 0 8px;
	}

	/* ------------------------------------------- Drilldown (mobile) ----- */
	/* Each panel (L2 list) and grid (L3) becomes a full-height page that
	   slides in over the previous level. Nesting gives the stacking order:
	   grid covers its panel, panel covers the L1 list. JS toggles .omm-dd-open. */
	.omm[data-mobile="drilldown"] .omm-nav {
		overflow: hidden;
	}

	.omm[data-mobile="drilldown"] .omm-dd-back {
		display: flex;
	}

	.omm[data-mobile="drilldown"] .omm-panel,
	.omm[data-mobile="drilldown"] .omm-grid {
		position: absolute;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		display: block;
		visibility: visible;
		opacity: 1;
		background: #fff;
		transform: translateX(100%);
		transition: transform 0.28s ease;
		overflow-x: hidden;
		overflow-y: auto;
		overscroll-behavior: contain;
		z-index: 2;
	}

	/* "Logo en todos los niveles": offset only the PANEL (its containing block is
	   the nav), so it starts below the logo zone (--omm-dd-top, measured in JS).
	   The grid keeps top:0 because its containing block is the panel, which is
	   already offset — applying the offset to both would double it. */
	.omm[data-mobile="drilldown"][data-logo-levels="all"] .omm-panel {
		top: var(--omm-dd-top, 0px);
	}

	.omm[data-mobile="drilldown"] .omm-grid {
		z-index: 3;
	}

	.omm[data-mobile="drilldown"] .omm-panel.omm-dd-open,
	.omm[data-mobile="drilldown"] .omm-grid.omm-dd-open {
		transform: translateX(0);
	}

	/* Flatten the desktop panel scaffolding so the L2 list fills the page;
	   grids are absolute, so their wrapper must not reserve flow space. */
	.omm[data-mobile="drilldown"] .omm-panel__inner,
	.omm[data-mobile="drilldown"] .omm-panel__content {
		display: block;
	}

	.omm[data-mobile="drilldown"] .omm-grids {
		display: contents;
	}

	.omm[data-mobile="drilldown"] .omm-l2 {
		padding: 0;
	}

	.omm[data-mobile="drilldown"] .omm-l2-link {
		padding: 14px 16px;
		border-radius: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.omm-nav {
		transition: none;
	}

	.omm[data-mobile="drilldown"] .omm-panel,
	.omm[data-mobile="drilldown"] .omm-grid {
		transition: none;
	}
}

/* ------------------------------ Per-device column backgrounds ------- */
/* Solid background colour per breakpoint, fed by the editor's per-device
   colour controls (Elementor's COLOR control isn't responsive, so each device
   writes its own var). Breakpoints mirror Elementor's defaults: tablet <=1024,
   mobile <=767. Each smaller size falls back to the larger one's colour, then
   to transparent. Declared last so they win over the base rule.

   In drilldown the grids wrapper is display:contents (no box) and each
   .omm-panel / .omm-grid is forced opaque, so the colour is applied to those
   boxes there (default #fff to preserve the current look when no colour set). */
@media (max-width: 1024px) {
	.omm-l2 {
		background-color: var(--omm-l2bg-t, var(--omm-l2bg, transparent));
	}

	.omm-grids {
		background-color: var(--omm-gbg-t, var(--omm-gbg, transparent));
	}

	.omm[data-mobile="drilldown"] .omm-panel {
		background-color: var(--omm-l2bg-t, var(--omm-l2bg, #fff));
	}

	.omm[data-mobile="drilldown"] .omm-grid {
		background-color: var(--omm-gbg-t, var(--omm-gbg, #fff));
	}
}

@media (max-width: 767px) {
	.omm-l2 {
		background-color: var(--omm-l2bg-m, var(--omm-l2bg-t, var(--omm-l2bg, transparent)));
	}

	.omm-grids {
		background-color: var(--omm-gbg-m, var(--omm-gbg-t, var(--omm-gbg, transparent)));
	}

	.omm[data-mobile="drilldown"] .omm-panel {
		background-color: var(--omm-l2bg-m, var(--omm-l2bg-t, var(--omm-l2bg, #fff)));
	}

	.omm[data-mobile="drilldown"] .omm-grid {
		background-color: var(--omm-gbg-m, var(--omm-gbg-t, var(--omm-gbg, #fff)));
	}
}
