:root {
	--bg: #f6f7fb;
	--text: #222;
	--card-bg: #fff;
	--accent: #0066cc;
	--accent-dark: #004f99;
	--shadow: rgba(0, 0, 0, 0.08);
	--border: #eee;
   --scroll-offset: 5em;
}

[data-theme="dark"] {
	--bg: #111;
	--text: #e8e8e8;
	--card-bg: #181818;
	--accent: #7cb9ff;
	--accent-dark: #b3d9ff;
	--shadow: rgba(0, 0, 0, 0.5);
	--border: #333;
}

/* ==== Base Layout ==== */
body {
	font-family: 'Inter', sans-serif;
	margin: 0;
	padding: 0;
	background: var(--bg);
	color: var(--text);
	line-height: 1.7;
	transition: background 0.3s ease, color 0.3s ease;
}

/* ==== Header ==== */
header {
	text-align: center;
	padding: 3em 1em 2em;
	background: var(--card-bg);
	box-shadow: 0 2px 12px var(--shadow);
	position: relative;
}

h1 {
	font-size: 2.4em;
	font-weight: 700;
	margin-bottom: 0.2em;
	color: var(--text);
}

header p {
	color: #666;
	font-size: 1.05em;
	margin: 0.4em 0 1.2em;
}

nav {
	margin-top: 1.2em;
}

nav a {
	margin: 0 0.7em;
	text-decoration: none;
	color: var(--accent);
	font-weight: 500;
	transition: color 0.2s ease;
}

nav a:hover {
	color: var(--accent-dark);
}

/* ==== Theme & CV ==== */
.header-buttons {
	position: absolute;
	top: 1.5em;
	right: 1.5em;
	display: flex;
	gap: 0.8em;
	align-items: center;
}

#theme-toggle,
.cv-button {
	position: static;
	/* these styles were lost when you removed the old blocks */
	background: var(--accent);
	color: #fff;
	border: none;
	border-radius: 20px;
	padding: 0.4em 0.9em;
	cursor: pointer;
	font-size: 0.9em;
	text-decoration: none;
	transition: background 0.3s ease;
	z-index: 1000;
}

#theme-toggle:hover,
.cv-button:hover {
	background: var(--accent-dark);
}

/* Override only the CV button */
.cv-button {
	background: #888;
	color: #fff;
}

.cv-button:hover {
	background: #666;
}

/* ==== Main Layout ==== */
main {
	max-width: 900px;
	background: var(--card-bg);
	margin: 3em auto 0 auto;
	/* sets top margin to 3em normally */
	padding: 3em 3em 2em;
	border-radius: 16px;
	box-shadow: 0 6px 25px var(--shadow);
	transition: background 0.3s ease, box-shadow 0.3s ease;
	padding-top: 2em;
}

main section:first-of-type {
	margin-top: 0;
	padding-top: 2em;
}

/* ==== Sections ==== */
section {
	background: var(--card-bg);
	border-radius: 12px;
	padding: 1.8em 2em;
	margin: 2em 0;
	box-shadow: 0 1px 4px var(--shadow);
	animation: fadeIn 0.4s ease;
	transition: background 0.3s ease, box-shadow 0.3s ease;
   scroll-margin-top: var(--scroll-offset);
}

body.scrolled section {
	scroll-margin-top: 3.5em;
}

section h2 {
	font-size: 1.4em;
	border-left: 4px solid var(--accent);
	padding-left: 0.5em;
	color: var(--text);
	margin-bottom: 0.6em;
}

/* ==== Lists ==== */
ul {
	list-style: none;
	padding-left: 1em;
}

ul li::before {
	content: "• ";
	color: var(--accent);
	font-weight: bold;
}

a {
	color: var(--accent);
	text-decoration: none;
	transition: color 0.2s ease;
}

a:hover {
	color: var(--accent-dark);
	text-decoration: underline;
}

strong,
b {
	font-weight: 700;
	color: var(--text);
}

ul li strong {
	font-weight: 700;
}


/* ==== Headshot ==== */
.headshot {
	width: 180px;
	border-radius: 50%;
	display: block;
	margin: 0 auto 1.5em;
}

/* ==== Footer ==== */
footer {
	text-align: center;
	padding: 1.2em;
	font-size: 0.9em;
	color: #666;
	background-color: var(--card-bg);
	border-top: 1px solid var(--border);
}

/* ==== Animation ==== */
html {
	scroll-behavior: smooth;
}

html,
body {
	background-color: var(--card-bg);
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ==== Responsive ==== */
@media (max-width: 600px) {
	main {
		padding: 2em 1.5em;
	}

	nav {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
	}

	nav a {
		margin: 0.4em;
	}
}

/* default state: hidden sidebar */
/* ===== Floating topbar Navigation (updated from side) ===== */
/* hidden by default */
/* ===== Floating Top Bookmark Bar ===== */
body.scrolled #top-nav {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	margin: 0;
	background: var(--card-bg);
	box-shadow: 0 2px 10px var(--shadow);
	padding: 0.6em 0.5em;
	z-index: 999;
	width: 100%;
	border-top: 1px solid var(--card-bg);
}

body.scrolled .top-nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 1em;
	justify-content: center;
	align-items: center;
	max-width: 92%;
	margin: 0 auto;
}

/* prevent the bar from covering content when visible at top */
body.scrolled main {
	padding-top: 3.4em;
	/* adjust if you change bar height */
	transition: padding-top 0.2s ease;
}

/* fixed toggle button that stays even when the bar is collapsed */
#top-toggle {
	position: fixed;
	top: 0.35em;
	right: 0.8em;
	background: transparent;
	border: none;
	color: var(--accent);
	font-size: 1.2em;
	cursor: pointer;
	padding: 0.3em 0.4em;
	border-radius: 6px;
	z-index: 1000;
	display: none;
	/* show only after header has scrolled away */
}

#top-toggle:hover {
	color: var(--accent-dark);
}

/* show the toggle only when header is out of view */
body.scrolled #top-toggle {
	display: block;
}

/* collapsed state: slide the whole nav off-screen so it doesn't block content */
body.top-collapsed #top-nav {
	transform: translateY(-110%);
	opacity: 0;
	transition: transform 0.28s ease, opacity 0.28s ease;
}

/* when collapsed, remove the extra top padding */
body.scrolled.top-collapsed main {
	padding-top: 0;
}

/* small screens */
@media (max-width: 600px) {
	body.scrolled #top-nav {
		padding: 0.6em;
	}

	#top-toggle {
		top: 0.2em;
	}
}

/* ====== Top Header Contact Links ====== */
header .contact-row {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 1.2em;
	margin-top: 0.6em;
}

/* ==== Contact icons (normalize SVG size) ==== */
.contact-item img {
	width: 18px;
	height: 18px;
	min-width: 18px;
	min-height: 18px;
	display: inline-block;
	object-fit: contain;
	vertical-align: middle;
	filter: grayscale(100%);
	transition: filter 0.3s ease;
}

header .contact-item img {
	width: 18px;
	height: 18px;
	filter: grayscale(100%) brightness(0.7);
	transition: filter 0.3s ease;
}

header .contact-item:hover {
	color: var(--accent-dark);
}

header .contact-item:hover img {
	filter: invert(35%) sepia(80%) saturate(300%) hue-rotate(180deg);
}

/* Adapt icons in dark mode */
[data-theme="dark"] header .contact-item img {
	filter: invert(85%);
}

/* Slightly tighter spacing on mobile */
@media (max-width: 600px) {
	header .contact-row {
		gap: 0.8em;
	}

	header .contact-item {
		font-size: 0.9em;
	}
}

/* === Current Research layout === */
.research-item {
	display: grid;
	grid-template-columns: 140px 1fr;
	/* SMALL left column */
	gap: 20px;
	align-items: start;
	margin-bottom: 24px;
}

.research-image img {
	width: 100%;
	max-width: 140px;
	/* HARD CAP on image size */
	height: auto;
	border: 1px solid #ccc;
}

/* Stack cleanly on mobile */
@media (max-width: 768px) {
	.research-item {
		grid-template-columns: 1fr;
	}

	.research-image img {
		max-width: 100%;
	}
}
