/* Homepage-only layout. Tokens and chrome come from ds.css.
   Other origin pages should import ds.css, not this file. */
:root {
  --accent: var(--ds-accent);
  --surface: var(--ds-bg-elevated);
  --ink: var(--ds-text);
}

[data-lang="en"] .zh,
[data-lang="zh"] .en { display: none !important; }
[data-lang="zh"] em { font-style: normal; }
[data-lang="zh"] body,
[data-lang="zh"].ds-page { line-height: 1.65; }

.ds-nav-brand.brand {
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity var(--ds-duration) var(--ds-ease), transform var(--ds-duration) var(--ds-ease);
}
.ds-nav.show-brand .ds-nav-brand.brand {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.ds-nav-brand .cn { font-weight: 600; }
.ds-nav-brand .en-name {
  font-size: 12px;
  font-weight: 400;
  color: var(--ds-text-secondary);
}

/* ---- hero ---- */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  align-items: start;
}
.avatar {
  position: relative;
  width: 112px;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--ds-bg-elevated);
  box-shadow: var(--ds-shadow-2), 0 0 0 1px var(--ds-hairline);
}
.avatar .monogram {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 600 42px/1 var(--ds-font-display);
  color: var(--ds-text);
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--ds-bg-elevated) 88%, transparent) 0 30%, transparent 62%);
}
.avatar img { z-index: 1; object-position: 50% 30%; }
.avatar canvas,
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.intro .ds-hero-title {
  font-size: clamp(36px, 9vw, 56px);
  margin: 0 0 10px;
}
.intro .ds-hero-title .alt {
  display: inline-block;
  margin-left: .28em;
  font-size: .42em;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ds-text-secondary);
  vertical-align: 0.18em;
}
.role .amp { color: var(--ds-text-tertiary); margin: 0 .12em; }
.role .muted { font-weight: 400; color: var(--ds-text-tertiary); }
.bio {
  margin: 0;
  max-width: 40em;
  color: var(--ds-text);
}
.bio strong { font-weight: 600; }

.links-row {
  margin: 22px 0 0;
}
.intro .ds-quote { margin-top: 28px; max-width: 36em; }

/* ---- news ---- */
.news {
  list-style: none;
  margin: 0;
  padding: 8px 22px;
}
.news.ds-card:hover {
  transform: none;
  box-shadow: var(--ds-shadow-1);
}
.news li {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--ds-hairline);
  font-size: var(--ds-text-body);
  color: var(--ds-text);
}
.news li:last-child { border-bottom: 0; }
.news time {
  font: 500 13px/1.7 var(--ds-font-mono);
  color: var(--ds-text-secondary);
  font-variant-numeric: tabular-nums;
}
.news li.top time { color: var(--ds-accent); }
.news strong { font-weight: 600; }
.news .conf { margin-right: 8px; vertical-align: 1px; }

/* ---- publications ---- */
#papers .ds-card.pub {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 18px;
  margin: 0 0 16px;
}
.thumb {
  display: block;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 16 / 10;
  padding: 8px;
  border: 1px solid var(--ds-hairline);
  border-radius: var(--ds-radius-md);
  background: #fff;
  overflow: hidden;
  cursor: zoom-in;
  transition: box-shadow var(--ds-duration) var(--ds-ease);
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.venue {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}
.kind { font-size: 12px; color: var(--ds-text-secondary); }
.pub h3 {
  font-family: var(--ds-font-display);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: var(--ds-tracking-tight);
  margin: 0 0 6px;
}
.authors { margin: 0 0 8px; font-size: 14px; color: var(--ds-text-secondary); }
.authors b { color: var(--ds-text); font-weight: 600; }
.tldr { margin: 0 0 10px; color: var(--ds-text); text-wrap: pretty; }
details { margin: 0 0 12px; font-size: 15px; color: var(--ds-text-secondary); }
summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ds-accent);
  list-style: none;
  user-select: none;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: " ›"; }
details[open] summary::after { content: " ˄"; }
details p {
  margin: 8px 0 0;
  padding-left: 12px;
  border-left: 2px solid var(--ds-hairline);
}
.pills { display: flex; flex-wrap: wrap; gap: 14px 18px; margin: 0; }

/* ---- experience ---- */
.cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.col-h {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: var(--ds-tracking-caps);
  text-transform: uppercase;
  color: var(--ds-text-secondary);
  margin: 0 0 8px;
}
[data-lang="zh"] .col-h { letter-spacing: .18em; }
.tl + .col-h { margin-top: 28px; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--ds-hairline);
}
.tl li:last-child { border-bottom: 0; }
.tl h4 {
  font: 600 16px/1.35 var(--ds-font-display);
  letter-spacing: var(--ds-tracking-tight);
  margin: 0 0 3px;
}
.tl p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ds-text-secondary); }
.tl time {
  flex: none;
  font: 500 12px/1.8 var(--ds-font-mono);
  color: var(--ds-text-tertiary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tag { margin-left: 4px; vertical-align: 2px; }
.service { margin: 12px 0 0; font-size: 15px; color: var(--ds-text); }

/* ---- visitors ---- */
#visitors[hidden] { display: none; }
#visitors .ds-muted { margin: 0 0 6px; }
#map {
  height: 320px;
  border-radius: var(--ds-radius-md);
  border: 1px solid var(--ds-hairline);
  overflow: hidden;
  margin-top: 12px;
  background: var(--ds-bg-elevated);
}
[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }
}

/* ---- lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--ds-overlay);
  backdrop-filter: blur(10px);
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: min(1400px, 96vw);
  max-height: 92vh;
  border-radius: var(--ds-radius-md);
  background: #fff;
  box-shadow: var(--ds-shadow-3);
}
.lightbox button {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

/* ---- reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .55s var(--ds-ease-out), transform .55s var(--ds-ease-out);
}
.reveal.in { opacity: 1; transform: none; }

@media (min-width: 760px) {
  .hero-grid {
    grid-template-columns: 176px 1fr;
    gap: 48px;
    padding-top: 12px;
  }
  .avatar { width: 176px; }
  .avatar .monogram { font-size: 64px; }
  .intro .ds-hero-title { font-size: clamp(44px, 5vw, 64px); }
  .news li { grid-template-columns: 78px 1fr; gap: 18px; }
  #papers .ds-card.pub {
    grid-template-columns: 240px 1fr;
    gap: 28px;
    padding: 22px;
  }
  .thumb { max-width: none; }
  .cols { grid-template-columns: 1fr 1fr; gap: 20px; }
}

@media (min-width: 1440px) {
  .intro { padding-top: 80px; }
}

@media (max-width: 733px) {
  .ds-nav-brand .en-name { display: none; }
  .ds-nav-tools { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}
