:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --fg-muted: #555;
  --link: #3273dc;
  --link-hover: #1d4fa1;
  --border: #e5e5e5;
  --card-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  --btn-bg: #ffffff;
  --btn-border: #cccccc;
  --year-border: #ececec;
  --news-row: #fafafa;
}

html[data-theme="dark"] {
  --bg: #15171a;
  --fg: #e6e6e6;
  --fg-muted: #a8a8a8;
  --link: #6aa9ff;
  --link-hover: #9ec5ff;
  --border: #2c2f33;
  --card-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  --btn-bg: #22262b;
  --btn-border: #3a3f45;
  --year-border: #2c2f33;
  --news-row: #1c1f23;
}

* { box-sizing: border-box; }

body {
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--fg);
  background-color: var(--bg);
  margin: 0;
  padding: 0;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.container-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

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

h1, h2, h3, h4, h5 {
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-weight: 500;
  color: var(--fg);
}

h1.name { font-size: 32px; margin: 0 0 6px; font-weight: 500; }
h5.section-title {
  font-size: 18px;
  font-weight: 500;
  margin-top: 36px;
  margin-bottom: 14px;
  letter-spacing: 0.3px;
}

.profile-img {
  width: 22%;
  max-width: 180px;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  margin: 6px 0 14px 24px;
  float: right;
}

.bio p { margin: 0 0 12px; color: var(--fg); }
.bio p.email { color: var(--fg-muted); font-size: 14px; }

.contact-icons { margin: 12px 0 8px; font-size: 22px; }
.contact-icons a {
  margin-right: 14px;
  color: var(--fg-muted);
  transition: color 0.15s ease;
}
.contact-icons a:hover { color: var(--link); text-decoration: none; }

.theme-toggle {
  position: absolute;
  top: 22px; right: 22px;
  background: transparent;
  border: 1px solid var(--btn-border);
  color: var(--fg-muted);
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
}
.theme-toggle:hover { color: var(--link); border-color: var(--link); }
.theme-toggle .fa-sun { display: none; }
html[data-theme="dark"] .theme-toggle .fa-sun { display: inline; }
html[data-theme="dark"] .theme-toggle .fa-moon { display: none; }

.news-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.news-table tr:nth-child(even) { background: var(--news-row); }
.news-table th {
  font-weight: 500;
  color: var(--fg-muted);
  white-space: nowrap;
  padding: 6px 12px 6px 8px;
  text-align: left;
  vertical-align: top;
  width: 110px;
}
.news-table td { padding: 6px 8px; vertical-align: top; }

.pub { display: flex; gap: 18px; padding: 14px 0; align-items: flex-start; }
.pub-img {
  flex: 0 0 25%;
  max-width: 25%;
}
.pub-img img {
  width: 100%;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  display: block;
}
.pub-body { flex: 1; min-width: 0; }
.pub-title { font-weight: 500; font-size: 16px; color: var(--fg); margin-bottom: 4px; }
.pub-author { font-size: 14px; color: var(--fg-muted); margin-bottom: 4px; }
.pub-author em { font-style: normal; font-weight: 600; color: var(--fg); border-bottom: 1px solid; }
.pub-venue { font-size: 14px; font-style: italic; color: var(--fg-muted); margin-bottom: 8px; }
.pub-venue strong { font-style: normal; color: var(--fg); }
.pub-tldr { font-size: 13.5px; color: var(--fg-muted); margin-top: 6px; }

.btn-paper {
  display: inline-block;
  padding: 2px 10px;
  margin-right: 6px;
  font-size: 13px;
  border: 1px solid var(--btn-border);
  border-radius: 4px;
  background: var(--btn-bg);
  color: var(--fg-muted);
}
.btn-paper:hover {
  text-decoration: none;
  color: var(--link);
  border-color: var(--link);
}

h2.year {
  font-size: 18px;
  font-weight: 500;
  border-bottom: 1px solid var(--year-border);
  padding-bottom: 4px;
  margin: 28px 0 8px;
  color: var(--fg-muted);
}

.toggle-btn {
  display: block;
  margin: 14px 0;
  padding: 4px 12px;
  font-size: 13px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 4px;
  color: var(--fg-muted);
  cursor: pointer;
}
.toggle-btn:hover { color: var(--link); border-color: var(--link); }

.exp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.exp-table th {
  font-weight: 500;
  color: var(--fg-muted);
  white-space: nowrap;
  padding: 6px 12px 6px 0;
  text-align: left;
  vertical-align: top;
  width: 160px;
}
.exp-table td { padding: 6px 0; vertical-align: top; }

.honors-list { padding-left: 20px; margin: 0; }
.honors-list li { margin-bottom: 4px; color: var(--fg); }

.services p { margin: 6px 0; font-size: 14px; }

footer {
  text-align: center;
  margin-top: 50px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 13px;
}

@media (max-width: 600px) {
  .container-main { padding: 24px 16px 60px; }
  h1.name { font-size: 26px; }
  .profile-img {
    float: none;
    display: block;
    width: 45%;
    margin: 0 auto 16px;
  }
  .pub { flex-direction: column; }
  .pub-img { flex: 0 0 auto; max-width: 100%; }
  .exp-table th, .news-table th { width: auto; }
  .theme-toggle { top: 14px; right: 14px; }
}
