/* Page Menu: header button + side panel (WO-210). See inc/bsw-page-menu.php.
   Unlayered on purpose: the theme's own rules sit in @layer and would lose to
   Additional CSS; these must win over both. */

.bsw-pm, .bsw-pm-open {
	--bsw-pm-blue: #4B9CD3;
	--bsw-pm-navy: #13294B;
	--bsw-pm-ease: cubic-bezier(.22, .9, .24, 1);
}

/* ---------- header ---------- */

/* The theme's own phone menu is replaced by the panel. */
body.bsw-has-page-menu .yak-menu-toggle,
body.bsw-has-page-menu #yak-mobile-nav {
	display: none !important;
}

body.bsw-has-page-menu .site-header > .wrap {
	justify-content: flex-start;
	flex-wrap: nowrap;
}

body.bsw-has-page-menu .site-header .title-area {
	margin-right: auto;
}

button.bsw-pm-open {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	flex: none;
	height: 48px;
	margin: 0;
	padding: 0 22px 0 18px;
	border: 0;
	border-radius: 999px;
	background: #fff;
	color: var(--bsw-pm-navy);
	font: 700 19px/1 "Work Sans", sans-serif;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
	transition: background-color .2s, color .2s, transform .2s var(--bsw-pm-ease);
}

button.bsw-pm-open:hover {
	background: var(--bsw-pm-navy);
	color: #fff;
}

button.bsw-pm-open:active {
	transform: scale(.96);
}

button.bsw-pm-open:focus-visible {
	outline: 3px solid var(--bsw-pm-navy);
	outline-offset: 3px;
}

.bsw-pm-open__bars {
	position: relative;
	flex: none;
	width: 22px;
	height: 14px;
}

.bsw-pm-open__bars::before,
.bsw-pm-open__bars::after {
	content: "";
	position: absolute;
	left: 0;
	height: 2.5px;
	border-radius: 2px;
	background: currentColor;
	transition: width .25s var(--bsw-pm-ease);
}

.bsw-pm-open__bars::before { top: 1px; width: 22px; }
.bsw-pm-open__bars::after { bottom: 1px; width: 14px; }
button.bsw-pm-open:hover .bsw-pm-open__bars::after { width: 22px; }

/* ---------- panel ---------- */

html:has(dialog.bsw-pm[open]) {
	overflow: hidden;
	scrollbar-gutter: stable;
}

dialog.bsw-pm {
	position: fixed;
	inset: 0 0 0 auto;
	width: min(640px, 100dvw - 24px);
	max-width: none;
	height: calc(100svh - 24px);
	max-height: none;
	margin: 12px 12px 12px auto;
	padding: 0;
	border: 0;
	border-radius: 28px;
	overflow: hidden;
	background: var(--bsw-pm-navy);
	color: #fff;
	box-shadow: -30px 0 80px rgba(8, 20, 42, .45);
	transform: translateX(calc(100% + 24px));
	transition: transform .55s var(--bsw-pm-ease), overlay .55s allow-discrete, display .55s allow-discrete;
}

dialog.bsw-pm:not([open]) {
	display: none;
}

dialog.bsw-pm[open] {
	transform: none;
}

@starting-style {
	dialog.bsw-pm[open] { transform: translateX(calc(100% + 24px)); }
}

dialog.bsw-pm::backdrop {
	background: rgba(13, 31, 60, .5);
	backdrop-filter: blur(10px);
	opacity: 0;
	transition: opacity .45s ease, overlay .45s allow-discrete, display .45s allow-discrete;
}

dialog.bsw-pm[open]::backdrop {
	opacity: 1;
}

@starting-style {
	dialog.bsw-pm[open]::backdrop { opacity: 0; }
}

.bsw-pm__inner {
	display: grid;
	grid-template-rows: auto 1fr auto;
	gap: 8px;
	height: 100%;
	padding: 20px 20px 26px 56px;
	overflow-y: auto;
	background: radial-gradient(120% 60% at 100% 0%, rgba(75, 156, 211, .22), transparent 60%);
}

.bsw-pm__top {
	display: flex;
	justify-content: flex-end;
}

button.bsw-pm__close {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	height: 48px;
	margin: 0;
	padding: 0 22px 0 18px;
	border: 0;
	border-radius: 999px;
	background: rgba(255, 255, 255, .12);
	color: #fff;
	font: 700 19px/1 "Work Sans", sans-serif;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
	transition: background-color .2s, color .2s;
}

button.bsw-pm__close:hover {
	background: #fff;
	color: var(--bsw-pm-navy);
}

.bsw-pm__close svg {
	width: 18px;
	height: 18px;
}

.bsw-pm :focus-visible {
	outline: 3px solid #fff;
	outline-offset: 3px;
}

/* the theme styles every list; reset ours */
.bsw-pm ul.bsw-pm__list,
.bsw-pm ul.bsw-pm__actions {
	list-style: none;
	margin: 0;
	padding: 0;
}

.bsw-pm ul.bsw-pm__list > li,
.bsw-pm ul.bsw-pm__actions > li {
	list-style: none;
	margin: 0;
	padding: 0;
}

.bsw-pm ul.bsw-pm__list {
	align-self: center;
}

.bsw-pm a.bsw-pm__link {
	position: relative;
	display: flex;
	align-items: center;
	min-height: 44px; /* a comfortable target for a finger */
	padding: .34em 20px .34em 0;
	color: #fff;
	font: 700 clamp(24px, min(4.1svh, 7.2vw), 38px)/1.08 "Work Sans", sans-serif;
	letter-spacing: -.025em;
	text-decoration: none;
	text-wrap: balance;
	transition: transform .3s var(--bsw-pm-ease), color .2s;
}

.bsw-pm a.bsw-pm__link::before {
	content: "";
	position: absolute;
	left: -56px;
	top: 50%;
	width: 36px;
	height: 4px;
	margin-top: -2px;
	border-radius: 0 4px 4px 0;
	background: var(--bsw-pm-blue);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform .3s var(--bsw-pm-ease);
}

.bsw-pm a.bsw-pm__link:hover,
.bsw-pm a.bsw-pm__link:focus-visible {
	color: var(--bsw-pm-blue);
	transform: translateX(10px);
}

.bsw-pm a.bsw-pm__link[aria-current] {
	color: var(--bsw-pm-blue);
}

.bsw-pm a.bsw-pm__link[aria-current]::before {
	transform: scaleX(1);
}

.bsw-pm a.bsw-pm__link:hover::before {
	transform: scaleX(1) translateX(-10px);
}

/* ---------- foot: action buttons, then the school ---------- */

.bsw-pm__foot {
	margin-right: 36px;
}

.bsw-pm ul.bsw-pm__actions {
	display: grid;
	gap: 12px;
}

.bsw-pm a.bsw-pm__button {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 64px;
	padding: 12px 24px;
	border: 2px solid #fff;
	border-radius: 999px;
	background: transparent;
	color: #fff;
	font: 700 clamp(19px, 2.6svh, 23px)/1.15 "Work Sans", sans-serif;
	letter-spacing: -.01em;
	text-align: center;
	text-decoration: none;
	transition: background-color .2s, color .2s, border-color .2s, transform .2s var(--bsw-pm-ease);
}

/* the first button is the main one */
.bsw-pm ul.bsw-pm__actions > li:first-child a.bsw-pm__button {
	border-color: var(--bsw-pm-blue);
	background: var(--bsw-pm-blue);
	color: var(--bsw-pm-navy);
}

.bsw-pm a.bsw-pm__button:hover,
.bsw-pm ul.bsw-pm__actions > li:first-child a.bsw-pm__button:hover {
	border-color: #fff;
	background: #fff;
	color: var(--bsw-pm-navy);
}

.bsw-pm a.bsw-pm__button:active {
	transform: scale(.98);
}

.bsw-pm a.bsw-pm__school {
	display: flex;
	align-items: center;
	width: fit-content;
	min-height: 44px;
	margin-top: 18px;
	color: #fff;
	font-weight: 600;
}

.bsw-pm a.bsw-pm__school img {
	display: block;
	width: auto;
	height: 44px;
}

/* links rise in one after another */
dialog.bsw-pm[open] .bsw-pm__list > li {
	animation: bsw-pm-rise .6s var(--bsw-pm-ease) both;
	animation-delay: calc(.12s + var(--i, 0) * .045s);
}

dialog.bsw-pm[open] .bsw-pm__foot {
	animation: bsw-pm-rise .6s var(--bsw-pm-ease) .45s both;
}

@keyframes bsw-pm-rise {
	from { opacity: 0; transform: translateY(22px); }
}

@media (prefers-reduced-motion: reduce) {
	dialog.bsw-pm,
	dialog.bsw-pm::backdrop,
	.bsw-pm a.bsw-pm__link,
	.bsw-pm a.bsw-pm__link::before,
	button.bsw-pm-open,
	.bsw-pm-open__bars::after {
		transition: none;
	}

	dialog.bsw-pm[open] .bsw-pm__list > li,
	dialog.bsw-pm[open] .bsw-pm__foot {
		animation: none;
	}
}

/* Windows High Contrast and similar: colors are replaced, so shapes must carry it. */
@media (forced-colors: active) {
	dialog.bsw-pm {
		border: 2px solid CanvasText;
	}

	.bsw-pm-open__bars::before,
	.bsw-pm-open__bars::after,
	.bsw-pm a.bsw-pm__link::before {
		forced-color-adjust: none;
		background: CanvasText;
	}

	button.bsw-pm-open,
	button.bsw-pm__close,
	.bsw-pm a.bsw-pm__button {
		border: 2px solid ButtonText;
	}

	.bsw-pm a.bsw-pm__link[aria-current] {
		text-decoration: underline;
	}

	/* the logo is white artwork: keep a dark plate behind it */
	.bsw-pm a.bsw-pm__school img {
		forced-color-adjust: none;
		padding: 6px 10px;
		border-radius: 6px;
		background: #13294B;
	}
}

@media (max-width: 959px) {
	/* The theme slides the header away on the way down the page. Bring it back
	   whenever keyboard focus is inside it, so Menu is never focused off screen. */
	body.bsw-has-page-menu .site-header:focus-within {
		top: 0;
	}

	button.bsw-pm-open,
	button.bsw-pm__close {
		height: 44px;
		padding: 0 18px 0 15px;
		font-size: 17px;
	}

	dialog.bsw-pm {
		border-radius: 22px;
	}

	.bsw-pm__inner {
		padding: 14px 14px 20px 32px;
	}

	.bsw-pm a.bsw-pm__link::before {
		left: -32px;
		width: 20px;
	}

	.bsw-pm__foot {
		margin-right: 18px;
	}

	.bsw-pm a.bsw-pm__button {
		min-height: 56px;
	}

	.bsw-pm a.bsw-pm__school img {
		height: 38px;
	}
}
