/* ===== Design Tokens ===== */
:root {
  --bg: #ffffff;
  --bg-alt: #f6f7fb;
  --surface: #ffffff;
  --surface-hover: #f8f9ff;
  --text: #1a1a2e;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-dark: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  --accent-soft: rgba(99, 102, 241, 0.08);
  --border: rgba(0, 0, 0, 0.07);
  --border-hover: rgba(99, 102, 241, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --max-width: 960px;
  --nav-height: 64px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0d1117;
  --bg-alt: #161b27;
  --surface: #161b27;
  --surface-hover: #1c2233;
  --text: #e6e9ef;
  --text-secondary: #9ba8bb;
  --text-muted: #6b7689;
  --accent: #818cf8;
  --accent-light: #a5b4fc;
  --accent-dark: #6366f1;
  --accent-soft: rgba(129, 140, 248, 0.12);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(129, 140, 248, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 24px);
}

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

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

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

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

/* ===== Navbar ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: background var(--transition), border-color var(--transition);
}

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

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.nav-brand .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-gradient);
}

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

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

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

.nav-links a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.theme-toggle {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  transition: all var(--transition);
  margin-left: 8px;
}

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

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

.nav-mobile-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* ===== Layout ===== */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: calc(var(--nav-height) + 48px) 24px 80px;
}

.section {
  margin-bottom: 72px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-header .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

.section-tag {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 48px 0 56px;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 500px;
  max-width: 100%;
  background: radial-gradient(ellipse at center, var(--accent-soft), transparent 70%);
  z-index: -1;
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.83rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
  background: var(--surface);
}

.hero-badge .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  position: relative;
}

.hero-badge .pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse-ring 2s ease-out infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.5); opacity: 0; }
}

.hero-avatar-wrap {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  margin: 0 auto 28px;
  padding: 4px;
  background: var(--accent-gradient);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.3);
  position: relative;
}

.hero-avatar-wrap::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: var(--accent-gradient);
  opacity: 0.15;
  z-index: -1;
  filter: blur(20px);
}

.hero-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 3px solid var(--bg);
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero .tagline {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-weight: 400;
}

.hero-social {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--accent);
  border-color: var(--border-hover);
  background: var(--accent-soft);
}

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all var(--transition);
}

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

/* ===== Research Interests ===== */
.tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.tag:hover {
  border-color: var(--border-hover);
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.tag .tag-icon {
  font-size: 1.1rem;
}

/* ===== Timeline (Education) ===== */
.timeline {
  position: relative;
  padding-left: 32px;
}

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

.timeline-item {
  position: relative;
  margin-bottom: 28px;
}

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

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

.timeline-date {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.timeline-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

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

/* ===== Prose (Future Work) ===== */
.prose {
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--text-secondary);
}

.prose p {
  margin-bottom: 16px;
}

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

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

/* ===== Publication Cards ===== */
.pub-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pub-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.pub-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition);
}

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

.pub-card:hover::before {
  opacity: 1;
}

.pub-venue {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
}

.pub-venue.eccv { background: rgba(99, 102, 241, 0.12); color: #6366f1; }
.pub-venue.icml { background: rgba(236, 72, 153, 0.12); color: #ec4899; }
.pub-venue.neurips { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.pub-venue.tip { background: rgba(34, 197, 94, 0.12); color: #22c55e; }

[data-theme="dark"] .pub-venue.eccv { color: #a5b4fc; }
[data-theme="dark"] .pub-venue.icml { color: #f9a8d4; }
[data-theme="dark"] .pub-venue.neurips { color: #fcd34d; }
[data-theme="dark"] .pub-venue.tip { color: #86efac; }

.pub-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.4;
}

.pub-authors {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.pub-authors .me {
  font-weight: 700;
  color: var(--accent);
}

.pub-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.pub-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.pub-meta .meta-item {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.pub-links {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.pub-link {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
}

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

.pub-section-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  margin-top: 8px;
}

/* ===== Project Cards ===== */
.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all var(--transition);
}

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

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.project-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.project-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.project-status.active {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
}

.project-status.completed {
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-muted);
}

.project-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.project-status.active .dot {
  animation: pulse-dot 1.8s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.project-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.project-list {
  list-style: none;
  margin-bottom: 16px;
}

.project-list li {
  font-size: 0.88rem;
  color: var(--text-secondary);
  padding-left: 20px;
  position: relative;
  margin-bottom: 6px;
}

.project-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 8px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
}

.project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-tag {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}

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

/* ===== CV Section ===== */
.cv-block {
  margin-bottom: 40px;
}

.cv-block h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cv-block h3 .icon {
  font-size: 1.2rem;
}

.cv-entry {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.cv-entry:last-child {
  border-bottom: none;
}

.cv-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.cv-entry-title {
  font-weight: 600;
  color: var(--text);
}

.cv-entry-title .me {
  color: var(--accent);
  font-weight: 700;
}

.cv-entry-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.cv-entry-note {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 500;
  margin-top: 2px;
}

.cv-award {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.cv-award:last-child {
  border-bottom: none;
}

.cv-award-date {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 80px;
}

.cv-award-title {
  font-size: 0.92rem;
  color: var(--text);
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  font-size: 0.83rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--text-secondary);
}

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

/* ===== Scroll Animations ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero h1 { font-size: 2.2rem; }
  .hero .tagline { font-size: 1rem; }
  .hero-avatar-wrap { width: 104px; height: 104px; }

  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 16px;
    gap: 4px;
    transform: translateY(-120%);
    transition: transform var(--transition);
    box-shadow: var(--shadow-md);
  }

  .nav-links.open {
    transform: translateY(0);
  }

  .nav-links a {
    width: 100%;
    padding: 12px 16px;
  }

  .nav-mobile-toggle {
    display: flex;
  }

  .section-header h2 { font-size: 1.3rem; }
  .pub-card, .project-card { padding: 20px; }
  .pub-links { margin-left: 0; }
  .project-header { flex-direction: column; }
}

@media (max-width: 480px) {
  main { padding: calc(var(--nav-height) + 32px) 16px 60px; }
  .hero h1 { font-size: 1.8rem; }
  .hero { padding: 24px 0 40px; }
}
