/* ============================================
   Yuanlu Xu - Academic Personal Website
   ============================================ */

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

:root {
  --primary: #1a365d;
  --primary-light: #2a5298;
  --accent: #3182ce;
  --accent-light: #63b3ed;
  --bg: #ffffff;
  --bg-alt: #f7fafc;
  --bg-card: #ffffff;
  --text: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --max-width: 1100px;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  color: var(--primary-light);
}

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

/* --- Navbar --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--transition);
}

.navbar.scrolled {
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.nav-logo:hover {
  color: var(--primary);
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.25rem 0;
  position: relative;
  transition: color var(--transition);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}

/* --- Hero --- */
.hero {
  padding: 140px 2rem 80px;
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
}

.hero-container {
  max-width: var(--max-width);
  margin: 0 auto;
}

.hero-content {
  display: flex;
  align-items: center;
  gap: 4rem;
}

.hero-image-wrapper {
  flex-shrink: 0;
}

.hero-image {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid white;
  box-shadow: var(--shadow-lg);
}

.hero-text h1 {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.hero-title {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.hero-affiliation {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.hero-bio {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 600px;
  margin-bottom: 1.5rem;
}

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

.hero-links {
  display: flex;
  gap: 1rem;
}

.icon-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: white;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.icon-link:hover {
  color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* --- Sections --- */
.section {
  padding: 80px 2rem;
}

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2.5rem;
}

/* --- Research Grid --- */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.research-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  transition: all var(--transition);
}

.research-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
  border-color: var(--accent-light);
}

.research-icon {
  font-size: 1.75rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.research-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.research-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* --- Publications --- */
.pub-filters {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.pub-filter {
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.pub-filter:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pub-filter.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

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

.pub-item {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  transition: opacity var(--transition), transform var(--transition);
}

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

.pub-item.hidden {
  display: none;
}

.pub-year {
  flex-shrink: 0;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  width: 50px;
  padding-top: 0.15rem;
}

.pub-content {
  flex: 1;
  min-width: 0;
}

.pub-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 0.35rem;
}

.pub-authors {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

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

.pub-venue {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.venue-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  background: #ebf4ff;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 4px;
}

/* --- Publication Links --- */
.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.pub-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all var(--transition);
}

.pub-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: #ebf4ff;
}

.pub-link i {
  font-size: 0.82rem;
}

.pub-link .ai {
  font-size: 0.9rem;
}

.pub-more {
  text-align: center;
  margin-top: 2.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  background: var(--primary);
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 100px;
  transition: all var(--transition);
  font-family: inherit;
}

.btn:hover {
  background: var(--primary-light);
  color: white;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* --- Timeline --- */
.timeline {
  max-width: 600px;
  margin: 2.5rem auto 0;
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 2rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -2rem;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  z-index: 1;
}

.timeline-content {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  transition: box-shadow var(--transition);
}

.timeline-content:hover {
  box-shadow: var(--shadow-sm);
}

.timeline-date {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline-content h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0.25rem 0 0.15rem;
}

.timeline-content p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* --- Contact --- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 2.5rem;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}

.contact-card:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.contact-card i {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

/* --- Footer --- */
.footer {
  padding: 2rem;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.footer p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* --- Animations --- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 1.5rem 2rem;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition);
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }

  .hero {
    padding: 110px 1.5rem 60px;
  }

  .hero-content {
    flex-direction: column;
    text-align: center;
    gap: 2rem;
  }

  .hero-image {
    width: 160px;
    height: 160px;
  }

  .hero-text h1 {
    font-size: 2rem;
  }

  .hero-bio {
    max-width: 100%;
  }

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

  .section {
    padding: 60px 1.5rem;
  }

  .section-title {
    font-size: 1.6rem;
  }

  .pub-item {
    flex-direction: column;
    gap: 0.5rem;
  }

  .pub-year {
    width: auto;
  }

  .research-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 480px) {
  .research-grid {
    grid-template-columns: 1fr;
  }

  .hero-text h1 {
    font-size: 1.75rem;
  }
}
