/* CSS 变量 - 主题色系 */
:root {
  --primary-color: #f22f27;
  --primary-dark: #cc1616;
  --primary-light: #ff5d52;
  --text-color: #262626;
  --text-secondary: #595959;
  --text-light: #8c8c8c;
  --bg-light: #fafafa;
  --bg-code: #f8f5ec;
  --border-color: #e0e0e0;
}

.post-layout {
  position: relative;
  padding-top: 0;
}
.post {
  position: relative;
  border: none;
}
.post-header {
  margin-bottom: 20px;
  padding-bottom: 0;
  border: none;
  text-align: center;
}
/* 隐藏 post-header 里的标题，使用 post-content 里的 h1 */
.post-header .post-title {
  display: none;
}
.post-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 30px;
}
.post-meta .date {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.5px;
}
.post-meta .date::before {
  content: '📅 ';
  margin-right: 5px;
}

/* 文章内容样式 - 参考 zj.css */
.post-content {
  font-size: 17px;
  line-height: 1.8;
  color: var(--text-color);
  font-family: 'Source Han Serif CN', 'Microsoft YaHei', Georgia, serif;
}

/* h1 - 居中，底部红色装饰线 */
.post-content h1:first-child {
  display: block !important;
  text-align: center;
  padding-bottom: 0.3em;
  font-size: 2.2em;
  line-height: 1.2;
  margin: 1.4em auto 1.0em;
  color: #590009;
  position: relative;
}
.post-content h1:first-child::after {
  content: '';
  display: block;
  margin: 0.2em auto 0;
  width: 100px;
  height: 2px;
  border-bottom: 2px solid var(--primary-color);
}

/* h2 - # 前缀，底部边框 */
.post-content h2 {
  font-size: 1.8em;
  line-height: 1.4;
  margin: 2em auto 1.4em;
  color: var(--text-color);
  font-weight: 600;
  border-bottom: 1px solid var(--primary-color);
  padding-bottom: 5px;
  position: relative;
}
.post-content h2::before {
  content: '# ';
  color: var(--primary-color);
}

/* h3 - 左侧红色边框 */
.post-content h3 {
  font-size: 1.4em;
  line-height: 1.43;
  margin: 1.6em auto 1.2em;
  padding-left: 9px;
  border-left: 5px solid var(--primary-color);
  color: var(--text-color);
  font-weight: 600;
}

/* h4 - 顶部红色边框框线 */
.post-content h4 {
  margin-top: 1.3em;
  font-size: 1.2em;
  padding: 6px;
  display: inline-block;
  border: 1px solid var(--primary-color);
  border-top: 4px solid var(--primary-color);
  color: var(--text-color);
  font-weight: 600;
}

.post-content h5,
.post-content h6 {
  font-size: 1rem;
  margin: 1em auto 0.8em;
  color: var(--text-color);
  font-weight: 600;
}

/* 段落 */
.post-content p {
  margin: 0.8em 0;
  line-height: 1.8;
  word-spacing: 0.05rem;
  color: var(--text-color);
}

/* 链接 - 蓝色，底部下划线 */
.post-content a {
  color: blue;
  font-weight: 500;
  padding: 0 2px;
  text-decoration: none;
  border-bottom: 1px solid blue;
}
.post-content a:hover {
  border-bottom: 2px solid var(--primary-color);
  color: var(--primary-dark);
}

/* 列表 - 红色标记 */
.post-content ul,
.post-content ol {
  margin: 0.5rem 0;
  padding-left: 25px;
}
.post-content ol > li,
.post-content ul > li {
  color: #db4d52;
  font-weight: bold;
  margin: 8px 0;
}
.post-content ol > li > *:not(a),
.post-content ul > li > *:not(a) {
  color: #333;
  font-weight: normal;
}
.post-content ol > li > *:not(ol):not(ul),
.post-content ul > li > *:not(ol):not(ul) {
  padding-left: 0.25rem;
}

/* 代码 - 行内代码 */
.post-content code {
  padding: 2px 4px;
  border-radius: 2px;
  font-family: 'Source Code Pro', 'Roboto Mono', 'Source Sans Pro', 'Microsoft YaHei', '微软雅黑' !important;
  font-size: 1rem;
  color: #ff3502;
  background-color: var(--bg-code);
}

/* 代码块 - 完全参考 zj.css/Typora 原始设计 */
.post-content pre {
  border: 1px solid #7a7a7a;
  -webkit-font-smoothing: auto;
  margin: 2rem 0 !important;
  padding: 8px 10px;
  line-height: 1.45;
  border-radius: 2px;
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace !important;
  font-size: 0.85rem;
  word-wrap: normal;
  overflow-x: auto;
  /* 不设置 background，使用默认白色背景 */
  position: relative;
  white-space: pre;
  tab-size: 4;
  letter-spacing: 0;
  font-kerning: none;
  text-rendering: optimizeSpeed;
  font-weight: 400;
  -webkit-text-stroke: 0;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}
.post-content pre code {
  background: none !important;
  padding: 0;
  line-height: inherit;
  color: #24292f;  /* 接近 GitHub 文本色 */
  font-family: inherit !important;
  white-space: pre;
  font-kerning: none;
  text-rendering: optimizeSpeed;
  font-weight: 400;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}
.post-content pre code span {
  font-family: inherit !important;
  font-kerning: none;
  text-rendering: optimizeSpeed;
  font-weight: 400;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}
.post-content pre code.hljs * {
  font-weight: 400 !important;
}
/* highlight.js 额外样式 */
.post-content pre code.hljs {
  display: block;
  overflow-x: auto;
  padding: 0;
  color: rgb(0, 0, 0);  /* 默认黑色文本 */
}

/* 代码块复制按钮 */
.post-content pre .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #ddd;
  background: #fff;
  color: #666;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s, border-color 0.2s, color 0.2s;
}
.post-content pre:hover .copy-btn {
  opacity: 1;
}
.post-content pre .copy-btn.copied {
  border-color: #2ecc71;
  color: #2ecc71;
}

/* 自定义语法高亮颜色 - 完全匹配 Typora/CodeMirror */
.post-content pre code.hljs .hljs-keyword {
  color: rgb(119, 0, 136);  /* 紫色：package, import, func, var, if, return */
}
.post-content pre code.hljs .hljs-string {
  color: #22a2c9;  /* 蓝色：字符串 */
}
.post-content pre code.hljs .hljs-number {
  color: rgb(17, 102, 68);  /* 绿色：数字 */
}
.post-content pre code.hljs .hljs-comment {
  color: rgb(170, 85, 0);  /* 橙色：注释 */
}
.post-content pre code.hljs .hljs-variable,
.post-content pre code.hljs .hljs-title.function_,
.post-content pre code.hljs .hljs-title.class_,
.post-content pre code.hljs .hljs-attr {
  color: rgb(0, 0, 0);  /* 黑色：变量、函数名、类名 */
}
.post-content pre code.hljs .hljs-built_in,
.post-content pre code.hljs .hljs-type {
  color: rgb(0, 85, 170);  /* 蓝色：内置类型 map, string, int */
}
.post-content pre code.hljs .hljs-literal {
  color: rgb(34, 17, 153);  /* 深蓝：nil, true, false */
}
.post-content pre code.hljs .hljs-operator,
.post-content pre code.hljs .hljs-punctuation {
  color: rgb(0, 0, 0);  /* 黑色：操作符和标点 */
}

/* 引用块 - 粉红色背景 */
.post-content blockquote {
  border-left: 4px solid rgb(239, 112, 96);
  padding: 10px 15px;
  margin: 20px 0;
  color: #3f3f3f;
  background-color: #fff9f9;
  font-style: normal;
}

/* 加粗和斜体 */
.post-content strong {
  padding: 0.1em;
  color: #dc3545;
  font-weight: bold;
}
.post-content em {
  padding: 0 2px 0 2px;
  font-style: normal;
  color: #ff3502;
}

/* 图片 */
.post-content img {
  max-width: 100%;
  height: auto;
  margin: 24px auto;
  display: block;
  border-radius: 4px;
}

/* 表格 */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  word-break: initial;
}
.post-content table tr {
  border-top: 1px solid var(--primary-color);
  margin: 0;
  padding: 0;
}
.post-content table tr:nth-child(2n),
.post-content table thead {
  background-color: #fafafa;
}
.post-content table th {
  border: 1px solid #dfe2e5;
  text-align: left;
  margin: 0;
  padding: 6px 13px;
  font-size: 100%;
  font-weight: normal;
}
.post-content table td {
  border: 1px solid #dfe2e5;
  text-align: left;
  margin: 0;
  padding: 6px 13px;
}
.post-content table tr:hover {
  background: #f5f5f5;
}

/* 水平分割线 */
.post-content hr {
  height: 2px;
  padding: 0;
  margin: 16px 0;
  background-color: #e7e7e7;
  border: 0 none;
  overflow: hidden;
}

/* 文章页脚 - 日期显示在右下角 */
.post-footer {
  margin-top: 50px;
  display: flex;
  justify-content: flex-end;
}
.post-footer .post-meta {
  margin-bottom: 0;
}
.post-footer .post-meta .date {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 400;
}

/* 评论区 */
.comments {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

/* 话题返回链接 */
.topic-link {
  margin-top: 24px;
}
.topic-link a {
  display: inline-flex;
  align-items: center;
  color: #666;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}
.topic-link a:hover {
  color: var(--primary-color);
}

/* 返回链接 */
.back-link {
  margin-top: 40px;
  padding-top: 25px;
  border-top: 1px solid var(--border-color);
}
.back-link a {
  display: inline-flex;
  align-items: center;
  color: #666;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}
.back-link a:hover {
  color: var(--primary-color);
}
