:root {
  /* The page colour is sampled from the photo backdrop so the portrait sits in the page. */
  --paper: #f1edea;
  --ink: #1b2230;
  --muted: #5d6573;
  --rule: #d9d2cb;
  --accent: #1f4e79;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(31, 78, 121, 0.3);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}
a:hover { text-decoration-color: currentColor; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 16px; background: #fff; padding: 8px 12px; z-index: 10; }

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 28px 0 0;
  font-size: 14px;
}
.topbar .mark {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
}
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px 26px; }
.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.topbar nav a:hover { color: var(--ink); }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 56px;
  align-items: end;
  padding-top: 40px;
  border-bottom: 1px solid var(--rule);
}
.hero-text { padding-bottom: 72px; }

.eyebrow {
  margin: 0 0 22px;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(48px, 7.4vw, 92px);
  line-height: 1;
  letter-spacing: -0.02em;
}
.name-zh {
  margin: 14px 0 0;
  font-size: 22px;
  letter-spacing: 0.3em;
  color: var(--muted);
}

.lede {
  margin: 34px 0 0;
  max-width: 30em;
  font-family: var(--serif);
  font-size: clamp(20px, 2.1vw, 24px);
  line-height: 1.45;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 36px 0 0;
  padding: 0;
  list-style: none;
}
.links a {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.links a:hover { background: var(--ink); color: var(--paper); }
.links a.primary { background: var(--ink); color: var(--paper); }
.links a.primary:hover { background: var(--accent); border-color: var(--accent); }

.hero-photo { margin: 0; align-self: end; }
.hero-photo img {
  display: block;
  width: 100%;
  height: auto;
  /* Feather the top and sides into the page; the bottom rests on the rule. */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 9%),
    linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to bottom, transparent 0, #000 9%),
    linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%);
  mask-composite: intersect;
}

/* ---------- Sections ---------- */
.section {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 40px;
  padding: 56px 0;
  border-bottom: 1px solid var(--rule);
}
.section h2 {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-body { max-width: 720px; }
.section-body > :first-child { margin-top: 0; }
.section-body > :last-child { margin-bottom: 0; }

.bio p { margin: 0 0 1.1em; font-size: 18px; }

.entries { margin: 0; padding: 0; list-style: none; }
.entries li {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 24px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
}
.entries li:first-child { border-top: 0; padding-top: 0; }
.entries li:last-child { padding-bottom: 0; }
.entries .what {
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.3;
}
.entries .what a { color: var(--ink); text-decoration-color: var(--rule); }
.entries .what a:hover { color: var(--accent); text-decoration-color: currentColor; }
.entries .detail { color: var(--muted); font-size: 16px; }

.contact p { margin: 0 0 0.5em; }
.contact .email {
  font-family: var(--serif);
  font-size: clamp(22px, 3vw, 30px);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 48px;
  font-size: 14px;
  color: var(--muted);
}
footer a { color: var(--muted); }

/* ---------- Small screens ---------- */
@media (max-width: 820px) {
  .page { padding: 0 20px; }
  .topbar { padding-top: 20px; }
  .topbar nav { gap: 4px 18px; }
  .hero { grid-template-columns: 1fr; gap: 0; padding-top: 28px; }
  .hero-text { padding-bottom: 28px; }
  .hero-photo { max-width: 420px; width: 100%; margin: 0 auto; }
  .section { grid-template-columns: 1fr; gap: 18px; padding: 40px 0; }
  .section h2 { margin: 0; }
  .entries li { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 480px) {
  .topbar .mark { display: none; }
  .name-zh { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

@media print {
  .topbar nav, .links, footer a { display: none; }
  .section, .hero { border-color: #ccc; }
}

/* ---------- Sub-pages (news, teaching) ---------- */
.topbar nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

.page-head {
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--rule);
}
.page-head h1 { font-size: clamp(42px, 6vw, 72px); }
.page-head .lede { margin-top: 22px; }

.log { margin: 0; padding: 0; list-style: none; }
.log li {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 24px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
}
.log li:first-child { border-top: 0; padding-top: 0; }
.log li:last-child { padding-bottom: 0; }
.log time { padding-top: 4px; color: var(--muted); font-size: 15px; }
.log h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 20px;
  line-height: 1.3;
}
.log h3 a { color: var(--ink); text-decoration-color: var(--rule); }
.log h3 a:hover { color: var(--accent); text-decoration-color: currentColor; }
.log p { margin: 4px 0 0; color: var(--muted); font-size: 16px; }

.statement { font-family: var(--serif); font-size: 21px; line-height: 1.5; margin: 0; }

@media (max-width: 820px) {
  .page-head { padding: 40px 0 36px; }
  .log li { grid-template-columns: 1fr; gap: 2px; }
  .log time { padding-top: 0; font-size: 14px; }
}

/* ---------- Research themes (homepage) ---------- */
.themes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 36px 40px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.themes li { border-top: 2px solid var(--ink); padding-top: 16px; }
.themes h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.25;
}
.themes p { margin: 0; font-size: 16px; color: var(--muted); }
.themes .work { margin-top: 12px; font-size: 14px; color: var(--ink); }
.themes .work a { color: var(--ink); text-decoration-color: var(--rule); }
.themes .work a:hover { color: var(--accent); text-decoration-color: currentColor; }
.more { margin: 36px 0 0; font-size: 15px; }

/* ---------- Publications ---------- */
.year-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
}
.year-nav a { color: var(--muted); text-decoration: none; }
.year-nav a:hover { color: var(--ink); }

.pubs { margin: 0; padding: 0; list-style: none; }
.pubs li { padding: 16px 0; border-top: 1px solid var(--rule); }
.pubs li:first-child { border-top: 0; padding-top: 0; }
.pubs li:last-child { padding-bottom: 0; }
.pubs h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 19px;
  line-height: 1.35;
}
.pubs h3 a { color: var(--ink); text-decoration-color: var(--accent); }
.pubs h3 a:hover { color: var(--accent); }
.pubs p { margin: 4px 0 0; font-size: 15px; }
.pubs .authors { color: var(--muted); }
.pubs .authors strong { color: var(--ink); font-weight: 600; }
.pubs .tag {
  display: inline-block;
  margin-right: 6px;
  padding: 0 7px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  vertical-align: 1px;
}
.section[id] { scroll-margin-top: 12px; }

/* ---------- Group ---------- */
.group-photos { display: flex; gap: 20px; padding: 40px 0 0; }
.group-photos figure { margin: 0; min-width: 0; }
.group-photos img { display: block; width: 100%; height: auto; border-radius: 6px; }
.group-photos figcaption { margin-top: 8px; font-size: 14px; color: var(--muted); }

.people {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.people.wide { grid-template-columns: 1fr; gap: 14px; }
.people .name { display: block; font-family: var(--serif); font-size: 19px; line-height: 1.3; }
.people .name a { color: var(--ink); text-decoration-color: var(--rule); }
.people .name a:hover { color: var(--accent); text-decoration-color: currentColor; }
.people .note { display: block; font-size: 14px; color: var(--muted); }
.join-links { margin: 16px 0 0; font-size: 16px; }

@media (max-width: 820px) {
  .themes { grid-template-columns: 1fr; gap: 28px; }
  .people { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .group-photos { flex-direction: column; padding-top: 24px; }
}

/* ---------- Click-to-play video ---------- */
.video { margin: 0; }
.video-poster,
.video iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 6px;
}
.video-poster {
  position: relative;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  overflow: hidden;
}
.video-poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
.video-poster::after {
  content: "";
  position: absolute;
  inset: 55% 0 0 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.6));
}
.video-play {
  position: absolute;
  z-index: 1;
  /* Left of centre: the right half of the cover carries the programme's title. */
  left: 29%;
  top: 40%;
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(27, 34, 48, 0.72);
  transition: background 0.15s, transform 0.15s;
}
.video-play::after {
  content: "";
  position: absolute;
  left: 28px;
  top: 22px;
  border-style: solid;
  border-width: 14px 0 14px 22px;
  border-color: transparent transparent transparent #fff;
}
.video-poster:hover .video-play { background: var(--accent); transform: scale(1.06); }
.video-label { position: absolute; z-index: 1; left: 20px; right: 20px; bottom: 14px; }
/* The cover image carries its own title, so the text title is kept for screen readers only. */
.video-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.video-meta { display: block; font-size: 14px; }
.video figcaption { margin-top: 12px; font-size: 16px; color: var(--muted); }
@media (max-width: 820px) {
  .video-play { width: 52px; height: 52px; margin: -26px 0 0 -26px; top: 34%; }
  .video-play::after { left: 19px; top: 15px; border-width: 9px 0 9px 15px; }
  .video-label { left: 12px; bottom: 8px; }
  .video-meta { font-size: 12px; }
}

/* ---------- Contact topics, QR codes, openings ---------- */
.contact .contact-lead { margin: 22px 0 0; font-size: 16px; color: var(--muted); }
.contact .contact-topics { margin: 12px 0 0; }
.contact .address { margin: 28px 0 0; }
.follow { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 32px; }
.follow figure { margin: 0; width: 148px; }
.follow img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 6px; background: #fff; }
.follow figcaption { margin-top: 8px; font-size: 14px; color: var(--muted); line-height: 1.4; }
.follow figcaption strong { display: block; color: var(--ink); font-weight: 600; }
.openings { border: 1px solid var(--ink); border-radius: 8px; padding: 28px; }
.openings p { margin: 14px 0 0; }
.openings .statement { margin: 0; }
.openings .links { margin-top: 22px; }

/* ---------- English / 中文 ---------- */
html:not(.zh) .zh { display: none !important; }
html.zh .en { display: none !important; }
html.zh {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}
html.zh h1 { letter-spacing: 0.04em; }
html.zh .eyebrow, html.zh .section h2 { letter-spacing: 0.2em; }
.lang-switch { display: inline-flex; gap: 6px; white-space: nowrap; color: var(--muted); }
.lang-switch button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: 0.02em;
  color: var(--muted);
  cursor: pointer;
}
.lang-switch button:hover { color: var(--ink); }
.lang-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
html:not(.zh) .lang-switch [data-lang="en"],
html.zh .lang-switch [data-lang="zh"] { color: var(--ink); font-weight: 600; }
