/* ============================================
   HANQING WANG — CUSTOM ACADEMIC HOMEPAGE
   A modern, distinctive research homepage
   ============================================ */

/* --- CSS Variables & Theming --- */
:root {
  --bg-primary: #fafbfc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #8888a0;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --accent-dark: #4834d4;
  --gradient-start: #6c5ce7;
  --gradient-end: #00cec9;
  --border-color: #e8e8f0;
  --card-shadow: 0 4px 20px rgba(108, 92, 231, 0.08);
  --card-hover-shadow: 0 8px 32px rgba(108, 92, 231, 0.16);
  --hero-overlay: rgba(26, 26, 46, 0.85);
  --nav-bg: rgba(250, 251, 252, 0.85);
  --tag-bg: #f0eeff;
  --tag-text: #6c5ce7;
  --highlight-bg: rgba(108, 92, 231, 0.06);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-width: 1100px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #0f0e17;
  --bg-secondary: #1a1932;
  --bg-card: #1e1d36;
  --text-primary: #fffffe;
  --text-secondary: #c0c0d8;
  --text-muted: #7878a0;
  --border-color: #2a2950;
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --card-hover-shadow: 0 8px 32px rgba(108, 92, 231, 0.25);
  --hero-overlay: rgba(15, 14, 23, 0.88);
  --nav-bg: rgba(15, 14, 23, 0.9);
  --tag-bg: rgba(108, 92, 231, 0.2);
  --tag-text: #a29bfe;
  --highlight-bg: rgba(108, 92, 231, 0.1);
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

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

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

[data-theme="dark"] a:hover {
  color: var(--accent-light);
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Navigation --- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition), border-color var(--transition);
}

.nav-inner {
  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-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.nav-logo span {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  position: relative;
  padding-bottom: 2px;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  transition: width var(--transition);
  border-radius: 1px;
}

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

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

/* Dark mode toggle */
.theme-toggle {
  background: none;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(30deg);
}

/* --- Hero Section --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-top: 64px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* Animated gradient mesh */
.hero-bg::before {
  content: '';
  position: absolute;
  inset: -50%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(108, 92, 231, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(0, 206, 201, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 40% 80%, rgba(253, 121, 168, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 60%, rgba(108, 92, 231, 0.15) 0%, transparent 50%);
  animation: meshMove 20s ease-in-out infinite alternate;
}

@keyframes meshMove {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-5%, 3%) scale(1.05); }
  66% { transform: translate(3%, -5%) scale(0.98); }
  100% { transform: translate(-2%, 2%) scale(1.03); }
}

/* Floating dots */
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--accent) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.06;
  animation: dotDrift 30s linear infinite;
}

@keyframes dotDrift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(60px, 60px); }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  width: 100%;
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 4rem;
}

.hero-text {
  flex: 1;
}

.hero-greeting {
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards 0.2s;
}

.hero-name {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards 0.4s;
}

.hero-name .gradient-text {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-title {
  font-size: 1.25rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards 0.6s;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 540px;
  margin-bottom: 2rem;
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards 0.8s;
}

.hero-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards 1s;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition);
}

.hero-btn.primary {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: #fff;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.hero-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(108, 92, 231, 0.4);
  color: #fff;
}

.hero-btn.secondary {
  border: 2px solid var(--border-color);
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.hero-btn.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.hero-photo {
  flex-shrink: 0;
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards 0.6s;
}

.hero-photo img {
  width: 280px;
  height: 280px;
  object-fit: cover;
  border-radius: 24px;
  border: 4px solid var(--bg-secondary);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  transition: transform var(--transition);
}

.hero-photo img:hover {
  transform: scale(1.03) rotate(1deg);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Scroll reveal animation --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible,
.reveal.no-animate {
  opacity: 1;
  transform: translateY(0);
}

/* --- Section Styles --- */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 5rem 2rem;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 40px;
  height: 3px;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  border-radius: 2px;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 3rem;
}

/* --- News Section --- */
.news-list {
  list-style: none;
  border-left: 3px solid var(--accent);
  padding-left: 1.5rem;
}

.news-item {
  position: relative;
  padding: 0.75rem 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.news-item::before {
  content: '';
  position: absolute;
  left: -1.75rem;
  top: 1.15rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-primary);
}

.news-item:first-child::before {
  background: var(--gradient-end);
  box-shadow: 0 0 0 4px rgba(0, 206, 201, 0.2);
}

.news-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-right: 0.75rem;
}

.news-highlight {
  color: var(--accent);
  font-weight: 600;
}

.news-badge {
  display: inline-block;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  letter-spacing: 0.03em;
}

/* --- Publications Section --- */
.pub-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.pub-card {
  display: flex;
  gap: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  transition: all var(--transition);
}

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

.pub-thumbnail {
  flex-shrink: 0;
  width: 200px;
  height: 140px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--highlight-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pub-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition);
}

.pub-card:hover .pub-thumbnail img {
  transform: scale(1.05);
}

.pub-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pub-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

.pub-authors {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
  line-height: 1.5;
}

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

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

.pub-venue .oral-badge,
.pub-venue .spotlight-badge {
  font-style: normal;
  font-weight: 700;
  color: #e74c3c;
}

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

.pub-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--tag-bg);
  color: var(--tag-text);
  transition: all var(--transition);
}

.pub-link:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}

/* --- Recruiting / CTA Section --- */
.cta-section {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  border-radius: 20px;
  padding: 3rem;
  color: #fff;
  text-align: center;
  margin: 0 2rem;
  max-width: calc(var(--max-width) - 4rem);
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 4rem;
}

.cta-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.cta-section p {
  font-size: 1rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 1.5rem;
  line-height: 1.7;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  background: #fff;
  color: var(--accent-dark);
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all var(--transition);
}

.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  color: var(--accent-dark);
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: border-color var(--transition);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-social {
  display: flex;
  gap: 1rem;
}

.footer-social a {
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: color var(--transition), transform var(--transition);
}

.footer-social a:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

/* --- Scroll to Top Button --- */
.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all var(--transition);
  z-index: 99;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
  .hero-content {
    flex-direction: column-reverse;
    text-align: center;
    gap: 2rem;
    padding-top: 2rem;
  }

  .hero-name {
    font-size: 2.5rem;
  }

  .hero-desc {
    margin-left: auto;
    margin-right: auto;
  }

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

  .hero-photo img {
    width: 200px;
    height: 200px;
  }

  .section {
    padding: 3rem 1.25rem;
  }

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

  .pub-card {
    flex-direction: column;
    padding: 1.25rem;
  }

  .pub-thumbnail {
    width: 100%;
    height: 180px;
  }

  .nav-links {
    gap: 1rem;
  }

  .nav-links a {
    font-size: 0.82rem;
  }

  .cta-section {
    margin: 0 1rem 3rem;
    padding: 2rem 1.5rem;
  }

  .footer-inner {
    flex-direction: column;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .hero-name {
    font-size: 2rem;
  }

  .hero-title {
    font-size: 1.05rem;
  }

  .nav-inner {
    padding: 0 1rem;
  }

  .hero-photo img {
    width: 160px;
    height: 160px;
  }
}

/* --- Selection Color --- */
::selection {
  background: var(--accent);
  color: #fff;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
