/* Self-hosted fonts; licenses: ../fonts/Gelasio-OFL.txt and ../fonts/NotoSerifSC-OFL.txt. */
@font-face {
  font-family: "Gelasio";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/gelasio-latin-variable.woff2") format("woff2");
}

@font-face {
  font-family: "Homepage Name";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/noto-serif-sc-name-bold.woff2") format("woff2");
  unicode-range: U+590F, U+6E05, U+FF08-FF09;
}

/* Base styles */
[hidden] {
  display: none;
}

html {
  --font-serif: "Gelasio", Georgia, serif;
  font-size: 100%;
  background-color: #f0f0f0;
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}

html[data-latin-font="georgia"] {
  --font-serif: Georgia, "Gelasio", serif;
}

.profile-name-zh {
  font-family: "Homepage Name", SimSun, "Songti SC", serif;
}

html,
button {
  font-family: var(--font-serif);
}

a:focus {
  outline: thin dotted;
}

a:hover,
a:active {
  outline: 0;
}

img {
  border: 0;
}

button {
  font-size: 100%;
  margin: 0;
  vertical-align: baseline;
  line-height: normal;
  cursor: pointer;
  -webkit-appearance: button;
}

button::-moz-focus-inner {
  border: 0;
  padding: 0;
}

body {
  padding: 20px 0 20px 0px;
  margin: 0px;
  font: 16px/1.5 var(--font-serif);
  color: #f0e7d5;
  font-weight: normal;
  background: #f0f0f0;
}

h1, h2, h3 {
  color: #000000;
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-weight: normal;
}

p {
  margin: 0 0 20px;
}

h1, h2, h3 {
  line-height: 1.1;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 20px;
  line-height: 24px;
  font-family: var(--font-serif);
  font-weight: normal;
  color: #2f2f2f;
}

a {
  color: #3677a9;
  font-weight: 400;
  text-decoration: none;
}
a:hover {
  color: #0000dd;
}

strong {
  font-family: var(--font-serif);
  font-weight: bold;
}

.wrapper {
  box-sizing: border-box;
  width: 100%;
  max-width: 900px;
  min-width: 0;
  margin: auto auto;
  position: relative;
  padding: 20px 20px;
  color: #000000;
  background-color: #ffffff;
}

/* Homepage profile and research overview */
.profile-section,
.research-item {
  box-sizing: border-box;
}

.profile-section {
  display: flow-root;
}

.profile-section::after {
  display: table;
  clear: both;
  content: "";
}

.profile-media {
  float: left;
  width: 150px;
  margin-top: 6px;
}

.profile-portrait {
  display: block;
  width: 150px;
  height: 150px;
}

.profile-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin: 12px 0 0;
}

.profile-links a {
  display: grid;
  place-items: center;
  flex: 0 0 22px;
  width: 22px;
  height: 24px;
  line-height: 0;
}

/* Icon alignment is baked into the PNG canvases. */
.profile-link-icon {
  display: block;
  width: 22px;
  height: 22px;
  overflow: hidden;
}

.subwrapper {
  min-height: 190px;
  margin-left: 170px;
  margin-bottom: 0;
}

.recruiting {
  color: #c00;
  overflow-wrap: anywhere;
}

.news-list {
  margin-bottom: 12px;
}

/* Match visibleNewsCount in news.js; hide older entries before deferred JS runs.
   JS moves them into a nested container, where this rule no longer applies. */
.news-list > .news-item:nth-child(n + 11) {
  display: none;
}

.news-item-toggle {
  position: relative;
  padding-right: 30px;
}

.news-toggle {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #3677a9;
  cursor: pointer;
}

.news-toggle::before {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: "";
  transform: translateY(-2px) rotate(45deg);
}

.news-toggle[aria-expanded="true"]::before {
  transform: translateY(2px) rotate(225deg);
}

.news-toggle:hover {
  background: #f0f5f9;
}

.news-toggle:focus-visible {
  outline: 2px solid #3677a9;
  outline-offset: 2px;
}

.research-section {
  max-width: none;
  margin: 0 0 8px;
  padding: 0;
}

.research-intro {
  margin: -2px 0 14px;
  color: #000;
}

.research-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid #ddd;
}

.research-tabs[hidden],
.research-item[hidden] {
  display: none;
}

.research-tabs button {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  padding: 8px clamp(2px, calc((100vw - 640px) / 26), 8px);
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #555;
  font: 16px/1.25 var(--font-serif);
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.research-tab-label {
  grid-area: 1 / 1;
  min-width: 0;
}

.research-tab-line {
  display: block;
  white-space: nowrap;
}

.research-tabs button:hover {
  color: #3677a9;
  background: #f5f8fb;
}

.research-tabs button[aria-selected="true"] {
  border-bottom-color: #3677a9;
  background: #f0f5f9;
  color: #24577d;
  font-weight: bold;
}

.research-tabs button:focus-visible {
  outline: 2px solid #3677a9;
  outline-offset: -4px;
}

.research-item:focus-visible {
  outline: 2px solid #3677a9;
  outline-offset: 3px;
}

.research-tabs-enabled .research-item {
  padding-top: 24px;
  border-top: 0;
}

.research-tabs-enabled .research-panels {
  display: grid;
}

/* Overlap the overview panels so switching areas keeps the fixed paper list in place. */
.research-tabs-enabled .research-panels .research-item {
  grid-area: 1 / 1;
  opacity: 1;
  align-self: start;
}

.research-tabs-enabled .research-panels .research-item[hidden] {
  display: grid;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

@media screen and (prefers-reduced-motion: no-preference) {
  .research-tabs-enabled .research-panels .research-item {
    transition: opacity 420ms cubic-bezier(.4, 0, .2, 1), visibility 0s;
  }

  .research-tabs-enabled .research-panels .research-item[hidden] {
    transition-delay: 0s, 420ms;
  }

  .research-tabs button {
    transition: color 220ms ease, background-color 220ms ease,
      border-bottom-color 220ms ease;
  }

  .news-toggle::before {
    transition: transform 360ms ease-in-out;
  }
}

@media print {
  .research-tabs {
    display: none;
  }

  .research-item[hidden] {
    display: grid;
  }

  .research-tabs-enabled .research-panels {
    display: block;
  }

  .research-tabs-enabled .research-panels .research-item[hidden] {
    display: grid;
    visibility: visible;
    opacity: 1;
  }
}

.research-item {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr);
  column-gap: 20px;
  row-gap: 8px;
  align-content: stretch;
  align-items: center;
  margin: 0;
  padding: 20px 0;
  border-top: 1px solid #ddd;
}

.research-figure {
  display: block;
  align-self: start;
  min-width: 0;
  width: 170px;
  max-width: 170px;
  margin: 6px -10px 0;
}

.research-figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  background: transparent;
}

.research-copy {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-width: 0;
}

.research-copy h3 {
  margin-bottom: 8px;
  color: #222;
  font-size: 19px;
  line-height: 1.3;
}

.research-copy p {
  margin-bottom: 0;
  font-size: 15px;
  line-height: 1.5;
  text-wrap: pretty;
}

.research-copy .research-topics {
  margin: auto 0 0;
  padding-top: 12px;
  color: #666;
  font-size: 13px;
  line-height: 1.55;
  text-wrap: pretty;
}

.all-publications {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid #e7e7e7;
  color: #555;
  font-size: 14px;
  text-align: right;
}

hr {
  border: 0;
  outline: none;
  height: 2px;
  color: #e0e0e0;
  background: transparent url("../images/divider.gif") center center repeat-x;
  margin: 0 0 20px;
}

@media print, screen and (max-width: 720px) {
  body {
    padding: 0;
  }

  .wrapper {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 20px;
  }
}

/* Keep research figures beside the description until the viewport is truly narrow. */
@media print, screen and (max-width: 560px) {
  .research-item {
    grid-template-columns: minmax(0, 1fr);
    align-content: stretch;
    grid-template-rows: 170px auto;
    row-gap: 18px;
  }

  .research-figure {
    margin: 0 auto;
  }

}

@media screen and (max-width: 560px) and (orientation: portrait) {
  .profile-section,
  .profile-media,
  .subwrapper {
    box-sizing: border-box;
    width: 100%;
  }

  .profile-media {
    float: none;
    margin: 10px auto 16px;
  }

  .profile-portrait {
    margin: 0 auto;
  }

  .subwrapper {
    min-height: 0;
    margin-left: 0;
  }
}

@media print, screen and (max-width: 480px) {
  .research-copy h3 {
    font-size: 18px;
  }

  .research-copy .research-topics {
    font-size: 12px;
  }

  .all-publications {
    text-align: left;
  }

}


/* One shared publication list, outside the research tab panels. */
.selected-publications {
  min-width: 0;
  margin: 12px 0 8px;
}
.selected-publications-heading {
  padding-bottom: 8px;
  border-bottom: 1px solid #ddd;
}
.selected-publications-heading h2 {
  margin: 0;
  color: #333;
  font-size: 16px;
  font-weight: bold;
  line-height: 1.5;
}
.publication-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.publication-item {
  display: grid;
  --publication-image-height: 120px;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding: 20px 0;
}
.publication-item + .publication-item {
  border-top: 1px solid #eaeaea;
}
/* Images are pre-fitted offline to the 218 x 118px inner frame at 2x resolution.
   Two title lines, two author lines and one source line occupy about 120px. */
.publication-figure {
  position: relative;
  box-sizing: border-box;
  align-self: start;
  width: 220px;
  max-width: 100%;
  height: var(--publication-image-height);
  margin: 0;
  overflow: hidden;
  border: 1px solid #e4e9ed;
  border-radius: 4px;
}
.publication-figure > a { position: absolute; inset: 0; display: block; }
.publication-figure img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: fill;
}
.publication-copy { min-width: 0; }
.publication-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 7px;
  color: #666;
  font-size: 12px;
}
.publication-placeholder,
.publication-tag {
  padding: 1px 6px;
  border: 1px solid #dbe5ed;
  border-radius: 3px;
  background: #f4f8fb;
  color: #526b7c;
  font-size: 11px;
}
.publication-copy h3 {
  margin: 0 0 5px;
  color: #24577d;
  font-size: 16px;
  font-weight: bold;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.publication-authors {
  margin: 0 0 6px;
  color: #666;
  font-size: 13px;
}
/* Give the profile owner a clear emphasis within the muted author list. */
.publication-authors strong {
  color: #595959;
  font-weight: 700;
  white-space: nowrap;
}
/* Keep the overview compact above the independent publication list. */
.research-item { align-content: start; padding-bottom: 12px; }
@media screen and (max-width: 720px) {
  .publication-item { grid-template-columns: 220px minmax(0, 1fr); gap: 18px; }
}
@media screen and (max-width: 560px) {
  .publication-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
}
@media print {
  .research-item { grid-template-rows: auto; }
  .publication-item { break-inside: avoid; }
}

.publication-copy h3 a { color: inherit; font-weight: inherit; }
.publication-copy h3 a:hover { color: #3677a9; text-decoration: underline; }


.publication-source {
  margin: 0;
  color: #555;
  font-size: 13px;
  line-height: 1.5;
}

/* Leave a clear gap between the final paper and the full-list divider. */
.publication-item:last-child { padding-bottom: 24px; }
.corresponding-author { font-size: 0.75em; line-height: 0; vertical-align: super; }

/* Fitting and whitespace optimization are baked into the 436 x 236px image files. */
.publication-figure img { background: #fff; }
.publication-item[data-placeholder] h3 { color: #666; }

.publication-author-list[title] { cursor: help; }

/* The long NC title uses three lines; its authors occupy just one line. */
.publication-item-compact-authors .publication-authors {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The two icon sets share their existing 22px canvas and alignment. */
.profile-link-icon-light, .profile-link-icon-dark { grid-area: 1 / 1; }
.profile-link-icon-dark, .theme-toggle-sun { opacity: 0; }

.theme-toggle {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 100;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid #cad3dc;
  border-radius: 50%;
  background: #fff;
  color: #3b5266;
  box-shadow: 0 3px 12px #142b4320;
  cursor: pointer;
  touch-action: manipulation;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle svg { grid-area: 1 / 1; width: 22px; height: 22px; }
.theme-toggle:hover { background: #eff4f8; }
.theme-toggle:focus-visible { outline: 2px solid #3677a9; outline-offset: 3px; }
@media screen and (prefers-reduced-motion: no-preference) {
  .theme-toggle { transition: background-color 180ms ease, border-color 180ms ease; }
}
@media print {
  .theme-toggle { display: none; }
}

/* Crossfade a single page snapshot so inherited text and backgrounds share one timeline. */
@media screen and (prefers-reduced-motion: no-preference) {
  html.theme-snapshot-transition,
  html.theme-snapshot-transition * {
    transition: none !important;
  }
  html.theme-snapshot-transition::view-transition-group(root) {
    animation: none;
  }
  html.theme-snapshot-transition::view-transition-image-pair(root) {
    isolation: isolate;
  }
  html.theme-snapshot-transition::view-transition-old(root) {
    animation: none;
    mix-blend-mode: normal;
  }
  html.theme-snapshot-transition::view-transition-new(root) {
    animation: theme-page-fade 360ms ease-in-out both;
    mix-blend-mode: normal;
  }
}
@keyframes theme-page-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
