/* ===== Theme variables ===== */
:root {
  --bg: #ffffff;
  --text: #2b2b2b;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --border: #e6e8eb;
  --tag-bg: #f1f5f9;
  --tag-text: #475569;
  --max-width: 1020px;
  --radius: 10px;
  --shadow: 0 6px 22px rgba(15, 23, 42, 0.10);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
}

html.dark {
  --bg: #14171c;
  --text: #e6e8eb;
  --muted: #9aa3af;
  --accent: #6ea8fe;
  --accent-soft: #1c2430;
  --border: #2a2f37;
  --tag-bg: #1c222b;
  --tag-text: #b6c0cc;
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
}

/* ===== Base ===== */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ===== Site header (shared layout with the blog) ===== */
.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  line-height: 2;
}
.nav .logo a {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.nav .menu {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 18px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav .menu a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.nav .menu a:hover { color: var(--accent); text-decoration: none; }
#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--text);
  display: inline-flex;
  align-items: center;
}
#theme-toggle svg { width: 17px; height: 17px; }
html.dark #theme-toggle .moon { display: none; }
html:not(.dark) #theme-toggle .sun { display: none; }

/* ===== Header / profile ===== */
header.profile {
  display: flex;
  gap: 32px;
  align-items: center;
  padding: 56px 0 12px;
}
header.profile .photo {
  flex: 0 0 auto;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--tag-bg);
}
header.profile .intro h1 {
  margin: 0 0 4px;
  font-size: 30px;
  letter-spacing: -0.01em;
}
header.profile .intro .cn-name {
  font-weight: 400;
  color: var(--muted);
  font-size: 20px;
  margin-left: 8px;
}
header.profile .intro .tagline {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 15px;
}

/* ===== Social / contact links ===== */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}
.links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: var(--bg);
  transition: all 0.15s ease;
}
.links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

/* ===== Sections ===== */
section { padding-top: 36px; scroll-margin-top: 70px; }
section h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

p.about { margin: 0; }
p.about + p.about { margin-top: 14px; }

/* ===== Timeline rows (education / experience) ===== */
.row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  margin: 4px 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.row:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border);
  background: var(--bg);
}
.row .role { font-weight: 600; }
.row .org { color: var(--muted); }
.row .date {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  text-align: right;
}
.row .detail {
  color: var(--muted);
  font-size: 14.5px;
  margin-top: 4px;
}

/* ===== Research interests ===== */
.research-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.research-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.research-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}
.ri-title { font-weight: 700; margin: 0 0 6px; font-size: 16px; }
.ri-desc { color: var(--muted); font-size: 14px; line-height: 1.55; }

/* ===== News ===== */
ul.news {
  list-style: none;
  margin: 0;
  padding: 0;
}
ul.news li {
  display: flex;
  gap: 12px;
  padding: 7px 0;
}
ul.news li .when {
  flex: 0 0 96px;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

/* ===== Publications (zhiningliu.com style) ===== */
.pub {
  padding: 16px;
  margin: 6px 0;
  border: 1px solid transparent;
  border-radius: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.pub:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border);
  background: var(--bg);
}
.pub-title {
  display: block;
  font-weight: 600;
  font-size: 16.5px;
  line-height: 1.4;
  color: var(--accent);
}
.pub-title:hover { text-decoration: underline; }
.pub-authors { color: var(--text); font-size: 14.5px; margin-top: 3px; }
.pub-authors .me { font-weight: 700; }
.pub-venue { color: var(--muted); font-style: italic; font-size: 14px; margin-top: 2px; }
.pub-insight { font-size: 14.5px; line-height: 1.55; margin-top: 6px; color: var(--text); }
.pub-insight strong { color: var(--accent); }
.pub-links { margin-top: 8px; font-size: 13px; }
.pub-links a {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 9px;
  margin-right: 7px;
  color: var(--muted);
  font-weight: 500;
}
.pub-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.pub-links a svg { width: 13px; height: 13px; }
.pub-links a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.tags { margin-top: 8px; }
.tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 999px;
  margin: 0 5px 5px 0;
  background: hsl(var(--h, 215) 45% 90%);
  color: hsl(var(--h, 215) 38% 32%);
}
html.dark .tag {
  background: hsl(var(--h, 215) 22% 22%);
  color: hsl(var(--h, 215) 58% 78%);
}

/* ===== Publications toolbar / tag filter ===== */
.pub-note { color: var(--muted); font-size: 14px; margin: -6px 0 14px; }
.pub-note .me { color: var(--text); font-weight: 700; }
.pub-toolbar { margin-bottom: 10px; }
.tag-filter { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-tag {
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 11px;
  border-radius: 999px;
  background: transparent;
  color: hsl(var(--h, 215) 38% 38%);
  border: 1px solid hsl(var(--h, 215) 40% 80%);
  transition: all 0.12s ease;
}
.filter-tag:hover { border-color: hsl(var(--h, 215) 45% 58%); }
.filter-tag.active {
  background: hsl(var(--h, 215) 45% 90%);
  color: hsl(var(--h, 215) 38% 26%);
  border-color: hsl(var(--h, 215) 45% 85%);
}
.filter-tag .tag-count { opacity: 0.55; font-size: 11px; }
html.dark .filter-tag { color: hsl(var(--h, 215) 55% 75%); border-color: hsl(var(--h, 215) 28% 34%); }
html.dark .filter-tag.active {
  background: hsl(var(--h, 215) 30% 26%);
  color: hsl(var(--h, 215) 60% 80%);
  border-color: hsl(var(--h, 215) 30% 32%);
}
.pub-status { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.pub-status a { color: var(--muted); text-decoration: underline; }
.pub-toggle { text-align: center; margin-top: 12px; }
.show-all {
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 20px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
}
.show-all:hover { border-color: var(--accent); background: var(--accent-soft); }
.show-all .chev { font-size: 9px; }

/* ===== Back-to-top button ===== */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #3f5a78;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s, background 0.15s ease;
  z-index: 60;
}
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { background: #34506f; }
.to-top svg { width: 20px; height: 20px; }

/* ===== Awards / lists ===== */
ul.plain { padding-left: 18px; margin: 0; }
ul.plain li { padding: 3px 0; }

/* ===== Footer ===== */
footer {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  header.profile {
    flex-direction: column;
    text-align: center;
    padding-top: 36px;
  }
  header.profile .links { justify-content: center; }
  .row { flex-direction: column; }
  .row .date { text-align: left; }
  .nav { flex-wrap: wrap; gap: 8px; }
  .research-grid { grid-template-columns: 1fr; }
}
