/* ============================================================
   Zhang Peng — Academic homepage
   Light, youthful-but-scholarly design.
   Palette: warm off-white base + academic blue + coral accent.
   ============================================================ */

:root {
  --bg: #faf9f6;
  --bg-alt: #f2f4f8;
  --surface: #ffffff;
  --text: #1f2733;
  --text-soft: #5b6572;
  --text-faint: #8b94a1;
  --primary: #1d4ed8;
  --primary-soft: #e4ecfd;
  --accent: #ff6b4a;
  --accent-soft: #ffe8e2;
  --border: #e6e4de;
  --shadow: 0 1px 2px rgba(31, 39, 51, 0.05), 0 8px 24px rgba(31, 39, 51, 0.06);
  --shadow-lift: 0 2px 4px rgba(31, 39, 51, 0.06), 0 14px 34px rgba(31, 39, 51, 0.10);
  --radius: 16px;
  --font-sans: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}

:root[data-theme="dark"] {
  --bg: #0f1522;
  --bg-alt: #131b2b;
  --surface: #1a2334;
  --text: #e8ebf1;
  --text-soft: #a7b0bf;
  --text-faint: #78818f;
  --primary: #7ea4ff;
  --primary-soft: #1f2c4d;
  --accent: #ff7d5c;
  --accent-soft: #3a2420;
  --border: #273147;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.35), 0 14px 34px rgba(0, 0, 0, 0.45);
}

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

html { scroll-behavior: smooth; font-size: 18px; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

img { max-width: 100%; display: block; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }

.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 24px;
}

.link {
  color: var(--primary);
  border-bottom: 1px dashed currentColor;
}
.link:hover { color: var(--accent); }

.accent-dot { color: var(--accent); }

/* ---------------- Nav ---------------- */
.nav-wrap {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-soft);
}

.nav-links a { position: relative; padding: 4px 0; }
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: right 0.25s ease;
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { right: 0; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: transform 0.2s, color 0.2s;
}
.theme-toggle:hover { transform: rotate(15deg); color: var(--accent); }
:root[data-theme="light"] .icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  padding: 72px 0 56px;
  overflow: hidden;
}

.hero-decor {
  position: absolute;
  inset: 0;
  color: var(--primary);
  opacity: 0.10;
  pointer-events: none;
}
:root[data-theme="dark"] .hero-decor { opacity: 0.14; }
.contours { width: 100%; height: 100%; }
.sat { fill: var(--accent); }
.orbit { color: var(--accent); }

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 48px;
  align-items: center;
}

.hero-kicker {
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.hero-name {
  font-size: clamp(2.4rem, 5.5vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 8px 0 2px;
}

.hero-cn {
  font-weight: 600;
  font-size: 0.55em;
  color: var(--text-soft);
  margin-left: 6px;
}

.hero-pron {
  color: var(--text-faint);
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.hero-role {
  font-weight: 500;
  color: var(--text-soft);
  margin-bottom: 18px;
}

.role-badge {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 999px;
  padding: 3px 12px;
  margin-right: 8px;
}

.hero-intro {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  max-width: 560px;
  margin-bottom: 26px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 11px 22px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
}
.btn-sm { padding: 8px 16px; font-size: 0.88rem; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px rgba(255, 107, 74, 0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(255, 107, 74, 0.45);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  color: var(--primary);
}

.socials {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-soft);
  transition: transform 0.18s, color 0.18s, border-color 0.18s, background 0.18s;
}
.socials a svg { width: 18px; height: 18px; }
.socials a:hover {
  transform: translateY(-3px);
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Portrait */
.hero-portrait {
  justify-self: center;
  text-align: center;
}
.portrait-frame {
  position: relative;
  width: min(280px, 68vw);
  aspect-ratio: 1;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow-lift);
  transform: rotate(2deg);
  transition: transform 0.3s;
}
.portrait-frame:hover { transform: rotate(0deg) scale(1.02); }
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; }

.portrait-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
  box-shadow: var(--shadow);
}
.chip-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #2fbf71;
  box-shadow: 0 0 0 4px rgba(47, 191, 113, 0.18);
}

/* Interests */
.interests {
  margin-top: 44px;
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
  position: relative;
}
.interests-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.pill {
  font-size: 0.86rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-soft);
  transition: transform 0.18s, box-shadow 0.18s;
}
.pill:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pills-sm .pill { font-size: 0.78rem; padding: 4px 11px; }

.pill-a { background: #e4ecfd; border-color: #c9d9fb; color: #1d4ed8; }
.pill-b { background: #ffe8e2; border-color: #ffd0c4; color: #d43d1c; }
.pill-c { background: #e0f5ea; border-color: #bfe9d3; color: #147a4d; }
.pill-d { background: #fdf3d8; border-color: #f7e4ac; color: #9a6b00; }
.pill-e { background: #f0e7fd; border-color: #ddc9fa; color: #6d28d9; }
.pill-f { background: #e0f3f9; border-color: #bde5f2; color: #0e7490; }

:root[data-theme="dark"] .pill-a { background: #1f2c4d; border-color: #2c3d68; color: #9db9ff; }
:root[data-theme="dark"] .pill-b { background: #3a2420; border-color: #55322a; color: #ff9c82; }
:root[data-theme="dark"] .pill-c { background: #16342a; border-color: #1f4a3a; color: #6fd8a8; }
:root[data-theme="dark"] .pill-d { background: #38300f; border-color: #514617; color: #e8c95d; }
:root[data-theme="dark"] .pill-e { background: #2d2247; border-color: #413266; color: #c4a5f7; }
:root[data-theme="dark"] .pill-f { background: #12333d; border-color: #1b4a57; color: #7fd4ec; }

/* ---------------- Sections ---------------- */
.section { padding: 76px 0; }
.section-alt { background: var(--bg-alt); }

.section-title {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 38px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.title-index {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 2px 9px;
}

.section-footnote {
  margin-top: 22px;
  font-size: 0.88rem;
  color: var(--text-faint);
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card-wide { max-width: 820px; }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.card-head h3 { font-size: 1.08rem; font-weight: 700; letter-spacing: -0.01em; }
.card-org { color: var(--text-soft); font-size: 0.94rem; margin-top: 2px; }

.date-badge {
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 4px 12px;
}

.card-note { font-size: 0.92rem; color: var(--text-soft); }
.card-courses {
  margin-top: 10px;
  font-size: 0.88rem;
  color: var(--text-faint);
  line-height: 1.7;
}

.bullets {
  list-style: none;
  margin-top: 10px;
  display: grid;
  gap: 10px;
}
.bullets li {
  position: relative;
  padding-left: 22px;
  font-size: 0.95rem;
  color: var(--text-soft);
}
.bullets li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.55em;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.75;
}

.card-media {
  margin-top: 18px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  max-width: 280px;
}
.card-media img {
  width: 100%;
  max-height: 170px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* Timeline */
.timeline {
  position: relative;
  display: grid;
  gap: 26px;
  padding-left: 26px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 5px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(var(--primary), var(--accent));
  opacity: 0.35;
  border-radius: 2px;
}
.timeline-item { position: relative; }
.timeline-marker {
  position: absolute;
  left: -26px; top: 26px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.marker-accent {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ---------------- Research ---------------- */
.research-eyebrow {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

.research-current {
  max-width: 760px;
  margin-bottom: 32px;
}

.serif {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  margin-bottom: 18px;
}

.research-invite {
  font-style: italic;
  color: var(--primary);
  border-left: 3px solid var(--accent);
  padding-left: 14px;
}

.research-current-projects { margin-bottom: 56px; }

.research-past .research-eyebrow { margin-bottom: 22px; }

.project-list-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.numbered-list { counter-reset: project-index; }

.project-name-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  box-shadow: var(--shadow);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.numbered-list .project-name-card {
  counter-increment: project-index;
}
.numbered-list .project-name-card::before {
  content: counter(project-index);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
}
:root[data-theme="dark"] .numbered-list .project-name-card::before {
  color: #ff9c82;
}
.project-name-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: var(--primary);
}
.project-name-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

/* ---------------- Publications ---------------- */
.pub-card {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.pub-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }

.pub-year {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--primary);
  border-right: 2px solid var(--border);
  padding-right: 18px;
}

.pub-body h3 {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.45;
  margin-bottom: 6px;
}
.pub-authors { font-size: 0.9rem; color: var(--text-soft); }
.pub-authors strong { color: var(--text); }
.pub-venue {
  font-size: 0.86rem;
  font-style: italic;
  color: var(--text-faint);
  margin: 4px 0 12px;
}

.badge-featured {
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #d43d1c;
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 2px 8px;
  margin-left: 8px;
}
:root[data-theme="dark"] .badge-featured { color: #ff9c82; }

.pub-links { display: flex; gap: 8px; flex-wrap: wrap; }

.pub-btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 8px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-soft);
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}
a.pub-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}
.pub-btn.is-disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.cite-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* ---------------- Projects ---------------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
}

.project-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }

.project-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.project-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.project-card:hover .project-media img { transform: scale(1.04); }
.project-media::after {
  content: "";
  position: absolute;
  top: 10px; right: 10px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(15, 21, 34, 0.55);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px;
}

.project-body { padding: 20px 22px 24px; }
.project-body h3 { font-size: 1.02rem; font-weight: 700; margin-bottom: 10px; letter-spacing: -0.01em; line-height: 1.35; }

/* ---------------- Skills ---------------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}
.card-span { grid-column: 1 / -1; }

.skill-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.skill-title::before {
  content: "";
  width: 10px; height: 10px;
  border-radius: 3px;
  background: var(--accent);
}

.skill-list { display: grid; gap: 10px; }
.skill-list li {
  font-size: 0.92rem;
  color: var(--text-soft);
  padding-left: 18px;
  position: relative;
}
.skill-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.6em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.6;
}
.skill-list strong { color: var(--text); }

/* ---------------- Footer ---------------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 48px 0 40px;
  background: var(--bg-alt);
}
.footer-inner { text-align: center; }
.footer-name { font-weight: 800; font-size: 1.15rem; margin-bottom: 4px; }
.footer-line { color: var(--text-soft); font-size: 0.92rem; margin-bottom: 18px; }
.socials-footer { justify-content: center; margin-bottom: 22px; }
.footer-copy { font-size: 0.8rem; color: var(--text-faint); }

/* ---------------- Modal ---------------- */
.modal { position: fixed; inset: 0; z-index: 200; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 21, 34, 0.55);
  backdrop-filter: blur(3px);
}
.modal-panel {
  position: relative;
  max-width: 640px;
  margin: 12vh auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 24px 28px 28px;
  width: calc(100% - 40px);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.modal-head h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-faint);
  cursor: pointer;
}
.modal-close:hover { color: var(--accent); }
.modal-panel pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  font-size: 0.8rem;
  overflow-x: auto;
  margin-bottom: 16px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------------- Reveal animation ---------------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .hero-portrait { order: -1; }
  .skills-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px 18px;
    display: none;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { padding: 10px 0; width: 100%; }
  .project-grid { grid-template-columns: 1fr; }
  .pub-card { grid-template-columns: 1fr; gap: 8px; }
  .pub-year { border-right: none; border-bottom: 2px solid var(--border); padding: 0 0 6px; }
  .section { padding: 56px 0; }
}
