:root {
  --ivory: #F9F8F4;
  --ivory-warm: #F3EFE6;
  --paper: #FCFAF4;
  --forest: #2D3A31;
  --moss: #4F5E4A;
  --sage: #8C9A84;
  --sage-light: #C8D1BF;
  --sage-active: #DDE9D2;
  --clay: #C27B66;
  --clay-deep: #A65D4B;
  --morandi-red: #B76E6A;
  --ink: #1F2620;
  --ink-soft: #4A534B;
  --line: rgba(45, 58, 49, 0.12);
  --line-strong: rgba(45, 58, 49, 0.22);
  --shadow-soft: 0 1px 2px rgba(45, 58, 49, 0.04),
                 0 8px 24px rgba(45, 58, 49, 0.06),
                 0 24px 64px rgba(45, 58, 49, 0.04);
  --shadow-leaf: 0 2px 6px rgba(45, 58, 49, 0.05),
                 0 16px 40px rgba(140, 154, 132, 0.18);
  --topbar-height: 54px;
  --radius: 12px;
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 32px;
  --ease: cubic-bezier(0.34, 0.04, 0.18, 0.98);
  --outline-flow: cubic-bezier(0.2, 0.78, 0.18, 1);
  --dur: 280ms;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: var(--ivory);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(140, 154, 132, 0.08), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(194, 123, 102, 0.06), transparent 45%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.18 0 0 0 0 0.22 0 0 0 0 0.19 0 0 0 0.04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-attachment: fixed;
  background-size: auto, auto, 240px 240px;
  font-family: "Newsreader", "Source Han Serif SC", "Songti SC", Georgia, serif;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

a,
button {
  -webkit-tap-highlight-color: transparent;
}

.topbar__button[hidden],
.mobile-rail-actions[hidden] {
  display: none !important;
}

::selection {
  background: var(--sage-active);
  color: var(--forest);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: var(--topbar-height);
  padding: 9px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(249, 248, 244, 0.78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.brand {
  color: var(--forest);
  text-decoration: none;
}

.brand__name {
  font-family: "Fraunces", serif;
  font-size: 24px;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0;
}

.topbar__actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.topbar__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 2px;
  align-self: stretch;
  padding-bottom: 1px;
}

.topbar__tagline {
  position: relative;
  display: inline-block;
  width: 46ch;
  color: var(--ink-soft);
  font-family: "DM Mono", monospace;
  font-size: 10px;
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: 0;
  opacity: 0.76;
  overflow: hidden;
  white-space: nowrap;
}

.topbar__tagline::after {
  content: attr(data-hover-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  white-space: nowrap;
}

.topbar__tagline:hover {
  color: transparent;
}

.topbar__tagline:hover::after {
  animation: taglineTyping 1s steps(46, end) forwards;
}

body.is-article-mode .topbar__tagline {
  display: none;
}

.topbar__button {
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--forest);
  cursor: pointer;
  font-family: "DM Mono", monospace;
  font-size: 12px;
  letter-spacing: 0;
}

.topbar__button:hover {
  background: var(--sage-active);
}

.topbar__button--mobile {
  display: none;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr);
  gap: 0;
  max-width: 1400px;
  min-height: calc(100vh - var(--topbar-height));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

body.is-article-mode .layout {
  display: block;
  max-width: none;
}

.sidebar {
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow: hidden;
  padding: 22px 28px 40px 32px;
  border-right: 1px solid var(--line);
}

body.is-article-mode .sidebar {
  display: none;
}

.sidebar__inner {
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100%;
  min-height: 0;
}

.sidebar__header {
  flex: 0 0 auto;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line-strong);
}

.sidebar-tabs {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--forest);
  font-family: "Fraunces", serif;
  font-size: 25px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0;
  white-space: nowrap;
}

.sidebar-tab {
  min-height: 36px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--forest);
  cursor: pointer;
  font: inherit;
  letter-spacing: 0;
  transition: color var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

.sidebar-tab:hover {
  color: var(--moss);
}

.sidebar-tab.is-active {
  color: var(--moss);
}

.sidebar-tab-separator {
  color: var(--morandi-red);
  font-size: 1.4em;
  line-height: 1;
  transform: translateY(0.08em);
}

.tree {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar__inner > nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar__inner > nav::-webkit-scrollbar {
  display: none;
}

.tree__loading {
  display: inline-flex;
  gap: 6px;
  padding: 12px 0;
}

.tree__loading span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sage);
  animation: pulse 1.3s var(--ease) infinite;
}

.tree__loading span:nth-child(2) {
  animation-delay: 120ms;
}

.tree__loading span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.35;
    transform: scale(0.82);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@keyframes taglineTyping {
  from {
    width: 0;
  }
  to {
    width: 46ch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar__tagline:hover::after {
    width: 46ch;
    animation: none;
  }
}

.tree-node {
  user-select: none;
}

.tree-node__row {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background 420ms var(--ease), color 420ms var(--ease), padding 420ms var(--ease);
}

.tree-node__row:hover {
  background: var(--sage-light);
  color: var(--forest);
}

.tree-node__row:active {
  background: var(--forest);
  color: var(--ivory);
}

.tree-node.is-active > .tree-node__row {
  background: var(--forest);
  color: var(--ivory);
  font-style: italic;
}

.tree-node.is-empty > .tree-node__row {
  cursor: default;
}

.tree-node__dot {
  display: inline-flex;
  width: 14px;
  height: 18px;
  flex: 0 0 14px;
  align-items: center;
  justify-content: center;
  color: var(--morandi-red);
  font-family: "Newsreader", "Source Han Serif SC", serif;
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
  transition: color 420ms var(--ease), transform 420ms var(--ease);
}

.tree-node__dot::before {
  content: "·";
}

.tree-node.is-selected-path > .tree-node__row .tree-node__dot {
  color: var(--morandi-red);
  transform: scale(1.08);
}

.tree-node--branch.is-open > .tree-node__row .tree-node__dot,
.tree-node--branch.is-open > .tree-node__row .tree-node__label {
  color: var(--moss);
}

.tree-node__label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--ink);
  font-family: "Newsreader", serif;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-node.is-active > .tree-node__row .tree-node__label {
  color: var(--ivory);
}

.tree-node.is-active > .tree-node__row .tree-node__dot {
  color: currentColor;
}

.tree-node__count {
  color: var(--ink-soft);
  font-family: "DM Mono", monospace;
  font-size: 11px;
  opacity: 0.68;
}

.tree-node.is-active > .tree-node__row .tree-node__count {
  color: var(--sage-light);
  opacity: 0.9;
}

.tree-node__children {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  transition: grid-template-rows 360ms var(--ease);
}

.tree-node.is-open > .tree-node__children {
  grid-template-rows: 1fr;
}

.tree-node__children > div {
  min-height: 0;
  margin-left: 14px;
  padding-left: 16px;
  border-left: 1px dashed var(--line);
}

.timeline-nav {
  --timeline-axis-width: 34px;
  --timeline-month-step: 24px;
  --timeline-indent: 104px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding-left: var(--timeline-indent, 0px);
  padding-top: 2px;
}

.timeline-month {
  display: inline-grid;
  flex: 0 0 auto;
  grid-template-columns: var(--timeline-axis-width);
  place-items: center;
  min-width: var(--timeline-axis-width);
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: "Newsreader", "Source Han Serif SC", serif;
  font-size: 19px;
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.timeline-month:hover {
  background: var(--sage-light);
  color: var(--forest);
}

.timeline-month.is-active {
  background: var(--forest);
  color: var(--ivory);
}

.timeline-month__label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2ch;
}

.timeline-connector {
  display: block;
  flex: 0 0 auto;
  width: 1px;
  height: var(--month-gap-height, var(--timeline-month-step));
  margin-left: calc((var(--timeline-axis-width) - 1px) / 2);
  background: repeating-linear-gradient(
    to bottom,
    var(--line-strong) 0 3px,
    transparent 3px 7px
  );
}

.timeline-year {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: var(--timeline-axis-width);
  justify-items: center;
  align-items: center;
  width: var(--timeline-axis-width);
  gap: 2px;
  padding: 2px 0;
  color: var(--forest);
}

.timeline-year__dot {
  display: grid;
  place-items: center;
  width: 100%;
  color: var(--morandi-red);
  font-family: "Newsreader", "Source Han Serif SC", serif;
  font-size: 26px;
  font-weight: 500;
  line-height: 0.85;
}

.timeline-year__text {
  display: block;
  justify-self: center;
  width: max-content;
  color: var(--moss);
  font-family: "Fraunces", serif;
  font-size: 20px;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
}

.timeline-year__measure {
  position: fixed;
  left: -9999px;
  top: -9999px;
  visibility: hidden;
  pointer-events: none;
}

.content {
  min-width: 0;
  padding: 48px 56px 96px;
}

.content:focus {
  outline: none;
}

body.is-article-mode .content {
  padding: 0;
}

.list-view {
  max-width: 860px;
}

.list-view--steady .post-card {
  animation: none;
}

.list-view__header {
  display: block;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.list-view__eyebrow,
.list-view__count,
.post-card__meta {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  letter-spacing: 0;
}

.list-view__eyebrow {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
  margin-bottom: 14px;
  color: var(--ink-soft);
  line-height: 1.55;
  text-transform: uppercase;
}

.path-segment {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
}

.path-separator {
  display: inline-flex;
  align-items: center;
  margin: 0 0.55em;
  color: var(--morandi-red);
  font-size: 2em;
  line-height: 1;
  vertical-align: middle;
}

.list-view__title {
  margin: 0;
  color: var(--forest);
  font-family: "Fraunces", serif;
  font-size: clamp(40px, 5vw, 64px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0;
}

.list-view__count {
  margin-top: 12px;
  color: var(--ink-soft);
}

.list-view__items {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.list-sentinel {
  height: 1px;
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px 28px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--ivory-warm);
  box-shadow: var(--shadow-soft);
  color: inherit;
  text-decoration: none;
  animation: fadeUp 380ms var(--ease) both;
  transition: transform 420ms var(--ease), box-shadow 420ms var(--ease), border-color 420ms var(--ease), background 420ms var(--ease);
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: var(--sage-light);
  background: #FBF9F2;
  box-shadow: var(--shadow-leaf);
}

.post-card__meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
}

.meta-separator {
  display: inline-flex;
  align-items: center;
  color: var(--morandi-red);
  font-size: 2em;
  line-height: 1;
  vertical-align: middle;
}

.post-card__title {
  margin: 0;
  color: var(--forest);
  font-family: "Fraunces", serif;
  font-size: 24px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: 0;
}

.post-card:hover .post-card__title {
  color: var(--moss);
}

.post-card__summary {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  font-style: normal;
  line-height: 1.65;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes articleLoadingSheen {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

.empty {
  padding: 72px 20px;
  color: var(--ink-soft);
  text-align: center;
}

.empty--small {
  padding: 18px 0;
  text-align: left;
}

.empty p {
  margin: 0;
  font-style: italic;
}

.article-view {
  min-height: calc(100vh - var(--topbar-height));
}

.article-stage {
  position: relative;
  min-height: calc(100vh - var(--topbar-height));
}

.article-stage__content {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 260ms var(--ease), transform 360ms var(--ease), filter 360ms var(--ease);
  will-change: opacity, transform;
}

.article-view--loading .article-stage__content {
  display: none;
}

.article-view--preparing .article-stage__content {
  opacity: 0;
  transform: translateY(10px);
  filter: blur(1px);
  pointer-events: none;
}

.article-loading {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 2;
  display: grid;
  width: min(720px, calc(100% - 72px));
  gap: 14px;
  padding-top: 64px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 220ms var(--ease), transform 360ms var(--ease);
}

.article-view--loading .article-loading,
.article-view--preparing .article-loading {
  opacity: 1;
}

.article-view--ready .article-loading {
  opacity: 0;
  transform: translate(-50%, -8px);
}

.article-loading__line {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(200, 209, 191, 0.28), rgba(249, 248, 244, 0.82), rgba(200, 209, 191, 0.28));
  background-size: 220% 100%;
  box-shadow: inset 0 0 0 1px rgba(45, 58, 49, 0.05);
  animation: articleLoadingSheen 1.35s var(--ease) infinite;
}

.article-loading__line--meta {
  width: 176px;
  height: 8px;
}

.article-loading__line--title {
  width: min(430px, 82%);
  height: 34px;
  margin: 4px 0 12px;
  border-radius: 18px;
}

.article-loading__line--short {
  width: 54%;
}

.markdown-article {
  position: relative;
  width: min(880px, calc(100% - 72px));
  max-width: none;
  margin: 0 auto;
  padding: 54px 0 110px;
}

.article-heading {
  width: min(720px, 100%);
  max-width: none;
  margin: 0 auto 30px;
  padding-bottom: 0;
  border-bottom: 0;
  text-align: left;
}

.article-heading__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
  color: var(--ink-soft);
  font-family: "DM Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-heading h1 {
  margin: 0;
  color: var(--forest);
  font-family: "Fraunces", serif;
  font-style: normal;
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: 0;
}

.markdown-body {
  width: min(720px, 100%);
  max-width: none;
  margin: 0 auto;
  color: var(--ink);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.85;
  text-align: left;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  scroll-margin-top: 76px;
  margin: 2.15em 0 0.76em;
  color: var(--forest);
  font-family: "Fraunces", serif;
  font-style: normal;
  font-weight: 650;
  line-height: 1.18;
  letter-spacing: 0;
}

/* Keep the article title and its first section visually connected. */
.markdown-body > :first-child {
  margin-top: 0.9em;
}

.markdown-body h1 {
  font-size: 34px;
}

.markdown-body h2 {
  font-size: 27px;
}

.markdown-body h3 {
  font-size: 20px;
}

.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  font-size: 18px;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body pre {
  margin: 0 0 0.9em;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.4em;
}

.markdown-body li + li {
  margin-top: 0.42em;
}

.markdown-body li > ul,
.markdown-body li > ol {
  margin: 0.42em 0 0;
}

.markdown-body li.task-item {
  list-style: none;
}

.markdown-body li.task-item input[type="checkbox"] {
  margin: 0 0.45em 0 -1.4em;
  accent-color: var(--moss);
  vertical-align: -0.08em;
}

.markdown-body a {
  color: var(--clay);
  text-decoration: none;
  border-bottom: 1px solid rgba(194, 123, 102, 0.4);
  transition: border-color var(--dur) var(--ease);
}

.markdown-body a:hover {
  border-color: var(--clay);
}

.markdown-body img {
  display: block;
  max-width: 100%;
  max-height: 256px;
  width: auto;
  height: auto;
  margin: 22px auto;
  border-radius: var(--radius-md);
  cursor: zoom-in;
  object-fit: contain;
}

.markdown-body img.is-error {
  min-height: 120px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  background: rgba(243, 239, 230, 0.72);
  color: var(--ink-soft);
  object-fit: contain;
}

.markdown-body blockquote {
  padding: 6px 0 6px 20px;
  border-left: 3px solid var(--sage);
  color: var(--ink-soft);
  font-style: normal;
}

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

.markdown-body code {
  padding: 0.12em 0.38em;
  border-radius: 5px;
  background: rgba(200, 209, 191, 0.48);
  color: var(--forest);
  font-family: "DM Mono", monospace;
  font-size: 0.9em;
}

.markdown-body pre {
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--forest);
  color: var(--ivory);
  box-shadow: var(--shadow-soft);
}

.markdown-body pre code {
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 20px 24px;
  background: transparent;
  color: inherit;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.markdown-body pre code::-webkit-scrollbar,
.math-block mjx-container[jax="SVG"][display="true"]::-webkit-scrollbar {
  display: none;
}

.mermaid-diagram {
  margin: 1.8em 0 2em;
  padding: clamp(18px, 4vw, 28px);
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
  color: var(--forest);
  text-align: center;
  scrollbar-width: thin;
}

.mermaid-diagram .mermaid {
  width: max-content;
  min-width: 100%;
  margin: 0 auto;
}

.mermaid-diagram svg {
  display: block;
  height: auto;
  margin: 0 auto;
}

.mermaid-diagram text,
.mermaid-diagram .label,
.mermaid-diagram .nodeLabel,
.mermaid-diagram .edgeLabel {
  font-family: "Newsreader", "Source Han Serif SC", "Songti SC", Georgia, serif !important;
}

.markdown-body hr {
  width: 60%;
  height: 1px;
  margin: 3em auto;
  border: 0;
  background: var(--line);
}

.markdown-body .table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 0 0 0.9em;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.markdown-body .table-wrap::-webkit-scrollbar {
  display: none;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94em;
  line-height: 1.6;
}

.markdown-body th,
.markdown-body td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  border-bottom-color: var(--line-strong);
  color: var(--forest);
  font-weight: 600;
}

.math-inline {
  color: var(--moss);
  font-size: 0.9em;
  font-weight: 600;
  white-space: nowrap;
}

/* 块级公式：开放式经典排版——无框无底、公式居中、编号右对齐（类 LaTeX \eqno）。 */
.math-block {
  position: relative;
  margin: 2em 0;
  padding: 0 3.25em;
  color: var(--forest);
  font-weight: 600;
  line-height: 1.7;
  text-align: center;
}

/* 短公式由外层居中；超出边界的公式由悬停滚轮横向查看，编号保持固定。 */
.math-block mjx-container[jax="SVG"][display="true"] {
  display: inline-block;
  max-width: 100%;
  margin: 0;
  padding: 0.3em 0;
  overflow-x: auto;
  overflow-y: hidden;
  text-align: left;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.markdown-body mjx-container[jax="SVG"] {
  color: var(--forest);
  font-weight: 700;
}

.markdown-body mjx-container[jax="SVG"] path {
  stroke: currentColor;
  stroke-width: 10;
  stroke-linejoin: round;
  paint-order: stroke fill;
}

.math-block__suffix {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  color: var(--ink-soft);
  font-family: "DM Mono", monospace;
  font-size: 12px;
}

.ref-mark {
  margin-left: 0.18em;
  color: var(--clay);
  font-family: "DM Mono", monospace;
  font-size: 0.62em;
  line-height: 1;
  vertical-align: super;
}

.html-article {
  min-height: calc(100vh - var(--topbar-height));
  overflow-anchor: none;
}

.html-article-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - var(--topbar-height));
  height: auto;
  border: 0;
  background: #fff;
  overflow: hidden;
  overflow-anchor: none;
  transition: opacity 260ms var(--ease);
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 34px;
  border: 0;
  background: rgba(31, 38, 32, 0.76);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.image-lightbox__close {
  position: fixed;
  top: 18px;
  right: 20px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(249, 248, 244, 0.44);
  border-radius: 999px;
  background: rgba(249, 248, 244, 0.12);
  color: var(--ivory);
  cursor: pointer;
  font-family: "DM Mono", monospace;
  font-size: 20px;
  line-height: 1;
}

.image-lightbox__figure {
  max-width: 100%;
  margin: 0;
}

.image-lightbox__image {
  display: block;
  max-width: min(100%, 1280px);
  max-height: calc(100vh - 110px);
  width: auto;
  height: auto;
  border-radius: var(--radius-sm);
  background: var(--paper);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  object-fit: contain;
}

.image-lightbox__caption {
  max-width: min(100%, 960px);
  margin-top: 12px;
  color: rgba(249, 248, 244, 0.82);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.article-rail {
  position: fixed;
  top: 50%;
  z-index: 35;
  width: 172px;
  max-height: min(76vh, 720px);
  transform: translateY(-50%);
  pointer-events: none;
}

.article-rail--outline {
  left: 14px;
}

.article-rail--refs {
  right: 14px;
}

.article-rail__inner {
  display: grid;
  gap: 6px;
  max-height: min(76vh, 720px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-block: 6px;
  pointer-events: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.article-rail__inner::-webkit-scrollbar {
  display: none;
}

.rail-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 18px;
  padding: 1px 0;
  border: 0;
  background: transparent;
  color: var(--forest);
  cursor: pointer;
  text-align: left;
  transition: color var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

/* HTML articles can bring their own light or dark surface. */
.article-rail--on-dark .rail-item {
  color: rgba(249, 248, 244, 0.9);
}

.article-rail--on-dark.article-rail--outline .rail-item__line,
.article-rail--on-dark.article-rail--refs .rail-item__line {
  background: rgba(249, 248, 244, 0.82);
}

.article-rail--on-dark.article-rail--outline .rail-item__text,
.article-rail--on-dark.article-rail--refs .rail-item__text {
  color: rgba(249, 248, 244, 0.9);
}

.article-rail--on-dark.article-rail--outline .rail-item:hover .rail-item__text,
.article-rail--on-dark.article-rail--refs .rail-item:hover .rail-item__text {
  color: var(--forest);
}

.article-rail--on-dark.article-rail--outline:hover .rail-item__line,
.article-rail--on-dark.article-rail--refs:hover .rail-item__line {
  background: var(--forest);
}

.rail-item__line {
  width: 8px;
  height: 1px;
  justify-self: end;
  border-radius: 999px;
  background: var(--forest);
  opacity: 0.45;
  transition: width var(--dur) var(--ease), height var(--dur) var(--ease), opacity var(--dur) var(--ease), background var(--dur) var(--ease);
}

.rail-item--level-1 .rail-item__line { width: 10px; }
.rail-item--level-2 .rail-item__line { width: 8px; }
.rail-item--level-3 .rail-item__line { width: 7px; }
.rail-item--level-4 .rail-item__line,
.rail-item--level-5 .rail-item__line,
.rail-item--level-6 .rail-item__line { width: 5px; }

.article-rail--outline .article-rail__inner {
  gap: 2px;
  width: 100px;
  max-width: 172px;
  padding-inline: 2px 10px;
}

.article-rail--outline:hover .article-rail__inner,
.article-rail--outline.is-fading .article-rail__inner {
  width: 172px;
}

.article-rail--outline .rail-item {
  --outline-line-width: 8px;
  --outline-text-size: 13px;
  --outline-hover-height: 22px;
  --outline-indent: 0px;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 3px;
  min-height: var(--outline-hover-height);
  padding: 0;
  transition:
    color var(--dur) var(--ease),
    opacity var(--dur) var(--ease);
}

.article-rail--outline .rail-item--level-1 {
  --outline-line-width: 12px;
  --outline-text-size: 18px;
  --outline-hover-height: 30px;
  --outline-indent: 0px;
}

.article-rail--outline .rail-item--level-2 {
  --outline-line-width: 10px;
  --outline-text-size: 16px;
  --outline-hover-height: 27px;
  --outline-indent: 8px;
}

.article-rail--outline .rail-item--level-3 {
  --outline-line-width: 8px;
  --outline-text-size: 14px;
  --outline-hover-height: 24px;
  --outline-indent: 15px;
}

.article-rail--outline .rail-item--level-4 {
  --outline-line-width: 7px;
  --outline-text-size: 12.5px;
  --outline-hover-height: 22px;
  --outline-indent: 22px;
}

.article-rail--outline .rail-item--level-5 {
  --outline-line-width: 6px;
  --outline-text-size: 11.5px;
  --outline-hover-height: 21px;
  --outline-indent: 29px;
}

.article-rail--outline .rail-item--level-6 {
  --outline-line-width: 5px;
  --outline-text-size: 10.5px;
  --outline-hover-height: 20px;
  --outline-indent: 36px;
}

.article-rail--outline .rail-item__line {
  width: var(--outline-line-width);
  height: 2px;
  justify-self: start;
  opacity: 0.56;
  transition:
    opacity 140ms var(--ease),
    background var(--dur) var(--ease);
}

.article-rail:hover .rail-item {
  grid-template-columns: 34px minmax(0, 1fr);
  min-height: 22px;
}

.article-rail:hover .rail-item__line {
  background: var(--moss);
  opacity: 0.76;
}

.article-rail:hover .rail-item--level-1 .rail-item__line { width: 32px; height: 2px; }
.article-rail:hover .rail-item--level-2 .rail-item__line { width: 26px; }
.article-rail:hover .rail-item--level-3 .rail-item__line { width: 21px; }
.article-rail:hover .rail-item--level-4 .rail-item__line,
.article-rail:hover .rail-item--level-5 .rail-item__line,
.article-rail:hover .rail-item--level-6 .rail-item__line { width: 16px; }

.rail-item__text {
  max-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: "Newsreader", "Source Han Serif SC", serif;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: max-width var(--dur) var(--ease), opacity var(--dur) var(--ease), color var(--dur) var(--ease);
}

.article-rail:hover .rail-item__text {
  max-width: 126px;
  opacity: 1;
}

.rail-item:hover .rail-item__text {
  color: var(--sage);
}

.rail-item--level-1 .rail-item__text { font-size: 12.5px; }
.rail-item--level-2 .rail-item__text { font-size: 12px; }
.rail-item--level-3 .rail-item__text { font-size: 11.5px; }
.rail-item--level-4 .rail-item__text,
.rail-item--level-5 .rail-item__text,
.rail-item--level-6 .rail-item__text { font-size: 11px; }

.article-rail--outline:hover .rail-item,
.article-rail--outline.is-fading .rail-item {
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 3px;
  min-height: var(--outline-hover-height);
}

.article-rail--outline:hover .rail-item .rail-item__line {
  width: 0;
  opacity: 0;
}

.article-rail--outline.is-fading .rail-item__line {
  width: var(--outline-line-width);
  opacity: 0.56;
  transition:
    opacity 140ms var(--ease),
    background var(--dur) var(--ease);
}

.article-rail--outline .rail-item__text {
  max-width: 0;
  max-height: 0;
  padding-block: 0;
  padding-left: 0;
  margin-block: 0;
  color: var(--ink);
  font-size: var(--outline-text-size);
  line-height: 1.35;
  opacity: 0;
  transition:
    opacity 95ms var(--ease) 20ms,
    color var(--dur) var(--ease);
  will-change: max-width, opacity;
}

.article-rail--outline:hover .rail-item__text {
  max-width: 158px;
  max-height: none;
  padding-block: 2px;
  padding-left: var(--outline-indent);
  margin-block: 0;
  opacity: 1;
}

.article-rail--outline.is-fading .rail-item__text {
  max-width: 158px;
  max-height: none;
  padding-block: 2px;
  padding-left: var(--outline-indent);
  margin-block: 0;
  opacity: 0;
  transition: opacity 140ms var(--ease);
}

.article-rail--refs .article-rail__inner {
  width: 100px;
  max-width: 172px;
  margin-left: auto;
  padding-inline: 10px 2px;
}

.article-rail--refs:hover .article-rail__inner,
.article-rail--refs.is-fading .article-rail__inner {
  width: 172px;
}

.article-rail--refs .rail-item {
  --refs-line-width: 12px;
  --refs-text-size: 13.5px;
  --refs-hover-height: 24px;
  grid-template-columns: minmax(0, 1fr) 18px;
  gap: 4px;
  min-height: var(--refs-hover-height);
  transition:
    color var(--dur) var(--ease),
    opacity var(--dur) var(--ease);
}

.article-rail--refs:hover .rail-item,
.article-rail--refs.is-fading .rail-item {
  grid-template-columns: minmax(0, 1fr) 8px;
  gap: 3px;
  min-height: var(--refs-hover-height);
}

.article-rail--refs .rail-item__line {
  grid-column: 2;
  grid-row: 1;
  width: var(--refs-line-width);
  height: 2px;
  justify-self: end;
  opacity: 0.56;
  transition:
    opacity 140ms var(--ease),
    background var(--dur) var(--ease);
}

.article-rail--refs .rail-item__text {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  max-width: 0;
  color: var(--ink);
  font-size: var(--refs-text-size);
  line-height: 1.4;
  opacity: 0;
  overflow: hidden;
  padding-block: 2px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition:
    opacity 95ms var(--ease) 20ms,
    color var(--dur) var(--ease);
  will-change: max-width, opacity;
}

.article-rail--refs:hover .rail-item .rail-item__line {
  width: 0;
  opacity: 0;
}

.article-rail--refs.is-fading .rail-item__line {
  width: var(--refs-line-width);
  opacity: 0.56;
  transition:
    opacity 140ms var(--ease),
    background var(--dur) var(--ease);
}

.article-rail--refs:hover .rail-item__text {
  max-width: 158px;
  opacity: 1;
}

.article-rail--refs.is-fading .rail-item__text {
  max-width: 158px;
  opacity: 0;
  transition: opacity 140ms var(--ease);
}

.article-rail.is-collapsed .rail-item {
  grid-template-columns: 14px minmax(0, 1fr);
  min-height: 18px;
  opacity: 0;
  pointer-events: none;
}

.article-rail--refs.is-collapsed .rail-item {
  grid-template-columns: minmax(0, 1fr) 14px;
}

.article-rail.is-collapsed .rail-item__text {
  max-width: 0;
  opacity: 0;
}

.article-rail.is-collapsed .rail-item .rail-item__line {
  width: 0;
  height: 2px;
  background: var(--forest);
  opacity: 0;
  transform: none;
}

.article-rail--outline.is-collapsed .rail-item {
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 4px;
  min-height: 12px;
}

.article-rail--outline.is-collapsed .rail-item .rail-item__line {
  height: 2px;
}

.rail-empty {
  color: var(--ink-soft);
  font-family: "DM Mono", monospace;
  font-size: 11px;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.article-rail:hover .rail-empty {
  opacity: 0.72;
}

.mobile-rail-actions {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 60;
  display: none;
  gap: 8px;
}

.mobile-rail-actions button {
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(249, 248, 244, 0.9);
  color: var(--forest);
  font-family: "DM Mono", monospace;
  font-size: 12px;
}

@media (max-width: 1020px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .topbar__button--mobile {
    display: inline-flex;
    align-items: center;
  }

  .sidebar,
  body.is-article-mode .sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    z-index: 45;
    display: block;
    width: min(330px, 86vw);
    height: calc(100vh - var(--topbar-height));
    background: var(--ivory);
    box-shadow: var(--shadow-soft);
    transform: translateX(-104%);
    transition: transform var(--dur) var(--ease);
  }

  body.is-index-open .sidebar {
    transform: translateX(0);
  }

  .content {
    padding: 36px 22px 82px;
  }

  .list-view {
    max-width: none;
  }

  .list-view__header {
    grid-template-columns: 1fr;
  }

  .markdown-article {
    width: min(760px, calc(100% - 34px));
    padding-top: 36px;
  }

  .article-rail {
    top: var(--topbar-height);
    bottom: 0;
    width: min(330px, 86vw);
    max-height: none;
    padding: 22px 18px 18px;
    background: rgba(249, 248, 244, 0.96);
    box-shadow: var(--shadow-soft);
    transform: none;
    transition: transform var(--dur) var(--ease);
  }

  .article-rail--outline {
    left: 0;
    transform: translateX(-104%);
  }

  .article-rail--refs {
    right: 0;
    transform: translateX(104%);
  }

  body.is-outline-open .article-rail--outline,
  body.is-refs-open .article-rail--refs {
    transform: translateX(0);
  }

  .article-rail__inner {
    max-height: calc(100vh - var(--topbar-height) - 44px);
    max-height: calc(100dvh - var(--topbar-height) - 44px);
    overflow-y: auto;
    padding-block: 4px 6px;
  }

  .rail-item,
  .article-rail--refs .rail-item {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .article-rail--refs .rail-item__line,
  .article-rail--refs .rail-item__text {
    grid-column: auto;
    grid-row: auto;
    justify-self: end;
    text-align: left;
  }

  .rail-item__text,
  .article-rail:hover .rail-item__text {
    max-width: none;
    opacity: 1;
    white-space: normal;
  }

  .article-rail--outline .article-rail__inner {
    gap: 6px;
    width: auto;
    max-width: none;
    padding-inline: 0;
  }

  .article-rail--outline:hover .article-rail__inner,
  .article-rail--outline.is-fading .article-rail__inner {
    width: auto;
    max-width: none;
  }

  .article-rail--refs .article-rail__inner,
  .article-rail--refs:hover .article-rail__inner,
  .article-rail--refs.is-fading .article-rail__inner {
    width: auto;
    max-width: none;
    margin-left: 0;
    padding-inline: 0;
  }

  .article-rail--outline .rail-item,
  .article-rail--outline:hover .rail-item,
  .article-rail--outline.is-fading .rail-item {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 6px;
    min-height: 22px;
    padding: 1px 0;
  }

  .article-rail--outline .rail-item__line,
  .article-rail--outline:hover .rail-item .rail-item__line,
  .article-rail--outline.is-fading .rail-item__line {
    width: var(--outline-line-width);
    height: 2px;
    opacity: 0.56;
    transform: none;
  }

  .article-rail--outline .rail-item__text,
  .article-rail--outline:hover .rail-item__text,
  .article-rail--outline.is-fading .rail-item__text {
    max-width: none;
    max-height: none;
    padding-block: 0;
    padding-left: var(--outline-indent);
    margin-block: 0;
    font-size: var(--outline-text-size);
    line-height: 1.2;
    opacity: 1;
    transform: none;
    transition: none;
    white-space: normal;
  }

  .article-rail--refs .rail-item__text,
  .article-rail--refs:hover .rail-item__text,
  .article-rail--refs.is-fading .rail-item__text {
    max-width: none;
    opacity: 1;
    text-align: left;
    white-space: normal;
    transition: none;
  }

  .article-rail--outline .rail-item,
  .article-rail--outline:hover .rail-item,
  .article-rail--outline.is-fading .rail-item,
  .article-rail--refs .rail-item,
  .article-rail--refs:hover .rail-item,
  .article-rail--refs.is-fading .rail-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .article-rail--outline .rail-item__line,
  .article-rail--outline:hover .rail-item .rail-item__line,
  .article-rail--outline.is-fading .rail-item__line,
  .article-rail--refs .rail-item__line,
  .article-rail--refs:hover .rail-item .rail-item__line,
  .article-rail--refs.is-fading .rail-item__line {
    display: none;
  }

  .article-rail--outline .rail-item__text,
  .article-rail--outline:hover .rail-item__text,
  .article-rail--outline.is-fading .rail-item__text {
    padding-left: min(var(--outline-indent), 18px);
    padding-block: 2px;
    line-height: 1.45;
    overflow: visible;
  }

  .article-rail--refs .rail-item__text,
  .article-rail--refs:hover .rail-item__text,
  .article-rail--refs.is-fading .rail-item__text {
    grid-column: 1;
    justify-self: stretch;
    text-align: right;
    width: 100%;
    padding-block: 2px;
    line-height: 1.45;
    overflow: visible;
  }

  .mobile-rail-actions {
    display: inline-flex;
  }
}

@media (max-width: 1020px) and (hover: none), (max-width: 1020px) and (pointer: coarse) {
  .topbar__button:hover {
    background: transparent;
  }

  .topbar__button:active,
  .mobile-rail-actions button:active {
    background: var(--sage-active);
  }

  .mobile-rail-actions button:hover {
    background: rgba(249, 248, 244, 0.9);
  }

  .sidebar-tab:hover {
    color: var(--forest);
  }

  .sidebar-tab.is-active {
    color: var(--moss);
  }

  .tree-node:not(.is-active) > .tree-node__row:hover {
    background: transparent;
    color: var(--ink);
  }

  .tree-node__row:active {
    background: var(--sage-active);
    color: var(--forest);
  }

  .timeline-month:hover {
    background: transparent;
    color: var(--ink);
  }

  .timeline-month:active {
    background: var(--sage-active);
    color: var(--forest);
  }

  .timeline-month.is-active {
    background: var(--forest);
    color: var(--ivory);
  }

  .post-card:hover {
    transform: none;
    border-color: transparent;
    background: var(--ivory-warm);
    box-shadow: var(--shadow-soft);
  }

  .post-card:hover .post-card__title {
    color: var(--forest);
  }
}

@media (max-width: 620px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 8px 14px;
  }

  .brand {
    min-width: 0;
  }

  .topbar__tagline {
    display: none;
  }

  .topbar__right {
    min-width: max-content;
  }

  .brand__name {
    display: block;
    overflow: hidden;
    font-size: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .post-card {
    padding: 17px;
  }

  .list-view__title {
    font-size: 42px;
  }

  .markdown-body {
    font-size: 16px;
  }

  .markdown-body pre code {
    padding: 16px 18px;
  }

  .math-block {
    padding: 0 2.2em;
  }

  .html-article-frame {
    height: calc(100vh - var(--topbar-height));
  }
}

@media (prefers-reduced-motion: reduce) {
  .article-stage__content,
  .html-article-frame {
    transition: none;
    transform: none;
    filter: none;
  }

  .article-loading {
    transition: none;
    transform: translateX(-50%);
  }

  .article-view--ready .article-loading {
    transform: translateX(-50%);
  }

  .article-loading__line {
    animation: none;
  }

  .article-rail--outline .rail-item,
  .article-rail--outline .rail-item__line,
  .article-rail--outline .rail-item__text {
    transition: none;
  }
}
