/* Apple-inspired personal site — system type, glass nav, generous space */

:root {
	--bg: #ffffff;
	--bg-alt: #f5f5f7;
	--bg-hero: #fbfbfd;
	--text: #1d1d1f;
	--text-secondary: #6e6e73;
	--text-tertiary: #86868b;
	--link: #0066cc;
	--link-hover: #0077ed;
	--border: rgba(0, 0, 0, 0.08);
	--card-bg: #ffffff;
	--nav-bg: rgba(251, 251, 253, 0.72);
	--shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
	--radius: 18px;
	--radius-sm: 12px;
	--max: 68rem;
	--content: 68rem;
	--content-narrow: 28rem;
	--section-pad-y: 5rem;
	--section-pad-x: 1.5rem;
	--font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
		"Helvetica Neue", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #000000;
		--bg-alt: #1d1d1f;
		--bg-hero: #000000;
		--text: #f5f5f7;
		--text-secondary: #a1a1a6;
		--text-tertiary: #6e6e73;
		--link: #2997ff;
		--link-hover: #64b5ff;
		--border: rgba(255, 255, 255, 0.1);
		--card-bg: #1d1d1f;
		--nav-bg: rgba(0, 0, 0, 0.72);
		--shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
	}
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	font-family: var(--font);
	font-size: 17px;
	line-height: 1.47059;
	letter-spacing: -0.022em;
	color: var(--text);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

a {
	color: inherit;
	text-decoration: none;
}

/* Unified web links in page content */
.site-link {
	color: var(--link);
	text-decoration: none;
}

.site-link:hover,
.site-link:focus-visible {
	color: var(--link-hover);
	text-decoration: underline;
}

/* —— Global nav (Apple.com style) —— */
.site-top {
	position: sticky;
	top: 0;
	z-index: 1000;
	background: var(--bg);
	border-bottom: 1px solid var(--border);
}

.global-nav {
	background: var(--nav-bg);
	backdrop-filter: saturate(180%) blur(20px);
	-webkit-backdrop-filter: saturate(180%) blur(20px);
}

.nav-inner {
	max-width: var(--max);
	margin: 0 auto;
	padding: 0 1rem;
	height: 48px;
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 1rem;
	position: relative;
	z-index: 1002;
}

.site-top:not(.nav--inline) .nav-toggle {
	margin-left: auto;
}

.site-top.nav--inline .nav-drawer {
	flex: 1 1 auto;
	min-width: 0;
	position: static;
	visibility: visible;
	opacity: 1;
	pointer-events: auto;
	background: transparent;
	z-index: auto;
}

.site-top.nav--inline .nav-drawer .nav-links {
	flex-direction: row;
	justify-content: flex-end;
	align-items: center;
	flex-wrap: nowrap;
	gap: 0 1.25rem;
	width: 100%;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	max-width: none;
	overflow: hidden;
}

.site-top.nav--inline .nav-drawer .nav-links a {
	font-size: 0.75rem;
	font-weight: 500;
	padding: 0;
	letter-spacing: -0.01em;
}

.nav-logo {
	flex-shrink: 0;
	white-space: nowrap;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--text);
	letter-spacing: -0.01em;
}

.nav-logo:hover {
	text-decoration: none;
	color: var(--text);
	opacity: 0.8;
}

/* Menu button (compact / hamburger mode) */
.site-top:not(.nav--inline) .nav-toggle {
	display: flex;
}

.nav-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	margin: 0 -0.5rem 0 0;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.nav-toggle-icon {
	position: relative;
	width: 1.125rem;
	height: 1px;
	background: var(--text);
	border-radius: 1px;
	transition: background 0.2s ease;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
	content: "";
	position: absolute;
	left: 0;
	width: 100%;
	height: 1px;
	background: var(--text);
	border-radius: 1px;
	transition: transform 0.25s ease, top 0.25s ease;
}

.nav-toggle-icon::before {
	top: -6px;
}

.nav-toggle-icon::after {
	top: 6px;
}

.nav-open .nav-toggle-icon {
	background: transparent;
}

.nav-open .nav-toggle-icon::before {
	top: 0;
	transform: rotate(45deg);
}

.nav-open .nav-toggle-icon::after {
	top: 0;
	transform: rotate(-45deg);
}

/* Compact drawer (when links do not fit one row) — hidden until hamburger opens */
.site-top:not(.nav--inline) .nav-drawer {
	display: none;
	position: fixed;
	top: 48px;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1001;
	height: auto;
	background: var(--bg);
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
}

.site-top.nav-mode-switch .nav-drawer {
	display: none !important;
	visibility: hidden !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

/* No full-screen drawer flash while the window is being resized */
html.nav-resizing .site-top:not(.nav--inline) .nav-drawer {
	display: none !important;
	transition: none;
	visibility: hidden !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

html.nav-resizing.nav-open .site-top:not(.nav--inline) .nav-drawer {
	visibility: hidden !important;
	opacity: 0 !important;
}

html.nav-open .site-top:not(.nav--inline) .nav-drawer {
	display: block;
	visibility: visible;
	opacity: 1;
	pointer-events: auto;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.site-top:not(.nav--inline) .nav-drawer .nav-links {
	flex-direction: column;
	align-items: flex-start;
	gap: 0;
	margin: 0 auto;
	padding: 2rem 1.75rem;
	max-width: var(--max);
	width: 100%;
	min-height: calc(100vh - 48px);
	min-height: calc(100dvh - 48px);
	box-sizing: border-box;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.site-top:not(.nav--inline) .nav-drawer .nav-links a {
	font-size: clamp(1.5rem, 5vw, 1.85rem);
	font-weight: 600;
	letter-spacing: -0.02em;
	line-height: 1.2;
	padding: 0.55rem 0;
}

.nav-drawer .nav-links a:hover,
.nav-drawer .nav-links a.is-active {
	color: var(--text);
	text-decoration: none;
}

.nav-open {
	overflow: hidden;
}

/* Desktop inline nav */
.nav-links {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 0 1.25rem;
}

.nav-links a {
	flex-shrink: 0;
	white-space: nowrap;
	font-size: 0.75rem;
	color: var(--text-secondary);
	letter-spacing: -0.01em;
	transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.is-active {
	color: var(--text);
	text-decoration: none;
}

/* —— Hero —— */
.hero {
	background: var(--bg-hero);
	padding: 4rem 1.5rem 5rem;
	text-align: center;
}

.hero-inner {
	max-width: var(--max);
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2.5rem;
}

.hero-copy {
	max-width: 40rem;
}

.hero-eyebrow {
	margin: 0 0 0.5rem;
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--text-tertiary);
}

.hero-title {
	margin: 0 0 0.75rem;
	font-size: clamp(2.75rem, 8vw, 4.5rem);
	font-weight: 700;
	letter-spacing: -0.04em;
	line-height: 1.05;
	background: linear-gradient(180deg, var(--text) 0%, var(--text-secondary) 100%);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

@media (prefers-color-scheme: dark) {
	.hero-title {
		background: linear-gradient(180deg, #f5f5f7 0%, #a1a1a6 100%);
		-webkit-background-clip: text;
		background-clip: text;
	}
}

.hero-subtitle {
	margin: 0 0 1.75rem;
	font-size: clamp(1.1rem, 2.5vw, 1.35rem);
	font-weight: 400;
	line-height: 1.4;
	color: var(--text-secondary);
	letter-spacing: -0.01em;
}

.hero-cta {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75rem;
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.65rem 1.35rem;
	font-size: 0.95rem;
	font-weight: 500;
	border-radius: 980px;
	letter-spacing: -0.01em;
	transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.btn:hover {
	text-decoration: none;
	transform: scale(1.02);
}

.btn-primary {
	background: var(--link);
	color: #fff;
}

.btn-primary:hover {
	background: var(--link-hover);
	color: #fff;
}

.btn-secondary {
	background: transparent;
	color: var(--link);
	box-shadow: inset 0 0 0 1px var(--border);
}

@media (prefers-color-scheme: dark) {
	.btn-secondary {
		box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
	}
}

.btn-secondary:hover {
	background: rgba(0, 102, 204, 0.08);
	color: var(--link);
}

.hero-portrait {
	margin: 0;
}

.hero-portrait img {
	width: min(280px, 70vw);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}

/* —— Bands (sections) —— */
.band {
	padding: var(--section-pad-y) var(--section-pad-x);
	background: var(--bg);
}

.band-alt {
	background: var(--bg-alt);
}

.band-contact {
	padding: var(--section-pad-y) var(--section-pad-x) calc(var(--section-pad-y) + 1rem);
	text-align: center;
}

.band-inner,
.band-inner-wide {
	max-width: var(--content);
	margin: 0 auto;
}

.band-inner-narrow {
	max-width: var(--content-narrow);
	margin: 0 auto;
}

.band-headline {
	margin: 0 0 0.5rem;
	font-size: clamp(2rem, 5vw, 2.75rem);
	font-weight: 700;
	letter-spacing: -0.03em;
	line-height: 1.1;
	text-align: center;
}

.band-lead {
	margin: 0 0 2.5rem;
	max-width: none;
	font-size: 1.15rem;
	color: var(--text-secondary);
	text-align: center;
	letter-spacing: -0.01em;
}

.band-foot {
	margin-top: 2rem;
	text-align: center;
}

.prose {
	max-width: none;
}

.prose p {
	margin: 0 0 1rem;
	color: var(--text-secondary);
}

.prose strong {
	color: var(--text);
	font-weight: 600;
}

.link-row {
	margin-top: 1.25rem;
}

.subsection-title {
	margin: 3rem 0 1.25rem;
	font-size: 1.35rem;
	font-weight: 600;
	letter-spacing: -0.02em;
	text-align: center;
	color: var(--text);
}

/* —— Tiles —— */
.tile-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 1rem;
	margin-bottom: 1rem;
}

.tile {
	padding: 1.75rem;
	background: var(--card-bg);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	border: 1px solid var(--border);
}

.tile h3 {
	margin: 0 0 0.5rem;
	font-size: 1.15rem;
	font-weight: 600;
	letter-spacing: -0.02em;
}

.tile p {
	margin: 0;
	font-size: 0.95rem;
	color: var(--text-secondary);
	line-height: 1.45;
}

/* —— Cards (selected papers) —— */
.card-stack {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.card {
	padding: 1.5rem 1.75rem;
	background: var(--card-bg);
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
	transform: translateY(-2px);
	box-shadow: var(--shadow);
}

.card-year {
	margin: 0 0 0.35rem;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--text-tertiary);
	letter-spacing: 0.02em;
}

.card-title {
	margin: 0 0 0.35rem;
	font-size: 1.05rem;
	font-weight: 600;
	letter-spacing: -0.02em;
	line-height: 1.35;
}

.card-title a {
	color: var(--text);
}

.card-title a:hover {
	color: var(--link);
	text-decoration: none;
}

.card-meta {
	margin: 0;
	font-size: 0.9rem;
	color: var(--text-secondary);
}

/* —— Publication list —— */
.pub-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.pub-item {
	display: grid;
	grid-template-columns: 4rem 1fr;
	gap: 1.25rem;
	padding: 1.35rem 0;
	border-bottom: 1px solid var(--border);
	align-items: start;
}

.pub-item:last-child {
	border-bottom: none;
}

.pub-year {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--text-tertiary);
	padding-top: 0.15rem;
}

.pub-title {
	margin: 0 0 0.25rem;
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: -0.02em;
	line-height: 1.35;
}

.pub-title a,
.thesis-paper-title {
	color: var(--text);
	font-weight: 600;
	font-size: 1rem;
	letter-spacing: -0.02em;
	line-height: 1.35;
	text-decoration: none;
}

.pub-title a:hover,
.pub-title a:focus-visible,
.thesis-paper-title:hover,
.thesis-paper-title:focus-visible {
	color: var(--link);
	text-decoration: none;
}

.pub-meta {
	margin: 0;
	font-size: 0.9rem;
	color: var(--text-secondary);
}

/* —— Thesis errata —— */
.band-lead-left {
	text-align: left;
	margin-left: 0;
	margin-right: 0;
}

#thesis-corrections .band-headline {
	text-align: left;
}

.thesis-intro {
	margin: 0 0 2.5rem;
	max-width: none;
	font-size: 1.15rem;
	line-height: 1.5;
	letter-spacing: -0.01em;
	color: var(--text-secondary);
}

.errata-list {
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: errata;
}

.errata-item {
	counter-increment: errata;
	padding: 1.35rem 0;
	border-bottom: 1px solid var(--border);
}

.errata-item:last-child {
	border-bottom: none;
}

.errata-item::before {
	content: counter(errata) ".";
	display: block;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--text-tertiary);
	margin-bottom: 0.35rem;
}

.errata-location {
	margin: 0 0 0.35rem;
	font-size: 1rem;
}

.errata-detail {
	margin: 0;
	color: var(--text-secondary);
}

.errata-detail code {
	font-size: 0.9em;
	padding: 0.1em 0.35em;
	border-radius: 4px;
	background: var(--bg-alt);
}

.errata-sublist {
	margin: 0.75rem 0 0;
	padding-left: 1.25rem;
	color: var(--text-secondary);
}

.errata-sublist li {
	margin-bottom: 0.75rem;
}

.errata-quote {
	margin: 0.5rem 0 0;
	padding: 0.85rem 1rem;
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--text);
	background: var(--card-bg);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	border-left: 3px solid var(--link);
}

.errata-invite {
	margin: 1.75rem 0 0;
	padding: 1rem 1.25rem;
	font-size: 0.95rem;
	color: var(--text-secondary);
	background: var(--card-bg);
	border-radius: var(--radius-sm);
	border: 1px solid var(--border);
}

/* —— Timeline —— */
.timeline {
	list-style: none;
	margin: 0;
	padding: 0;
}

.timeline li {
	display: grid;
	grid-template-columns: minmax(10rem, auto) 1fr;
	gap: 1rem;
	padding: 0.85rem 0;
	border-bottom: 1px solid var(--border);
	align-items: baseline;
}

.timeline li:last-child {
	border-bottom: none;
}

.timeline time {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--text-tertiary);
	white-space: nowrap;
}

.timeline span {
	color: var(--text-secondary);
}

.timeline em {
	color: var(--text);
	font-style: normal;
	font-weight: 500;
}

/* —— Gallery —— */
.gallery {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 1rem;
	margin-top: 1rem;
}

.gallery-item {
	position: relative;
	display: block;
	border-radius: var(--radius);
	overflow: hidden;
	aspect-ratio: 4 / 3;
	background: var(--bg-alt);
}

.gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.gallery-item--focus-top img {
	object-position: top center;
	transform-origin: top center;
}

.gallery-item span {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 2rem 1rem 1rem;
	font-size: 0.9rem;
	font-weight: 500;
	color: #fff;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
}

.gallery-item:hover {
	text-decoration: none;
}

.gallery-item:hover img {
	transform: scale(1.04);
}

/* —— Contact —— */
.contact-emails {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-top: 1rem;
}

.contact-email {
	margin: 0;
}

.email-display {
	font-size: clamp(1.25rem, 3vw, 1.75rem);
	font-weight: 500;
	letter-spacing: -0.02em;
	color: var(--link);
}

.email-display:hover,
.email-display:focus-visible {
	color: var(--link-hover);
	text-decoration: underline;
}

/* —— Footer —— */
.site-footer {
	padding: 2rem 1.5rem 2.5rem;
	background: var(--bg-alt);
	border-top: 1px solid var(--border);
}

.footer-inner {
	max-width: var(--max);
	margin: 0 auto;
	text-align: center;
}

.site-footer p {
	margin: 0.25rem 0;
	font-size: 0.75rem;
	color: var(--text-tertiary);
}

/* —— Scroll reveal —— */
.reveal {
	opacity: 0;
	transform: translateY(24px);
	transition: opacity 0.7s cubic-bezier(0.25, 0.1, 0.25, 1),
		transform 0.7s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.reveal.is-visible {
	opacity: 1;
	transform: translateY(0);
}

/* —— Responsive —— */
@media (min-width: 768px) {
	.hero-inner {
		flex-direction: row-reverse;
		justify-content: center;
		text-align: left;
	}

	.hero-copy {
		flex: 1;
		max-width: 36rem;
	}

	.hero-cta {
		justify-content: flex-start;
	}

	.band-headline,
	.band-lead,
	.subsection-title,
	.band-foot {
		text-align: left;
	}

	.band-lead {
		text-align: left;
	}

	.band-contact .band-headline,
	.band-contact .contact-email {
		text-align: center;
	}
}

.site-top.nav--inline .nav-toggle {
	display: none;
}

.nav-measure-probe {
	position: absolute;
	left: -9999px;
	top: 0;
	width: auto;
	height: 0;
	overflow: hidden;
	visibility: hidden;
	pointer-events: none;
}

.nav-measure-row {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 0 1.25rem;
}

.nav-measure-link {
	flex-shrink: 0;
	white-space: nowrap;
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: -0.01em;
}

@media (max-width: 640px) {
	.pub-item {
		grid-template-columns: 1fr;
		gap: 0.35rem;
	}

	.timeline li {
		grid-template-columns: 1fr;
		gap: 0.25rem;
	}
}

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

	.reveal {
		opacity: 1;
		transform: none;
		transition: none;
	}

	.card:hover,
	.gallery-item:hover img,
	.btn:hover {
		transform: none;
	}

	.nav-drawer,
	.nav-toggle-icon,
	.nav-toggle-icon::before,
	.nav-toggle-icon::after,
	html.nav-resizing .nav-drawer {
		transition: none;
	}
}
