/* ============================================================
   macOS Desktop Theme - Post Content
   ============================================================ */

.post-window .window-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.post-content-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* 文章头部 */
.post-header {
  padding: 40px 48px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.post-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
  color: #1d1d1f;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 13px;
  color: #86868b;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-item i {
  font-size: 12px;
}

.meta-item a {
  color: #86868b;
}

.meta-item a:hover {
  color: var(--macos-blue);
}

.post-cover {
  margin-top: 20px;
  border-radius: 12px;
  overflow: hidden;
}

.post-cover img {
  width: 100%;
  height: auto;
  display: block;
}

/* 文章正文 */
.post-content {
  padding: 32px 48px;
  font-size: 16px;
  line-height: 1.8;
  color: #1d1d1f;
}

/* Markdown 样式 */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin-top: 28px;
  margin-bottom: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.markdown-body h1 {
  font-size: 28px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.08);
}

.markdown-body h2 {
  font-size: 24px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

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

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

.markdown-body p {
  margin-bottom: 16px;
}

.markdown-body a {
  color: var(--macos-blue);
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 122, 255, 0.3);
  transition: border-color 0.2s;
}

.markdown-body a:hover {
  border-bottom-color: var(--macos-blue);
}

.markdown-body ul,
.markdown-body ol {
  margin-bottom: 16px;
  padding-left: 28px;
}

.markdown-body ul {
  list-style: disc;
}

.markdown-body ol {
  list-style: decimal;
}

.markdown-body li {
  margin-bottom: 6px;
}

.markdown-body blockquote {
  margin: 20px 0;
  padding: 12px 20px;
  border-left: 4px solid var(--macos-blue);
  background: rgba(0, 122, 255, 0.05);
  border-radius: 0 8px 8px 0;
  color: #555;
}

.markdown-body blockquote p {
  margin-bottom: 0;
}

.markdown-body code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
}

/* Hexo 代码高亮 - figure.highlight 结构 */
.markdown-body figure.highlight {
  margin: 20px 0;
  background: #1e1e1e;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.markdown-body figure.highlight table {
  width: 100%;
  margin: 0;
  border: none;
  border-collapse: collapse;
}

.markdown-body figure.highlight table td {
  padding: 0;
  border: none;
}

.markdown-body figure.highlight table tr {
  background: none;
}

.markdown-body figure.highlight .gutter {
  width: 40px;
  min-width: 40px;
  background: #252526;
  text-align: right;
  user-select: none;
  border-right: 1px solid #333;
}

.markdown-body figure.highlight .gutter pre {
  margin: 0;
  padding: 16px 10px;
  background: none;
  color: #858585;
  font-size: 13px;
  line-height: 1.6;
  text-align: right;
}

.markdown-body figure.highlight .code pre {
  margin: 0;
  padding: 16px 20px;
  background: none;
  overflow-x: auto;
}

.markdown-body figure.highlight .line {
  color: #d4d4d4;
  font-size: 14px;
  line-height: 1.6;
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
  display: block;
  white-space: pre;
}

/* 行内代码 */
.markdown-body code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
  color: #c7254e;
}

/* 代码块内的 code 元素覆盖 */
.markdown-body figure.highlight code,
.markdown-body pre code {
  background: none;
  padding: 0;
  color: #d4d4d4;
  font-size: 14px;
  line-height: 1.6;
}

/* 兼容普通 pre 结构（无 highlight 时） */
.markdown-body pre:not(.highlight pre) {
  margin: 20px 0;
  padding: 16px 20px;
  background: #1e1e1e;
  border-radius: 10px;
  overflow-x: auto;
  position: relative;
  color: #d4d4d4;
}

/* 代码高亮语法颜色 */
.markdown-body figure.highlight .comment,
.markdown-body figure.highlight .quote {
  color: #6a9955;
}

.markdown-body figure.highlight .keyword,
.markdown-body figure.highlight .selector-tag,
.markdown-body figure.highlight .literal {
  color: #569cd6;
}

.markdown-body figure.highlight .string,
.markdown-body figure.highlight .doctag {
  color: #ce9178;
}

.markdown-body figure.highlight .number,
.markdown-body figure.highlight .literal {
  color: #b5cea8;
}

.markdown-body figure.highlight .built_in,
.markdown-body figure.highlight .type {
  color: #4ec9b0;
}

.markdown-body figure.highlight .function,
.markdown-body figure.highlight .title {
  color: #dcdcaa;
}

.markdown-body figure.highlight .variable,
.markdown-body figure.highlight .attr {
  color: #9cdcfe;
}

.markdown-body figure.highlight .meta {
  color: #c586c0;
}

.markdown-body table {
  width: 100%;
  margin: 20px 0;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
}

.markdown-body th,
.markdown-body td {
  padding: 12px 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  text-align: left;
}

.markdown-body th {
  background: rgba(0, 0, 0, 0.03);
  font-weight: 600;
}

.markdown-body tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

.markdown-body img {
  max-width: 100%;
  border-radius: 8px;
  margin: 16px 0;
  cursor: zoom-in;
}

.markdown-body hr {
  margin: 32px 0;
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* 文章标签 */
.post-tags {
  padding: 20px 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.post-tags i {
  color: #888;
}

.post-tag {
  padding: 5px 14px;
  background: rgba(0, 122, 255, 0.1);
  color: var(--macos-blue);
  border-radius: 14px;
  font-size: 13px;
  transition: all 0.2s;
}

.post-tag:hover {
  background: var(--macos-blue);
  color: #fff;
}

/* 版权声明 */
.post-copyright {
  margin: 0 48px 24px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 10px;
  border-left: 4px solid var(--macos-blue);
}

.copyright-item {
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
}

.copyright-item:last-child {
  margin-bottom: 0;
}

.copyright-label {
  font-weight: 600;
  color: #333;
}

/* 打赏 */
.post-reward {
  text-align: center;
  padding: 24px 48px;
}

.reward-btn {
  padding: 10px 28px;
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  color: #fff;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.reward-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(238, 90, 82, 0.4);
}

.reward-qrcodes {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 20px;
}

.reward-item {
  text-align: center;
}

.reward-item img {
  width: 140px;
  height: 140px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.reward-item span {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: #666;
}

/* 文章导航 */
.post-nav {
  display: flex;
  gap: 16px;
  padding: 24px 48px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.post-nav-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 10px;
  transition: all 0.2s;
  color: #333;
}

.post-nav-item:hover {
  background: rgba(0, 122, 255, 0.08);
  transform: translateY(-2px);
}

.post-nav-item.next {
  flex-direction: row-reverse;
  text-align: right;
}

.nav-text {
  flex: 1;
  min-width: 0;
}

.nav-label {
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
}

.nav-title {
  display: block;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-nav-item i {
  color: #888;
  font-size: 14px;
}

/* 评论区 */
.post-comments {
  padding: 32px 48px 48px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.comments-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.comments-title i {
  color: var(--macos-blue);
}

/* 目录侧边栏 */
.post-toc-sidebar {
  width: 240px;
  flex-shrink: 0;
  border-left: 1px solid rgba(0, 0, 0, 0.06);
  overflow-y: auto;
  padding: 20px 16px;
  background: rgba(255, 255, 255, 0.3);
}

.toc-header {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toc-content ol {
  list-style: none;
  padding-left: 0;
}

.toc-content ol ol {
  padding-left: 16px;
  margin-top: 4px;
}

.toc-content li {
  margin-bottom: 6px;
}

.toc-content a {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
  display: block;
  padding: 3px 8px;
  border-radius: 4px;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}

.toc-content a:hover,
.toc-content a.active {
  color: var(--macos-blue);
  background: rgba(0, 122, 255, 0.08);
  border-left-color: var(--macos-blue);
}

/* 代码复制按钮 */
.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #aaa;
  border-radius: 6px;
  font-size: 12px;
  opacity: 0;
  transition: all 0.2s;
}

.markdown-body figure.highlight:hover .code-copy-btn,
.markdown-body pre:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* 响应式 */
@media (max-width: 900px) {
  .post-toc-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  .post-header,
  .post-content,
  .post-tags,
  .post-reward,
  .post-comments {
    padding-left: 20px;
    padding-right: 20px;
  }

  .post-copyright {
    margin-left: 20px;
    margin-right: 20px;
  }

  .post-nav {
    flex-direction: column;
    padding: 20px;
  }

  .post-nav-item.next {
    flex-direction: row;
    text-align: left;
  }

  .post-title {
    font-size: 24px;
  }
}
