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

/* --- Theme Variables --- */
:root {
  --bg: #fafafa;
  --bg-alt: #f0f0f0;
  --text: #1a1a1a;
  --text-secondary: #555;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #e0e0e0;
  --tag-bg: #e8eef8;
  --tag-text: #2563eb;
  --nav-bg: rgba(250, 250, 250, 0.85);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #161618;
  --bg-alt: #1e1e21;
  --text: #e4e4e7;
  --text-secondary: #a1a1aa;
  --accent: #60a5fa;
  --accent-hover: #93bbfd;
  --border: #2e2e32;
  --tag-bg: #1e293b;
  --tag-text: #60a5fa;
  --nav-bg: rgba(22, 22, 24, 0.85);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161618;
    --bg-alt: #1e1e21;
    --text: #e4e4e7;
    --text-secondary: #a1a1aa;
    --accent: #60a5fa;
    --accent-hover: #93bbfd;
    --border: #2e2e32;
    --tag-bg: #1e293b;
    --tag-text: #60a5fa;
    --nav-bg: rgba(22, 22, 24, 0.85);
  }
}

/* --- Typography --- */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  line-height: 1.3;
  font-weight: 600;
}

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

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

/* --- Layout --- */
.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Navigation --- */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.25s ease;
}

nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}

.nav-brand {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

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

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

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 450;
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* --- Theme Toggle --- */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1;
  transition: color 0.15s ease, border-color 0.15s ease;
  display: flex;
  align-items: center;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-secondary);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

/* Default (light): show moon */
.theme-toggle .icon-moon { display: inline; }
.theme-toggle .icon-sun  { display: none; }

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

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun  { display: inline; }
}

/* --- Sections --- */
section {
  padding: 2.5rem 0 1rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

/* --- About / Hero --- */
.about {
  padding-top: 2.5rem;
}

.about-grid {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.profile-photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-alt);
  border: 3px solid var(--border);
}

/* Placeholder when no image is loaded */
.profile-photo-placeholder {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--bg-alt);
  border: 3px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 2.5rem;
}

.about-content h1 {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

.about-content .title {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.about-content .bio {
  margin-bottom: 1.25rem;
  color: var(--text);
}

.social-links {
  display: flex;
  gap: 1rem;
  list-style: none;
  flex-wrap: wrap;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all 0.15s ease;
}

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

.social-links svg {
  width: 16px;
  height: 16px;
}

/* --- Publications --- */
.pub-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.pub-item {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

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

.pub-title {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
  margin-bottom: 0.25rem;
}

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

.pub-title a:hover {
  color: var(--accent);
}

.pub-authors {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
}

.pub-venue {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 0.5rem;
}

.pub-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pub-links a {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: var(--tag-bg);
  color: var(--tag-text);
  transition: opacity 0.15s ease;
}

.pub-links a:hover {
  opacity: 0.8;
}

/* --- Research --- */
#research p {
  margin-bottom: 1rem;
  color: var(--text);
}

#research p:last-child {
  margin-bottom: 0;
}

/* --- Education --- */
.edu-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.edu-item {
  padding-left: 1rem;
  border-left: 2px solid var(--accent);
}

.edu-degree {
  font-weight: 600;
  font-size: 1rem;
}

.edu-details {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* --- Footer --- */
footer {
  padding: 2rem 0;
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .about-grid {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile-photo,
  .profile-photo-placeholder {
    width: 120px;
    height: 120px;
  }

  .social-links {
    justify-content: center;
  }

  .about-content h1 {
    font-size: 1.5rem;
  }

  section {
    padding: 2rem 0 1rem;
  }

  .nav-links {
    gap: 1rem;
  }
}
