/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:       #fafaf8;
  --white:    #ffffff;
  --text:     #111111;
  --muted:    #696969;
  --subtle:   #9b9b9b;
  --accent:   #1a3a5c;
  --accent-hover: #245080;
  --border:   #e4e4de;
  --photo-bg: #e9e9e4;

  --nav-h: 64px;
  --max-w: 1080px;
  --section-gap: 96px;
}

html {
  scroll-behavior: smooth;
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 32px;
}

main {
  padding-top: var(--nav-h);
}

section {
  padding: var(--section-gap) 0;
}

section + section {
  border-top: 1px solid var(--border);
}

/* ─── Navigation ────────────────────────────────────────────── */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(250, 250, 248, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: box-shadow 0.2s ease;
}

#navbar.scrolled {
  box-shadow: 0 1px 0 var(--border);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 32px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-name {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.nav-name:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 36px;
  align-items: center;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

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

/* CV link — slightly distinguished */
.nav-links li:nth-last-child(2) a {
  color: var(--accent);
}

.nav-links li:nth-last-child(2) a:hover {
  color: var(--accent-hover);
}

/* Mobile toggle button */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  width: 28px;
  height: 28px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--text);
  transition: transform 0.2s, opacity 0.2s;
  transform-origin: center;
}

.nav-toggle.active span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.active span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* ─── About Section ─────────────────────────────────────────── */
#about {
  padding-top: calc(var(--section-gap) + 24px);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 64px;
  align-items: start;
}

.about-text h1 {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(2.6rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: var(--text);
  margin-bottom: 16px;
}

.subtitle {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 40px;
}

.institution {
  font-size: 0.875rem;
  color: var(--subtle);
}

.bio p {
  font-size: 1rem;
  line-height: 1.75;
  color: #333333;
  margin-bottom: 20px;
}

.bio p:last-child {
  margin-bottom: 0;
}

.bio a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s;
}

.bio a:hover {
  text-decoration-color: var(--accent);
}

/* Photo */
.about-photo {
  position: sticky;
  top: calc(var(--nav-h) + 48px);
}

.about-photo img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center top;
  border-radius: 4px;
  background: var(--photo-bg);
  display: block;
  filter: grayscale(10%);
}

/* ─── Research Section ──────────────────────────────────────── */
#research {
  background: var(--white);
}

#research h2, #contact h2 {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 20px;
}

.research-prose p {
  font-size: 0.9375rem;
  color: #555555;
  line-height: 1.75;
  max-width: 680px;
}

.section-intro {
  font-size: 0.975rem;
  color: var(--muted);
  max-width: 640px;
  line-height: 1.7;
  margin-bottom: 56px;
}

.research-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.research-item {
  padding: 36px 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
}

.research-item:first-child {
  border-top: 1px solid var(--border);
}

.research-meta {
  font-size: 0.775rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
  padding-top: 4px;
}

.research-item h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.4;
}

.research-item p {
  font-size: 0.9375rem;
  color: #555555;
  line-height: 1.7;
}

/* ─── Contact Section ───────────────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}

.contact-grid > div:first-child h2 {
  margin-bottom: 16px;
}

.contact-grid > div:first-child > p {
  color: var(--muted);
  font-size: 0.975rem;
  margin-bottom: 20px;
}

.email-display {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 24px !important;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.email-display .at {
  color: var(--subtle);
  font-size: 0.875rem;
  padding: 0 2px;
}

.email-btn {
  display: inline-block;
  padding: 11px 28px;
  background: var(--accent);
  color: var(--white);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 3px;
  transition: background 0.15s;
}

.email-btn:hover {
  background: var(--accent-hover);
}

.consulting-note {
  padding: 36px;
  background: var(--bg);
  border-radius: 4px;
  border: 1px solid var(--border);
}

.consulting-note h3 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle);
  margin-bottom: 16px;
}

.consulting-note p {
  font-size: 0.9375rem;
  color: #555555;
  line-height: 1.75;
}

/* ─── Footer ────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
}

footer p {
  font-size: 0.8125rem;
  color: var(--subtle);
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 860px) {
  :root {
    --section-gap: 64px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .about-photo {
    position: static;
    max-width: 220px;
    margin: 0 auto;
  }

  /* Move photo above bio on mobile — reorder */
  .about-grid .about-photo {
    order: -1;
  }

  .research-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

/* Hamburger nav kicks in at tablet width, not just small phones */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: rgba(250, 250, 248, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-direction: column;
    gap: 0;
    padding: 8px 0 20px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a {
    display: block;
    padding: 14px 32px;
    font-size: 0.9375rem;
  }

  .nav-toggle {
    display: flex;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 0 20px;
  }

  #about {
    padding-top: calc(var(--nav-h) + 32px);
  }

  .email-display {
    word-break: break-all;
  }

  .email-btn {
    display: block;
    text-align: center;
    padding: 14px 28px;
  }

  .consulting-note {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  :root {
    --section-gap: 48px;
  }

  .container {
    padding: 0 16px;
  }

  .about-photo {
    max-width: 180px;
  }
}
