/* ==========================================================================
   Mega menu: the "island" card under a header item (functions/megamenu.php, parts/mega/panel.php, js/megamenu.js).
   Desktop only (xl): below it the mobile accordion of header.php is used. Colours, shape and motion come from css/identity.css (--av-*).
   Outer panel: .mm.mm--c (positioned by js); card: .mm-c. Shared pieces: .mm-ic icon, .mm-tx text, .mm-go "see all".
   ========================================================================== */

.mm { display: none; position: absolute; top: 100%; z-index: 998; color: var(--av-text); font-weight: var(--av-fw-medium, 500); }
@media (min-width: 1280px) { .mm { display: block; } }
.mm, .mm * { box-sizing: border-box; }
:where(.mm a) { color: inherit; text-decoration: none; }
.mm a:focus-visible, .mm button:focus-visible { outline: var(--av-focus); outline-offset: 2px; }

/* open / close motion: js/header.js puts .is-open on the panel (the Laravel front's driver has its own, chrome/src/_behavior.css).
   display is animated too (allow-discrete) so the card fades out before it leaves the layout; a browser without it just shows / hides it. */
@media (min-width: 1280px) {
	.avadis-chrome[data-chrome-driver="js"] .mm[data-chrome="mega-panel"] { display: none; opacity: 0; transform: translateY(-8px);
		transition: opacity .12s ease, transform .12s ease, display .12s allow-discrete; }
	.avadis-chrome[data-chrome-driver="js"] .mm[data-chrome="mega-panel"].is-open { display: block; opacity: 1; transform: none;
		transition: opacity .18s ease, transform .24s var(--av-ease), display .24s allow-discrete; }
	@starting-style { .avadis-chrome[data-chrome-driver="js"] .mm[data-chrome="mega-panel"].is-open { opacity: 0; transform: translateY(-8px); } }
}

/* the page goes quiet while a panel is open */
html body::before { content: ""; position: fixed; inset: 76px 0 0 0; /* starts under the header bar */ z-index: 90; background: rgba(26, 18, 38, .26); opacity: 0; pointer-events: none; transition: opacity .2s; }
html body.mm-open::before { opacity: 1; }

/* the header item itself: a soft purple pill that fades in on hover and stays lit while its card is open (li.mm-on is set by header.php) */
#main-menu > ul#menu-list > li > a { border-radius: 12px; transition: background-color .18s, color .18s; }
#main-menu > ul#menu-list > li:hover > a,
#main-menu > ul#menu-list > li.mm-on > a { background-color: var(--av-purple-100); color: var(--av-purple); }
#main-menu > ul#menu-list > li > a:focus-visible { outline: var(--av-focus); outline-offset: 0; }
/* nine top items (دواپس has its own since 2026-11-28): below 1440px the 16px sides pushed the last one into the phone button */
@media (min-width: 1280px) and (max-width: 1439.98px) { #main-menu > ul#menu-list > li > a { padding-inline: 11px; } }
.has-hero-overlay #header:not(.sticky) #main-menu > ul#menu-list > li:hover > a,
.has-hero-overlay #header:not(.sticky) #main-menu > ul#menu-list > li.mm-on > a { background-color: rgba(255, 255, 255, .16); color: #fff; }

/* shared pieces */
.mm b { display: block; font-weight: var(--av-fw-bold, 700); font-size: var(--av-fs-small, 14px); line-height: 1.7; color: var(--av-ink); }
.mm small { display: block; font-size: var(--av-fs-caption, 13px); line-height: 1.7; color: var(--av-muted); font-weight: var(--av-fw-medium, 500); }
.mm-tx { min-width: 0; }
.mm-ic { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--av-purple-100); color: var(--av-purple); transition: background .18s, color .18s; }
.mm-ic svg { width: 20px; height: 20px; }
.mm-go { display: inline-flex; align-items: center; gap: 8px; font-weight: var(--av-fw-heading, 800); font-size: var(--av-fs-caption, 13px); }
.mm-go svg { width: 16px; height: 16px; transition: transform .2s var(--av-ease); }
a:hover > .mm-go svg, a.mm-go:hover svg { transform: translateX(-4px); }
.mm-c__row:hover .mm-ic { background: var(--av-purple); color: #fff; }

/* ---------- C: island ---------- */
.mm--c { top: calc(100% + 8px); }
.mm--c::after { content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 14px; }
.mm--c::before { content: ""; position: absolute; z-index: 2; top: -7px; left: var(--nx, 50%); width: 14px; height: 14px; background: #fff; border: 1px solid var(--av-line); border-right: 0; border-bottom: 0; border-radius: 4px 0 0 0; transform: translateX(-50%) rotate(45deg); }
.mm-c { position: relative; overflow: hidden; border-radius: 20px; background: #fff; border: 1px solid var(--av-line); box-shadow: 0 30px 60px -24px rgba(63, 11, 121, .45); }
.mm-c__cols { display: flex; gap: 6px; padding: 12px 12px 30px; /* room for the line a hovered row opens, so the card does not change height */ }
.mm-c__col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mm-c__col + .mm-c__col { border-inline-start: 1px solid var(--av-line); padding-inline-start: 6px; }
.mm-c__lab { padding: 6px 10px 8px; font-size: var(--av-fs-caption, 13px); font-weight: var(--av-fw-heading, 800); color: var(--av-purple); }
/* a column stacked under another one (menu item class mm-stack): a line and some air above its title */
.mm-c__row + .mm-c__lab { margin: 8px 10px 0; padding: 12px 0 8px; border-top: 1px solid var(--av-line); }
.mm-c__row { display: flex; gap: 11px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; transition: background .15s; }
.mm-c__row:hover { background: var(--av-purple-50); }
.mm-c__row .mm-ic { width: 34px; height: 34px; border-radius: 10px; }
.mm-c__row .mm-ic svg { width: 18px; height: 18px; }
.mm-c__row b { font-size: var(--av-fs-small, 14px); line-height: 1.6; min-height: 34px; display: flex; align-items: center; /* the title stays level with the icon; the line opens below it */ }
/* the one line under a title shows only while the pointer (or keyboard focus) is on the row; the row grows by it (grid 0fr -> 1fr) */
.mm-c__row .mm-tx { display: grid; grid-template-rows: auto 0fr; transition: grid-template-rows .2s var(--av-ease); }
.mm-c__row .mm-tx small { overflow: hidden; min-height: 0; opacity: 0; transition: opacity .15s; }
.mm-c__row:hover .mm-tx, .mm-c__row:focus-visible .mm-tx { grid-template-rows: auto 1fr; }
.mm-c__row:hover .mm-tx small, .mm-c__row:focus-visible .mm-tx small { opacity: 1; transition: opacity .2s .06s; }
.mm-c__foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 22px; background: var(--av-purple-50); border-top: 1px solid var(--av-line); color: var(--av-purple); }
.mm-c__foot small { color: var(--av-muted); }

@media (prefers-reduced-motion: reduce) {
	.mm, .mm *, html body::before { transition: none !important; }
}

/* the plugin sets the sub-menu description to .8em (12.8px): it takes the caption size of the type scale */
body #mega-menu-wrap-main-menu-right #mega-menu-main-menu-right .mega-description-group .mega-menu-description { font-size: var(--av-fs-caption, 13px); font-weight: var(--av-fw-regular, 400); }
