:root {
	--map-ink: #413c3c;
	--map-line: #dedbd9;
	--route-me: #f0c419;
	--route-research: #d43a32;
	--route-projects: #2878b8;
	--route-public: #4c9b3b;
	--content-width: 1040px;
	--network-shift: 2%;
}

html {
	scroll-behavior: smooth;
}

body {
	background: #ffffff;
}

.mobile-section-nav {
	display: none;
}

.site-map {
	position: -webkit-sticky;
	position: sticky;
	top: 0;
	z-index: 1000;
	box-sizing: border-box;
	width: 100%;
	height: 156px;
	padding: 0;
	border-bottom: 1px solid rgba(65, 60, 60, 0.14);
	margin: 0;
	overflow-x: auto;
	overflow-y: hidden;
	background: rgba(255, 255, 255, 0.94);
	color: var(--map-ink);
	scrollbar-color: #c8c4c1 transparent;
	scrollbar-width: thin;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-x: contain;
	touch-action: pan-x pan-y;
	transition: height 220ms ease;
}

.site-map.is-collapsed {
	height: 26px;
}

.site-map.is-collapsed .map-canvas {
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
}

.site-map-intro {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	border: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.map-canvas {
	position: relative;
	display: block;
	width: min(100%, 760px);
	height: 152px;
	margin: 0 auto;
	overflow: hidden;
	background: transparent;
	opacity: 1;
	transition: opacity 160ms ease;
}

.map-toggle {
	position: absolute;
	z-index: 5;
	right: max(12px, calc((100% - 760px) / 2 + 8px));
	bottom: 1px;
	display: grid;
	width: 28px;
	height: 18px;
	padding: 0;
	border: 0;
	border-radius: 9px 9px 0 0;
	background: rgba(255, 255, 255, 0.9);
	color: rgba(65, 60, 60, 0.58);
	cursor: pointer;
	place-items: center;
}

.map-toggle:hover {
	color: var(--map-ink);
}

.map-toggle:focus-visible {
	outline: 1px solid var(--map-ink);
	outline-offset: -2px;
}

.map-toggle-icon {
	display: block;
	width: 7px;
	height: 7px;
	border-top: 1px solid currentColor;
	border-left: 1px solid currentColor;
	transform: rotate(45deg) translate(1px, 1px);
	transform-origin: center;
	transition: transform 180ms ease;
}

.site-map.is-collapsed .map-toggle {
	bottom: 4px;
}

.site-map.is-collapsed .map-toggle-icon {
	transform: rotate(225deg) translate(1px, 1px);
}

.map-lines-canvas {
	position: absolute;
	z-index: 1;
	width: 100%;
	height: 100%;
	inset: 0;
	pointer-events: none;
}

.map-stations {
	position: absolute;
	z-index: 2;
	inset: 0;
}

.map-station {
	--station-color: var(--map-ink);
	position: absolute;
	top: var(--y);
	left: calc(var(--x) - var(--network-shift));
	display: block;
	width: 36px;
	height: 36px;
	border: 0;
	background: transparent;
	color: var(--map-ink);
	font-size: 9.5px;
	font-weight: 700;
	line-height: 1.1;
	text-align: center;
	text-decoration: none;
	transform: translate(-50%, -50%);
}

.map-station:hover,
.map-station:focus,
.map-station:active {
	color: var(--station-label-color, var(--station-color));
	text-decoration: none;
}

.station--me {
	--station-color: var(--route-me);
	--station-label-color: #806200;
}

.station--research {
	--station-color: var(--route-research);
	--station-label-color: #a92b25;
}

.station--projects {
	--station-color: var(--route-projects);
	--station-label-color: #1d6097;
}

.station--public {
	--station-color: var(--route-public);
	--station-label-color: #347329;
}

.station-dot {
	position: absolute;
	top: 50%;
	left: 50%;
	display: block;
	width: 10px;
	height: 10px;
	border: 2px solid var(--station-color);
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 0 0 2px #ffffff;
	opacity: 0.74;
	transform: translate(-50%, -50%);
	transition:
		width 150ms ease,
		height 150ms ease,
		background-color 150ms ease,
		box-shadow 150ms ease;
}

.station--home .station-dot {
	width: 31px;
	height: 31px;
	border: 4px solid #ffffff;
	background: conic-gradient(
		var(--route-research) 0 25%,
		var(--route-projects) 25% 50%,
		var(--route-public) 50% 75%,
		var(--route-me) 75% 100%
	);
	box-shadow:
		0 0 0 2px var(--map-ink),
		0 0 0 5px #ffffff;
	opacity: 1;
}

.station--home .station-dot::after {
	position: absolute;
	inset: 6px;
	border-radius: 50%;
	background: #ffffff;
	content: "";
}

.map-station span {
	position: absolute;
	left: 50%;
	display: block;
	width: max-content;
	max-width: 122px;
	padding: 1px 2px;
	background: rgba(255, 255, 255, 0.94);
	color: var(--station-label-color, var(--station-color));
	font-weight: 800;
	letter-spacing: 0.01em;
	white-space: nowrap;
	cursor: pointer;
	transform: translateX(-50%);
	transition:
		color 150ms ease,
		background-color 150ms ease,
		box-shadow 150ms ease;
}

.station--home span {
	color: var(--map-ink);
}

.map-station:hover span,
.map-station:focus-visible span,
.map-station.is-current span {
	background: #ffffff;
	box-shadow: 0 0 0 1px var(--station-label-color, var(--station-color));
}

.station--home:hover span,
.station--home:focus-visible span,
.station--home.is-current span {
	box-shadow: 0 0 0 1px var(--map-ink);
}

.map-station span::before {
	position: absolute;
	display: block;
	background: currentColor;
	content: "";
	opacity: 0.4;
	pointer-events: none;
}

.station--above span {
	bottom: calc(50% + 16px);
}

.station--below span {
	top: calc(50% + 16px);
}

.label--north span {
	bottom: calc(50% + 16px);
}

.station--above span::before,
.label--north span::before {
	top: 100%;
	left: 50%;
	width: 1px;
	height: 11px;
}

.label--south span {
	top: calc(50% + 16px);
}

.station--below span::before,
.label--south span::before {
	bottom: 100%;
	left: 50%;
	width: 1px;
	height: 11px;
}

.label--east span {
	top: 50%;
	left: calc(50% + 16px);
	transform: translateY(-50%);
}

.label--east span::before {
	top: 50%;
	right: 100%;
	width: 11px;
	height: 1px;
}

.label--west span {
	top: 50%;
	right: calc(50% + 16px);
	left: auto;
	transform: translateY(-50%);
}

.label--west span::before {
	top: 50%;
	left: 100%;
	width: 11px;
	height: 1px;
}

.label--north-east span {
	right: auto;
	bottom: calc(50% + 14px);
	left: calc(50% + 12px);
	transform: none;
}

.label--north-east span::before {
	top: 100%;
	left: 0;
	width: 12px;
	height: 1px;
	transform: rotate(132deg);
	transform-origin: left center;
}

.map-line-name {
	position: absolute;
	z-index: 3;
	top: var(--y);
	left: calc(var(--x) - var(--network-shift));
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 1px 3px 2px;
	background: rgba(255, 255, 255, 0.96);
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.055em;
	line-height: 1;
	text-transform: uppercase;
	white-space: nowrap;
	pointer-events: none;
	transform: translate(-50%, -50%);
}

.map-line-name::before {
	display: block;
	width: 15px;
	height: 4px;
	border-radius: 999px;
	background: currentColor;
	content: "";
}

.line-name--me {
	color: var(--route-me);
}

.line-name--research {
	color: var(--route-research);
}

.line-name--projects {
	color: var(--route-projects);
}

.line-name--public {
	color: var(--route-public);
}

.map-station.is-route-active .station-dot,
.map-station.is-current .station-dot,
.map-station:hover .station-dot,
.map-station:focus-visible .station-dot {
	width: 16px;
	height: 16px;
	background: var(--station-color);
	opacity: 1;
}

.station--home.is-route-active .station-dot,
.station--home.is-current .station-dot,
.station--home:hover .station-dot,
.station--home:focus-visible .station-dot {
	width: 34px;
	height: 34px;
	background: conic-gradient(
		var(--route-research) 0 25%,
		var(--route-projects) 25% 50%,
		var(--route-public) 50% 75%,
		var(--route-me) 75% 100%
	);
}

.map-station.is-route-active span,
.map-station.is-current span {
	color: var(--station-label-color, var(--station-color));
}

.map-station.is-current .station-dot {
	box-shadow:
		0 0 0 3px #ffffff,
		0 0 0 6px var(--station-color);
}

.station--home.is-current .station-dot {
	box-shadow:
		0 0 0 4px #ffffff,
		0 0 0 7px var(--map-ink);
}

.map-station:focus-visible {
	border-radius: 2px;
	outline: 2px solid var(--station-color);
	outline-offset: 1px;
}

.mapped-content {
	display: block;
}

.mapped-content > :not(#home-section) {
	width: 100%;
}

#short_bio {
	--section-accent: #a67f00;
}

:is(
	#research-section,
	#publications-section,
	#teaching-section
) {
	--section-accent: #a92b25;
}

:is(
	#funded-projects-section,
	#projects-section,
	#open-source-section,
	#data-section,
	#other-work-section
) {
	--section-accent: #1d6097;
}

:is(
	#talks-section,
	#media-section,
	#contact-section
) {
	--section-accent: #347329;
}

.mapped-content > :not(#home-section) h2 {
	margin: 0 0 24px !important;
	color: var(--section-accent, var(--map-ink));
	font-size: 28px !important;
	font-weight: 700 !important;
	letter-spacing: 0.05em !important;
	line-height: 1.2;
	text-align: center;
	text-transform: none !important;
}

.mapped-content > :not(#home-section) h2::after {
	display: block;
	width: 30px;
	height: 3px;
	margin: 9px auto 0;
	border-radius: 999px;
	background: currentColor;
	content: "";
}

.mapped-content > #short_bio > .row {
	width: min(calc(100% - 30px), var(--content-width));
	margin-right: auto;
	margin-left: auto;
}

.mapped-content > #short_bio .cv-heading {
	max-width: var(--content-width);
}

@media (min-width: 768px) {
	.mapped-content > #short_bio > .cv-equal-row > .cv-equal {
		flex: 0 0 50%;
		max-width: 50%;
	}
}

.research-comic {
	width: min(calc(100% - 30px), 620px);
	margin-right: auto;
	margin-left: auto;
}

.mapped-content > :not(#home-section) .col-lg-7,
.mapped-content > :not(#home-section) .col-lg-10 {
	box-sizing: border-box;
	flex: 0 0 100%;
	width: 100%;
	max-width: var(--content-width);
	margin-right: auto;
	margin-left: auto;
}

.mapped-content > :not(#home-section) img {
	max-width: 100%;
	height: auto;
}

.mapped-subsection {
	width: 100%;
	padding: 48px max(15px, calc((100% - var(--content-width)) / 2));
	border-top: 7px double gray;
}

#home-section,
#about-section,
#short_bio,
#contact-section,
#research-section,
#phd-research,
#publications-section,
#teaching-section,
#funded-projects-section,
#projects-section,
#open-source-section,
#data-section,
#other-work-section,
#talks-section,
#media-section {
	scroll-margin-top: 170px;
}

.map-arrival {
	animation: map-arrival 1.1s ease-out;
}

@keyframes map-arrival {
	0% {
		box-shadow: inset 4px 0 0 var(--arrival-color, var(--route-projects));
	}

	100% {
		box-shadow: inset 0 0 0 transparent;
	}
}

@media (prefers-reduced-motion: reduce) {
	.site-map,
	.map-canvas,
	.map-toggle-icon {
		transition: none;
	}
}

@media (max-width: 900px) {
	.site-map {
		height: 156px;
		padding-inline: 0;
	}

	.map-canvas {
		width: 760px;
		height: 152px;
	}

	#home-section,
	#about-section,
	#short_bio,
	#contact-section,
	#research-section,
	#phd-research,
	#publications-section,
	#teaching-section,
	#funded-projects-section,
	#projects-section,
	#open-source-section,
	#data-section,
	#other-work-section,
	#talks-section,
	#media-section {
		scroll-margin-top: 170px;
	}
}

@media (max-width: 600px) {
	html,
	body {
		max-width: 100%;
		overflow-x: clip;
	}

	.site-map {
		display: block;
		width: 100%;
		max-width: 100vw;
		height: 190px;
		overflow-x: hidden;
	}

	.mobile-section-nav {
		display: none;
	}

	.map-canvas {
		width: 100%;
		height: 186px;
	}

	.map-station {
		width: 32px;
		height: 32px;
		font-size: 8.5px;
	}

	.map-station[data-node="me-about"] {
		--x: 36% !important;
		--y: 24% !important;
	}

	.map-station[data-node="me-short-cv"] {
		--x: 20% !important;
		--y: 24% !important;
	}

	.map-station[data-node="research-interest"] {
		--x: 64% !important;
		--y: 24% !important;
	}

	.map-station[data-node="research-phd"] {
		--x: 80% !important;
		--y: 24% !important;
	}

	.map-station[data-node="research-publications"] {
		--x: 80% !important;
		--y: 42% !important;
	}

	.map-station[data-node="research-teaching"] {
		--x: 92% !important;
		--y: 42% !important;
	}

	.map-station[data-node="projects-projects"] {
		--x: 64% !important;
		--y: 78% !important;
	}

	.map-station[data-node="projects-tools"] {
		--x: 80% !important;
		--y: 78% !important;
	}

	.map-station[data-node="projects-open"] {
		--x: 80% !important;
		--y: 60% !important;
	}

	.map-station[data-node="projects-data"] {
		--x: 92% !important;
		--y: 60% !important;
	}

	.map-station[data-node="projects-other"] {
		--x: 92% !important;
		--y: 90% !important;
	}

	.map-station[data-node="public-talks"] {
		--x: 36% !important;
		--y: 78% !important;
	}

	.map-station[data-node="public-media"] {
		--x: 20% !important;
		--y: 78% !important;
	}

	.map-station[data-node="public-contact"] {
		--x: 8% !important;
		--y: 92% !important;
	}

	.map-station span {
		max-width: 96px;
		padding-inline: 1px;
	}

	.map-station[data-node="research-publications"] span {
		right: auto;
		bottom: calc(50% + 14px);
		left: 50%;
		transform: translateX(-50%);
	}

	.map-station[data-node="research-publications"] span::before {
		top: 100%;
		left: 50%;
		width: 1px;
		height: 9px;
		transform: none;
	}

	.map-station[data-node="research-teaching"] span {
		top: 50%;
		right: calc(50% + 14px);
		left: auto;
		transform: translateY(-50%);
	}

	.map-station[data-node="research-teaching"] span::before {
		top: 50%;
		right: auto;
		left: 100%;
		width: 9px;
		height: 1px;
		transform: none;
	}

	.map-station[data-node="public-contact"] span {
		top: 50%;
		right: auto;
		left: calc(50% + 14px);
		transform: translateY(-50%);
	}

	.map-station[data-node="public-contact"] span::before {
		top: 50%;
		right: 100%;
		left: auto;
		width: 9px;
		height: 1px;
		transform: none;
	}

	.map-line-name {
		gap: 3px;
		padding-inline: 2px;
		font-size: 8px;
		letter-spacing: 0.035em;
	}

	.map-line-name::before {
		width: 11px;
		height: 3px;
	}

	.map-toggle {
		right: 8px;
	}

	.mapped-content,
	.mapped-content > *,
	.mapped-content .row {
		box-sizing: border-box;
		max-width: 100%;
	}

	.mapped-content {
		overflow-x: hidden;
		overflow-x: clip;
	}

	.mapped-content .row {
		margin-right: 0;
		margin-left: 0;
	}

	.mapped-content > .section-block {
		padding-right: 15px;
		padding-left: 15px;
	}

	.mapped-content p,
	.mapped-content a,
	.mapped-content .text-left {
		overflow-wrap: anywhere;
	}

	#home-section,
	#about-section,
	#short_bio,
	#contact-section,
	#research-section,
	#phd-research,
	#publications-section,
	#teaching-section,
	#funded-projects-section,
	#projects-section,
	#open-source-section,
	#data-section,
	#other-work-section,
	#talks-section,
	#media-section {
		scroll-margin-top: 204px;
	}

	.mapped-subsection {
		padding: 36px 15px;
	}
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	.station-dot {
		transition: none;
	}

	.map-arrival {
		animation: none;
	}
}
