/* Single column, desert0616-style: hero + sections. No sidebar, no education/interests. */
@import url("https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,wght@0,400;0,600;0,700&family=Source+Sans+3:wght@400;500;600&display=swap");

:root {
  color-scheme: light dark;
  /* 纯白 + 深蓝 #013D7C + 橘黄 #EF7C02 */
  --bg: #ffffff;
  --text: #013D7C;
  --text-muted: #4a6b8a;
  --accent: #EF7C02;
  --accent-hover: #d66b02;
  --border: #e2e8f0;
  --line-accent: #EF7C02;
  --transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  /* 字号层级 */
  --text-xs: 0.8125rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 1.75rem;
  --text-hero: clamp(1.25rem, 3vw, 1.5rem);
  --font-sans: "Source Sans 3", system-ui, sans-serif;
  --font-serif: "Source Serif 4", Georgia, serif;
  --icon-paper: #ffffff;
  --icon-band: #e8e8ec;
}

[data-theme="dark"] {
  --bg: #16171a;
  --text: #eae8e4;
  --text-muted: #9a9a9a;
  --accent: #6ba3d4;
  --accent-hover: #8bb8e0;
  --border: #36373c;
  --line-accent: #6ba3d4;
  --icon-paper: #2a2a2e;
  --icon-band: #3d3d42;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: #ffffff;
}

@media (max-width: 640px) {
  html {
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
  }
  body {
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.45;
  color: var(--text);
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: var(--transition);
}

[data-theme="dark"] html,
[data-theme="dark"] body {
  background: var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.top-bar {
  display: none;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3rem);
}

/* ========== 顶部信息窗：左照片与右侧 bio 等高，上下水平对齐，照片缩放填满 ========== */
.hero {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: clamp(2rem, 5vw, 3rem);
  padding-top: clamp(1.5rem, 4vw, 2.5rem);
  padding-bottom: 0;
  margin-bottom: 0;
}

.hero-identity {
  flex-shrink: 0;
  width: clamp(160px, 28vw, 220px);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.hero-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.hero-bio {
  flex: 0 0 auto;
  max-width: 42em;
}

.hero-links {
  flex: 0 0 auto;
}

.hero-bio .hero-head {
  margin-bottom: 0.5rem;
}

.hero-head .hero-name-zh {
  margin-left: 0.45em;
}

.hero-head h1 {
  font-family: var(--font-serif);
  font-size: var(--text-hero);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
  line-height: 1.25;
}

.hero-bio .intro {
  font-family: var(--font-sans);
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
  margin: 0 0 0;
}

.intro a {
  color: var(--accent);
}

/* 联系区：纯文字链接，用 · 分隔 */
.hero-links {
  font-size: var(--text-sm);
  margin-top: 1rem;
  padding-top: 0;
}

.hero-links a,
.hero-links .email-hover-wrap {
  color: var(--accent);
  font-weight: 500;
}

.hero-links a:hover,
.hero-links .email-hover-wrap:hover {
  color: var(--accent-hover);
}

.hero-links .email-hover-wrap {
  cursor: default;
}

.avatar-wrap {
  position: relative;
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  border-radius: 0;
  overflow: hidden;
  border: none;
  box-shadow: none;
}

.avatar-wrap img {
  border: none;
  outline: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 无照片时 initials 占位：方形，不拉伸 */
.avatar-wrap:has(.avatar-initials:not(.hide)) {
  flex: 0 0 auto;
  height: auto;
  aspect-ratio: 1;
  width: 100%;
}

.avatar-img.hide {
  display: none;
}

.avatar-initials {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--accent);
}

.avatar-initials.hide {
  display: none;
}

.affiliation {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: 0.75em;
}

/* 邮箱悬停显示图片（图标在照片下） */
.email-hover-wrap {
  position: relative;
}

.email-hover-img {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 0.35rem;
  max-width: 220px;
  height: auto;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.email-hover-wrap:hover .email-hover-img {
  opacity: 1;
  visibility: visible;
}

.link-btn {
  font-family: inherit;
  font-size: inherit;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

.hide {
  display: none !important;
}

/* Main: sections */
.main {
  padding-top: 0.75rem;
}

.main section {
  padding-top: 1.5rem;
  padding-bottom: 0;
}

.main section h2 {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  color: var(--text);
  padding-left: 0.75rem;
  border-left: 4px solid var(--line-accent);
  border-bottom: none;
}

.prose {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
}

.prose a {
  color: var(--accent);
}

/* Publications: 左发表地/年份，中标题+作者，右 url 图标 */
#publications {
  padding-left: 0;
  margin-left: 0;
}

.pub-note {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-bottom: 1rem;
}

.pub-note a {
  color: var(--accent);
}

.pub-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  margin-left: 0;
  line-height: 1.4;
}

.pub-venue-col {
  flex-shrink: 0;
  width: 4.25rem;
  min-width: 4.25rem;
  text-align: right;
}

.pub-year {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
}

.pub-venue {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text);
}

.pub-venue-col.pub-venue-col--wrapped .pub-year,
.pub-venue-col.pub-venue-col--wrapped .pub-venue {
  font-size: 0.625rem;
  line-height: 1.2;
}

.pub-venue-col.pub-venue-col--wrapped .pub-venue {
  margin-top: 0.15em;
}

.pub-content {
  flex: 1;
  min-width: 0;
}

.pub-url-cell {
  flex-shrink: 0;
  width: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pub-title-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
  min-width: 0;
}

.pub-url {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  margin: -0.2rem;
  border-radius: 6px;
  color: var(--accent);
  flex-shrink: 0;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.pub-url:hover {
  color: var(--accent-hover);
  background-color: color-mix(in srgb, var(--accent) 12%, transparent);
  transform: scale(1.06);
  text-decoration: none;
}

.pub-url-placeholder {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  opacity: 0.5;
  cursor: default;
  flex-shrink: 0;
}

.pub-url-placeholder::after {
  content: "To appear";
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%) translateY(-4px);
  font-size: 0.7rem;
  font-family: var(--font-sans);
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
}

.pub-url-placeholder:hover::after {
  opacity: 1;
  visibility: visible;
}

.pub-url-placeholder .pub-url-icon {
  color: inherit;
}
.pub-url-placeholder .pub-url-icon-paper {
  stroke: currentColor;
  stroke-opacity: 0.5;
}
.pub-url-placeholder .pub-url-icon-band {
  fill: currentColor;
  opacity: 0.7;
}
.pub-url-placeholder .pub-url-icon-text {
  fill: rgba(255, 255, 255, 0.9);
}

.pub-url-icon {
  width: 1.6rem;
  height: 1.6rem;
  display: block;
}

.pub-url-icon-paper {
  fill: var(--icon-paper);
  stroke: #e02424;
  stroke-opacity: 0.6;
}

.pub-url-icon-band {
  fill: #e02424;
}

.pub-url-icon-text {
  fill: rgba(255, 255, 255, 0.95);
}

.pub-title {
  font-weight: 600;
  color: var(--text);
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.pub-title-inner {
  display: inline-block;
  white-space: nowrap;
  transition: transform 3s linear;
}

.pub-item--hover .pub-title--truncated .pub-title-inner {
  transform: translateX(var(--title-scroll, 0));
}

.pub-authors {
  font-size: var(--text-sm);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.pub-authors-inner {
  display: inline-block;
  white-space: nowrap;
  transition: transform 3s linear;
}

.pub-item--hover .pub-authors--truncated .pub-authors-inner {
  transform: translateX(var(--authors-scroll, 0));
}

.pub-authors .author-self {
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 640px) {
  .hero {
    flex-direction: column;
    align-items: center;
    padding-top: 0.75rem;
    padding-bottom: 0;
    text-align: center;
  }
  .hero-identity {
    width: clamp(140px, 40vw, 180px);
  }
  .hero-right {
    align-items: center;
  }
  .avatar-wrap {
    flex: none;
    height: auto;
    aspect-ratio: auto;
  }
  .avatar-wrap img,
  .avatar-img {
    height: auto;
    object-fit: contain;
  }
  .hero-bio {
    max-width: none;
    text-align: center;
  }
  .hero-links {
    text-align: center;
  }
  .pub-item,
  .pub-item .pub-title,
  .pub-item .pub-authors {
    font-size: 14px;
  }
  .pub-venue-col .pub-year,
  .pub-venue-col .pub-venue {
    font-size: 13px;
  }
  .pub-venue-col.pub-venue-col--wrapped .pub-year,
  .pub-venue-col.pub-venue-col--wrapped .pub-venue {
    font-size: 13px;
  }
  .pub-venue-col {
    width: 4.25rem;
    min-width: 4.25rem;
    text-align: right;
    word-break: break-word;
  }
  .pub-venue {
    white-space: normal;
  }
  .pub-url-cell {
    justify-content: center;
  }
}

/* Service: two columns with balanced heights (content flows, then splits so cols are ~equal) */
.service-columns {
  column-count: 2;
  column-gap: 2rem;
  column-fill: balance;
  height: auto;
  min-height: 0;
}

@media (max-width: 640px) {
  .service-columns {
    column-count: 1;
  }
}

.service-block {
  margin-bottom: 1.25rem;
}

.service-block:last-child {
  margin-bottom: 0;
}

.service-col-title,
.service-block h3 {
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-weight: 600;
  margin: 0 0 0.6rem;
  color: var(--text);
}

.service-list {
  list-style: disc;
  list-style-position: inside;
  padding-left: 0.35rem;
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.45;
}

.service-list li {
  margin-bottom: 0.15rem;
  overflow: hidden;
  overflow-x: hidden;
  white-space: nowrap;
  min-width: 0;
  isolation: isolate;
}

.service-item-inner {
  display: inline-block;
  white-space: nowrap;
  transition: transform 0.3s linear;
}

.service-list li.service-item--truncated.service-item--hover .service-item-inner {
  transform: translateX(var(--service-scroll, 0px));
}

/* Entry rows (talks, teaching, awards) */
.entry-list {
  display: block;
}

.entry {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-size: var(--text-sm);
}

.entry-key {
  flex-shrink: 0;
  width: 4rem;
  text-align: right;
  color: var(--text-muted);
  font-weight: 600;
}

.entry-main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text-muted);
}

.entry-main-inner {
  display: inline-block;
  white-space: nowrap;
  transition: transform 0.3s linear;
}

.entry.entry--hover .entry-main--truncated .entry-main-inner {
  transform: translateX(var(--entry-scroll, 0));
}

.entry-main strong {
  color: var(--text);
}

.link-icon {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  vertical-align: middle;
  color: var(--accent);
}
.link-icon-youtube {
  width: 1.25em;
  height: 1.25em;
  color: #e02424;
}

@media (max-width: 640px) {
  .main {
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
  }
  .main section {
    font-size: 14px;
  }
  .main section h2 {
    font-size: 18px;
  }
  .entry-list {
    font-size: 14px;
  }
  .entry,
  .entry .entry-key,
  .entry .entry-main,
  .entry .entry-main-inner,
  .entry .entry-main strong {
    font-size: 14px;
  }
  .service-list,
  .service-list li,
  .service-item-inner {
    font-size: 14px;
  }
  .service-list li {
    white-space: normal;
  }
  .service-item-inner {
    white-space: normal;
  }
  .entry-key {
    width: 3.5rem;
    min-width: 3.5rem;
  }
}

/* Footer */
.site-footer {
  margin-top: 1.5rem;
  padding-top: 0.75rem;
  border-top: 2px solid var(--border);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: center;
}

.site-footer p {
  margin: 0;
}

/* Theme toggle */
.themeToggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: none;
  box-shadow: 0 1px 3px rgba(1, 61, 124, 0.12);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: var(--transition);
}

[data-theme="dark"] .themeToggle {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.themeToggle:hover {
  opacity: 0.9;
}

.themeToggleIcon {
  width: 1.25rem;
  height: 1.25rem;
}

.themeToggleSun {
  display: block;
}

.themeToggleMoon {
  display: none;
}

[data-theme="dark"] .themeToggleSun {
  display: none;
}

[data-theme="dark"] .themeToggleMoon {
  display: block;
}

.noscript {
  padding: 1rem;
  color: var(--text-muted);
}

@media print {
  .themeToggle,
  .top-bar {
    display: none !important;
  }
  a {
    color: #111;
  }
}
