/* ==========================================================================
   Accessible disclosure nav
   ========================================================================== */
.showsearch,
.hamburger {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	background: none;
	border: 0;
	cursor: pointer;
	font: inherit;
	padding: 0.5em 1em;
	border-radius: 300px;
	border:2px solid var(--erasmus_blue);

	background: var(--erasmus_blue); color:white; font-weight: 600;
	font-size: 18px; line-height: 1;
	height: calc(2em + 4px); box-sizing: border-box;
}
.showsearch { font-weight: 400; padding: 0.5em}

.showsearch:focus-visible,
.hamburger:focus-visible {
	outline: 2px solid var(--erasmus_blue);
	outline-offset: 2px;
}

.hamburger__box {
	position: relative;
	display: inline-block;
	width: 18px;
	height: 14px;
}

.hamburger__inner,
.hamburger__inner::before,
.hamburger__inner::after {
	position: absolute;
	left: 0;
	width: 18px;
	height: 2px;
	background: currentColor;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.hamburger__inner {
	top: 7px;
}
.hamburger__inner::before {
	content: "";
	top: -5px;
}
.hamburger__inner::after {
	content: "";
	top: 5px;
}

.hamburger[aria-expanded="true"] .hamburger__inner {
	background: transparent;
}
.hamburger[aria-expanded="true"] .hamburger__inner::before {
	transform: translateY(5px) rotate(45deg);
}
.hamburger[aria-expanded="true"] .hamburger__inner::after {
	transform: translateY(-5px) rotate(-45deg);
}

/* ---- nav structure ---- */

.site-nav ul {
	list-style: none;
	margin: 0;
	padding: 0 0 12px;
}

/* Depth 0: top-level row, e.g. Erasmus+ | Key information | Funding | FAQ | Blog */
.menu-item--depth-0-list {
	display: flex;
	flex-wrap: wrap;
	gap: 32px;
	justify-content: space-between;
	justify-content: center;
}
.menu-item--depth-0-list > li {
	/*flex: 1;*/ margin: 0;
}

.submenu {
	display: block;     box-sizing: border-box;
}
.submenu[hidden] {
	display: none;
}
.submenu--depth-1 {
	 position: absolute;
	z-index: 10; background: white;
	width: calc(100% - var(--wrapper_margin) - var(--wrapper_margin));
	width: 100%; left: 0; top:100%; padding: 0 var(--wrapper_margin) 12px !important ;}


/* Depth-1 submenu only (the dropdown directly under a top-level item):
   lay its items out in 3 columns via CSS multi-column rather than grid.
   Grid places items into shared rows, so an expanding nested submenu
   inside one item pushes every row below it down the page; multicol
   flows items down each column independently instead, so an expanding
   item only grows its own column. Nested accordion levels (depth 2+)
   keep the normal single-column block layout below.
   break-inside: avoid stops an item (especially one with an expanded
   nested submenu) being split across two columns mid-content. */
.submenu--depth-1 {
	column-count: 3;
	column-gap: 24px;
}
.submenu--depth-1 li {
	break-inside: avoid;
	padding: 0.33em 0;
	margin: 0;
}


.submenu--depth-1 li a > span {
	width:auto;
	display: inline-flex;
	transition: all 0.2s ease; cursor: pointer; /*font-weight: 700;*/
	text-decoration: none;
	background-image: linear-gradient(currentColor, currentColor), linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0));
	background-position: 0 100%, 0 100%;
	background-repeat: no-repeat, no-repeat;
	background-size: 0 2px, 100% 2px;
	transition: background-size .3s;

}

.submenu--depth-1 li a:hover > span{
	background-size: 100% 2px, 100% 2px

}


.submenu--depth-2 { padding: 0.33em 0 !important; }
.submenu--depth-1 > .submenu-parent-link {
	column-span: all;
}
/* The depth-0 parent's own page, exposed as the first link inside its
   submenu (depth-0 items are button-only, so this is their only route to
   their own page). Depth 1+ items have a direct link next to their toggle
   button instead, so this pattern only ever appears one level deep. */
.submenu--depth-1 li.submenu-parent-link {
	padding-bottom: 0.2em;
	margin-bottom: 0.2em;
	border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}
.submenu-parent-link .menu-link {
	font-weight: 700;
}

/* Nested accordion indent, e.g. For Staff -> Staff Teaching / Staff Training */
.submenu--depth-3,
.submenu--depth-4 {
	padding-left: 1.25em;
}

.menu-link,
.menu-toggle {
	display: flex;
	align-items: center;
	gap: 0.5em;
	width: 100%;
	/*padding: 0.5em 0.5em;*/
	text-align: left;
	background: none;
	border: 0;
	font: inherit;
	color: var(--erasmus_blue);
	text-decoration: none;
	cursor: pointer;
	box-sizing: border-box;
	font-weight: 600;
	transition: all 0.1s ease;
}

li.menu-item--depth-0 > :is(.menu-link,.menu-toggle) {

	border-radius: 300px; padding: 0.5em 1em;
	width: auto !important;
}
li.menu-item--depth-0 > :is(.menu-link) {
	display: inline-block;
}

li.menu-item--depth-0 > :is(.menu-link,.menu-toggle):is(:hover,:focus-visible) {
	background: color-mix(in srgb, var(--erasmus_blue) 10%, white);
}
li.menu-item--depth-0 > :is(.menu-link,.menu-toggle):is(:focus-visible) {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}
li.menu-item--depth-0 > .menu-toggle[aria-expanded="true"] {
	background: color-mix(in srgb, var(--erasmus_blue) 15%, white);
	background: var(--erasmus_blue); color: white;
}


	/*.menu-link:hover,
    .menu-toggle:hover {
        text-decoration: underline;
    }*/

/* Never remove this - it's the only visible cue for keyboard users */
.menu-link:focus-visible,
.menu-toggle:focus-visible/*,
.hamburger:focus-visible*/ {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* Depth 1+: the item's link and its submenu toggle button now sit side
   by side as siblings, instead of the button being the only child.
   Depth 0 <li>s never match `.menu-link` here since they only ever
   contain a single button, so this only affects nested rows. */
.has-submenu {
/*	display: flex;
	align-items: stretch;*/
}
.has-submenu > .menu-link {
	flex: 1 1 auto;
	width: auto;
}
.menu-toggle--icon-only {
	flex: 0 0 auto;
	width: auto;
	min-width: 44px; /* keep a real touch target now the button is icon-only */
	justify-content: center;
	text-decoration: none !important;
}

li.menu-item--depth-1.has-submenu   { display: flex; flex-wrap: wrap; }
li.menu-item--depth-1.has-submenu > a { max-width: calc(100% - 44px); }
li.menu-item--depth-1.has-submenu > ul {  width: 100%; }



/* +/- indicator, driven purely by aria-expanded - no separate icon state to keep in sync.
   This is what depth 1+ toggle buttons use (the plus stays as-is). */
.menu-toggle__icon {
	margin-left: 0;
	position: relative;
	width: 0.8em;
	height: 0.8em;
	flex: none;
}
.menu-toggle__icon::before,
.menu-toggle__icon::after {
	content: "";
	position: absolute;
	background: currentColor;
}
.menu-toggle__icon::before {
	top: 50%;
	left: 0;
	width: 100%;
	height: 2px;
	transform: translateY(-50%);
}
.menu-toggle__icon::after {
	top: 0;
	left: 50%;
	width: 2px;
	height: 100%;
	transform: translateX(-50%);
	transition: opacity 0.15s ease;
}
.menu-toggle[aria-expanded="true"] .menu-toggle__icon::after {
	opacity: 0;
}

/* Depth 0: the toggle button's icon is now a literal ▼ character (set in
   the walker markup) rather than the CSS-drawn +/-, so switch off the
   pseudo-element lines here and just rotate the glyph on expand. */
.menu-item--depth-0 > .menu-toggle .menu-toggle__icon {
	width: auto;
	height: auto;
	line-height: 1;
	font-size: 1em;
	transform: scaleY(0.75) scaleX(1.25);

	transition: transform 0.15s ease;
}
.menu-item--depth-0 > .menu-toggle .menu-toggle__icon::before,
.menu-item--depth-0 > .menu-toggle .menu-toggle__icon::after {
	content: none;
}
.menu-item--depth-0 > .menu-toggle[aria-expanded="true"] .menu-toggle__icon {
	transform: scaleY(0.75) scaleX(1.25) rotate(180deg);
}
@media screen and (max-width: 850px) {
	.hamburger{ padding: 0.5em; width: 36px; height: 36px;
		position: relative; }
	.hamburger__box {
		position: absolute; top: calc(50% - 1px); left: 50%; transform: translate(-50%,-50%);}
	span.hamburger__label {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		padding: 0;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		border: 0;
	}
}