/* ==========================================================================
   Chenyu Liu — Academic Homepage Stylesheet
   Editorial Academic Aesthetic · PolyU Burgundy Accent · Light/Dark Themes
   ========================================================================== */

:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-subtle: #f3f1ec;
  --text: #18181b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --border: #e5e2dc;
  --border-strong: #d4d0c8;
  --accent: #961c34;
  --accent-hover: #7a1428;
  --accent-soft: rgba(150, 28, 52, 0.08);
  --badge-conf-bg: #eef2ff;
  --badge-conf-text: #3730a3;
  --badge-journal-bg: #fdf2f4;
  --badge-journal-text: #961c34;
  --badge-oral-bg: #ecfdf5;
  --badge-oral-text: #065f46;
  --badge-review-bg: #fffbeb;
  --badge-review-text: #92400e;
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.04);
  --shadow-md: 0 8px 24px rgba(24, 24, 27, 0.06);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-serif: "Iowan Old Style", "Charter", "Palatino Linotype", Georgia, "Songti SC", "STSong", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #111113;
  --surface: #18181b;
  --surface-subtle: #202024;
  --text: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border: #27272a;
  --border-strong: #3f3f46;
  --accent: #e0526d;
  --accent-hover: #f06e86;
  --accent-soft: rgba(224, 82, 109, 0.14);
  --badge-conf-bg: rgba(99, 102, 241, 0.16);
  --badge-conf-text: #a5b4fc;
  --badge-journal-bg: rgba(224, 82, 109, 0.16);
  --badge-journal-text: #fda4af;
  --badge-oral-bg: rgba(16, 185, 129, 0.16);
  --badge-oral-text: #6ee7b7;
  --badge-review-bg: rgba(245, 158, 11, 0.16);
  --badge-review-text: #fcd34d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.35);
}

/* Language switching */
[data-lang="en"] .lang-zh { display: none; }
[data-lang="zh"] .lang-en { display: none; }

/* Base Reset */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover { color: var(--text); }
.brand-name {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-cn {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-weight: 400;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}
.nav-links a {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
}
.nav-links a:hover { color: var(--accent); }

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.control-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
}
.control-btn.icon-only {
  width: 34px;
  padding: 0;
}
.control-btn svg {
  width: 16px;
  height: 16px;
}
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }

/* Hero */
.hero {
  padding: 56px 0 32px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 44px;
  align-items: start;
}

.hero-avatar-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-avatar {
  width: 220px;
  height: 220px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  background: var(--surface-subtle);
}

.avatar-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.meta-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--accent);
}

.hero-kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

.hero-title {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: 2.35rem;
  line-height: 1.18;
  letter-spacing: -0.02em;
}
.title-sub {
  font-size: 1.45rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 8px;
}

.hero-affiliation {
  margin: 0 0 18px;
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.65;
}

.hero-bio {
  margin: 0 0 20px;
  color: var(--text);
  font-size: 0.97rem;
  line-height: 1.78;
}

.research-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.tag {
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 500;
}

.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.87rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}
.pill-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
  color: var(--text);
  transform: translateY(-1px);
}
.pill-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.pill-btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
}
.pill-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Highlights Strip */
.highlights-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 40px;
}

.highlight-card {
  padding: 18px 22px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.highlight-value {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.highlight-label {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Sections */
.section {
  padding: 44px 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: 72px;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.section-title {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

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

/* Publications */
.filter-group {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.filter-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.filter-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

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

.pub-item {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 20px;
  padding: 20px 22px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.pub-item:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.pub-item.hidden {
  display: none;
}

.pub-year {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding-top: 4px;
}

.pub-title {
  margin: 0 0 6px;
  font-size: 1.03rem;
  font-weight: 650;
  line-height: 1.45;
  color: var(--text);
}

.pub-title-link {
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s ease;
}
.pub-title-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pub-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.77rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.pub-link-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.pub-link-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.pub-authors {
  margin: 0 0 11px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.pub-authors .me {
  color: var(--text);
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}
.author-note {
  color: var(--text-muted);
  font-size: 0.85rem;
}

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

.venue-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
}
.venue-conf {
  background: var(--badge-conf-bg);
  color: var(--badge-conf-text);
}
.venue-journal {
  background: var(--badge-journal-bg);
  color: var(--badge-journal-text);
}
.venue-oral {
  background: var(--badge-oral-bg);
  color: var(--badge-oral-text);
}
.venue-review {
  background: var(--badge-review-bg);
  color: var(--badge-review-text);
}

.topic-chip {
  padding: 2px 9px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Projects */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.project-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.project-title {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.4;
}

.stack-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stack-chip {
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.project-points {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.68;
}
.project-points li + li {
  margin-top: 8px;
}

/* Education & Experience */
.two-col-section {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 36px;
  align-items: start;
}

.timeline {
  position: relative;
  margin-top: 20px;
  padding-left: 22px;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.timeline-item {
  position: relative;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -29px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}

.timeline-period {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 3px;
}

.timeline-org {
  margin: 0 0 2px;
  font-size: 1.03rem;
  font-weight: 650;
}

.timeline-role {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.timeline-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* Awards & Service */
.info-box {
  padding: 24px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.award-entry {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 16px;
}

.award-badge {
  flex-shrink: 0;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  background: var(--badge-oral-bg);
  color: var(--badge-oral-text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.award-title {
  margin: 0 0 4px;
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.45;
}

.award-sub {
  margin: 0;
  font-size: 0.87rem;
  color: var(--text-secondary);
}

.service-intro {
  margin: 14px 0 14px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.reviewer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reviewer-chip {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 40px;
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-inner p { margin: 0; }
.back-top {
  color: var(--text-secondary);
  font-weight: 500;
}
.back-top:hover { color: var(--accent); }

/* Responsive */
@media (max-width: 860px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 26px;
  }
  .hero-avatar-wrap {
    flex-direction: row;
    align-items: center;
  }
  .hero-avatar {
    width: 132px;
    height: 132px;
  }
  .project-grid,
  .two-col-section,
  .highlights-strip {
    grid-template-columns: 1fr;
  }
  .nav-links {
    display: none;
  }
}

@media (max-width: 600px) {
  .container { padding: 0 18px; }
  .hero { padding-top: 32px; }
  .hero-avatar-wrap {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-title { font-size: 1.85rem; }
  .title-sub { font-size: 1.15rem; }
  .pub-item {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 16px 18px;
  }
  .filter-group {
    width: 100%;
    justify-content: space-between;
  }
  .filter-btn {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
