/*
 * מגה-מניו "מוצרים" + אייקון עגלה בהדר. נטען בכל עמוד (לא רק עמודי
 * קטלוג) — ר' EA_Catalog_Header::enqueue_assets. טוקני ה-theme בלבד,
 * באותו תיקון ניגודיות הקבוע בפרויקט הזה: #c2410c ולא var(--es-orange).
 *
 * מבנה/פריסה/צבעים לפי catalog-source/mockup/MegaMenu.dc.html, גופנים
 * מה-theme (var(--es-font-head)/var(--es-font-body), לא Rubik/Assistant
 * שבמוקאפ עצמו — אלה placeholder של כלי העיצוב בלבד).
 */

#es-header { position: fixed; } /* כבר מוגדר ב-theme — כאן רק תזכורת שזו נקודת העיגון ל-position:absolute למטה */

.es-mega-menu {
	position: absolute;
	top: 100%;
	inset-inline: 0;
	background: var(--es-white);
	border-bottom: 1px solid var(--es-border-2);
	box-shadow: var(--es-shadow-lg);
	z-index: 900;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity var(--es-transition), transform var(--es-transition), visibility var(--es-transition);
}
.es-mega-menu.is-open { opacity: 1; visibility: visible; transform: translateY(0); }

.es-mega-menu__inner {
	display: grid;
	grid-template-columns: 3fr 1fr;
	gap: 40px;
	padding: 32px 28px 36px;
}

.es-mega-menu__main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.es-mega-menu__head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.es-mega-menu__title { font-family: var(--es-font-head); font-size: 1.15rem; font-weight: 800; color: var(--es-navy); }
.es-mega-menu__all { font-weight: 700; font-size: 0.85rem; color: #c2410c; text-decoration: none; white-space: nowrap; }
.es-mega-menu__all:hover { text-decoration: underline; }

.es-mega-menu__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.es-mega-menu__cat {
	display: flex;
	gap: 12px;
	align-items: center;
	padding: 10px;
	border: 1px solid var(--es-border-2);
	border-radius: var(--es-radius-lg);
	background: var(--es-off-white);
	text-decoration: none;
	transition: border-color var(--es-transition), transform var(--es-transition);
}
.es-mega-menu__cat:hover { border-color: var(--es-orange); transform: translateY(-2px); }
.es-mega-menu__cat-media {
	flex-shrink: 0;
	width: 84px;
	height: 64px;
	border-radius: var(--es-radius);
	overflow: hidden;
	background: var(--es-border-2);
}
.es-mega-menu__cat-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.es-mega-menu__cat-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.es-mega-menu__cat-name { font-weight: 800; font-size: 0.95rem; color: var(--es-navy); }
.es-mega-menu__cat-desc { font-size: 0.78rem; color: var(--es-gray); line-height: 1.4; }

.es-mega-menu__featured {
	background: var(--es-navy);
	color: var(--es-white);
	border-radius: var(--es-radius-lg);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.es-mega-menu__featured-media { display: block; aspect-ratio: 16 / 10; background: rgba(255, 255, 255, 0.08); }
.es-mega-menu__featured-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.es-mega-menu__featured-body { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.es-mega-menu__featured-tag { font-size: 0.72rem; font-weight: 800; color: #fdba74; }
.es-mega-menu__featured-name { font-family: var(--es-font-head); font-size: 1.05rem; font-weight: 800; }
.es-mega-menu__featured-desc { margin: 0; font-size: 0.85rem; line-height: 1.5; color: rgba(255, 255, 255, 0.82); }
.es-mega-menu__featured-cta {
	margin-top: 6px;
	align-self: flex-start;
	background: var(--es-white);
	color: var(--es-navy);
	font-weight: 800;
	font-size: 0.82rem;
	padding: 10px 16px;
	border-radius: var(--es-radius);
	text-decoration: none;
}
.es-mega-menu__featured-cta:hover { background: #fdba74; }

/* כפתור אקורדיון נפרד (מוזרק ע"י JS) — מוסתר בדסקטופ, מוצג במובייל */
.es-mega-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	padding: 0;
	margin: 0;
	background: none;
	border: none;
	cursor: pointer;
	color: var(--es-gray-light);
}
.es-mega-toggle__arrow { transition: transform var(--es-transition); }
.es-mega-toggle[aria-expanded="true"] .es-mega-toggle__arrow { transform: rotate(180deg); }

/*
 * אקורדיון נייד נפרד לגמרי מ-#es-mega-products (ר' הערת הפתיחה ב-
 * catalog-megamenu.js). מוזרק תמיד ע"י JS, מוסתר כברירת מחדל ([hidden]),
 * רלוונטי ויזואלית רק מתחת ל-breakpoint (שם בלבד הכפתור פותח אותו —
 * בדסקטופ הוא נשאר [hidden] תמיד, אין צורך בכלל CSS נוסף להסתרה).
 */
.es-mega-mobile-accordion { padding: 4px 0 10px 24px; }
.es-mega-mobile-accordion__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.es-mega-mobile-accordion__list li { border-top: 1px solid var(--es-border-2); }
.es-mega-mobile-accordion__list li:first-child { border-top: none; }
.es-mega-mobile-accordion__list a {
	display: block;
	padding: 10px 0;
	color: var(--es-navy);
	text-decoration: none;
	font-size: 0.92rem;
}
.es-mega-mobile-accordion__list a:hover,
.es-mega-mobile-accordion__list a:focus-visible { color: #c2410c; }
.es-mega-mobile-accordion__all {
	display: block;
	margin-top: 8px;
	padding: 10px 0;
	font-weight: 800;
	font-size: 0.88rem;
	color: #c2410c;
	text-decoration: none;
	border-top: 1px solid var(--es-border-2);
}

/* אייקון עגלה בהדר */
.es-header-cart {
	position: relative;
	width: 42px;
	height: 42px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--es-border-2);
	border-radius: var(--es-radius);
	color: var(--es-navy);
	text-decoration: none;
	transition: border-color var(--es-transition), background var(--es-transition);
}
.es-header-cart:hover { border-color: var(--es-orange); background: var(--es-orange-dim); }
.es-header-cart__count {
	position: absolute;
	top: -6px;
	inset-inline-start: -6px;
	min-width: 18px;
	height: 18px;
	padding: 0 3px;
	border-radius: 9px;
	background: #c2410c;
	color: var(--es-white);
	font-size: 0.68rem;
	font-weight: 800;
	display: flex;
	align-items: center;
	justify-content: center;
}

@media (max-width: 768px) {
	/* 44x44 יעד מגע — אותו ערך בדיוק כמו .es-dropdown-toggle של ה-theme ב-style.css (WCAG 2.5.5). */
	.es-mega-toggle { display: flex; width: 44px; height: 44px; }

	/*
	 * הפאנל של הדסקטופ (רשת תלת-עמודתית עם תמונות ומוצר מוביל) לא נבנה
	 * להידחס לרוחב נייד. גרסה קודמת ניסתה לכווץ אותו (position:static +
	 * max-height) — זה יצר עמודה צרה שגולשת מעל ההדר, ואפילו סגור
	 * (max-height:0) עדיין צבע מאחורי פריטי התפריט כי position:static
	 * עדיין תופס מקום בזרימה. הפתרון: display:none גמור. מתחת ל-breakpoint
	 * הזה האקורדיון הנפרד (#es-mega-mobile-accordion, ב-catalog-megamenu.js)
	 * הוא מה שמוצג — ללא תמונות ו/או מוצר מוביל, לפי הדרישה.
	 */
	.es-mega-menu { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
	.es-mega-menu,
	.es-mega-menu.is-open,
	.es-mega-toggle__arrow {
		transition: none;
	}
}

/* a11y: the count badge must really be hidden at zero (display overrode [hidden]) */
.es-header-cart__count[hidden] { display: none; }
