/* --------------------------------------------------------------
   Zaixiang Zheng - Personal Homepage
   Minimal, academic, responsive. Light/Dark themes.
-----------------------------------------------------------------*/

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-soft: #f3efe8;
  --border: #e6e1d6;
  --border-soft: #ede9e0;
  --text: #1f2328;
  --text-soft: #555c66;
  --muted: #8a8f98;
  --accent: #7c3f58;          /* plum / burgundy */
  --accent-soft: #c58ba1;
  --accent-bg: rgba(124, 63, 88, 0.05);
  --highlight: #a7542e;       /* terracotta */
  --link: #7c3f58;
  --link-hover: #4a2135;
  --code-bg: #f3efe8;
  --shadow: 0 1px 3px rgba(30, 20, 40, 0.06), 0 4px 16px rgba(30, 20, 40, 0.04);
  --radius: 10px;
  --max-width: 960px;
  --font-serif: "Palatino", "Palatino Linotype", "Book Antiqua", "Source Serif Pro", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141418;
    --surface: #1b1b21;
    --surface-soft: #24242c;
    --border: #2c2c36;
    --border-soft: #25252e;
    --text: #e9e7e2;
    --text-soft: #bdbac2;
    --muted: #8a8692;
    --accent: #d49ab0;
    --accent-soft: #a46b82;
    --accent-bg: rgba(212, 154, 176, 0.08);
    --highlight: #e0a07b;
    --link: #d49ab0;
    --link-hover: #eac3d0;
    --code-bg: #24242c;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.35);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 28px 96px;
}

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
a:hover { color: var(--link-hover); border-bottom-color: var(--link-hover); }

h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; color: var(--text); line-height: 1.25; }
h1 { font-size: 2.2rem; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 {
  font-size: 1.35rem;
  margin: 48px 0 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
h2::before {
  content: "§";
  color: var(--accent);
  font-weight: 500;
  font-size: 1.1rem;
}
h3 { font-size: 1.1rem; margin: 20px 0 6px; }

p { margin: 0 0 12px; }

ul { padding-left: 1.25rem; margin: 8px 0 12px; }
li { margin: 4px 0; }

/* --------- Header --------- */
.header {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 32px;
  align-items: center;
}
.header .identity .name-cn {
  font-family: "STKaiti", "Kaiti SC", KaiTi, serif;
  font-weight: 500;
  font-size: 1.6rem;
  color: var(--text-soft);
  margin-left: 8px;
}
.header .role {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-soft);
  margin: 2px 0 14px;
  font-size: 1.05rem;
}
.contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 0.95rem;
  color: var(--text-soft);
}
.contact-list li { margin: 0; }
.contact-list .icon { color: var(--accent); margin-right: 6px; }
.note {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 10px 12px;
  border-left: 3px solid var(--accent-soft);
  background: var(--surface-soft);
  border-radius: 0 6px 6px 0;
}

.avatar {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow);
  border: 3px solid var(--surface);
}
.avatar-caption {
  text-align: center;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

/* --------- Highlight Cards --------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin: 18px 0 8px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent-soft); }
.card .card-tag {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
}
.card h3 { margin: 0 0 6px; font-size: 1.02rem; }
.card p { margin: 0 0 10px; font-size: 0.9rem; color: var(--text-soft); }
.card .card-links a {
  font-size: 0.8rem;
  margin-right: 8px;
  color: var(--accent);
  border-bottom: none;
}
.card .card-links a:hover { color: var(--link-hover); }

/* --------- News --------- */
.news {
  max-height: 320px;
  overflow-y: auto;
  padding: 6px 14px 6px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.news ul { list-style: none; padding: 0; margin: 0; }
.news li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.92rem;
}
.news li:last-child { border-bottom: none; }
.news .date {
  display: inline-block;
  min-width: 82px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin-right: 8px;
}

/* --------- Publications --------- */
.pub-legend {
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-bottom: 12px;
}
.pub-legend code {
  background: var(--code-bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.pub-list { list-style: none; padding: 0; }
.pub-list > li {
  margin: 0;
  padding: 16px 10px 16px 12px;
  border-top: 1px solid var(--border-soft);
  border-left: 3px solid transparent;
  border-radius: 4px;
  transition: background 0.15s ease, border-left-color 0.15s ease, transform 0.15s ease;
}
.pub-list > li:first-child { border-top: none; }
.pub-list > li:hover {
  background: var(--accent-bg);
  border-left-color: var(--accent-soft);
  transform: translateX(2px);
}
.pub-list > li > div + div { margin-top: 3px; }

.pub-expand {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease, margin-top 0.25s ease, opacity 0.2s ease;
  opacity: 0;
  margin-top: 0;
}
.pub-expand > .pub-expand-inner { overflow: hidden; }
.pub-list > li:hover > .pub-expand,
.pub-list > li:focus-within > .pub-expand {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 8px;
}
.pub-abstract {
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.55;
  margin: 0 0 8px;
  padding-left: 10px;
  border-left: 2px solid var(--accent-soft);
}
.pub-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin: 0;
}
.pub-keywords .kw {
  font-size: 0.72rem;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-soft);
  border: 1px solid var(--border);
  letter-spacing: 0.02em;
}
.pub-title { font-weight: 600; color: var(--text); }
.pub-authors { color: var(--text-soft); font-size: 0.92rem; }
.pub-authors .me { color: var(--text); border-bottom: 1px solid var(--accent-soft); }
.pub-venue { color: var(--text-soft); font-size: 0.9rem; }
.pub-venue .venue-name {
  font-weight: 700;
  font-style: normal;
  color: var(--accent);
  letter-spacing: 0.01em;
}
.pub-links { font-size: 0.85rem; margin-top: 2px; word-spacing: 4px; }
.pub-links a { margin-right: 0; }
.pub-badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 4px;
  letter-spacing: 0.03em;
  vertical-align: middle;
}
.badge-oral { background: #7c3f58; color: #fff; }
.badge-spot { background: #a7542e; color: #fff; }
.badge-best { background: #b88436; color: #fff; }
.badge-hl   { background: #3b6b52; color: #fff; }

.lead, .equal, .intern {
  vertical-align: super;
  font-size: 0.72em;
  font-weight: bold;
  line-height: 0;                 /* prevent the superscript from enlarging line-height */
  margin: 0 1px;
}
.lead   { color: #7c3f58; }
.equal  { color: #1e7c86; }
.intern { color: #b07a1a; }

@media (prefers-color-scheme: dark) {
  .badge-oral { background: #d49ab0; color: #1b1b21; }
  .badge-spot { background: #e0a07b; color: #1b1b21; }
  .badge-best { background: #e0b868; color: #1b1b21; }
  .badge-hl   { background: #7db399; color: #1b1b21; }
  .lead  { color: #d49ab0; }
  .equal { color: #7fbfc7; }
  .intern{ color: #e0b868; }
}

/* --------- Mentoring --------- */
.mentoring li { font-size: 0.94rem; }
.mentoring .name { font-weight: 600; }
.mentoring .proj { color: var(--muted); font-size: 0.88rem; }

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

/* --------- ClustrMaps visitor counter --------- */
.clustrmaps-wrapper {
  margin: 28px auto 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 180px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  max-width: 380px;
}
.clustrmaps-wrapper iframe,
.clustrmaps-wrapper canvas,
.clustrmaps-wrapper img {
  max-width: 100%;
  height: auto;
}
@media (prefers-color-scheme: dark) {
  /* ClustrMaps widget has a hard-coded white background; soften it in dark mode. */
  .clustrmaps-wrapper { opacity: 0.85; }
}

/* --------- Responsive --------- */

/* Tablet / small laptop */
@media (max-width: 720px) {
  .container { padding: 28px 18px 56px; }

  /* Header: stack vertically, avatar goes on top, identity centered */
  .header {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 18px;
  }
  .header .identity { order: 2; }
  .header .avatar-wrapper { order: 1; display: flex; justify-content: center; }

  .avatar { width: 140px; height: 140px; }
  .avatar-caption { display: none; }

  /* Contact list: center + tighter wrapping */
  .contact-list {
    justify-content: center;
    gap: 6px 14px;
    font-size: 0.9rem;
  }
  .contact-list li { white-space: nowrap; }

  .header .role { font-size: 0.98rem; }
  .note { text-align: left; font-size: 0.8rem; }

  h1 { font-size: 1.7rem; }
  h1 .name-cn { display: inline-block; font-size: 1.3rem; margin-left: 6px; }
  h2 { font-size: 1.2rem; }

  /* Publications: avoid long arXiv ids forcing horizontal scroll */
  .pub-authors, .pub-venue { overflow-wrap: anywhere; }
  .pub-list > li { padding: 14px 8px 14px 10px; }
  .pub-list > li:hover { transform: none; }
}

/* Phone portrait — aggressive compaction */
@media (max-width: 480px) {
  .container { padding: 22px 14px 48px; }

  .avatar { width: 118px; height: 118px; border-width: 2px; }

  h1 { font-size: 1.5rem; line-height: 1.2; }
  h1 .name-cn { font-size: 1.1rem; display: block; margin: 2px 0 0; }

  .header .role { font-size: 0.9rem; margin: 4px 0 10px; }

  .contact-list {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
  }
  .contact-list li { padding: 0; }

  .note { font-size: 0.78rem; padding: 8px 10px; }

  /* Cards become single-column with slightly smaller padding */
  .cards { grid-template-columns: 1fr; gap: 10px; }
  .card { padding: 14px 14px; }

  /* News scroller a bit shorter */
  .news { max-height: 280px; }

  /* Clustrmaps widget width fits phone */
  .clustrmaps-wrapper { max-width: 100%; min-height: 160px; }
}
