a {
  color: inherit;
  text-decoration: none;
}

body {
  background-color: #fcfbf8;
  color: #292822;
  cursor: default;
  font-size: 18px;
  line-height: 1.9;
  margin: 0;
}

nav {
  background-color: #fcfbf8;
  border-bottom: 1px solid #e7e5de;
  left: 0;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 10;
}

nav > div {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 0 auto;
  max-width: 100%;
  padding: 14px 32px;
  width: 780px;
}

.nav-title {
  display: flex;
  gap: 0.25em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.nav-title > a {
  flex-shrink: 0;
}

/* 省略号由文章标题自身生成，与文字一起改变透明度。 */
.nav-article-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 默认轻淡显示并保留位置，没有译文时仅淡出。 */
.nav-language,
.nav-language[hidden] {
  display: block;
  flex-shrink: 0;
  width: 2em;
  white-space: nowrap;
  text-align: right;
  opacity: 0.6;
  visibility: visible;
  transition: none;
}

.nav-language[href]:hover,
.nav-language[href]:focus-visible {
  opacity: 1;
}

.nav-language.is-unavailable {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 0s linear 180ms;
}

@media (prefers-reduced-motion: reduce) {
  .nav-language,
  .nav-language.is-unavailable {
    transition: none;
  }
}

#body {
  box-sizing: border-box;
  margin: 0 auto;
  max-width: 100%;
  padding: 120px 32px 96px;
  width: 780px;
}










/* 中文站全部沿用原有字体，新增英文字体仅在英文站使用。 */

body {
  font-family: "Noto Serif SC", serif;
}

nav {
  font-family: "ZCOOL XiaoWei", serif;
}

html:lang(en) body {
  font-family: "Aleo", "Noto Serif SC", serif;
}

html:lang(en) nav {
  font-family: "Zilla Slab", "ZCOOL XiaoWei", serif;
}

html:lang(en) #body :is(h2, h3, h4, h5, h6) {
  font-family: "DM Sans", "Noto Serif SC", sans-serif;
}

/* Unbounded 仅用于英文站大标题，中文字符仍回退到思源宋体。 */
html:lang(en) #body h1 {
  font-family: "Unbounded", "Noto Serif SC", sans-serif;
  font-weight: 600;
}










/* 正在修改文章排版 */

nav {
  line-height: 1.5;
  overflow-wrap: anywhere;
}

#body {
  overflow-wrap: break-word;
}

#body > :first-child {
  margin-top: 0;
}

#body > :last-child {
  margin-bottom: 0;
}

#body h1,
#body h2,
#body h3,
#body h4,
#body h5,
#body h6 {
  color: #191813;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#body h1 {
  font-size: 2.1em;
  text-wrap: balance;
  letter-spacing: -0.025em;
  margin: 0 0 1.1em;
}

#body h2 {
  font-size: 1.5em;
  margin: 2em 0 0.8em;
}

#body h3 {
  font-size: 1.2em;
  margin: 1.7em 0 0.65em;
}

#body h4,
#body h5,
#body h6 {
  font-size: 1em;
  margin: 1.5em 0 0.6em;
}

#body p,
#body ul,
#body ol {
  margin: 0 0 1.25em;
}

#body ul,
#body ol {
  padding-left: 1.5em;
}

#body li + li {
  margin-top: 0.35em;
}

#body li > p {
  margin: 0.5em 0;
}

#body li > ul,
#body li > ol {
  margin: 0.5em 0 0;
}

#body a {
  text-decoration: underline;
  text-decoration-color: #aaa69a;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

#body a:hover {
  text-decoration-color: currentColor;
}

#body blockquote {
  border-left: 2px solid #b9b4a7;
  color: #69655b;
  font-size: 0.95em;
  margin: 1.7em 0;
  padding: 0.15em 0 0.15em 1.25em;
}

#body blockquote > :last-child {
  margin-bottom: 0;
}

#body img {
  border-radius: 4px;
  display: block;
  height: auto;
  max-width: 100%;
}

#body .image-grid {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1.7em 0;
}

#body .image-grid.two-images {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#body .image-grid img {
  width: 100%;
}

#body .image-grid > a {
  min-width: 0;
}

#body .image-grid > br {
  display: none;
}

#body code {
  background-color: #f1efe8;
  border-radius: 3px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.8em;
  padding: 0.15em 0.35em;
}

#body pre {
  background-color: #f5f3ee;
  border: 1px solid #e5e2d9;
  border-radius: 6px;
  font-size: 0.8em;
  line-height: 1.65;
  margin: 1.7em 0;
  overflow-x: auto;
  overflow-wrap: normal;
  padding: 1.25em 1.5em;
  tab-size: 4;
}

#body pre code {
  background-color: transparent;
  border-radius: 0;
  font-size: inherit;
  padding: 0;
}

#body .highlight pre {
  margin: 0;
}

#body .highlight {
  margin: 1.7em 0;
}

#body table {
  border-collapse: collapse;
  display: block;
  font-size: 0.9em;
  line-height: 1.65;
  margin: 1.7em 0;
  overflow-x: auto;
}

#body th,
#body td {
  border-bottom: 1px solid #e5e2d9;
  border-top-color: #e5e2d9;
  padding: 0.65em 0.9em;
  text-align: left;
}

#body th {
  background-color: #f3f1eb;
}

#body thead:not(:has(th:not(:empty))) {
  display: none;
}

#body thead:not(:has(th:not(:empty))) + tbody > tr:first-child > td {
  border-top-style: solid;
  border-top-width: 1px;
}

#body hr {
  border: 0;
  border-top: 1px solid #e5e2d9;
  margin: 2.5em 0;
}

#body .katex {
  font-size: 1.05em;
}

#body .katex-display {
  margin: 1.7em 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.3em 0;
}

@media (max-width: 600px) {
  body {
    line-height: 1.85;
  }

  nav > div {
    padding: 14px 24px;
  }

  #body {
    padding: 104px 24px 64px;
  }

  #body h1 {
    font-size: 1.8em;
  }

  #body .image-grid {
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #body pre {
    padding: 1em;
  }
}

@media (max-width: 360px) {
  #body .image-grid,
  #body .image-grid.two-images {
    grid-template-columns: 1fr;
  }
}










/* 正在适配深色模式 */

@media (prefers-color-scheme: dark) {
  html {
    background-color: #000;
    color-scheme: dark;
  }

  body,
  nav {
    background-color: #000;
    color: #d6d6d6;
  }

  nav {
    border-bottom-color: #303030;
  }

  #body h1,
  #body h2,
  #body h3,
  #body h4,
  #body h5,
  #body h6 {
    color: #f5f5f5;
  }

  #body a {
    text-decoration-color: #777;
  }

  #body blockquote {
    border-left-color: #555;
    color: #aaa;
  }

  #body code,
  #body pre,
  #body th {
    background-color: #000;
  }

  #body pre,
  #body th,
  #body td,
  #body hr {
    border-color: #303030;
  }

  /* 覆盖 Hugo 写入的 GitHub 高亮行内颜色。 */
  #body .highlight [style*="background-color"] {
    background-color: #000 !important;
  }

  #body .highlight [style*="#1f2328"],
  #body .highlight [style*="#24292e"] {
    color: #e6edf3 !important;
  }

  #body .highlight [style*="#0550ae"],
  #body .highlight [style*="#990000"] {
    color: #79c0ff !important;
  }

  #body .highlight [style*="#6639ba"] {
    color: #d2a8ff !important;
  }

  #body .highlight [style*="#0a3069"],
  #body .highlight [style*="#032f62"] {
    color: #a5d6ff !important;
  }

  #body .highlight [style*="#cf222e"],
  #body .highlight [style*="#82071e"] {
    color: #ff7b72 !important;
  }

  #body .highlight [style*="#953800"] {
    color: #ffa657 !important;
  }

  #body .highlight [style*="#57606a"],
  #body .highlight [style*="#6a737d"] {
    color: #8b949e !important;
  }

  #body .highlight [style*="#116329"] {
    color: #7ee787 !important;
  }
}












/* 正在专门调整文章目录 */

html {
  scroll-behavior: smooth;
}

.article-toc {
  --toc-active: #191813;
  --toc-background: #fcfbf8;
  animation: toc-fade-in 240ms ease both;
  bottom: 24px;
  box-sizing: border-box;
  left: 12px;
  max-height: 60vh;
  overflow: auto;
  padding: 8px 12px;
  pointer-events: none;
  position: fixed;
  scrollbar-width: none;
  width: 390px;
  z-index: 11;
}

@keyframes toc-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.article-toc a {
  align-items: center;
  color: var(--toc-active);
  display: flex;
  font-size: 14px;
  height: 22px;
  line-height: 1.5;
  pointer-events: auto;
  position: relative;
  width: 36px;
}

.article-toc a::before {
  background-color: #888;
  border-radius: 2px;
  content: "";
  height: 1px;
  opacity: 0.5;
  transition: width 160ms ease, background-color 120ms ease, opacity 120ms ease;
  width: 14px;
}

.article-toc .toc-h3::before {
  width: 22px;
}

.article-toc span {
  background-color: var(--toc-background);
  border-radius: 4px;
  box-sizing: border-box;
  left: 38px;
  max-width: 320px;
  opacity: 0;
  overflow: hidden;
  padding: 3px 6px;
  pointer-events: none;
  position: absolute;
  text-overflow: ellipsis;
  top: 50%;
  transform: translateY(-50%);
  transition: opacity 120ms ease;
  white-space: nowrap;
}

.article-toc a:hover span,
.article-toc a:focus-visible span {
  font-weight: 700;
  opacity: 1;
}

.article-toc .is-active::before,
.article-toc a:hover::before,
.article-toc a:focus-visible::before {
  background-color: var(--toc-active);
  opacity: 0.85;
}

.article-toc a:hover::before,
.article-toc a:focus-visible::before {
  height: 2px;
  opacity: 1;
  width: 26px;
}

.article-toc .toc-h3:hover::before,
.article-toc .toc-h3:focus-visible::before {
  width: 34px;
}

@media (prefers-color-scheme: dark) {
  .article-toc {
    --toc-active: #fff;
    --toc-background: #000;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .article-toc {
    animation: none;
  }

  .article-toc a::before,
  .article-toc span {
    transition: none;
  }
}




/* 脚注浮窗：与页面同色，无箭头，仅淡入淡出。 */
.footnote-popup {
  background-color: inherit;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
  font-size: 15px;
  line-height: 1.7;
  max-height: calc(100dvh - 32px);
  opacity: 0;
  overflow: auto;
  overflow-wrap: anywhere;
  padding: 14px 18px;
  pointer-events: none;
  position: fixed;
  transition: opacity 160ms ease, visibility 160ms;
  visibility: hidden;
  width: min(340px, calc(100vw - 32px));
  z-index: 12;
}
.footnote-popup.is-open { opacity: 1; pointer-events: auto; visibility: visible; }
.footnote-popup p { margin: 0 0 0.6em; }
.footnote-popup > :last-child { margin-bottom: 0; }
.footnote-popup a { text-decoration: underline; text-underline-offset: 0.22em; }
@media (prefers-color-scheme: dark) {
  .footnote-popup { border: 1px solid #303030; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .footnote-popup { transition: none; }
}
