/* ===== KaTeX ===== */
.katex {
  font-size: 1em !important;
}

/* ===== details ===== */
details p {
  text-indent: 2em;
}

a,
a:visited {
  color: #551414;          /* ← 你想要的全局链接颜色 */
  border-bottom:1px dashed #5a0e0e;
}

a:hover {
  color: #551414;          /* ← 你想要的悬停颜色 */
  border-bottom: none;
  background-color:#e8bbbb;
}



/* ===== Fonts & base rendering ===== */
@font-face {
  font-family: "Noto-Serif-SC";
  src: url("/fonts/NotoSerifSC-Medium.otf") format("truetype");
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

/* ===== code / pre ===== */
code {
  padding: 2px 4px;
  font-size: 90%;
  background-color: #eeeeee;
  hyphens: none;
  -webkit-hyphens: none;
  -ms-hyphens: none;
  word-wrap: break-word;
  /* border-radius: 4px; */
}

/* Reset these values when there's code inside a pre. Pre handles the styling then.*/
pre code {
  background-color: transparent;
  padding: 0;
}

pre {
  display: block;
  padding: 9.5px;
  margin: 0 0 10px;
  line-height: 1.4;
  word-wrap: break-word;
  border: 1px solid #ccc;
  box-shadow: 0 5px 5px -5px #777777;
  max-width: 100%;
  /* These two copied from chroma theme (syntax.css) */
  color: #f8f8f2;
  background-color: #272822;
}

pre,
code {
  font-family: monocode, monospace;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== headings ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Noto Sans SC', sans-serif, 'Lora', serif;
}

h1#title {
  /*Some UA stylesheets put h1 to 1.5em when in an article, so we reset it back for our title here.*/
  font-size: 2em;
  font-family: 'Noto Sans SC', sans-serif, 'Lora', serif;
}

/* ===== body text ===== */
body {
  font-family: 'Noto Serif SC', serif, -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif;
  /* font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "WenQuanYi Micro Hei", sans-serif; */
  font-size: 1rem;
}

/* ===== containers ===== */
.content-container {
  padding-left: 1em;
  padding-right: 1em;
}

.content-container-narrow-pad {
  padding: 0.5em;
}

.v-center {
  align-items: center;
}

.look-sheet-bkg {
  background-color: white;
}

/* =========================
   Responsive (synced)
   ========================= */

/* ---- desktop text layout ---- */
@media (min-width: 720px) {
  /* Make everything 10% smaller! */
  html {
    font-size: 14.4px;
  }

  .content-container {
    /* ACHTUNG:
      Images are scaled in the fitfigure shortcode with an assumption that the
      page is 652px wide. If you change this value, remeasure and change the value
      there too. */
    width: 45rem;
    padding-left: 2em;
    padding-right: 2em;
    margin: 0 auto;
  }

  .content-container-narrow-pad {
    padding-left: 0.5em;
    padding-right: 0.5em;
    width: 45rem;
    margin: 0 auto;
  }

  .bottom-links {
    border: 1px solid #cccccc;
    border-bottom: 0px;
  }

  .look-sheet {
    border: 1px solid #ccc;
    box-shadow: 0 5px 5px -5px #777777;
    margin-top: 1em;
    margin-bottom: 1em;
    min-height: 0px;
    background-color: white;
  }

  .look-sheet-bkg {
    background-color: #fffdf7;
  }
}

/* ---- TOC fixed sidebar only on wide screens (synced with 45rem) ---- */
@media (min-width: 1170px) {
  .toc {
    position: fixed;
    top: 4rem;

    /* 同步点：以正文宽度 45rem 为基准去算左侧位置
       left = 左侧空白的一半 - toc宽度(18em) - 2em间距 */
    left: calc((100% - 45rem) / 2 - 18em - 2em);

    width: 18em;
    max-height: 80vh;
    overflow-y: auto;

    background: #f9f9f9;
    border: 1px solid #ddd;
    padding: 1em;
    border-radius: 6px;
    font-size: 0.9em;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  }
}

/* ---- TOC becomes in-flow on small/medium screens ---- */
@media (max-width: 1170px) {
  .toc {
    position: static;
    width: auto;
    max-height: none;
    margin: 2em 0;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  }

  .toc-title {
    font-size: 1.1em;
    margin-bottom: 0.6em;
    border-top: none;
    border-bottom: 1px solid #ccc;
    padding-bottom: 0.4em;
  }

  .toc-inner nav li li::before {
    color: #aaa;
  }
}

/* ===== figures / layout ===== */
figure.smaller {
  max-width: 67%;
}

figure.smaller25 {
  max-width: 25%;
  max-height: 25%;
}

.look-sheet-border {
  border: 1px solid #ccc;
  box-shadow: 0 5px 5px -5px #777777;
  margin-top: 1em;
  margin-bottom: 1em;
  min-height: 0px;
}

.article-pad-v {
  padding-top: 1em;
  padding-bottom: 1em;
}

blockquote {
  border-left: #777 0.25em solid;
  padding: 0 1.25em;
  margin: 2em 0 2em 1em;
}

body.sticky-nav .navbar {
  position: sticky;
  z-index: 1000; /* theoretically this should be applied automatically but it doesn't work on Safari in some circumstances */
  top: 0;
}

.nav-bkg {
  color: white;
  background: #00223E;
  /* fallback for old browsers */
  background: -webkit-linear-gradient(135deg, #3c1f0b 80%, #e8bbbb 80%);
  /* Chrome 10-25, Safari 5.1-6 */
  background: linear-gradient(135deg, #3c1f0b 80%, #e8bbbb 80%);
  /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}

.nav-bkg-50 {
  color: white;
  background: #00223E;
  /* fallback for old browsers */
  background: -webkit-linear-gradient(135deg, #3c1f0b 50%, #e8bbbb 50%);
  /* Chrome 10-25, Safari 5.1-6 */
  background: linear-gradient(135deg, #3c1f0b 50%, #e8bbbb 50%);
  /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}

::selection {
  background-color: #e8bbbb;
  color: #333333;
}

.drop-shadow {
  box-shadow: 0 5px 5px -5px #777777;
}

.nav-bkg a {
  text-decoration: none;
}

.pagewide-bar-padding {
  padding: 0.5em 1em;
}

nav a,
nav a:hover,
nav a:visited {
  color: white;
}

.post-date {
  color: #777;
}

.post-tags,
.post-tags a,
.post-tags a:hover,
.post-tags a:visited {
  color: #777;
}

.margin-top-2em {
  margin-top: 2em;
}

.article-body h2,
.article-body h3 {
  margin-top: 2em;
  margin-bottom: 0.5em;
}

kbd {
  background-color: #333;
  color: #fff;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 95%;
  white-space: nowrap;
}

figure {
  margin: 2em auto;
  display: table;
  text-align: center;
}

.squash-bottom {
  margin-bottom: 0;
}

.squash-top {
  margin-top: 0;
}

.twoup.squash-bottom figure {
  margin-bottom: 0;
}

.twoup.squash-top figure {
  margin-top: 0;
}

.twoup {
  display: flex;
}

.twoup figure {
  max-width: 48%;
  display: inline-block;
}

.twoup figure:first-child {
  margin-left: 0;
}

.twoup figure:last-child {
  margin-right: 0;
}

figure:not(.no-border) video,
figure:not(.no-border) img,
figure:not(.no-border) object,
figure:not(.no-border).style-tables table {
  border: 1px solid #ccc;
  box-shadow: 0 5px 5px -5px #777777;
  max-width: 100%;
  background-color: white;
  max-height: 85vh;
}

hr {
  padding: 0;
  border: none;
  border-top: 1px solid #AAA;
  margin: 2.5em 3em;
}

body {
  background-color: #FFFDF7;
}

figcaption {
  margin-top: 0.75em;
  font-style: italic;
  text-align: center;
  font-size: 0.75em;
  color: #5e5e5e;
}

/*
The figure is handling the margin here, its last child doesn't need to.
This is a side-effect of using display: table on figure. This is gross and
will have side-effects if you have multiple nested elements under the figcaption I think.
*/
figure figcaption :last-child {
  margin-bottom: 0;
}

.footnotes {
  margin-top: 4em;
  font-size: 85%;
}

.footnotes hr {
  margin-bottom: 1em;
}

.footnotes li {
  margin: 0 0 12px;
}

twitter-widget {
  /*
  Have to use important here because the twitter oembed puts the styles in the
  style attribute.
  */
  margin: 2em auto !important;
}

.list-unstyled {
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}

.flex-row {
  display: flex;
  justify-content: space-between;
}

.flex-row.flex-center {
  justify-content: center;
}

a.no-underline:hover {
  text-decoration: none;
}

a.no-underline:hover .re-underline {
  text-decoration: underline;
}

a.btn-dashed {
  border: dashed 1px #777;
  border-radius: 4px;
  padding: 0.5em;
}

a.btn-dashed:hover {
  box-shadow: 0 5px 5px -5px #777777;
  border: solid 1px #777;
  text-decoration: none;
  background-color: #77777722;
  transition: all 0.1s;
}

.vertical-margins {
  margin-top: 1em;
  margin-bottom: 1em;
}

.list-of-titles .post-title {
  color: black;
  font-size: 1.25em;
  font-weight: 600;
}

.list-of-titles li a {
  text-decoration: none;
  display: block;
  padding: 0.75em;
  border-bottom: 1px solid #ccc;
  /* hacks so that the text doesn't move unintentionally */
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
}

.list-of-titles li a:hover {
  background-color: white;
  border-left: 15px solid #ccc;
  border-right: 10px solid #ccc;
  box-shadow: 0 5px 5px -5px #777777;
}

.list-of-titles li a:hover .post-title {
  text-decoration: underline;
}

.list-of-titles li:first-child a {
  border-top: 1px solid #ccc;
}

.list-of-titles .post-meta {
  font-size: 0.875em;
  color: #777;
}

.list-of-titles li .post-description {
  font-size: 0.875em;
  color: black;
}

ul.right-links {
  display: none;
  float: right;
}

ul.right-links li {
  display: inline-block;
  margin-right: 1em;
}

@media (min-width: 440px) {
  ul.right-links {
    display: block;
  }
}

.embed.rich,
img {
  max-width: 100%;
}

div[itemprop="articleBody"] > p {
  text-indent: 2em;
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
}

.look-sheet-bkg.draft,
.list-of-titles li.draft a:hover {
  background: repeating-linear-gradient(135deg, white, white 10px, #ffd4a3 12px, #ffd4a3 12px);
}

.list-of-titles li.draft {
  background: repeating-linear-gradient(135deg, #fffdf7, #fffdf7 10px, #ffd4a3 12px, #ffd4a3 12px);
}

.post-meta.draft {
  font-weight: bold;
}

.text-1p5 {
  font-size: 1.5em;
}

.text-0p75 {
  font-size: 0.75em;
}

aside.article-aside {
  background-color: #fffdf7;
  padding: 0 1em;
  margin-top: 3em;
}

aside.article-aside > p:first-child {
  margin-top: 1rem;
}

aside.content-warning {
  font-style: italic;
  margin-bottom: 2rem;
  color: #777;
  border-top: solid 1px #777;
  border-bottom: solid 1px #777;
  padding-left: 1em;
  padding-right: 1em;
  padding-top: 0.25em;
  padding-bottom: 0.25em;
  display: inline-block;
}

aside.content-warning > p:last-child {
  margin-bottom: 0;
}

/*
TODO: understand CSS so I don't need to do this insane thing. The idea here is
that if an `aside` appears immediately after a heading, it should have close
spacing, but if it appears after other content it should have sufficient spacing
to make it look like a new section. I think we should theoretically be able to
do that with margins, but I don't understand how they work enough yet.
*/
h2 + aside.article-aside,
h3 + aside.article-aside,
h4 + aside.article-aside,
h5 + aside.article-aside {
  margin-top: 0.5em;
}

/* If we've nested this inside something, we probably don't want to have the huge margin */
h2:first-child,
h3:first-child,
h4:first-child,
h5:first-child,
h6:first-child {
  margin-top: 0.5em;
}

.expander {
  background-color: #fffdf7;
  padding: 0 1em;
  position: relative;
  /* anchor for the buttons */
}

.expander h2:first-child {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.expander .button {
  display: inline-block;
  font-weight: 400;
  text-align: center;
  vertical-align: middle;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  background-color: transparent;
  line-height: 1.5;
  border-radius: .25rem;
  font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif;
  padding: .25rem .75rem;
  font-size: .875rem;

  color: white;
  box-shadow: 0 5px 5px -5px #777777;
  background: #00223E;
  /* fallback for old browsers */
  background: -webkit-linear-gradient(135deg, #00223E 85%, #FFA17F 85%);
  /* Chrome 10-25, Safari 5.1-6 */
  background: linear-gradient(135deg, #00223E 85%, #FFA17F 85%);
  /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}

.expander .button {
  position: absolute;
  top: 0;
  right: 0;
  margin-right: 1em;
  margin-top: 1em;
}

.hidden {
  display: none;
}

.expander input.show:checked ~ .inner {
  display: block;
}

.expander input.hide:checked ~ .inner {
  display: none;
}

.expander input.show:checked ~ .button-show {
  display: none;
}

.expander input.hide:checked ~ .button-hide {
  display: none;
}

/*
This cursed incantation works around a display bug in Firefox, where writing
an emoji with default Emoji Presentation (e.g. 🐻) followed by a non-default
emoji character (e.g. ↩) results in the latter being rendered with emoji
presentation as well.

This is only a problem on the newer Goldmark renderer, which I'm not using yet.
*/
a.footnote-backref::before {
  content: ' ';
}

/* all this stuff is for header links */
.header-link {
  text-decoration: none;
  position: absolute;
  right: 0;
  top: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, white 20%);
  color: grey;
  fill: grey;
}

aside .header-link {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, #fffdf7 20%);
}

.header-link:hover {
  text-decoration: none;
}

/* Keep the selectors here in sync with site.js  */
h2,
h3,
h4 {
  position: relative;
}

h2:not(:hover) .header-link,
h3:not(:hover) .header-link,
h4:not(:hover) .header-link {
  display: none;
}

.header-link svg {
  height: 0.65em;
  margin-bottom: 0.225em;
  /* make these links easier to tap */
  margin-left: 0.6em;
  margin-right: 0.6em;
}

/* end header links */

/* this goes on the parent */
#content {
  position: relative;
}

.floating-footnotes {
  width: 25em;
  margin-top: 0;
  position: absolute;
  top: 0;
  /* The entire main article content, + the margins */
  left: calc(100% + 2em);
}

.floating-footnotes hr {
  display: none;
}

.floating-footnotes li[role=doc-endnote] p:last-child {
  margin-bottom: 0;
}

a.timestamp {
  border: solid 1px #007bff;
  background: rgb(0, 123, 255);
  background: linear-gradient(145deg, rgba(0, 123, 255, 1) 60%, rgba(0, 86, 179, 1) 100%);
  color: white;
  border-radius: 4px;
  padding: 2px;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

figure audio {
  /*
  Ok, you can't use 100% for this -- both Chrome and Firefox do _weird things_ if you try that.
  So we hardcode a pixel value manually based on the page width.
  */
  width: 580px;
  max-width: 100%;
}

article table {
  margin: 2.5em auto;
}

article table td:not(:first-child),
article table th:not(:first-child) {
  padding-left: 2em;
}

article table thead tr {
  border-bottom: 1px solid #00223E;
}

article table {
  border-bottom: 1px solid #00223E;
}

article table thead th {
  padding-bottom: 0.5em;
  font-family: 'Lora', serif;
}

article table tbody tr:first-child td {
  padding-top: 0.75em;
}

article table tbody tr:last-child td {
  padding-bottom: 0.75em;
}

article table td,
article table th {
  padding-left: 0.5em;
  padding-right: 0.5em;
  padding-top: 0.25em;
  padding-bottom: 0.25em;
  vertical-align: top;
}

.sidepull-side {
  margin-bottom: 4em;
}

@media (min-width: 1170px) {
  .sidepull-container {
    position: relative;
  }

  .sidepull-container .sidepull-side {
    /*
        fallback will be absolute positioning if browser doesn't know about sticky
        the `top` will result in maybe a little too much padding but it'll work still
      */
    position: absolute;
    position: sticky;
    width: 16em;
    top: 3em;
    margin-left: -18em /* width + a margin */;
    float: left;
  }

  .sidepull-not-when-sidebar-shown {
    display: none;
  }
}

/* 自定义样式 */
#content > details {
  border: solid thin;
  margin-bottom: 1em;
}

details > *:not(blockquote) {
  padding-left: 0.5em;
}

details > *:not(summary) {
  text-indent: 2em; /* 每段开头缩进 2 个字符宽 */
}

details > summary {
  font-weight: bold;
}

/* ############ toc style ############ */
/* TOC 样式主体（基础外观已在 .toc 里设置，这里保留你原本的内层样式） */
.toc a {
  border-bottom: none;
}

.toc a:hover {
  border-bottom: none;
}

.toc-title {
  display: block;
  margin-bottom: 0.7em; /* ✅ 稍大间距 */
  font-weight: bold;
  font-size: 1em;
  border-bottom: 2px double #999;
  border-top: 2px double #999;
  padding: 0.3em 0;
  text-align: center;
  letter-spacing: 0.02em;
}

/* 清除默认列表样式 */
.toc-inner nav ul {
  list-style: none;
  padding-left: 0;
  margin-left: 0;
}

/* 链接基础样式 */
.toc-inner nav a {
  color: #333;
  text-decoration: none;
  display: inline-block;
  width: 100%;
  transition: color 0.2s;
  font-weight: normal; /* 默认不加粗 */
}

.toc-inner nav a:hover {
  color: #000;
  /* text-decoration: underline; */
}

/* H2 项目（一级）样式增强 */
.toc-inner nav > ul > li > a {
  font-weight: bold;
  font-size: 1em;
  margin-top: 0.5em;
  display: block;
}

/* H2 项之间间距加大 */
.toc-inner nav > ul > li {
  margin-top: 1em;
}

/* H3+ 层级样式 */
.toc-inner nav li {
  position: relative;
  margin-top: 0.4em;
}

.toc-inner nav li li::before {
  content: "▸";
  position: absolute;
  left: 0;
  top: 0.15em; /* ✅ 轻微向下对齐文字 */
  color: #888;
  font-size: 0.9em;
  line-height: inherit; /* ✅ 保持与文字对齐 */
}

/* 为 ▸ 留空间 */
.toc-inner nav li li {
  padding-left: 1.2em;
}

.toc-inner nav li li li {
  padding-left: 2em;
}

.toc-inner nav li li li li {
  padding-left: 3em;
}

.toc-inner nav li li li li li {
  padding-left: 4em;
}

.toc-inner nav li a {
  line-height: 1.4;
}

/* ===== tag cloud (fixed placement + syntax) ===== */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: .55em .75em;
  align-items: center;
  margin-top: .25em;

}

.tag-cloud-item {
  text-decoration: none;
  /* color: inherit !important; 修复原来无效的 !important 写法 */
  /* border-bottom: 1px sol id transparent; */
  padding: .05em .1em;
    font-weight: bold;
}

.tag-cloud-item:hover {
    text-decoration: none;
}

.tag-count{
  font-size: 0.75em;        /* 相对 tag 本身字号缩小 */
  opacity: .65;
  margin-left: .25em;
}


.tag-cloud-item.draft .tag-name {
  font-style: italic;
}

.site-analytics-note{
  display: block;
  margin-top: 0.75em;
  font-size: 0.72em;
  line-height: 1.4;
  opacity: 0.55;
  letter-spacing: 0.02em;
}
