/* 全站静态展示，关闭菜单、按钮及页内跳转动效。 */
html { scroll-behavior: auto !important; }
*, *::before, *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
.page__content { line-height: 1.8; }
.page__content h2 { margin-top: 2rem; }
.page__content a, .archive__item-title a { text-underline-offset: 0.15em; }

/* 两个导航链接在窄屏上换行，始终直接可见。 */
.greedy-nav { flex-wrap: wrap; }
.greedy-nav .visible-links { flex-wrap: wrap; }
.greedy-nav .visible-links a { margin: 0 0.65rem; }
.greedy-nav__toggle, .greedy-nav .hidden-links { display: none !important; }
.code-copy {
  display: block;
  margin: 0 0 0.4rem auto;
  padding: 0.2rem 0.55rem;
  border: 1px solid #bbb;
  border-radius: 3px;
  background: #fff;
  color: #333;
  font-size: 0.7em;
  cursor: pointer;
}




/* 手机保留顶部导航，最新文章仅在电脑侧栏展示。 */
.sidebar-sections { display: none; }

@media (min-width: 1024px) {
  body { padding-left: 230px; }
  .masthead {
    position: fixed;
    inset: 0 auto 0 0;
    width: 230px;
    overflow-y: auto;
    border-bottom: 0;
    border-right: 1px solid #eee;
    background: #fff;
  }
  .masthead__inner-wrap { padding: 2rem 1.2rem; }
  .greedy-nav { flex-direction: column; align-items: stretch; }
  .greedy-nav .site-title { align-self: flex-start; margin: 0 0 1.5rem; }
  .greedy-nav .visible-links {
    flex-direction: column;
    align-items: stretch;
    flex: none;
    overflow: visible;
    width: 100%;
  }
  .greedy-nav .visible-links > li { margin-bottom: 1rem; white-space: normal; }
  .greedy-nav .visible-links a { margin: 0; }
  .greedy-nav .sidebar-latest {
    display: block;
    margin-top: 0.65rem;
    padding-left: 0.75rem;
    border-left: 1px solid #ddd;
  }
  .greedy-nav .sidebar-latest li { margin-bottom: 0.8rem; }
  .greedy-nav .sidebar-latest a {
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 0.7em;
    line-height: 1.5;
  }
  .greedy-nav .sidebar-latest a::before { display: none; }
  .sidebar-latest time { display: block; margin-top: 0.2rem; color: #777; font-size: 0.6em; }
  #main { padding-top: 1rem; }
  #main > .page, #main > .archive { float: none; width: 100%; }
  #main > .archive, .wide #main > .page { padding-inline-end: 0; }
}

/* 技术博客固定正文字号，避免主题在大屏上放大至 22px。 */
body.blog-reading { font-size: 17px; }
.blog-reading .page__content { line-height: 1.75; overflow-wrap: break-word; }
.blog-reading .page__title { font-size: 1.6em; line-height: 1.4; }
.blog-reading .page__content h1 { font-size: 1.5em; }
.blog-reading .page__content h2 { font-size: 1.3em; margin-top: 1.6em; }
.blog-reading .page__content h3 { font-size: 1.15em; }
.blog-reading .page__content pre { font-size: 14px; overflow-x: auto; }
.blog-reading .page__content pre code { white-space: pre; overflow-wrap: normal; }
.blog-reading .archive__item-title { font-size: 1.2em; line-height: 1.5; }
.blog-reading .archive__item-excerpt { font-size: 1em; line-height: 1.7; }
.blog-reading #main { max-width: 1440px; padding-inline: 24px; }

@media (min-width: 1024px) {
  body.blog-reading { padding-left: 230px; }
  .blog-reading #main > .page { padding-inline-end: 0; }
  /* 中等宽度屏幕把目录放在正文上方，避免挤压每行文字。 */
  .blog-reading .sidebar__right,
  .blog-reading .sidebar__right.sticky {
    position: static;
    float: none;
    width: 100%;
    margin-inline-end: 0;
    padding-inline-start: 0;
    margin-bottom: 1.5em;
  }
  .blog-reading .sidebar__right .toc { font-size: 14px; }
  .blog-reading .sidebar__right.sticky .toc .toc__menu { max-height: 220px; }
}

@media (min-width: 1400px) {
  .blog-reading #main > .page { padding-inline-end: 200px; }
  .blog-reading .sidebar__right,
  .blog-reading .sidebar__right.sticky {
    position: sticky;
    top: 24px;
    float: right;
    width: 180px;
    margin-inline-end: -200px;
    padding-inline-start: 0;
  }
  .blog-reading .sidebar__right.sticky .toc .toc__menu { max-height: calc(100vh - 100px); }
}

@media (max-width: 600px) {
  body.blog-reading { font-size: 16px; }
  .blog-reading #main { padding-inline: 16px; }
}

/* 首页和博客共用文字与导航尺寸，切换页面不改变侧栏。 */
body { font-size: 17px; }
.masthead { font-size: 17px; }
.greedy-nav .sidebar-latest a { font-size: 13px; }
.sidebar-latest time { font-size: 12px; }
.site-language-switch {
  position: fixed;
  top: 16px;
  right: 24px;
  z-index: 30;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 4px;
  font-size: 14px;
}
.site-language-switch a[aria-current="page"] { font-weight: 700; text-decoration: none; }
#main { padding-top: 64px; }
.resume-page .page__inner-wrap > header { display: none; }
.resume-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 24px;
  align-items: start;
  margin-bottom: 2rem;
}
.resume-header h1 { margin: 0 0 0.75em; font-size: 1.8em; }
.resume-header p { margin: 0 0 0.75em; }
.resume-photo { width: 210px; max-width: 100%; height: auto; border-radius: 4px; }
@media (max-width: 600px) {
  body { font-size: 16px; }
  #main { padding-top: 16px; }
  .resume-header { grid-template-columns: minmax(0, 1fr) 120px; gap: 12px; }
  .resume-header h1 { font-size: 1.5em; }
  .resume-photo { width: 120px; }
}

@media (max-width: 1023px) {
  .site-language-switch { position: absolute; top: 8px; right: 12px; }
  .masthead__inner-wrap { padding-top: 48px; }
}

@media (min-width: 1024px) {
  .sidebar-sections { display: block; margin-top: 0.8rem; }
  .sidebar-section { margin-top: 0.65rem; }
  .sidebar-section summary {
    display: list-item;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.6;
  }
  .sidebar-section summary:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
  .greedy-nav .sidebar-tags { margin-top: 0.6rem; padding-left: 0.75rem; border-left: 1px solid #ddd; }
  .greedy-nav .sidebar-tags a {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 0.25rem 0;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 13px;
    line-height: 1.5;
  }
  .greedy-nav .sidebar-tags a::before { display: none; }
  .sidebar-tag-count { flex-shrink: 0; color: #777; }
}

/* 校徽与学校名称在同一行对齐，保持原图比例。 */
.page__content .education-logo {
  display: inline-block;
  width: 36px;
  height: 36px;
  object-fit: contain;
  vertical-align: middle;
  margin: 0 0.5em 0 0;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  font-size: 13px;
}
.code-language { font-weight: 600; color: #555; }
.code-block-header .code-copy { margin: 0; font-size: 12px; }
.code-block-header + pre { margin-top: 0; }

/* 未高亮的纯文本代码块也使用完整的代码样式。 */
.page__content pre:not(.highlight) {
  padding: 1em;
  background: #263238;
  color: #eeffff;
  border-radius: 0 0 4px 4px;
  line-height: 1.8;
  tab-size: 4;
}
.page__content pre > code {
  display: block;
  font-size: inherit;
  color: inherit;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
}
