/* Modern-classic scholar homepage. System fonts only; js/lang.js only switches EN / 中文. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

:root {
  --text: #222;
  --muted: #6b6b6b;
  --link: #1a4f8b;
  --rule: #e6e6e6;
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.32, .72, 0, 1);
}

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
               "Noto Sans", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

[lang="zh-CN"] {
  font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
}

/* Only the chosen language is rendered; without JS the page stays English. */
html:not([data-lang="zh"]) .zh,
html[data-lang="zh"] .en { display: none; }

.container {
  position: relative;
  max-width: 920px;
  margin: 0 auto;
  padding: 80px 36px 56px;
}

a { color: inherit; text-decoration: underline; text-decoration-color: #c8c8c8; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: text-decoration-color .15s; }
a:hover, a:focus-visible { text-decoration-color: currentColor; }

/* Language switch */
.lang-switch {
  position: absolute;
  top: 28px;
  right: 36px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border-radius: 999px;
  background: rgba(118, 118, 128, .12);
  view-transition-name: lang-switch;
}
html:not([data-lang]) .lang-switch { display: none; }

.lang-switch button {
  position: relative;
  z-index: 1;
  min-width: 52px;
  padding: 4px 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: #555;
  font: 500 13px/1.4 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  cursor: pointer;
  transition: color .3s;
}
.lang-switch button[aria-pressed="true"] { color: #111; }
.lang-switch button:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }

.lang-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 1px 1px rgba(0, 0, 0, .04);
  transition: transform .5s var(--spring);
}
html[data-lang="zh"] .lang-thumb { transform: translateX(100%); }

/* Header */
.intro {
  display: flex;
  align-items: center;
  gap: 44px;
  margin-bottom: 44px;
}

.photo {
  flex: 0 0 192px;
  width: 192px;
  height: 240px;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 12px;
  display: block;
  view-transition-name: portrait;
}

h1 {
  margin: 0;
  font-family: Charter, "Iowan Old Style", Georgia, "Noto Serif", serif;
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.zh h1 {
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "PingFang SC",
               "Microsoft YaHei", serif;
  letter-spacing: .06em;
}

.aka  { margin: 2px 0 0; color: var(--muted); }
.role { margin: 12px 0 16px; }

.firm, .nb { white-space: nowrap; }
.mark {
  display: inline-block;
  width: 1.1em;
  height: 1em;
  margin-right: .3em;
  vertical-align: -0.12em;
  fill: currentColor;
}

.info { list-style: none; padding: 0; margin: 0; font-size: 16.5px; }
.info li { margin: 3px 0; }
.label {
  display: inline-block;
  min-width: 64px;
  color: var(--muted);
}

/* Sections */
h2 {
  margin: 48px 0 14px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 7px;
  border-bottom: 1px solid var(--rule);
}
.zh h2 { letter-spacing: .16em; }

section p { margin: 0 0 14px; }
.zh section p { line-height: 1.85; }

ul.news, ul.entries, ul.pubs { list-style: none; padding: 0; margin: 0; }

.news li { display: flex; gap: 18px; margin: 7px 0; }
.date { flex: 0 0 88px; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.zh .date { flex-basis: 124px; }

.entries li { margin: 9px 0; }
.entries.compact li { margin: 5px 0; }
.row { display: flex; justify-content: space-between; gap: 24px; }
.when { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }

.pubs li { margin: 0 0 16px; }
.pubs .title { font-weight: 600; }
.venue { color: var(--muted); font-style: italic; }
.venue:lang(zh) { font-style: normal; }

.item-title { font-weight: 600; margin-bottom: 4px !important; }
.meta { color: var(--muted); font-size: 15.5px; }

.ph { color: var(--muted); font-style: italic; }

footer {
  margin-top: 64px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 14px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  background: #f4f5f7;
  padding: 0.05em 0.35em;
  border-radius: 4px;
}

/* Language change: blur cross-fade (View Transitions, with a class-based fallback) */
@keyframes lang-out { to   { opacity: 0; filter: blur(8px); transform: translateY(-6px); } }
@keyframes lang-in  { from { opacity: 0; filter: blur(8px); transform: translateY(8px); } }

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: lang-out .26s var(--ease-in) both; }
  ::view-transition-new(root) { animation: lang-in .56s var(--ease-out) .08s both; }
  ::view-transition-old(lang-switch),
  ::view-transition-old(portrait) { display: none; }
  ::view-transition-new(lang-switch),
  ::view-transition-new(portrait) { animation: none; }

  .intro-text, main {
    transition: opacity .56s var(--ease-out), filter .56s var(--ease-out), transform .56s var(--ease-out);
  }
  .lang-out .intro-text, .lang-out main {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(-6px);
    transition-duration: .26s;
    transition-timing-function: var(--ease-in);
  }
  .lang-in .intro-text, .lang-in main {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(8px);
    transition: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lang-thumb, .lang-switch button { transition: none; }
}

/* Tablet */
@media (max-width: 1023px) {
  body { font-size: 17px; }
  .container { padding: 76px 32px 52px; }
  .lang-switch { right: 32px; }
}

/* Mobile */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .container { padding: 32px 20px 36px; }
  .lang-switch { top: 32px; right: 20px; }
  .intro { flex-direction: column; align-items: flex-start; gap: 20px; margin-bottom: 36px; }
  .photo { flex: none; width: 132px; height: 165px; }
  h1 { font-size: 30px; }
  .info { font-size: 15px; }
  h2 { margin-top: 40px; font-size: 13px; }
  .news li { flex-direction: column; gap: 0; }
  .date, .zh .date { flex: none; font-size: 14px; }
  .row { flex-direction: column; gap: 0; }
  .when { font-size: 14px; }
  .meta { font-size: 14px; }
  footer { margin-top: 56px; font-size: 13px; }
}
