/* ---------- tokens ---------- */
:root {
  color-scheme: light dark;
  --bg: #f2f4f8;
  --surface: #ffffff;
  --text: #1a1d21;
  --text-muted: #5c6470;
  --accent: #2563eb;
  --accent-soft: #dbe7ff;
  --border: #e4e8ee;
  --glow: rgba(37, 99, 235, 0.12);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 2px 10px rgba(16, 24, 40, 0.06);
  --surface-soft: rgba(255, 255, 255, 0.55);
  --max-width: 64rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #1a2028;
    --text: #e6e9ed;
    --text-muted: #9aa3af;
    --accent: #6ea0ff;
    --accent-soft: #1e2c4a;
    --border: #272e37;
    --glow: rgba(110, 160, 255, 0.10);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 10px rgba(0, 0, 0, 0.28);
    --surface-soft: rgba(26, 32, 40, 0.5);
  }
}

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

body {
  margin: 0;
  background:
    radial-gradient(60rem 28rem at 65% -8rem, var(--glow), transparent 70%) no-repeat,
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, .brand {
  font-family: "Space Grotesk", -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

/* ---------- header ---------- */
.site-header {
  background: transparent;
}

.site-header nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 650;
  color: var(--text);
}

.nav-links a {
  color: var(--text-muted);
  margin-left: 1.25rem;
  font-size: 0.95rem;
}
.nav-links a:hover { color: var(--accent); text-decoration: none; }
.nav-links a.active { color: var(--text); font-weight: 600; }

/* ---------- layout ---------- */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

section { margin-top: 3rem; }

h2 {
  font-size: 1.35rem;
  margin: 0 0 0.75rem;
}

/* ---------- hero ---------- */
.hero { margin-top: 3.5rem; }

.home-hero {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  justify-content: space-between;
}

.home-hero .hero-text { min-width: 0; }

.avatar {
  flex-shrink: 0;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-top: 0.5rem;
}

.hero h1 {
  font-size: 2.25rem;
  margin: 0;
}

.tagline {
  color: var(--text-muted);
  margin: 0.35rem 0 1.25rem;
}

.bio {
  margin: 0 0 1.25rem;
  color: var(--text);
}

.links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0;
  margin: 0;
}

.links a {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
}
.links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* ---------- update tags ---------- */
.tag {
  flex-shrink: 0;
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
  margin-top: 0.25rem;
}

.tag-paper  { background: #dbe7ff; color: #1d4ed8; }
.tag-career { background: #d7f3e3; color: #047857; }
.tag-blog   { background: #ece4ff; color: #6d28d9; }
.tag-news   { background: #fdeecd; color: #b45309; }

@media (prefers-color-scheme: dark) {
  .tag-paper  { background: #1e2c4a; color: #8ab1ff; }
  .tag-career { background: #123527; color: #4ade80; }
  .tag-blog   { background: #2a2050; color: #c4b5fd; }
  .tag-news   { background: #3a2c12; color: #fbbf24; }
}

/* ---------- news ---------- */
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.news-list li {
  display: flex;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.news-list li:last-child { border-bottom: none; }

.news-list .date {
  flex: 0 0 3.2rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- publications ---------- */
.section-note {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 1rem;
}

.pub-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pub-list li {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}
.pub-list li:last-child { border-bottom: none; }

.pub-list p { margin: 0; }

.pub-title {
  font-weight: 600;
}

.pub-authors {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.pub-authors strong { color: var(--text); }

.pub-venue {
  font-size: 0.9rem;
  color: var(--accent);
  margin-top: 0.15rem;
}

/* ---------- year groups ---------- */
.year-group { margin-top: 2rem; }

.year-group h2 {
  font-size: 1.15rem;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.35rem;
}

/* ---------- timeline (experience / education) ---------- */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline li {
  position: relative;
  padding: 0 0 1.75rem 1.5rem;
  border-left: 2px solid var(--border);
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 0.4rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline p { margin: 0; }

.entry-date {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.entry-title {
  font-weight: 600;
  margin-top: 0.15rem;
}

.entry-org {
  font-weight: 400;
  color: var(--text-muted);
}

.entry-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ---------- blog list ---------- */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list li {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.post-list .date {
  flex: 0 0 6.5rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.post-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

/* ---------- post article ---------- */
.post-content { margin-top: 1.5rem; }

.post-content h2 { margin-top: 2.25rem; }
.post-content h3 { margin-top: 1.75rem; margin-bottom: 0.5rem; }

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin: 1.25rem auto;
}

.post-content pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.55;
}

.post-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.post-content :not(pre) > code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.05em 0.35em;
  font-size: 0.88em;
}

.post-content blockquote {
  margin: 1.25rem 0;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.math-block { overflow-x: auto; margin: 1.25rem 0; }

.table-wrap { overflow-x: auto; margin: 1.25rem 0; }

.post-content table {
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0 auto;
}

.post-content th,
.post-content td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  text-align: left;
}

.post-content th { background: var(--surface); }

.empty-state {
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer p {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.25rem;
}

/* ---------- small screens ---------- */
@media (max-width: 520px) {
  .hero h1 { font-size: 1.85rem; }
  .news-list li { flex-direction: column; gap: 0; }
  .home-hero { flex-direction: column-reverse; gap: 1.25rem; padding: 1.4rem; }
  .avatar { width: 96px; height: 96px; }
  .news-list li { flex-direction: row; flex-wrap: wrap; }
  .news-list .date { flex-basis: auto; }
}
