/* =============================================================================
 *  style.css — academic personal site
 *  Theming via CSS custom properties; [data-theme="dark"] overrides below.
 * ========================================================================== */

:root {
  --max-width: 880px;
  --accent: #b5742a;
  --accent-soft: #f3e6d4;

  --bg: #ffffff;
  --bg-soft: #faf8f5;
  --surface: #ffffff;
  --border: #ebe7e1;
  --text: #1f1c18;
  --text-soft: #5f5a52;
  --text-muted: #938c81;

  --badge-bg: #f5ebdc;
  --badge-text: #8a5a1e;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Newsreader", Georgia, "Times New Roman", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", serif;
}

[data-theme="dark"] {
  --accent: #d9a15b;
  --accent-soft: #2e2418;

  --bg: #16130f;
  --bg-soft: #1d1913;
  --surface: #1f1a14;
  --border: #322b22;
  --text: #ece7df;
  --text-soft: #b3a99b;
  --text-muted: #847b6d;

  --badge-bg: #2c2317;
  --badge-text: #d9a15b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.35);
}

/* --------------------------- base --------------------------------------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 64px; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

strong { font-weight: 600; }

::selection { background: var(--accent-soft); color: var(--text); }

/* --------------------------- nav ---------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav__brand {
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
  font-size: 1.05rem;
}
.nav__links {
  display: flex;
  gap: 22px;
  margin-left: auto;
}
.nav__links a {
  color: var(--text-soft);
  font-size: 0.93rem;
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav__links a:hover { color: var(--text); text-decoration: none; }
.nav__links a.active { color: var(--accent); border-bottom-color: var(--accent); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.theme-toggle:hover { color: var(--accent); transform: rotate(-15deg); }

/* --------------------------- hero --------------------------------------- */
main { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

.hero {
  display: flex;
  gap: 44px;
  align-items: center;
  padding: 52px 0 40px;
}
.hero__photo { flex: 0 0 auto; }
.hero__photo img {
  width: 200px;
  height: 200px;
  border-radius: 14px;
  object-fit: cover;
  object-position: center 28%;
  background: var(--bg-soft);
  box-shadow: 0 10px 28px rgba(31, 28, 24, 0.12);
}
.hero__intro { flex: 1 1 auto; min-width: 0; }
.hero__name {
  font-family: var(--font-serif);
  font-size: 2.55rem;
  font-weight: 600;
  line-height: 1.1;
  margin: 0 0 10px;
  letter-spacing: -0.015em;
}
.hero__name-sep {
  color: var(--text-muted);
  font-weight: 300;
  margin: 0 0.3em;
}
.hero__name-cjk {
  color: var(--text);
  letter-spacing: 0.04em;
}
.hero__title { font-size: 1rem; color: var(--text); font-weight: 500; margin: 0 0 3px; }
.hero__affil { color: var(--text-soft); margin: 0 0 11px; font-size: 0.9rem; }
.hero__bio { color: var(--text-soft); margin: 0 0 14px; max-width: 60ch; font-size: 0.95rem; line-height: 1.65; }
.hero__bio:last-of-type { margin-bottom: 20px; }

.hero__links { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn:hover {
  text-decoration: none;
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn .icon {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex: 0 0 auto;
}

/* --------------------------- sections ----------------------------------- */
.section { padding: 30px 0; border-top: 1px solid var(--border); }
.section__title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  margin: 0 0 16px;
  padding-bottom: 9px;
  letter-spacing: -0.01em;
  position: relative;
}
.section__title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 34px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.section__note { color: var(--text-muted); font-size: 0.82rem; margin: -8px 0 6px; }

/* --------------------------- news --------------------------------------- */
.news { list-style: none; margin: 0; padding: 0; }
.news__item {
  display: flex;
  gap: 16px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.92rem;
}
.news__item:last-child { border-bottom: none; }
.news__date {
  flex: 0 0 92px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  padding-top: 1px;
}
.news__body { color: var(--text-soft); }
.news__body strong { color: var(--text); }

/* --------------------------- publications ------------------------------- */
.pub-list { list-style: none; margin: 0; padding: 0; counter-reset: pub; }
.pub {
  display: flex;
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.pub:last-child { border-bottom: none; }
.pub__thumb {
  flex: 0 0 140px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  align-self: flex-start;
}
.pub__thumb img { display: block; width: 100%; height: auto; }
.pub__body { flex: 1 1 auto; min-width: 0; }
.pub__title { font-size: 1rem; font-weight: 600; margin: 0 0 3px; line-height: 1.35; }
.pub__authors { color: var(--text-soft); font-size: 0.9rem; margin: 0 0 5px; }
.pub__authors .me { color: var(--text); font-weight: 700; }
.pub__meta { margin: 0 0 5px; display: flex; flex-wrap: wrap; gap: 7px; }

.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--bg-soft);
  color: var(--text-soft);
  border: 1px solid var(--border);
}
.badge--status {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.pub__links { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 5px; }
.pub__link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-soft);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.pub__link:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.pub__icon { width: 10px; height: 10px; fill: currentColor; flex: 0 0 auto; }

/* --------------------------- timeline ----------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline__item {
  display: flex;
  gap: 24px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.timeline__item:last-child { border-bottom: none; }
.timeline__main { flex: 1 1 auto; min-width: 0; }
.timeline__role { font-weight: 600; margin: 0 0 1px; font-size: 0.98rem; }
.timeline__org { font-weight: 400; color: var(--text-soft); }
.timeline__detail { color: var(--text-soft); margin: 0; font-size: 0.9rem; }
.timeline__extra { color: var(--text-muted); margin: 2px 0 0; font-size: 0.86rem; }
.timeline__aside { flex: 0 0 auto; text-align: right; }
.timeline__place { margin: 0; font-size: 0.9rem; color: var(--text-soft); }
.timeline__period { margin: 0; font-size: 0.85rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* --------------------------- footer ------------------------------------- */
.footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 22px 24px 36px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
}
.footer p { margin: 0; }

/* --------------------------- responsive --------------------------------- */
@media (max-width: 640px) {
  .nav__links { display: none; }
  .hero {
    flex-direction: column;
    text-align: center;
    gap: 22px;
    padding: 40px 0 32px;
  }
  .hero__bio { margin-left: auto; margin-right: auto; }
  .hero__links { justify-content: center; }
  .hero__name { font-size: 2.1rem; }

  .pub { flex-direction: column; gap: 12px; }
  .pub__thumb { flex-basis: auto; width: 100%; max-width: 280px; }

  .timeline__item { flex-direction: column; gap: 4px; }
  .timeline__aside { text-align: left; }
}
