:root {
  --primary: #8a2b1f;
  --primary-light: transparent;
  --text-main: #2b2926;
  --text-light: #77716a;
  --heading: #1a1816;
  --bg: #fbfaf7;
  --card-bg: #fbfaf7;
  --border-color: #dedad2;
  --rule-strong: #2b2926;
  --hiring-bg: #f4efe4;
  --hiring-border: #8a2b1f;
  --serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", "Songti SC", serif;
  --sans: "Source Sans 3", "Helvetica Neue", Arial, "PingFang SC", sans-serif;
  --mono: "SF Mono", Menlo, Consolas, monospace;
}

/* 夜间模式变量 */
[data-theme="dark"] {
  --primary: #e0a080;
  --text-main: #d9d4cb;
  --text-light: #958e84;
  --heading: #efebe4;
  --bg: #1b1a18;
  --card-bg: #1b1a18;
  --border-color: #3a3733;
  --rule-strong: #d9d4cb;
  --hiring-bg: #26231f;
  --hiring-border: #e0a080;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 17px;
}

body {
  font-family: var(--serif);
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
}

a:hover {
  text-decoration-color: currentColor;
}

/* Container Layout */
#container {
  max-width: 780px;
  margin: 0 auto;
  padding: 72px 24px 40px;
  position: relative;
}

/* 主题切换按钮 */
#theme-toggle {
  position: absolute;
  top: 24px;
  right: 24px;
  background: none;
  border: none;
  color: var(--text-light);
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#theme-toggle svg {
  width: 17px;
  height: 17px;
}

#theme-toggle:hover {
  color: var(--heading);
}

/* Header / Bio */
.profile-section {
  display: flex;
  gap: 36px;
  align-items: flex-start;
  margin-bottom: 40px;
}

.portrait-wrapper {
  flex: 0 0 170px;
}

.portrait-placeholder {
  height: 170px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--bg);
  font-family: var(--sans);
  font-size: 3rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 2px;
}

.portrait {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
}

.bio-wrapper {
  flex: 1;
}

h1 {
  font-size: 2.1rem;
  margin: 0 0 4px 0;
  color: var(--heading);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.role-tag {
  display: block;
  color: var(--text-light);
  font-style: italic;
  font-size: 1.05rem;
  margin-bottom: 16px;
}

.bio-wrapper p {
  margin: 0 0 12px 0;
}

.email-tag {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-main);
  display: block;
  margin: 8px 0 0 0;
}

.social-links {
  margin-top: 18px;
  display: flex;
  column-gap: 22px;
  row-gap: 6px;
  flex-wrap: wrap;
  font-family: var(--sans);
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.social-links a {
  color: var(--heading);
  text-decoration-color: var(--border-color);
}

.social-links a:hover {
  color: var(--primary);
  text-decoration-color: currentColor;
}

/* Hiring Box */
.hiring-box {
  background: var(--hiring-bg);
  border-left: 2px solid var(--hiring-border);
  padding: 12px 16px;
  margin: 24px 0;
}

/* Tab Navigation */
.tabs-nav {
  display: flex;
  gap: 28px;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 32px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.tab-btn {
  padding: 10px 0;
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
  position: relative;
}

.tab-btn:hover {
  color: var(--heading);
}

.tab-btn.active {
  color: var(--heading);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
}

/* Tab Content Control */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Content styles */
section-title {
  display: block;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-light);
  margin: 40px 0 12px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

section-title:first-of-type {
  margin-top: 0;
}

.year-tag {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: var(--text-light);
  margin: 32px 0 6px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
  display: block;
}

.pub-card {
  padding: 12px 0;
  font-size: 0.95rem;
}

.pub-title {
  display: block;
  font-weight: 600;
  color: var(--heading);
  font-size: 1.04rem;
  line-height: 1.4;
}

.pub-venue {
  display: inline-block;
  font-style: italic;
  color: var(--text-main);
  margin: 2px 0;
}

.author-me {
  font-weight: 600;
  color: var(--heading);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.lang-info {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 4px;
  display: block;
}

ul {
  padding-left: 1.2em;
}

li {
  margin-bottom: 8px;
}

.news-list li::marker {
  color: var(--text-light);
}

.empty-state {
  color: var(--text-light);
  font-style: italic;
}

/* 回到顶部按钮 */
#backToTop {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99;
  border: 1px solid var(--border-color);
  outline: none;
  background: var(--bg);
  color: var(--text-light);
  cursor: pointer;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
}

#backToTop:hover {
  color: var(--heading);
  border-color: var(--text-light);
}

#backToTop svg {
  width: 16px;
  height: 16px;
  display: block;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Footer */
footer {
  margin-top: 56px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--text-light);
}

/* Responsive */
@media (max-width: 640px) {
  html {
    font-size: 16px;
  }

  #container {
    padding: 56px 16px 32px;
  }

  #theme-toggle {
    top: 16px;
    right: 12px;
  }

  .profile-section {
    flex-direction: column;
    gap: 20px;
    margin-bottom: 32px;
  }

  .portrait-wrapper {
    flex: 0 0 auto;
    width: 130px;
  }

  .role-tag {
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .bio-wrapper p {
    font-size: 0.96rem;
  }

  .email-tag {
    font-size: 0.76rem;
    overflow-wrap: anywhere;
  }

  .social-links {
    column-gap: 14px;
    font-size: 0.76rem;
  }

  h1 {
    font-size: 1.8rem;
  }

  .tabs-nav {
    gap: 0;
    justify-content: space-between;
    margin-bottom: 24px;
  }

  .tab-btn {
    font-size: 0.74rem;
    letter-spacing: 0.05em;
  }

  #backToTop {
    bottom: 16px;
    right: 16px;
  }
}
