/* ==========================================================
   Zhiwei Deng — personal site
   ========================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #1a6eb5;
  --blue-light: #2d84d4;
  --blue-pale: #eef4fd;
  --text: #111827;
  --body: #374151;
  --muted: #6b7280;
  --light: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f0f2f5;
  --bg: #f7f9fc;
  --gold: #b45309;
  --gold-bg: #fffbeb;
  --gold-border: #fcd34d;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--body);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

/* Top accent bar */
body::before {
  content: '';
  display: block;
  height: 4px;
  background: linear-gradient(90deg, #1a6eb5 0%, #2d84d4 50%, #5ba4e8 100%);
}

a { color: var(--blue); text-decoration: none; transition: color .15s; }
a:hover { color: var(--blue-light); text-decoration: underline; }
strong { font-weight: 600; color: var(--text); }
em { font-style: italic; }
img { display: block; max-width: 100%; }

.container { max-width: 940px; margin: 0 auto; padding: 0 32px; }

/* ── Nav ── */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 52px;
}
.nav-brand { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.2px; }
.nav-brand:hover { color: var(--blue); text-decoration: none; }
.nav-links { list-style: none; display: flex; gap: 26px; }
.nav-links a { font-size: 13.5px; font-weight: 500; color: var(--muted); padding-bottom: 3px; }
.nav-links a:hover { color: var(--blue); text-decoration: none; }
.nav-links a.active { color: var(--blue); border-bottom: 2px solid var(--blue); }

/* ── Profile ── */
.profile { display: flex; gap: 52px; align-items: flex-start; margin-bottom: 64px; }
.profile-text { flex: 1; min-width: 0; }
.profile-photo { flex-shrink: 0; padding: 6px; }

.profile-photo-wrap { position: relative; display: inline-block; }
.profile-photo-wrap::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 16px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}
.profile-photo-wrap img {
  position: relative;
  width: 192px;
  height: 222px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(26, 110, 181, .18);
}

.profile-name {
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1.15;
}
.profile-name .zh {
  display: block;
  font-size: 17px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: .5px;
  margin-top: 6px;
}
.profile-pos {
  font-size: 15px;
  color: var(--muted);
  margin: 12px 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-pos a { color: var(--muted); font-weight: 500; }
.profile-pos a:hover { color: var(--blue); text-decoration: none; }
.profile-pos .sep { color: var(--light); }

.social-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.social-links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 13px;
  transition: all .15s;
}
.social-links a i { font-size: 12px; }
.social-links a:hover {
  color: var(--blue);
  border-color: var(--blue);
  background: var(--blue-pale);
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(26, 110, 181, .12);
}

.profile-bio p { margin-bottom: 18px; }

/* DeepMind work box */
.dm-work {
  margin-top: 6px;
  padding: 16px 20px 14px;
  background: linear-gradient(135deg, var(--blue-pale) 0%, #f0f9ff 100%);
  border: 1px solid #c3dcf5;
  border-radius: 10px;
}
.dm-work-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dm-work-title i { color: var(--blue); font-size: 13px; }
.dm-work ul { list-style: none; }
.dm-work > ul > li {
  font-size: 13.5px;
  padding: 3px 0 3px 18px;
  position: relative;
}
.dm-work > ul > li::before {
  content: '›';
  position: absolute;
  left: 4px;
  color: var(--blue);
  font-weight: 700;
}
.dm-work .note { color: var(--muted); }
.dm-sublist { margin: 3px 0 2px; }
.dm-sublist li {
  font-size: 13px;
  color: var(--body);
  padding: 1px 0 1px 16px;
  position: relative;
}
.dm-sublist li::before {
  content: '–';
  position: absolute;
  left: 2px;
  color: var(--light);
}

/* ── Section ── */
.section { margin-bottom: 56px; }
.section-header { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.section-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--blue);
  border-radius: 2px;
}
.section-rule { flex: 1; height: 1px; background: var(--border-light); }
.section-note { font-size: 13px; color: var(--muted); margin: -8px 0 18px; }

/* ── Research cards ── */
.research-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.research-card {
  padding: 16px 18px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  transition: box-shadow .2s, transform .2s;
}
.research-card:hover { box-shadow: 0 4px 16px rgba(26, 110, 181, .1); transform: translateY(-1px); }
.research-card h3 { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.research-card p { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ── News ── */
.news-list { list-style: none; }
.news-list li {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13.5px;
  align-items: baseline;
}
.news-list li:last-child { border-bottom: none; }
.news-date {
  min-width: 72px;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
  flex-shrink: 0;
  letter-spacing: .02em;
}

/* ── Publications ── */
.pub-list { list-style: none; }
.pub-entry {
  display: flex;
  gap: 20px;
  padding: 20px 14px;
  border-radius: 8px;
  border-bottom: 1px solid var(--border-light);
  transition: background .15s;
  scroll-margin-top: 16px;
}
.pub-entry:hover { background: var(--bg); }
.pub-entry:last-child { border-bottom: none; }
.pub-entry:target { background: var(--blue-pale); }

.pub-thumb { flex-shrink: 0; width: 150px; }
.pub-thumb img {
  width: 150px;
  height: 96px;
  object-fit: contain;
  padding: 4px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  transition: box-shadow .2s;
}
.pub-thumb img.cover { object-fit: cover; padding: 0; }
.pub-entry:hover .pub-thumb img { box-shadow: 0 4px 14px rgba(0, 0, 0, .1); }

.pub-body { flex: 1; min-width: 0; }
.pub-title { font-size: 14.5px; font-weight: 600; color: var(--text); margin-bottom: 4px; line-height: 1.4; }
.pub-title a { color: inherit; }
.pub-title a:hover { color: var(--blue); }
.pub-authors { font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.pub-venue-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 9px; }
.pub-venue-row:last-child { margin-bottom: 0; }
.pub-detail { font-size: 12.5px; color: var(--muted); }

.badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
  color: #fff;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--blue);
  line-height: 1.6;
}
.badge.red { background: #dc2626; }
.badge.gray { background: #6b7280; }
.badge.teal { background: #0f766e; }
.badge.tech { background: linear-gradient(90deg, #7c3aed, #4f46e5); }

.award-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 5px;
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid var(--gold-border);
  line-height: 1.6;
}
.award-tag i { font-size: 10px; margin-right: 3px; }

.pub-links { display: flex; flex-wrap: wrap; gap: 5px; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  background: #fff;
  transition: all .13s;
}
.link-btn i { font-size: 10.5px; }
.link-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-pale); text-decoration: none; }
.press { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

/* View all */
.view-all { text-align: center; margin-top: 32px; }
.view-all a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--blue);
  border: 1.5px solid var(--blue);
  border-radius: 8px;
  padding: 10px 28px;
  background: #fff;
  transition: all .15s;
}
.view-all a:hover {
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(26, 110, 181, .25);
}

/* ── Publications page ── */
.page-title { font-size: 30px; font-weight: 800; color: var(--text); letter-spacing: -.8px; margin-bottom: 6px; }
.page-subtitle { font-size: 13.5px; color: var(--muted); margin-bottom: 40px; }
.year-group { margin-bottom: 40px; }
.year-label {
  display: inline-block;
  font-size: 15px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: .04em;
  padding: 4px 12px 4px 10px;
  background: var(--blue-pale);
  border-left: 3px solid var(--blue);
  border-radius: 0 5px 5px 0;
  margin-bottom: 10px;
}
.compact .pub-entry { padding: 15px 14px; }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 44px;
  margin-top: 64px;
  text-align: center;
  font-size: 13px;
  color: var(--light);
}
.site-footer a { color: var(--light); }
.site-footer a:hover { color: var(--blue); }

/* ── Responsive ── */
@media (max-width: 680px) {
  .container { padding: 0 18px; }
  .site-nav { margin-bottom: 36px; }
  .profile { flex-direction: column-reverse; gap: 24px; margin-bottom: 48px; }
  .profile-photo-wrap img { width: 130px; height: 150px; }
  .profile-name { font-size: 28px; }
  .research-grid { grid-template-columns: 1fr; }
  .pub-entry { flex-direction: column; gap: 12px; padding: 16px 4px; }
  .pub-thumb, .pub-thumb img { width: 100%; }
  .pub-thumb img { height: 170px; }
  .news-list li { flex-direction: column; gap: 2px; }
}

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