/*--------------------------------------------------------------
# Mobile Scroll Menu
Horizontal, swipeable menu that only appears on mobile, placed
between the header (logo) and the recommendation/notification bar.
Supports multi-level dropdown (child menu) without breaking the
horizontal drag/scroll of the top-level menu.
--------------------------------------------------------------*/

.pjs-mobile-scrollmenu-wrap {
	display: none;
	position: relative;
	z-index: 999;
	background: #ffffff;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.wp-dark-mode-active .pjs-mobile-scrollmenu-wrap,
html[data-theme="dark"] .pjs-mobile-scrollmenu-wrap {
	background: #14181f;
	border-bottom-color: rgba(255, 255, 255, 0.08);
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

@media (max-width: 1200px) {
	.pjs-mobile-scrollmenu-wrap {
		display: block;
		/* Stick to the top of the viewport once scrolled past its
		   natural position. `--pjs-mobile-scrollmenu-top` is kept in
		   sync by JS: it's 0 if the mobile header above isn't itself
		   sticky/fixed, or equal to that header's height if it is -
		   so this bar always sits flush under it, never overlapping
		   and never leaving a gap. */
		position: sticky;
		position: -webkit-sticky;
		top: var( --pjs-mobile-scrollmenu-top, 0px );
	}
}

.pjs-mobile-scrollmenu-inner {
	position: relative;
}

/* the scrollable track */
.pjs-mobile-scrollmenu {
	overflow-x: auto;
	overflow-y: visible;
	-webkit-overflow-scrolling: touch;
	touch-action: pan-x;
	scrollbar-width: none;
	-ms-overflow-style: none;
	white-space: nowrap;
}

.pjs-mobile-scrollmenu::-webkit-scrollbar {
	display: none;
	height: 0;
}

.mobile-scroll-menu-list {
	display: inline-flex;
	flex-wrap: nowrap;
	align-items: center;
	list-style: none;
	margin: 0;
	padding: 0 0px;
}

.mobile-scroll-menu-list li {
	position: relative;
	flex: 0 0 auto;
}

.mobile-scroll-menu-list > li {
	margin: 0 4px;
}

.mobile-scroll-menu-list > li > a {
	display: flex;
	align-items: center;
	gap: 4px;
	white-space: nowrap;
	padding: 10px 5px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none !important;
	color: inherit;
	border-radius: 30px;
}

/* arrow indicator for items that have children, injected by JS as a span */
.mobile-scroll-menu-list .pjs-submenu-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-left: 2px;
	width: 14px;
	height: 14px;
	flex: 0 0 auto;
	transition: transform 0.2s ease;
}

.mobile-scroll-menu-list .pjs-submenu-toggle svg {
	width: 10px;
	height: 10px;
	display: block;
}

.mobile-scroll-menu-list li.pjs-submenu-open > a .pjs-submenu-toggle {
	transform: rotate(180deg);
}

/* dropdown / child menu panel
   Positioned with `fixed` (coordinates calculated in JS) instead of
   `absolute`, because the horizontally-scrollable ancestor uses
   `overflow-x: auto`. Per the CSS spec, once one overflow axis is not
   `visible`, the browser forces the other axis to compute to `auto` as
   well - so a plain `absolute` submenu would always get clipped and
   never actually be visible, no matter what `overflow-y` says. `fixed`
   positioning escapes that clipping entirely. */
.pjs-mobile-scrollmenu .sub-menu {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	min-width: 200px;
	max-width: 80vw;
	max-height: 60vh;
	overflow-y: auto;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: #ffffff;
	border-radius: 10px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
	white-space: normal;
	z-index: 999999;
	visibility: hidden;
}

.wp-dark-mode-active .pjs-mobile-scrollmenu .sub-menu,
html[data-theme="dark"] .pjs-mobile-scrollmenu .sub-menu {
	background: #1e232c;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Show the submenu belonging to whichever `li` is currently open -
   at ANY nesting depth (top-level item or a nested grandchild item),
   not just direct children of the menu list. */
.pjs-mobile-scrollmenu li.pjs-submenu-open > .sub-menu {
	display: block;
	visibility: visible;
}

.pjs-mobile-scrollmenu .sub-menu li {
	display: block;
}

.pjs-mobile-scrollmenu .sub-menu li a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	padding: 9px 10px;
	font-size: 13px;
	font-weight: 500;
	text-decoration: none !important;
	color: inherit;
	border-radius: 6px;
	white-space: normal;
}

.pjs-mobile-scrollmenu .sub-menu li:hover > a,
.pjs-mobile-scrollmenu .sub-menu li.pjs-submenu-open > a {
	background: rgba(0, 0, 0, 0.06);
}

.wp-dark-mode-active .pjs-mobile-scrollmenu .sub-menu li:hover > a,
.wp-dark-mode-active .pjs-mobile-scrollmenu .sub-menu li.pjs-submenu-open > a,
html[data-theme="dark"] .pjs-mobile-scrollmenu .sub-menu li:hover > a,
html[data-theme="dark"] .pjs-mobile-scrollmenu .sub-menu li.pjs-submenu-open > a {
	background: rgba(255, 255, 255, 0.08);
}

/* Nested child menu (grandchildren): position is calculated and set
   inline (top/left) by JS via getBoundingClientRect(), beside or below
   its parent item depending on available viewport space, so no fixed
   CSS offset is needed here. */
