/* Single post specific styles */
:root {
  --single-max-width: 880px;
}
.single .layout-main .container {
  max-width: var(--single-max-width);
}

.single-header {
  margin-bottom: 34px;
  text-align: center;
}
.single-header .single-title {
  font-size: 2.3rem;
  line-height: 1.25;
  margin: 0 0 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.single-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.single-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.single-meta i {
  font-size: 0.85rem;
  opacity: 0.82;
}

.single-feature {
  margin: 0 auto 34px;
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 16/8;
  position: relative;
  background: #f2f4f3;
}
[data-theme="dark"] .single-feature {
  background: #222;
}
.single-feature img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.single-content {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-primary);
}

/* 标题样式优化 - 强制优先级 */
.post-body h1,
.single-content h1 {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  margin: 2em 0 0.8em !important;
  line-height: 1.3 !important;
  color: #333 !important;
  border-bottom: 2px solid #e8e8e8 !important;
  padding-bottom: 0.4em !important;
}

.post-body h2,
.single-content h2 {
  font-size: 1.3rem !important;
  font-weight: 600 !important;
  margin: 1.8em 0 0.8em !important;
  line-height: 1.35 !important;
  color: #444 !important;
  border-left: 4px solid var(--main-color) !important;
  padding-left: 0.6em !important;
}

.post-body h3,
.single-content h3 {
  font-size: 1.2rem !important;
  font-weight: 600 !important;
  margin: 1.5em 0 0.6em !important;
  line-height: 1.4 !important;
  color: #555 !important;
}

.post-body h4,
.single-content h4 {
  font-size: 1.1rem !important;
  font-weight: 600 !important;
  margin: 1.3em 0 0.5em !important;
  line-height: 1.4 !important;
  color: #666 !important;
}

.post-body h5,
.single-content h5 {
  font-size: 1rem !important;
  font-weight: 600 !important;
  margin: 1.1em 0 0.4em !important;
  line-height: 1.4 !important;
  color: #777 !important;
}

/* 深色模式标题样式 */
[data-theme="dark"] .post-body h1,
[data-theme="dark"] .single-content h1 {
  color: #e8e8e8 !important;
  border-bottom-color: #444 !important;
}

[data-theme="dark"] .post-body h2,
[data-theme="dark"] .single-content h2 {
  color: #ddd !important;
}

[data-theme="dark"] .post-body h3,
[data-theme="dark"] .single-content h3 {
  color: #ccc !important;
}

[data-theme="dark"] .post-body h4,
[data-theme="dark"] .single-content h4 {
  color: #bbb !important;
}

[data-theme="dark"] .post-body h5,
[data-theme="dark"] .single-content h5 {
  color: #aaa !important;
}

.single-content p {
  margin: 1em 0;
}

/* 文章内容区域 */
.post-content {
  position: relative;
  max-width: 100%;
}

/* 右侧目录样式 */
.post-toc-sidebar {
  position: fixed;
  top: 150px;
  right: 300px;
  width: 230px;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
  max-height: calc(100vh - 120px);
  z-index: 999;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .post-toc-sidebar {
  background: rgba(22, 27, 34, 0.95); /* 深蓝灰半透明 */
  border-color: rgba(33, 38, 45, 0.8);
  box-shadow: 0 2px 12px rgba(88, 166, 255, 0.1); /* 蓝色阴影 */
}

.toc-header {
  padding: 8px 12px;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
}

[data-theme="dark"] .toc-header {
  background: rgba(33, 38, 45, 0.6); /* 暗蓝灰 */
  border-bottom-color: rgba(88, 166, 255, 0.2);
}

.toc-header h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  text-align: center;
}

[data-theme="dark"] .toc-header h3 {
  color: #8b949e; /* 柔和灰蓝 */
}

.toc-content {
  padding: 8px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-list li {
  margin: 0 0 2px 0;
  line-height: 1.3;
}

.toc-list a {
  display: block;
  padding: 4px 6px;
  color: #666;
  text-decoration: none;
  font-size: 11px;
  border-radius: 3px;
  transition: all 0.2s ease;
}

[data-theme="dark"] .toc-list a {
  color: #8b949e; /* 柔和灰蓝链接 */
}

.toc-list a:hover {
  background: var(--main-color);
  color: #fff;
}

[data-theme="dark"] .toc-list a:hover {
  background: #58a6ff; /* 亮蓝hover */
  color: #ffffff;
}

.toc-list a.active {
  background: var(--main-color);
  color: white;
  font-weight: 600;
}

[data-theme="dark"] .toc-list a.active {
  background: #58a6ff; /* 亮蓝激活状态 */
  color: #ffffff;
}

.toc-list .toc-h1 {
  padding-left: 6px;
  font-weight: 600;
  font-size: 12px;
}
.toc-list .toc-h2 {
  padding-left: 12px;
}
.toc-list .toc-h3 {
  padding-left: 18px;
}
.toc-list .toc-h4 {
  padding-left: 24px;
}
.toc-list .toc-h5 {
  padding-left: 30px;
}
.toc-list .toc-h6 {
  padding-left: 36px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .post-toc-sidebar {
    position: fixed;
    top: 80px;
    right: 50px;
    width: 180px;
  }
}

@media (max-width: 768px) {
  .post-toc-sidebar {
    position: fixed;
    top: 70px;
    right: 30px;
    width: 160px;
    max-height: calc(100vh - 90px);
  }

  .toc-header {
    padding: 6px 8px;
  }

  .toc-header h3 {
    font-size: 11px;
  }

  .toc-content {
    padding: 6px;
    max-height: calc(100vh - 120px);
  }

  .toc-list a {
    font-size: 10px;
    padding: 3px 5px;
  }
}

@media (max-width: 480px) {
  .post-toc-sidebar {
    position: fixed;
    top: 60px;
    right: 5px;
    left: 5px;
    width: auto;
    max-height: calc(100vh - 80px);
  }

  .toc-content {
    padding: 4px;
  }

  .toc-list a {
    font-size: 9px;
    padding: 2px 4px;
  }
}

/* 链接样式优化 - 强制优先级 */
.single-content a {
  color: var(--main-color) !important;
  text-decoration: none !important;
  position: relative !important;
  border-bottom: 1px solid transparent !important;
  transition: all 0.3s ease !important;
  display: inline-block !important;
}

.single-content a:hover {
  color: var(--dark-main-color) !important;
  border-bottom-color: var(--main-color) !important;
  transform: translateY(-1px) !important;
  text-decoration: none !important;
}

/* 图片fancybox样式 */
.single-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
}

.single-content img:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* fancybox图片容器 */
.single-content .fancybox-container {
  display: inline-block;
  margin: 1em 0;
}

.single-content .fancybox-container img {
  display: block;
  margin: 0 auto;
}
.single-content pre {
  background: #1e1f22;
  color: #eee;
  padding: 16px 18px;
  border-radius: 14px;
  overflow: auto;
  font-size: 0.85rem;
  line-height: 1.5;
  font-family: "PaperMono", "Consolas", "Monaco", "Courier New", monospace;
}
[data-theme="dark"] .single-content pre {
  background: #161b22; /* 深蓝灰背景 */
  border: 1px solid rgba(33, 38, 45, 0.5);
}
.single-content code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: "PaperMono", "Consolas", "Monaco", "Courier New", monospace;
}
[data-theme="dark"] .single-content code {
  background: rgba(110, 118, 129, 0.4); /* 深蓝灰背景 */
  color: #79c0ff; /* 浅蓝色代码 */
  border: 1px solid rgba(33, 38, 45, 0.6);
}
.single-content blockquote {
  margin: 1.6em 0;
  padding: 18px 24px;
  border-left: 5px solid var(--main-color);
  background: linear-gradient(
    135deg,
    rgba(121, 174, 156, 0.08),
    rgba(82, 132, 111, 0.08)
  );
  border-radius: 0 14px 14px 0;
}
[data-theme="dark"] .single-content blockquote {
  background: rgba(88, 166, 255, 0.08); /* 蓝色半透明 */
  border-left-color: #58a6ff; /* 亮蓝边框 */
}

.post-tags {
  margin: 42px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.post-tags a {
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  padding: 6px 12px 6px;
  background: var(--bg-elevate, #f3f5f4);
  border-radius: 20px;
  text-decoration: none;
  color: var(--text-secondary);
  transition: 0.25s;
}
.post-tags a:hover {
  background: linear-gradient(
    135deg,
    var(--main-color),
    var(--dark-main-color)
  );
  color: #fff;
}
[data-theme="dark"] .post-tags a {
  background: rgba(33, 38, 45, 0.6); /* 深蓝灰标签背景 */
  color: #8b949e; /* 柔和灰蓝文字 */
  border: 1px solid rgba(88, 166, 255, 0.3);
}
[data-theme="dark"] .post-tags a:hover {
  background: #58a6ff; /* 亮蓝色 */
  color: #ffffff;
  border-color: #58a6ff;
}

/* 文章导航样式 - 简化版 */
.post-navigation {
  margin: 30px 0;
  padding: 20px 0;
  border-top: 1px solid #eee;
}

[data-theme="dark"] .post-navigation {
  border-top-color: #333;
}

.nav-links {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.nav-prev,
.nav-next {
  flex: 1;
}

.nav-prev a,
.nav-next a {
  display: block;
  padding: 12px 16px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  text-decoration: none;
  color: #666;
  font-size: 14px;
  line-height: 1.4;
  transition: all 0.3s ease;
}

[data-theme="dark"] .nav-prev a,
[data-theme="dark"] .nav-next a {
  background: #222;
  border-color: #333;
  color: #aaa;
}

.nav-prev a:hover,
.nav-next a:hover {
  background: var(--main-color);
  color: white;
  border-color: var(--main-color);
  transform: translateY(-1px);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .nav-links {
    flex-direction: column;
    gap: 12px;
  }

  .nav-prev a,
  .nav-next a {
    font-size: 13px;
    padding: 10px 14px;
  }
}

/* Comments */
#comments {
  margin: 68px 0 0;
}
#comments h3 {
  font-size: 1.2rem;
  margin: 0 0 20px;
}
.comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.comment-list li {
  margin: 0 0 28px;
  display: flex;
  gap: 14px;
}
.comment-body {
  flex: 1;
  background: var(--bg-elevate, #f6f8f7);
  padding: 14px 18px 18px;
  border: 1px solid var(--border-primary);
  border-radius: 14px;
  position: relative;
}
.comment-body:before {
  content: "";
  position: absolute;
  left: -10px;
  top: 16px;
  border: 6px solid transparent;
  border-right-color: var(--border-primary);
}
.comment-body:after {
  content: "";
  position: absolute;
  left: -8px;
  top: 16px;
  border: 6px solid transparent;
  border-right-color: var(--bg-elevate, #f6f8f7);
}
[data-theme="dark"] .comment-body {
  background: #222;
}
.comment-meta {
  font-size: 0.7rem;
  color: var(--text-secondary);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 8px;
}
.comment-content p {
  margin: 0 0 0.9em;
}
/* 评论回复链接样式已移至 main.css，此处保留其他样式以避免冲突 */
/* .comment-reply-link 样式已移至 main.css，此处删除避免冲突 */

@media (max-width: 960px) {
  .single-header .single-title {
    font-size: 1.9rem;
  }
  .single-meta {
    justify-content: flex-start;
  }
  .post-navigation {
    flex-direction: column;
  }
  .post-navigation a {
    text-align: left;
  }
}
