/* ===== CSS Variables / Theme ===== */
:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-muted: #f0f4f8;
  --text: #20242a;
  --muted: #687383;
  --line: #dbe2ea;
  --accent: #1772d0;
  --accent-hover: #c76810;
  --notice-bg: #fff4df;
  --notice-border: #f2b950;
  --radius: 8px;
  --shadow: 0 10px 28px rgba(39, 54, 75, 0.08);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Lato', Verdana, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.58;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul {
  list-style: none;
}

/* ===== Sticky Header / Navigation ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(247, 248, 251, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-nav {
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: center;
}

.site-nav a {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover {
  color: var(--accent);
  background: var(--surface-muted);
}

/* ===== Page Shell ===== */
.page-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 34px 20px 60px;
}

/* ===== Sections ===== */
.section {
  scroll-margin-top: 72px;
  margin-bottom: 34px;
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading h2 {
  font-size: 23px;
  font-weight: 700;
  color: var(--text);
}

/* ===== Hero / About Section ===== */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 34px;
  align-items: center;
}

.profile-name {
  font-size: 34px;
  font-weight: 900;
  margin-bottom: 6px;
}

.profile-name-cn {
  font-size: 22px;
  font-weight: 400;
  color: var(--muted);
}

.profile-title {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 2px;
}

.profile-bio {
  margin-top: 16px;
  line-height: 1.7;
}

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

.profile-interests {
  margin-top: 14px;
}

.profile-interests h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.profile-interests ul {
  list-style: disc;
  padding-left: 20px;
}

.profile-interests li {
  margin-bottom: 4px;
  color: var(--text);
}

.profile-links {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.meta-link {
  display: inline-block;
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  transition: background 0.15s, border-color 0.15s;
}

.meta-link:hover {
  background: var(--surface-muted);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.avatar-link {
  display: block;
  justify-self: center;
}

.avatar {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 30%;
  border: 4px solid var(--surface);
  box-shadow: var(--shadow);
}

/* ===== Panel (News, Honors) ===== */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow);
}

.news-panel {
  max-height: 260px;
  overflow-y: auto;
}

.news-panel ul li {
  padding: 9px 0;
  border-bottom: 1px solid var(--surface-muted);
  font-size: 14px;
  line-height: 1.6;
}

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

.news-date {
  font-weight: 700;
  color: var(--muted);
  margin-right: 8px;
}

.news-emoji {
  display: inline-block;
}

.news-emoji.emoji-party {
  animation: party-pop 1.5s ease-in-out infinite;
}

.news-emoji.emoji-fire {
  animation: fire-flicker 0.8s ease-in-out infinite alternate;
}

@keyframes party-pop {
  0%, 100% { transform: scale(1) rotate(0deg); }
  20% { transform: scale(1.3) rotate(-10deg); }
  40% { transform: scale(0.9) rotate(5deg); }
  60% { transform: scale(1.2) rotate(-5deg); }
  80% { transform: scale(1) rotate(3deg); }
}

@keyframes fire-flicker {
  0% { transform: scale(1) translateY(0); filter: brightness(1); }
  50% { transform: scale(1.15) translateY(-2px); filter: brightness(1.2); }
  100% { transform: scale(1.05) translateY(-1px); filter: brightness(1.1); }
}

.honors-panel ul li {
  padding: 7px 0;
  border-bottom: 1px solid var(--surface-muted);
  font-size: 14px;
}

.honors-panel ul li:last-child {
  border-bottom: none;
}

/* ===== Media Items (Publications, Projects) ===== */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.media-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* Collapsed state: hidden by default, toggled via JS */
.media-item.collapsed:not(.hidden) {
  display: none;
}

.show-more-btn {
  display: block;
  margin: 16px auto;
  padding: 10px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s;
}

.show-more-btn:hover {
  background: var(--line);
}

.media-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-muted);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
}

.venue-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1.4;
  letter-spacing: 0.3px;
  pointer-events: none;
}

.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.media-frame img:hover {
  transform: scale(1.03);
}

.media-frame-placeholder {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.media-body h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.4;
}

.media-body .authors {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
  line-height: 1.5;
}

.media-body p.authors strong {
  color: #20242a;
  font-weight: 700;
}

.media-body .authors sup {
  font-size: 0.75em;
  vertical-align: super;
  line-height: 0;
  color: var(--muted);
}

.media-body .venue {
  font-size: 13px;
  font-weight: normal;
  color: var(--text);
  margin-bottom: 4px;
}

.project-about-heading {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 6px 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.media-body .abstract {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 8px;
  font-style: italic;
  line-height: 1.5;
}

.media-body .links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.media-body .links a {
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-weight: 700;
}

.media-body .links a:hover {
  background: var(--surface-muted);
  border-color: var(--accent);
}

/* ===== Experience Section ===== */
.experience-content {
  padding: 0;
}

.experience-content h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 12px;
  margin-top: 20px;
}

.experience-content h3:first-child {
  margin-top: 0;
}

.experience-content ul {
  padding-left: 0;
}

.experience-content li {
  padding: 8px 0;
  border-bottom: 1px solid var(--surface-muted);
  font-size: 14px;
  line-height: 1.6;
}

.experience-content li:last-child {
  border-bottom: none;
}

.exp-period {
  font-weight: 700;
  color: var(--muted);
}

/* ===== Experience Grid ===== */
.exp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.exp-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 10px 14px;
  background: var(--surface-muted);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.exp-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.exp-logo {
  width: 100%;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.exp-logo img {
  max-width: 100%;
  max-height: 54px;
  object-fit: contain;
}

.exp-logo-fallback {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  border-radius: 10px;
}

.exp-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.exp-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.exp-role {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}

/* ===== Logo Grid (legacy) ===== */
.logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.logo-grid a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--surface-muted);
  border-radius: var(--radius);
  transition: transform 0.18s ease;
}

.logo-grid a:hover {
  transform: scale(1.05);
}

.logo-grid img {
  max-height: 50px;
  max-width: 120px;
  object-fit: contain;
}

/* ===== Service Section ===== */
.service-content {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.service-content h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
  margin-top: 18px;
}

.service-content h3:first-child {
  margin-top: 0;
}

.service-content ul {
  padding-left: 20px;
  list-style: disc;
}

.service-content li {
  padding: 4px 0;
  font-size: 14px;
}

.service-content p {
  font-size: 14px;
  margin-bottom: 8px;
}

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 30px 20px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* ===== Notice Box ===== */
.notice {
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 14px;
  font-size: 14px;
}

/* ===== Responsive: Tablet ===== */
@media (max-width: 600px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .avatar-link {
    grid-row: 1;
    justify-self: center;
  }

  .avatar {
    width: min(220px, 62vw);
    height: auto;
    aspect-ratio: 1;
  }

  .profile-name {
    font-size: 28px;
    text-align: center;
  }

  .profile-title {
    text-align: center;
  }

  .profile-links {
    justify-content: center;
  }

  .section-heading h2 {
    font-size: 21px;
  }

  .media-item {
    grid-template-columns: 1fr;
  }

  .media-frame {
    max-width: 360px;
    margin: 0 auto;
  }

  .page-shell {
    padding: 24px 14px 40px;
  }
}

/* ===== Responsive: Mobile ===== */
@media (max-width: 520px) {
  .page-shell {
    max-width: 362px;
    margin: 0 auto;
  }

  .site-nav {
    gap: 6px 12px;
  }

  .site-nav a {
    font-size: 13px;
    padding: 3px 6px;
  }
}

/* ===== Responsive: Small Mobile ===== */
@media (max-width: 430px) {
  .profile-name {
    font-size: 24px;
  }

  .profile-name-cn {
    font-size: 18px;
  }

  .page-shell {
    padding: 14px 11px 30px;
  }

  .panel {
    padding: 14px;
  }

  .profile-links {
    gap: 8px 12px;
  }

  .media-item {
    padding: 14px;
  }
}

/* ===== Scrollbar styling ===== */
.news-panel::-webkit-scrollbar {
  width: 6px;
}

.news-panel::-webkit-scrollbar-track {
  background: var(--surface-muted);
  border-radius: 3px;
}

.news-panel::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}

.news-panel::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}
