/*
 * Header rule for the Contact page and the single Course page ONLY (body.sgx-pg-lite, added by inc/course.php and
 * inc/contact-page.php). Every other page keeps the header exactly as before.
 *
 *  - Desktop (1024px and up): the normal header with its navigation menu (unchanged).
 *  - Tablet (768-1023px): the navigation stays visible, inline in the bar, in a compact size; the search field is left out
 *    here (the bar already has the search icon and log in / cart).
 *  - Mobile (under 768px, 1.0.85): the same burger menu as the homepage (it used to have no menu at all).
 *  - The theme's own mobile bottom toolbar (Shop / Wishlist / Cart / My account) is hidden on these pages too, so there is no
 *    on phones the burger is the navigation.
 */

/* 1.0.85: the burger is hidden only where the tablet/desktop menu is inline (768px and up); on phones it opens the same menu as the homepage */
@media (min-width: 768px) { body.sgx-pg-lite .sgx-site .sgx-header:not(.sgx-nav-off) .sgx-burger { display: none !important; } }
body.sgx-pg-lite .wd-toolbar { display: none !important; }

/* tablet: inline navigation */
@media (min-width: 768px) and (max-width: 1023.98px) {
	html.sgx-js body.sgx-pg-lite .sgx-nav-panel,
	body.sgx-pg-lite .sgx-nav-panel {
		display: flex; position: static; flex-direction: row; align-items: center; flex: 1 1 auto; gap: 8px; min-width: 0; max-height: none;
		margin: 0 0 0 8px; padding: 0; overflow: visible; background: transparent; border-top: 0;
	}
	body.sgx-pg-lite .sgx-nav-panel .sgx-search { display: none; }
	body.sgx-pg-lite .sgx-nav { flex: 1 1 auto; min-width: 0; }
	body.sgx-pg-lite .sgx-menu { flex-direction: row; align-items: center; gap: 0; }
	body.sgx-pg-lite .sgx-menu > li { display: flex; }
	body.sgx-pg-lite .sgx-menu a {
		width: auto; min-height: 40px; padding: 8px 9px; border-radius: 999px; border-bottom: 0; background: transparent; color: #2A4033;
		font-family: var(--sgx-font-body, inherit); font-size: 14px; line-height: 24px; white-space: nowrap;
	}
	body.sgx-pg-lite .sgx-menu a:hover { background: #EEF6F0; }
	body.sgx-pg-lite .sgx-menu > .current-menu-item > a,
	body.sgx-pg-lite .sgx-menu > .current-menu-ancestor > a,
	body.sgx-pg-lite .sgx-menu > .current_page_item > a { background: #1E7A4C; color: #fff; }
	body.sgx-pg-lite .sgx-menu .sub-menu { position: absolute; display: block; opacity: 0; visibility: hidden; padding: 8px; min-width: 220px; background: #fff; border: 1px solid #D5E3D9; box-shadow: 0 2px 4px rgba(14, 42, 31, .06), 0 22px 44px rgba(30, 122, 76, .16); }
	body.sgx-pg-lite .sgx-menu li:hover > .sub-menu,
	body.sgx-pg-lite .sgx-menu li:focus-within > .sub-menu { opacity: 1; visibility: visible; }
	body.sgx-pg-lite .sgx-menu .sub-menu a { display: flex; width: 100%; border-radius: 10px; font-size: 14px; }
	body.sgx-pg-lite .sgx-tools { order: 0; margin-left: 0; }
	body.sgx-pg-lite .sgx-search-icon { display: inline-flex; }
}

/* mobile (1.0.85): the homepage header behaviour: logo, cart and the burger that opens the menu panel */
@media (max-width: 767.98px) {
	body.sgx-pg-lite .sgx-tools { margin-left: auto; }
}

/* the tablet menu is removed when it does not fit (assets/js/skillgrox-pagehead.js) or, without JavaScript, below 900px */
body.sgx-pg-lite .sgx-header.sgx-nav-off .sgx-nav-panel { display: none !important; }
@media (min-width: 768px) and (max-width: 899.98px) { html:not(.sgx-js) body.sgx-pg-lite .sgx-nav-panel { display: none; } }
@media (min-width: 768px) and (max-width: 1023.98px) { body.sgx-pg-lite .sgx-header.sgx-nav-off .sgx-tools { margin-left: auto; } }

/* desktop: when the menu is too long for the search field, the field becomes the icon (as the design does under 1280px) */
body.sgx-pg-lite .sgx-header.sgx-search-off .sgx-nav-panel .sgx-search { display: none; }
body.sgx-pg-lite .sgx-header.sgx-search-off .sgx-search-icon { display: inline-flex; }

/* step 1 when the menu is slightly too long: tighter items (assets/js/skillgrox-pagehead.js) */
body.sgx-pg-lite .sgx-header.sgx-nav-tight .sgx-menu a { padding: 8px 10px; font-size: 14px; }

/* tablet (768-1023px): the menu is made to fit before it is ever hidden - step 1 tighter items, step 2 also a smaller logo and
   closer spacing in the bar (assets/js/skillgrox-pagehead.js adds the classes only while the menu does not fit) */
@media (min-width: 768px) and (max-width: 1023.98px) {
	body.sgx-pg-lite .sgx-header.sgx-nav-tight .sgx-menu a { padding: 8px 6px; font-size: 13px; }
	body.sgx-pg-lite .sgx-header.sgx-head-snug .sgx-menu a { padding: 8px 4px; font-size: 13px; }
	body.sgx-pg-lite .sgx-header.sgx-head-snug .sgx-nav-panel { margin-left: 2px; gap: 4px; }
	body.sgx-pg-lite .sgx-header.sgx-head-snug .sgx-tools { gap: 2px; }
	body.sgx-pg-lite .sgx-header.sgx-head-snug .sgx-tools .sgx-account { margin-left: 2px; }
	body.sgx-pg-lite .sgx-site .sgx-header.sgx-head-snug .sgx-brand img { height: 44px; }
	body.sgx-pg-lite .sgx-header.sgx-head-snug .sgx-brand { font-size: 19px; }
}

/* 1.0.85: tablet width where the inline menu does not fit (assets/js/skillgrox-pagehead.js adds sgx-nav-off): it used to vanish with no
 * way to reach it. Now the burger appears and opens the same dropdown menu as the phone and the homepage. */
@media (min-width: 768px) and (max-width: 1023.98px) {
	body.sgx-pg-lite .sgx-site .sgx-header.sgx-nav-off .sgx-burger { display: inline-flex !important; }
	html.sgx-js body.sgx-pg-lite .sgx-header.sgx-nav-off.is-open .sgx-nav-panel {
		display: flex !important; position: absolute; left: 0; right: 0; top: 100%; z-index: 40; flex-direction: column; align-items: stretch; gap: 20px; margin: 0;
		max-height: calc(100vh - 64px); overflow-y: auto; padding: 24px 16px 28px; background: #FAFCF9; border-top: 1px solid #D5E3D9;
	}
	body.sgx-pg-lite .sgx-header.sgx-nav-off .sgx-nav-panel .sgx-search { display: block; order: -1; width: 100%; }
	body.sgx-pg-lite .sgx-header.sgx-nav-off .sgx-menu { flex-direction: column; align-items: stretch; gap: 0; }
	body.sgx-pg-lite .sgx-header.sgx-nav-off .sgx-menu > li { display: block; }
	body.sgx-pg-lite .sgx-header.sgx-nav-off .sgx-menu a { width: 100%; min-height: 0; padding: 16px 0; border-radius: 0; border-bottom: 1px solid #D5E3D9; background: transparent; color: #2A4033; font-family: var(--sgx-font-head, inherit); font-size: 24px; line-height: 1.3; white-space: normal; }
	body.sgx-pg-lite .sgx-header.sgx-nav-off .sgx-menu a:hover, body.sgx-pg-lite .sgx-header.sgx-nav-off .sgx-menu > .current-menu-item > a { background: transparent; color: #14251D; }
	body.sgx-pg-lite .sgx-header.sgx-nav-off .sgx-menu .sub-menu { position: static; display: block; opacity: 1; visibility: visible; box-shadow: none; border: 0; padding: 0 0 0 16px; min-width: 0; background: transparent; }
	body.sgx-pg-lite .sgx-header.sgx-nav-off .sgx-menu .sub-menu a { font-size: 18px; }
}
