@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700&display=swap");

/* TeX Gyre Termes 2.004（GUST 字体许可，见 assets/fonts/texgyretermes/），自托管 */
@font-face { font-family: "TeX Gyre Termes"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/texgyretermes/texgyretermes-regular.woff2") format("woff2"); }
@font-face { font-family: "TeX Gyre Termes"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("../fonts/texgyretermes/texgyretermes-italic.woff2") format("woff2"); }
@font-face { font-family: "TeX Gyre Termes"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/texgyretermes/texgyretermes-bold.woff2") format("woff2"); }
@font-face { font-family: "TeX Gyre Termes"; font-style: italic; font-weight: 700; font-display: swap;
  src: url("../fonts/texgyretermes/texgyretermes-bolditalic.woff2") format("woff2"); }

/* 字体优先级：Termes 能渲染的字符用 Termes；中文等 Termes 没有的字符逐字回退到 Noto Serif SC。
   最后几个系统字体只在两个网页字体都加载失败时才会用到 */
html body {
  font-family: "TeX Gyre Termes", "Noto Serif SC",
               "Times New Roman", Times, serif !important;
}

/* 对所有文本元素强制继承（排除图标字体 i / fa / ai，避免图标乱码） */
html body *:not(i):not(svg):not(path):not([class*="fa"]):not([class^="fa-"]):not([class*="ai"]):not([class^="ai-"]) {
  font-family: inherit !important;
}

/* 代码块保持等宽 */
html body code,
html body pre,
html body kbd,
html body samp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
               "Liberation Mono", "Courier New", monospace !important;
}

/* ===== 统一主页 & CV 的容器（居中 + 不贴边） ===== */
:root {
  --container-max: 1200px;
  --container-pad: 24px;
}

html body .masthead__inner-wrap,
html body #main {
  max-width: var(--container-max) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: var(--container-pad) !important;
  padding-right: var(--container-pad) !important;
}

/* pubs 排版 */
.selected-pubs p { margin: 0 0 1.05rem; line-height: 1.55; }
.selected-pubs strong { font-weight: 700; }

/* ===== Ensure homepage (layout--home) matches other pages ===== */

/* 1) force font inside homepage containers */
html body.layout--home,
html body.layout--home #main,
html body.layout--home .initial-content,
html body.layout--home .page__content,
html body.layout--home .archive,
html body.layout--home .archive__item,
html body.layout--home .page__title {
  font-family: inherit !important;
}

/* 2) force same width + padding on homepage containers */
html body.layout--home #main,
html body.layout--home .initial-content,
html body.layout--home .archive,
html body.layout--home .masthead__inner-wrap {
  max-width: var(--container-max) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: var(--container-pad) !important;
  padding-right: var(--container-pad) !important;
}

/* 侧栏离左边缘留一点距离，头像稍微内缩。只在桌面端（侧栏在左侧，≥ 925px）生效，
   否则手机上侧栏会比正文多缩进 24px，和正文对不齐 */
@media (min-width: 925px) {
  .sidebar.sticky {
    padding-left: 24px !important;   /* 想更远就加大，比如 24px */
    padding-right: 10px !important;
  }

  /* Optional: avatar itself a bit inset */
  .author__avatar {
    margin-left: 6px !important;
  }
}

/* 手机和平板（< 925px）：主题用 table-cell 排这一行，宽度只按内容收缩，
   Contact 按钮到不了右边缘。改成 flex 让这一行撑满正文宽度，头像放大到 64px；
   其余（字号、Contact 按钮和下拉菜单的样式）沿用主题 */
@media (max-width: 924.98px) {
  .sidebar [itemscope] {
    display: flex;
    align-items: center;
  }
  .sidebar div.author__avatar {
    flex: 0 0 64px;
    width: 64px;
  }
  .sidebar .author__urls-wrapper {
    margin-left: auto;
  }
}

/* ===== Research 页：论文条目（_includes/research-entry.html） =====
   正文和媒体共用同一个版心宽度 --pub-measure，图片、视频的左右边缘与文字对齐。
   作者、会议、key idea、图注、链接用同一字号、同一颜色，只靠正体 / 粗体 / 斜体区分；
   只有标题更大一号。只有方括号链接、BibTeX 折叠和视频的播放/暂停按钮可以交互 */
.research {
  --pub-measure: 46em;
  /* 年份、页首说明用的次要色：正文色和背景色按比例混合，浅色、深色主题下都可读
     （主题的 --global-base-color 在深色模式下等于背景色，不能用） */
  --pub-muted: color-mix(in srgb, var(--global-text-color) 68%, var(--global-bg-color));
}

.research__note {
  max-width: var(--pub-measure);
  margin: 0 0 0.5em;
  color: var(--pub-muted);
}

.research__year {
  max-width: var(--pub-measure);
  margin: 2em 0 1.25em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--global-dark-border-color);
  font-size: 1em;
  letter-spacing: 0.06em;
  color: var(--pub-muted);
}

.pub {
  max-width: var(--pub-measure);
  margin: 0 0 1.75em;
  padding-bottom: 1.75em;
  border-bottom: 1px solid var(--global-border-color);
  line-height: 1.55;
}

.pub:last-child,
.pub:has(+ .research__year) {
  border-bottom: 0;
  padding-bottom: 0;
}

.pub__title {
  margin: 0 0 0.35em;
  font-size: 1.15em;
  line-height: 1.3;
}

.pub__byline,
.pub__summary {
  margin: 0 0 0.75em;
}

/* 媒体：外框贴着版心边缘，与文字左右对齐，所有媒体统一 16:9。主题把 figure 设成 flex 容器，
   外框会按内容收缩、懒加载的图片加载前是 0 宽，所以改回块级。
   素材不是 16:9 时完整缩放进框内（contain），不裁切，多出的部分留底色：
   图片是白底（深色模式下也保持白底，因为论文图都是按白底画的），视频是黑底。不另加白边：素材自己要留好边距 */
.pub__media {
  display: block;
  margin: 0 0 0.75em;
}

.pub__frame {
  position: relative;
  box-sizing: border-box;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--global-border-color);
  background: #fff;
  line-height: 0;
}

.pub__frame--video {
  background: #000;
}

.pub__frame img,
.pub__frame video {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 播放/暂停按钮：样式完全来自主题的 .btn.btn--inverse，这里只负责摆到画面右下角 */
.pub__play {
  position: absolute;
  right: 0.75em;
  bottom: 0.75em;
  margin: 0;
  line-height: normal;
}

.pub__play[hidden] {
  display: none;
}

.pub__media figcaption {
  margin: 0.5em 0 0;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  text-align: left;
}

/* 主题给图注里的链接换了颜色、去掉下划线；改回和链接行一样 */
.pub__media figcaption a {
  color: var(--global-link-color);
  text-decoration: underline;
  border-bottom: 0;
}

/* 链接行：方括号里只有文字是链接 */
.pub__links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2em 0.9em;
}

.pub__bracket {
  white-space: nowrap;
}

.pub__bibtex summary {
  display: inline;
  list-style: none;
  cursor: pointer;
}

.pub__bibtex summary::-webkit-details-marker {
  display: none;
}

.pub__toggle {
  color: var(--global-link-color);
}

.pub__bibtex[open] {
  flex-basis: 100%;
}

.pub__bibtex pre {
  margin: 0.5em 0 0;
  padding: 0.75em 1em;
  overflow-x: auto;
  font-size: 0.75em;
  line-height: 1.5;
  white-space: pre;
  background: var(--global-code-background-color);
  border: 1px solid var(--global-border-color);
}
