/* ============================================================
 * post.css — 文章页
 * 阅读优先：正文系统栈 16px/1.75，标题走 Cascadia Mono。
 * 颜色一律使用 common.css 的变量。
 * ============================================================ */

.page-post {
  font-size: 16px;
  line-height: 1.75;
  overflow-wrap: break-word;
}

/* ---- 标题区 ---- */
.page-post .title {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}
.page-post .subtitle {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

/* ---- 目录 ---- */
.post-toc ul {
  margin: 10px 0 6px;
  padding-left: 18px;
}
.post-toc li {
  list-style: none;
  margin: 4px 0;
}
.post-toc a {
  font-size: 14px;
  color: var(--ink);
}
.post-toc a:hover {
  color: var(--accent);
}
.post-toc ul ul {
  padding-left: 16px;
}

/* 顶部折叠目录：窄屏用 */
.post-toc-top {
  margin: 26px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  padding: 10px 16px;
}
.post-toc-top summary {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.post-toc-top summary:hover {
  color: var(--accent);
}

/* 悬浮目录：宽屏固定在正文右侧 */
.post-toc-float {
  display: none;
}
@media (min-width: 1200px) {
  .post-toc-top {
    display: none;
  }
  .post-toc-float {
    display: block;
    position: fixed;
    top: 140px;
    left: calc(50% + 376px);
    width: 210px;
    max-height: calc(100vh - 220px);
    overflow: auto;
    font-family: var(--font-mono);
  }
  .post-toc-float ul {
    margin: 0;
    padding-left: 0;
  }
  .post-toc-float ul ul {
    padding-left: 12px;
  }
  .post-toc-float li {
    margin: 0;
  }
  .post-toc-float a {
    display: block;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--muted);
    padding: 4px 0 4px 10px;
    border-left: 2px solid var(--line);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 150ms ease, border-color 150ms ease;
  }
  .post-toc-float a:hover {
    color: var(--ink);
    border-left-color: var(--muted);
  }
  .post-toc-float a.active {
    color: var(--accent);
    font-weight: 600;
    border-left-color: var(--accent);
  }
}

/* ---- 正文节奏 ---- */
.page-post .post > * {
  margin: 20px 0;
}
.page-post .post > iframe {
  margin: 0;
  width: 100%;
}

.page-post .post h1,
.page-post .post h2,
.page-post .post h3,
.page-post .post h4,
.page-post .post h5,
.page-post .post h6 {
  font-family: var(--font-mono);
  line-height: 1.4;
  margin: 40px 0 16px;
  cursor: pointer;
  scroll-margin-top: 16px;
}
.page-post .post h1,
.page-post .post h2 {
  font-size: 22px;
  font-weight: 600;
}
.page-post .post h3 {
  font-size: 18px;
  font-weight: 600;
}
.page-post .post h4 {
  font-size: 16.5px;
  font-weight: 600;
}
.page-post .post h5,
.page-post .post h6 {
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
}
/* 悬停时在左侧浮现 # 锚点标记 */
.page-post .post h1,
.page-post .post h2 {
  position: relative;
  padding-left: 22px;
  margin-left: -22px;
}
.page-post .post h1::before,
.page-post .post h2::before {
  content: '#';
  position: absolute;
  left: 0;
  font-weight: 600;
  color: var(--accent);
  opacity: 0;
  transition: opacity 150ms ease;
}
.page-post .post h1:hover::before,
.page-post .post h2:hover::before {
  opacity: 1;
}

.page-post blockquote {
  border-left: 2px solid var(--accent);
  background-color: var(--bg-soft);
  border-radius: 0 8px 8px 0;
  padding: 10px 16px;
  color: var(--muted);
}
.page-post blockquote p {
  margin: 6px 0;
}

/* ---- 链接与强调 ---- */
.page-post .post a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.page-post .post a:hover {
  text-decoration-thickness: 2px;
}
.page-post strong,
.page-post b {
  font-weight: 600;
  color: var(--ink);
}

/* ---- 列表 ---- */
.page-post .post ul,
.page-post .post ol {
  padding-left: 22px;
}
.page-post .post ul > li {
  list-style: disc;
}
.page-post .post ol > li {
  list-style: decimal;
}
.page-post li > * {
  margin: 6px 0;
}
.page-post li::marker {
  color: var(--muted);
}

/* ---- 图片 ---- */
.page-post img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 6px;
  box-shadow: var(--shadow);
}
.page-post img[alt='line'] {
  display: inline-block;
  vertical-align: middle;
  background-color: transparent;
  box-shadow: none;
  border-radius: 0;
  margin: 0 4px;
  line-height: 1;
}

/* ---- 代码 ---- */
.page-post pre {
  font-size: 13.5px;
  line-height: 1.6;
  padding: 14px 16px;
  overflow: auto;
  border-radius: 8px;
  background-color: var(--bg-soft);
  max-height: 70vh;
  tab-size: 4;
}
.page-post code {
  font-size: 14px;
  background-color: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--ink);
}
.page-post pre code {
  font-size: inherit;
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  color: inherit;
  overflow-wrap: normal;
}

/* ---- 分隔线 / 表格 ---- */
.page-post hr {
  border: none;
  height: 1px;
  background-color: var(--line);
  margin: 32px 0;
}
.page-post table {
  min-width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.page-post tr {
  border-bottom: 1px solid var(--line);
}
.page-post th {
  font-weight: 600;
  background-color: var(--bg-soft);
}
.page-post th,
.page-post td {
  padding: 7px 12px;
  text-align: left;
}
.page-post .table-container {
  overflow: auto;
  margin: 20px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.page-post .table-container table {
  margin: 0;
  border: 0;
  border-radius: 0;
}
.page-post .table-container table tbody tr:last-child {
  border-bottom: 0;
}
.page-post .table-container table tbody tr:nth-child(even) {
  background-color: var(--bg-soft);
}

/* ---- 评论区 ---- */
.post-comments {
  margin: 40px 0 0;
}
.post-comments .giscus {
  margin-top: 8px;
}

/* ---- 图片全屏预览（blog.js 注入的节点）---- */
.img-move-item {
  border-radius: 6px;
}

/* ---- 移动端：字号不缩水，只收标题 ---- */
@media screen and (max-width: 560px) {
  .page-post .title {
    font-size: 26px;
  }
  .page-post .post h1,
  .page-post .post h2 {
    font-size: 20px;
  }
  .page-post .post h3 {
    font-size: 17px;
  }
  .page-post pre {
    font-size: 12.5px;
    padding: 12px;
  }
}
