/*
 * Dropdown (sub-menu) support for the primary menu.
 * The original theme only styled a flat menu; this adds one level of children,
 * e.g. About → Funded projects. Parent items stay clickable.
 */

/* ---- Mobile push menu (< 992px): children shown indented under the parent ---- */
.menu .sub-menu {
	margin: 0;
	padding: 0;
}

.menu .sub-menu li:first-of-type {
	margin-top: 0; /* theme adds 106px to every first <li> */
}

.menu .sub-menu li a {
	padding-left: 44px;
	font-size: 0.9em;
}

/* ---- Desktop (>= 992px): hover / keyboard-focus dropdown ---- */
@media only screen and (min-width: 992px) {
	.menu {
		overflow: visible; /* theme sets overflow-y: hidden, which would clip the dropdown */
	}

	.menu li.menu-item-has-children {
		position: relative;
	}

	.menu .sub-menu {
		display: none;
		position: absolute;
		top: 100%;
		left: 0; /* align with the parent's left edge, not under "We are hiring" */
		min-width: 190px;
		padding: 6px 0;
		text-align: left;
		background-color: #fff;
		border-radius: 4px;
		box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
		z-index: 100000;
	}

	.menu li:hover > .sub-menu,
	.menu li:focus-within > .sub-menu {
		display: block;
	}

	.menu .sub-menu li {
		display: block;
	}

	.menu .sub-menu li a,
	.menu .sub-menu li.current-menu-item a {
		padding: 8px 16px;
		white-space: nowrap;
		color: #000;
		background-color: transparent;
		border-radius: 0;
	}

	.menu .sub-menu li a:hover,
	.menu .sub-menu li a:focus,
	.menu .sub-menu li.current-menu-item a {
		color: #3d59a7;
	}

	/* Highlight "About" while on one of its child pages, like the current page */
	.menu > li.current-menu-ancestor > a {
		color: #fff;
		background-color: #3d59a7;
		border-radius: 4px;
	}
}
