/* MIT Profile
   Uses MIT brand typography: Neue Haas Grotesk with Arial fallback */

/* ========== Design tokens ========== */
:root {
	--mit-red: #750014;
	--mit-red-bright: #ff1423;
	--text-primary: #e0e0e0;
	--text-muted: #999;
	--text-secondary: #8b959e;
	--bg-primary: #000;
	--border-color: #333;
}

/* ========== Lorenz background ========== */
#lorenz-bg {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: -1;
	pointer-events: none;
}

/* ========== Reset & Base ========== */
*, *::before, *::after {
	box-sizing: border-box;
}

html {
	font-size: 16px;
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	font-family: "neue-haas-grotesk-text";
	font-weight: 400;
	font-size: 1rem;
	line-height: 1.5;
	color: var(--text-primary);
	background-color: var(--bg-primary);
}

a {
	color: var(--mit-red);
	text-decoration: none;
}

a:hover {
	color: var(--mit-red-bright);
	text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
	margin-top: 0;
	margin-bottom: 0.5rem;
	font-family: "neue-haas-grotesk-display";
	font-weight: 600;
	line-height: 1.2;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5, .h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p { margin-top: 0; margin-bottom: 1rem; }
hr { border: 0; border-top: 1px solid rgba(255,255,255,.15); margin: 1rem 0; }
hr.dotted { border-top-style: dotted; }
img { vertical-align: middle; border-style: none; }
small, .small { font-size: 80%; }
b, strong { font-weight: 700; }
svg { overflow: hidden; vertical-align: middle; }

/* ========== Layout ========== */
.container {
	width: 100%;
	max-width: 1140px;
	margin-left: auto;
	margin-right: auto;
	padding-left: 4vw;
	padding-right: 4vw;
}

.row {
	display: flex;
	flex-wrap: wrap;
	margin-left: -15px;
	margin-right: -15px;
}

[class*="col-"] {
	position: relative;
	width: 100%;
	padding-left: 15px;
	padding-right: 15px;
}

@media (min-width: 768px) {
	.col-md-3 { flex: 0 0 25%; max-width: 25%; }
	.col-md-4 { flex: 0 0 33.3333%; max-width: 33.3333%; }
	.col-md-5 { flex: 0 0 41.6667%; max-width: 41.6667%; }
}

/* ========== Utilities ========== */
.w-100 { width: 100%; }
.mt-5 { margin-top: 3rem; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 0.5rem; }
.pt-3 { padding-top: 1rem; }
.pt-5 { padding-top: 3rem; }
.pb-4 { padding-bottom: 1.5rem; }
.pb-5 { padding-bottom: 3rem; }
.section-gap { margin-top: 2rem; }
.text-muted { color: var(--text-muted); }

@media (min-width: 768px) {
	.mt-md-0 { margin-top: 0; }
}

/* ========== Buttons ========== */
.btn {
	display: inline-block;
	font-weight: 400;
	text-align: center;
	vertical-align: middle;
	cursor: pointer;
	padding: 0.375rem 0.75rem;
	font-size: 1rem;
	line-height: 1.5;
	border-radius: 0;
	border: 1px solid transparent;
	transition: background .15s, color .15s, border-color .15s;
	color: inherit;
}

.btn-sm {
	padding: 0.25rem 0.5rem;
	font-size: 0.875rem;
}

.btn-primary {
	color: #fff;
	background-color: var(--mit-red);
	border-color: var(--mit-red);
}

.btn-primary:hover {
	color: #fff;
	background-color: var(--mit-red-bright);
	border-color: var(--mit-red-bright);
	text-decoration: none;
}

/* ========== Images ========== */
.img-fluid {
	max-width: 100%;
	height: auto;
}

/* ========== Header ========== */
.header {
	padding: 0.75rem 0;
	border-bottom: 1px solid var(--border-color);
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 200;
	background: rgba(0, 0, 0, 0.95);
	transform: translateY(0);
	transition: transform 0.3s ease, opacity 0.3s ease;
	will-change: transform, opacity;
}

.header-hidden {
	transform: translateY(-100%);
	opacity: 0;
}

.header-content {
	max-width: 1140px;
	margin: 0 auto;
	padding: 0 15px;
}

.logo img {
	height: 55px;
	width: auto;
}

/* ========== Landing section ========== */
.landing-section {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 100dvh;
	display: flex;
	align-items: flex-start;
	padding-top: clamp(3rem, 5vh, 6rem);
	padding-bottom: clamp(3rem, 5vh, 6rem);
	z-index: 0;
	transition: transform 0.4s ease;
	will-change: transform;
}

.landing-spacer {
	height: 100dvh;
}

.landing-layout {
	display: flex;
	justify-content: space-between;
	width: 100%;
	height: 100%;
	gap: 3rem;
	max-width: 1140px;
	margin: 0 auto;
	padding-left: 4vw;
	padding-right: 4vw;
}

.landing-left {
	flex: 1;
}

.landing-logo {
	height: clamp(50px, 5vw, 80px);
	width: auto;
	margin-bottom: clamp(1rem, 1.5vw, 2rem);
}

.landing-details {
	margin-top: clamp(1rem, 1.5vw, 2rem);
}

.landing-details p {
	margin-bottom: 0.75rem;
	font-size: clamp(0.75rem, 1vw, 1rem);
}

.landing-right {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	text-align: right;
	margin-top: auto;
	align-self: flex-end;
}

.landing-right .profile-info {
	margin-top: 1rem;
	text-align: right;
}

@media (max-height: 900px) and (min-width: 768px) {
	.landing-section {
		padding-top: 4.5rem;
		padding-bottom: 4.5rem;
	}

	.landing-layout {
		gap: 2.25rem;
	}

	.landing-logo {
		height: 60px;
		margin-bottom: 1.5rem;
	}

	.landing-details {
		margin-top: 1.5rem;
	}

	.landing-details p {
		font-size: 0.75rem;
		margin-bottom: 0.55rem;
	}

	.profile-photo {
		width: 190px;
	}

	.profile-info h1 {
		font-size: 1.5rem;
	}

	.profile-info h4 {
		font-size: 0.95rem;
	}

	.landing-right .profile-info {
		margin-top: 0.75rem;
	}
}

/* ========== Main content ========== */
#main {
	padding-top: 1rem;
}

.main-container {
	position: relative;
}

.content {
	padding-bottom: 2rem;
	min-height: 100vh;
}

.scroll-bio-wrapper {
	position: relative;
	z-index: -1;
	/* Extra height creates the "pin space" — bio stays sticky while user scrolls through this */
	min-height: 100vh;
}

.scroll-bio {
	position: sticky;
	top: 50%;                       /* JS overrides with email-button Y */
	z-index: 1;
	pointer-events: auto;
	transition: opacity 0.4s ease;
	will-change: transform, opacity;
}

.scroll-bio .container {
	padding-left: 8vw;
}

#biography p {
	max-width: min(50vw, 540px);
}

.scroll-rest {
	position: relative;
	z-index: 2;
	background: rgba(0, 0, 0, 0.01);
	pointer-events: auto;
}

.bottom-spacer {
	height: 60vh;
}

.name-bold {
	font-weight: 700;
}

/* ========== Navigation tabs ========== */
.nav-tabs-light-wrapper {
	background: transparent;
	border-bottom: 2px solid transparent;
	z-index: 100;
	transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-tabs-light-wrapper.stuck {
	background: var(--bg-primary);
	border-bottom-color: var(--border-color);
}

.sticky-top {
	position: sticky;
	top: 80px;
	z-index: 100;
	will-change: transform;
}

[id="biography"],
[id="publications"],
[id="featured"] {
	scroll-margin-top: 140px;
}

.nav {
	display: flex;
	flex-wrap: wrap;
	padding-left: 0;
	margin-bottom: 0;
	list-style: none;
}

.nav-tabs-light {
	display: flex;
	flex-wrap: wrap;
	padding-left: 0;
	margin-top: 0;
	margin-bottom: 0;
	list-style: none;
}

.nav-item {
	margin-bottom: 0;
}

.nav-link {
	display: block;
	padding: 0.75rem 1rem;
	color: var(--text-muted);
	border-top: 2px solid transparent;
	border-bottom: 2px solid transparent;
	transition: color .15s, border-color .15s;
}

.nav-link:hover {
	color: var(--mit-red-bright);
	text-decoration: none;
	border-bottom-color: var(--mit-red-bright);
}

.nav-link.active {
	color: var(--mit-red-bright);
	border-bottom-color: var(--mit-red-bright);
	font-weight: 600;
}

/* ========== Collapse ========== */
.collapse {
	display: none;
}

.collapse.show {
	display: block;
}

.collapsed {
	/* marker for collapsed state */
}

/* ========== List groups ========== */
.list-group {
	display: flex;
	flex-direction: column;
	padding-left: 0;
	margin-bottom: 0;
}

.list-group-item {
	position: relative;
	display: block;
	padding: 0.75rem 1.25rem;
	background-color: transparent;
	border: 1px solid rgba(255,255,255,.1);
	margin-bottom: -1px;
}

.list-group-item-publication {
	border: none;
	border-bottom: 1px solid var(--border-color);
	padding: 1rem 0;
}

/* ========== Publications ========== */
.pub-heading {
	margin-bottom: 0.25rem;
}

.pub-title {
	color: var(--text-primary);
	text-decoration: none;
}

.pub-title:hover {
	color: var(--mit-red-bright);
	text-decoration: none;
}

.pub-authors {
	margin-bottom: 0.25rem;
}

.pub-author {
	color: var(--text-secondary);
}

.pub-journal,
.pub-date,
.pub-doi {
	color: var(--text-muted);
}

/* ========== Featured ========== */
.featured-item {
	padding: 0.75rem 0;
}

.featured-item h4 {
	margin-bottom: 0.5rem;
}

.featured-desc {
	color: var(--text-primary);
	line-height: 1.6;
	margin-bottom: 0.5rem;
}

/* ========== Profile photo ========== */
.profile-photo {
	width: clamp(150px, 15vw, 250px);
	height: auto;
	border-radius: 4px;
}

.profile-info h1 {
	margin-bottom: 0.25rem;
	font-size: clamp(1.3rem, 1.8vw, 2rem);
}

.profile-info h4 {
	margin-bottom: 0;
	font-size: clamp(0.85rem, 1.2vw, 1.25rem);
}

/* ========== Reveal / Show more ========== */
.hidden {
	display: none !important;
}

.reveal-section {
	position: relative;
	overflow: hidden;
}

.reveal-section.collapsed {
	max-height: 120px;
}

.reveal-section.expanded {
	max-height: none;
}

.reveal-fade {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 120px;
	background: linear-gradient(to bottom, transparent, var(--bg-primary));
	pointer-events: none;
	transition: opacity 0.4s ease;
}

.reveal-section.expanded .reveal-fade {
	opacity: 0;
}

.reveal-toggle {
	text-align: center;
	padding: 0.75rem 0;
	cursor: pointer;
	user-select: none;
}

.reveal-arrow {
	display: inline-block;
	color: var(--text-muted);
	font-size: 1.2rem;
	transition: transform 0.3s ease, color 0.2s ease;
}

.reveal-toggle:hover .reveal-arrow {
	color: var(--mit-red-bright);
}

.reveal-section.expanded + .reveal-toggle .reveal-arrow {
	transform: rotate(180deg);
}

/* ========== Footer ========== */
.footer-wrapper {
	background-color: transparent;
	position: relative;
	z-index: 1;
}

.footer {
	padding: 2rem 0;
}

.footer-group {
	margin-bottom: 1.5rem;
}

.footer-title {
	color: var(--text-primary);
	margin-bottom: 1rem;
}

.footer-title-no-underline {
	border: none;
}

.footer-legal {
	border-top: 1px solid var(--border-color);
	padding-top: 1rem;
	margin-top: 1rem;
}

.footer-legal-links {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem;
	align-items: center;
}

.footer-legal-links a {
	color: var(--text-secondary);
	font-size: 0.8rem;
}

.footer-legal-links a:hover {
	color: var(--mit-red);
}

/* ========== Responsive — mobile ========== */
@media (max-width: 767px) {
	.landing-logo {
		height: 50px;
	}

	.landing-section {
		height: 100dvh;
		padding-top: 0;
		padding-bottom: 0;
		align-items: stretch;
	}

	.landing-layout {
		gap: 0;
		flex-direction: column;
		height: 100dvh;
		padding-top: 3rem;
		padding-bottom: 3rem;
		box-sizing: border-box;
	}

	.landing-left {
		flex: 0 0 auto;
	}

	.landing-details {
		margin-top: 1.5rem;
	}

	.landing-details p {
		margin-bottom: 0.5rem;
		font-size: 0.8rem;
	}

	.landing-logo {
		margin-bottom: 0.5rem;
	}

	.landing-right {
		margin-top: auto;
	}

	.profile-photo {
		width: 33.33vw;
	}

	.profile-info h1 {
		font-size: 4vw;
	}

	.profile-info h4 {
		font-size: 3vw;
	}

	#biography p {
		max-width: 100%;
		margin-bottom: 0;
	}

	.bio-break {
		display: none;
	}

	#biography.section-gap {
		margin-top: 0;
	}

	.scroll-bio .container {
		padding-left: 8vw;
	}

	.scroll-bio-wrapper {
		z-index: -1;
	}

	.row {
		margin-left: -10px;
		margin-right: -10px;
	}

	[class*="col-"] {
		padding-left: 10px;
		padding-right: 10px;
	}

	h1 { font-size: 1.5rem; }

	.footer-title {
		font-size: 0.8rem;
		margin-bottom: 0.5rem;
	}

	.footer-legal {
		padding-top: 0.4rem;
		margin-top: 0.4rem;
	}

	.footer-legal-links {
		gap: 0.4rem 1rem;
	}

	.footer-legal-links a {
		font-size: 0.64rem;
	}
}

/* ========== Responsive — short desktop ========== */
@media (max-height: 900px) and (min-width: 768px) {
	.footer-title {
		font-size: 0.75rem;
	}

	.footer-legal-links a {
		font-size: 0.6rem;
	}
}
