/* Desktop mega menu — inc/mega-menu.php, opened by the header's «دسته‌بندی» button (mega-menu.js).
   A white panel the width of the header's bottom row, the account dropdown's look (r-16, soft shadow).
   Start: the category list (photo on the category cards' orange circle, active = light blue like the account menu).
   Rest: the active category's name + «مشاهده همه», subcategories as light grey pills (no shadow), four best sellers as mini cards. */
.site-header__bottom { position: relative; }
.mega-menu {
	position: absolute;
	top: calc(100% - var(--sp-12));
	inset-inline: 0;
	z-index: 960;
	display: grid;
	grid-template-columns: 264px minmax(0, 1fr);
	gap: var(--sp-24);
	max-height: calc(100vh - 220px);
	min-height: 420px;
	padding: var(--sp-16);
	border-radius: var(--r-16);
	background: var(--n-100);
	box-shadow: 0 16px 40px rgb(0 0 0 / .12);
	opacity: 0;
	translate: 0 6px;
	transition: opacity .2s, translate .2s;
}
.mega-menu[hidden] { display: none; }
.mega-menu.is-open { opacity: 1; translate: 0 0; }

/* Category list */
.mega-menu__cats { display: flex; flex-direction: column; min-height: 0; padding-inline-end: var(--sp-16); border-inline-end: 1px solid var(--n-95); overflow-y: auto; scrollbar-width: thin; }
.mega-menu__cat-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.mega-menu__cat { display: flex; align-items: center; gap: var(--sp-12); padding: 6px var(--sp-8); border-radius: var(--r-12); color: var(--n-30); font-size: var(--fs-body-m); font-weight: 600; transition: color .15s, background-color .15s; }
.mega-menu__cat-img { flex: none; display: grid; place-items: center; width: 44px; height: 44px; object-fit: contain; background: radial-gradient(circle at 50% 55%, var(--orange) 0 17px, transparent 18px); }
.mega-menu__cat-img.icon { color: var(--n-100); font-size: 18px; line-height: 1; background-image: radial-gradient(circle, var(--orange) 0 17px, transparent 18px); }
.mega-menu__cat-name { flex: 1; }
.mega-menu__cat:hover { color: var(--n-10); background: var(--n-97); }
.mega-menu__cat.is-active { color: var(--blue); background: var(--blue-light); font-weight: 800; }
.mega-menu__shop { display: flex; align-items: center; gap: var(--sp-8); margin-top: auto; padding: var(--sp-12) var(--sp-8) 4px; border-top: 1px solid var(--n-95); color: var(--n-40); font-size: var(--fs-body-m); font-weight: 600; transition: color .15s; }
.mega-menu__shop .icon { font-size: 20px; }
.mega-menu__shop:hover { color: var(--blue); }
.mega-menu a:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

/* The active category */
.mega-menu__pane { display: flex; flex-direction: column; gap: var(--sp-16); min-height: 0; padding: var(--sp-8) 0 var(--sp-8) var(--sp-8); overflow-y: auto; scrollbar-width: thin; }
.mega-menu__pane[hidden] { display: none; }
.mega-menu__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-16); }
.mega-menu__title { margin: 0; color: var(--n-10); font-size: var(--fs-title-m); line-height: var(--lh-title-m); font-weight: 800; }
.mega-menu__all { display: inline-flex; align-items: center; gap: 6px; color: var(--blue); font-size: var(--fs-body-m); font-weight: 700; }
.mega-menu__all .icon { font-size: 18px; transition: translate .15s; }
.mega-menu__all:hover .icon { translate: -3px 0; }
.mega-menu__subs { display: flex; flex-wrap: wrap; gap: var(--sp-8); margin: 0; padding: 0; list-style: none; }
.mega-menu__sub { display: block; padding: 6px var(--sp-12); border-radius: var(--r-pill); color: var(--n-30); background: var(--n-97); font-size: var(--fs-body-m); font-weight: 600; transition: color .15s, background-color .15s; }
.mega-menu__sub:hover { color: var(--blue); background: var(--blue-light); }
.mega-menu__label { margin: var(--sp-8) 0 0; color: var(--n-50); font-size: var(--fs-body-s); font-weight: 700; }
.mega-menu__products { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-16); margin: 0; padding: 0; list-style: none; }
.mega-menu .product-card--mini { height: 100%; }
.mega-menu .product-card--mini .product-card__image { aspect-ratio: 4 / 3; height: auto; }

@media (max-width: 1200px) {
	.mega-menu { grid-template-columns: 232px minmax(0, 1fr); }
	.mega-menu__products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.mega-menu__products > :nth-child(4) { display: none; }
}
@media (max-width: 769px) {
	.mega-menu { display: none; } /* phones: the phone menu has the categories */
}
@media (prefers-reduced-motion: reduce) {
	.mega-menu { transition: none; }
}
