/* Light theme (default) */
:root,
[data-theme="light"] {
  --text: #1a1a1a;
  --text-soft: #555;
  --text-muted: #888;
  --accent: #2b4570;
  --accent-hover: #3d5f96;
  --bg: #fafafa;
  --bg-card: #ffffff;
  --border: #e5e5e5;
  --border-strong: #d0d0d0;
  --serif: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Dark theme */
[data-theme="dark"] {
  --text: #e8e8e8;
  --text-soft: #b0b0b0;
  --text-muted: #808080;
  --accent: #7a9dcc;
  --accent-hover: #a0bde0;
  --bg: #14171a;
  --bg-card: #1c1f23;
  --border: #2a2e33;
  --border-strong: #3a3f45;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.2s ease, color 0.2s ease;
}

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  top: 1.2rem;
  right: 1.2rem;
  z-index: 100;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: scale(1.05);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* Show sun in dark mode, moon in light mode */
[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* Header / Hero */
.hero {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.hero-photo {
  flex-shrink: 0;
  width: 140px;
  height: 140px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-text {
  flex: 1;
  min-width: 0;
}

h1 {
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-soft);
  margin: 0 0 0.8rem;
  line-height: 1.5;
}

.hero-affiliation {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0;
}

/* Links row */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 1.2rem 0 0;
  font-size: 0.92rem;
}

.links a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

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

.links svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Sections */
section {
  margin: 2.5rem 0;
}

h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 1.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}

h3 {
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.35rem;
}

p {
  margin: 0 0 1rem;
  color: var(--text-soft);
}

.body-text {
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--text);
}

.body-text p {
  color: var(--text);
  margin-bottom: 1.1rem;
}

/* Navigation menu */
.nav-menu {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 0.8rem 0;
  margin: -0.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
  z-index: 50;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.nav-menu-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.5rem;
  justify-content: center;
}

.nav-menu a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.35rem 0.2rem;
  transition: color 0.15s ease;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

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

.nav-menu a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Smooth scroll with offset for sticky nav */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 4rem;
}

/* News */
.news {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 1.2rem;
  background: var(--bg-card);
}

.news-item {
  display: flex;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}

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

.news-date {
  flex-shrink: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  min-width: 5.5rem;
  padding-top: 0.05rem;
}

.news-text {
  font-size: 0.95rem;
  color: var(--text);
  margin: 0;
  line-height: 1.5;
}

.news-text a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.news-text a:hover {
  border-bottom-color: var(--accent);
}

.news-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-right: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
  background: var(--border);
  color: var(--text-soft);
}

.news-tag.new {
  background: #16a34a;
  color: white;
}

/* Publications */
.pub-group {
  margin-bottom: 1.8rem;
}

.pub-group-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.8rem;
}

.pub {
  margin-bottom: 1.2rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
}

.pub-title {
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.2rem;
  font-size: 0.98rem;
  line-height: 1.4;
}

.pub-authors {
  font-size: 0.92rem;
  color: var(--text-soft);
  margin: 0 0 0.2rem;
}

.pub-venue {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

.pub-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: var(--accent);
  color: white;
  margin-left: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

.pub-badge.review {
  background: #d97706;
}

.pub-badge.prep {
  background: #6b7280;
}

/* Talks */
.talk {
  margin-bottom: 1.4rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
}

.talk-title {
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.2rem;
  font-size: 0.98rem;
  line-height: 1.4;
}

.talk-venue {
  font-size: 0.92rem;
  color: var(--text-soft);
  margin: 0 0 0.15rem;
}

.talk-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

/* Awards */
.award {
  padding: 0.6rem 0 0.6rem 1.2rem;
  border-left: 2px solid var(--accent);
  margin-bottom: 0.8rem;
}

.award-title {
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.15rem;
  font-size: 0.98rem;
}

.award-detail {
  font-size: 0.9rem;
  color: var(--text-soft);
  margin: 0;
  line-height: 1.5;
}

/* Projects */
.project {
  margin-bottom: 1.6rem;
  padding: 1rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.15s ease;
}

.project:hover {
  border-color: var(--border-strong);
}

.project-title {
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
}

.project-desc {
  font-size: 0.92rem;
  color: var(--text-soft);
  margin: 0 0 0.5rem;
  line-height: 1.55;
}

.project-links {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.project-links a {
  color: var(--accent);
  text-decoration: none;
  margin-right: 0.8rem;
}

.project-links a:hover {
  text-decoration: underline;
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  background: var(--border);
  color: var(--text-soft);
  border-radius: 3px;
  margin-right: 0.3rem;
  font-weight: 500;
}

/* Interests list */
ul.interests {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul.interests li {
  padding: 0.35rem 0 0.35rem 1.3rem;
  position: relative;
  color: var(--text-soft);
  font-size: 0.98rem;
}

ul.interests li:before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 600;
}

/* Footer */
footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
}

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

/* Mobile */
@media (max-width: 640px) {
  .container {
    padding: 3.5rem 1.2rem 3rem;
  }

  .theme-toggle {
    top: 0.9rem;
    right: 0.9rem;
    width: 34px;
    height: 34px;
  }

  .theme-toggle svg {
    width: 16px;
    height: 16px;
  }

  .hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.2rem;
  }

  .hero-photo {
    width: 120px;
    height: 120px;
  }

  h1 {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .links {
    justify-content: center;
  }

  .body-text {
    font-size: 1.05rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  .nav-menu {
    margin: -0.5rem -1.2rem 2rem;
    padding: 0.7rem 0;
  }

  .nav-menu-inner {
    justify-content: flex-start;
    padding: 0 1.2rem;
    gap: 0.2rem 1.2rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .nav-menu-inner::-webkit-scrollbar {
    display: none;
  }

  .nav-menu a {
    font-size: 0.85rem;
  }
}

::selection {
  background: var(--accent);
  color: white;
}
