/* ============================================================
 * article.css — 文章详情页（新版暖色主题）
 * 全局变量 / 顶栏 / 页脚 / 模态框由 theme.css 提供，
 * 本文件只负责详情页正文、面包屑、标签、推荐与评论容器的样式。
 * ============================================================ */

/* ---------- 正文卡片容器 ---------- */
.article-container {
  max-width: 820px;
  margin: 28px auto 32px;
  padding: 36px 40px;
  background: var(--surface, #fff);
  border: 1px solid var(--border-light, #f0e7de);
  border-radius: 18px;
  box-shadow: 0 2px 16px rgba(160, 96, 42, 0.06);
  position: relative;
  z-index: 1;
  color: var(--ink-primary, #2c2520);
  box-sizing: border-box;
}

.article-container img {
  max-width: 100%;
  height: auto;
}

/* 三栏布局适配：详情页已嵌入 layout-container 中栏，卡片占满中栏宽度，避免二次居中 */
.layout-container .article-container {
  width: 100%;
  max-width: none;
  margin: 0;
}

/* 超宽屏（2K/4K/8K）：中栏被拉得很宽，正文限宽居中保证可读性（侧栏仍贴两侧） */
@media (min-width: 2000px) {
  .layout-container .article-container {
    max-width: 1080px;
    margin: 0 auto;
  }
}

/* ---------- 面包屑 ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.85rem;
  line-height: 1.5;
  padding: 0 0 0.9rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--border-light, #f0e7de);
  color: var(--ink-tertiary, #8d8074);
}

.breadcrumb a {
  color: var(--ink-secondary, #6b6057);
  text-decoration: none;
  transition: color 0.2s ease;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.breadcrumb a:hover {
  color: var(--accent, #c2410c);
  background: rgba(194, 65, 12, 0.06);
}

.breadcrumb-separator {
  margin: 0 0.4rem;
  color: var(--ink-quaternary, #b7aa9c);
  font-weight: 300;
}

.breadcrumb-current {
  color: var(--ink-primary, #2c2520);
  font-weight: 600;
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 标题与正文排版 ---------- */
.article-container h1 {
  margin: 0.4rem 0 1.6rem;
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink-primary, #2c2520);
  letter-spacing: -0.4px;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light, #f0e7de);
}

.article-content {
  line-height: 1.85;
  font-size: 15.5px;
  color: var(--ink-primary, #2c2520);
  word-break: break-word;
}

.article-content a {
  color: var(--accent, #c2410c);
  text-decoration: none;
  border-bottom: 1px solid rgba(194, 65, 12, 0.25);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.article-content a:hover {
  color: #9a3412;
  border-color: rgba(154, 52, 18, 0.5);
}

/* 行内代码样式。必须排除 pre 内的 code：code 是 inline 元素，
   若代码块内的 code 也命中本规则，Prism token 化后背景会按行盒逐行
   绘制成一条条断开的浅红条纹（2026-10-03 修复） */
.article-content :not(pre) > code {
  background: rgba(194, 65, 12, 0.07);
  border: 1px solid rgba(194, 65, 12, 0.12);
  border-radius: 6px;
  color: #9a3412;
  font-family: 'Consolas', 'Monaco', monospace;
  padding: 0.15rem 0.4rem;
  font-size: 0.9em;
}

.article-content pre {
  margin: 1em 0;
  border-radius: 12px;
}

.article-content blockquote {
  border-left: 4px solid var(--accent, #c2410c);
  background: rgba(194, 65, 12, 0.05);
  color: var(--ink-secondary, #6b6057);
  padding: 0.9rem 1.4rem;
  margin: 1.4rem 0;
  border-radius: 6px;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 14px;
}

.article-content table th,
.article-content table td {
  border: 1px solid var(--border-light, #f0e7de);
  padding: 8px 12px;
  text-align: left;
}

.article-content table th {
  background: rgba(194, 65, 12, 0.05);
  font-weight: 700;
}

/* ---------- 文章页脚（作者 / 时间 / 标签 / 分享） ---------- */
.article-footer {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border-light, #f0e7de);
}

.article-footer .meta-info {
  margin-bottom: 1rem;
  color: var(--ink-tertiary, #8d8074);
  font-size: 0.9rem;
}

.article-footer .meta-text p {
  margin: 0.3rem 0;
}

.article-footer .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.article-footer .tags span {
  background: rgba(194, 65, 12, 0.07);
  border: 1px solid rgba(194, 65, 12, 0.15);
  color: var(--accent, #c2410c);
  padding: 0.28rem 0.8rem;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.2s ease, border-color 0.2s ease;
  display: inline-block;
}

.article-footer .tags span:hover {
  background: rgba(194, 65, 12, 0.12);
  border-color: rgba(194, 65, 12, 0.3);
}

/* ---------- 点赞数动画 ---------- */
.like-count {
  display: inline-block;
  font-size: 16px;
  color: var(--ink-tertiary, #8d8074);
  transition: all 0.3s ease;
}

.like-updated {
  animation: likeUpdated 1s ease;
  color: #c2410c;
}

@keyframes likeUpdated {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ---------- 相关推荐 ---------- */
.related-section {
  margin-top: 2.4rem;
}

.related-section h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink-primary, #2c2520);
  letter-spacing: -0.3px;
  border-bottom: 1px solid var(--border-light, #f0e7de);
  padding-bottom: 0.7rem;
  margin-bottom: 1.2rem;
}

.recommended-articles {
  display: flex;
  overflow-x: auto;
  padding: 4px;
  gap: 12px;
  scrollbar-width: thin;
}

.recommended-articles .article {
  flex: 0 0 auto;
  width: 220px;
  text-align: left;
  background: var(--surface, #fff);
  border: 1px solid var(--border-light, #f0e7de);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.recommended-articles .article:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(160, 96, 42, 0.12);
}

.recommended-articles img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 0;
  transition: transform 0.25s ease;
}

.recommended-articles .article:hover img {
  transform: scale(1.04);
}

.recommended-articles .article-info {
  margin: 0;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.5;
}

.recommended-articles a {
  color: var(--ink-primary, #2c2520);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.recommended-articles a:hover {
  color: var(--accent, #c2410c);
}

.no-recommendations {
  color: var(--ink-tertiary, #8d8074);
  font-size: 13.5px;
}

/* ---------- 评论区容器 ---------- */
.comments-section {
  margin-top: 2.4rem;
}

.comments-section h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink-primary, #2c2520);
  letter-spacing: -0.3px;
  border-bottom: 1px solid var(--border-light, #f0e7de);
  padding-bottom: 0.7rem;
  margin-bottom: 1.2rem;
}

.comments-section form {
  margin-bottom: 1.4rem;
}

.comments-section textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  box-sizing: border-box;
  border: 1px solid var(--border-light, #f0e7de);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink-primary, #2c2520);
  background: var(--surface-sunken, #faf6f1);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.comments-section textarea:focus {
  border-color: var(--accent, #c2410c);
  box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.1);
}

/* ---------- 代码块（正文） ---------- */
/* 裸 pre 是 SSR 直出 / JS 未执行时的兜底形态，保持完整圆角；
   JS 增强后（enhanceCodeBlocks 包裹成 .code-block 窗口）由 .code-block pre 收掉上圆角 */
pre {
  background-color: #2d2a26;
  border-radius: 12px;
  padding: 1em;
  overflow-x: auto;
  margin: 1em 0;
  border: 1px solid rgba(232, 226, 217, 0.08);
}

pre code {
  color: #e8e2d9;
  font-family: "Consolas", "Monaco", "Andale Mono", "Ubuntu Mono", monospace;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  background: transparent;
  border: none;
  padding: 0;
}

/* 编辑器窗口：mac 圆点工具栏 + 语言标签 + 复制按钮（结构由 article.js 生成） */
.code-block {
  margin: 1.2em 0;
  border-radius: 12px;
  overflow: hidden;
  background: #2d2a26;
  border: 1px solid rgba(232, 226, 217, 0.08);
  box-shadow: 0 4px 18px rgba(44, 37, 32, 0.14);
}

.code-block pre {
  margin: 0;
  border-radius: 0;
  border: none;
}

.code-block-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(232, 226, 217, 0.08);
}

.code-dots {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}

.code-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.code-dots i:nth-child(1) { background: #ff5f57; }
.code-dots i:nth-child(2) { background: #febc2e; }
.code-dots i:nth-child(3) { background: #28c840; }

.code-lang {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #9a8f80;
}

.code-copy {
  flex-shrink: 0;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.4;
  color: #b7aa9c;
  background: transparent;
  border: 1px solid rgba(232, 226, 217, 0.16);
  border-radius: 6px;
  padding: 2px 10px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.code-copy:hover {
  color: #e8e2d9;
  border-color: rgba(232, 226, 217, 0.35);
  background: rgba(255, 255, 255, 0.05);
}

.code-copy.copied {
  color: #b5c98e;
  border-color: rgba(181, 201, 142, 0.45);
}

/* Prism.js 语法高亮（暖色系） */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata { color: #9a8f80; }

.token.punctuation { color: #b7aa9c; }

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted { color: #e88b6a; }

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted { color: #b5c98e; }

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string { color: #d9a76a; }

.token.atrule,
.token.attr-value,
.token.keyword { color: #e8927c; }

.token.function,
.token.class-name { color: #f0b26a; }

.token.regex,
.token.important,
.token.variable { color: #e88b6a; }

.code-tag {
  color: #e88b6a;
  font-family: "Consolas", "Monaco", "Andale Mono", "Ubuntu Mono", monospace;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .article-container {
    padding: 20px 16px;
    margin: 16px 12px 24px;
    border-radius: 14px;
  }

  .article-container h1 {
    font-size: 1.4rem;
  }

  .breadcrumb {
    font-size: 0.8rem;
  }

  .breadcrumb-current {
    max-width: 150px;
  }
}

@media (min-width: 1600px) {
  .article-container {
    max-width: 900px;
    padding: 44px 52px;
  }

  .breadcrumb-current {
    max-width: 600px;
  }
}

/* ============================================================
 * 悬浮互动栏（crdt.html demo 移植）+ 文章页脚行式 meta
 * 类名一律 fb- / pm- 前缀，避免与 action-buttons.css / comments.css 冲突；
 * 颜色全走 theme.css 的 CSS 变量，深浅色模式自动适配。
 * ============================================================ */

/* ---------- 悬浮互动栏 ---------- */
.float-barzone{position:fixed;left:0;right:0;bottom:0;display:flex;justify-content:center;
  padding:0 16px calc(18px + env(safe-area-inset-bottom,0px));pointer-events:none;z-index:40;
  transition:transform .46s cubic-bezier(.34,1.56,.64,1),opacity .3s ease;}
.float-barzone.hide{transform:translateY(140%);opacity:0;
  transition:transform .32s cubic-bezier(.4,0,1,1),opacity .26s ease;}

.fb-bar{pointer-events:auto;position:relative;display:flex;align-items:center;justify-content:center;gap:2px;
  background:var(--surface,#fff);border:1px solid var(--border-light,#f0e7de);border-radius:999px;padding:6px;
  box-shadow:0 8px 28px rgba(44,37,32,.16);cursor:default;}

.fb-btn{position:relative;display:flex;align-items:center;gap:7px;background:none;border:none;cursor:pointer;
  padding:9px 14px;border-radius:999px;font-family:inherit;font-size:13.5px;color:var(--ink-secondary,#6b6057);
  font-weight:500;transition:background .15s,color .2s,padding .28s cubic-bezier(.32,.72,0,1);white-space:nowrap;}
.fb-btn:hover{background:var(--surface-sunken,#faf6f1);}
.fb-btn svg{width:19px;height:19px;flex:none;}
.fb-btn .label{display:inline-block;max-width:120px;overflow:hidden;white-space:nowrap;
  transition:max-width .25s ease,opacity .25s ease;}
.fb-sep{width:1px;height:22px;background:var(--border-light,#f0e7de);margin:0 3px;flex:none;}

.fb-extra{display:flex;align-items:center;max-width:340px;overflow:hidden;
  transition:max-width .32s cubic-bezier(.32,.72,0,1),opacity .22s ease;opacity:1;}
.fb-bar.compact .fb-extra{max-width:0;opacity:0;}
.fb-bar.compact .fb-like-btn{padding:9px;}
.fb-bar.compact .fb-like-btn .label{max-width:0;opacity:0;}

/* 心形点赞（单向不可取消：liked 后锁定，服务端 ALREADY_LIKED 兜底） */
.fb-heart-wrap{position:relative;width:19px;height:19px;display:inline-block;}
.fb-heart-wrap svg{position:absolute;top:0;left:0;width:19px;height:19px;}
.fb-heart-fill{opacity:0;transform:scale(0);transition:transform .32s cubic-bezier(.34,1.56,.64,1),opacity .15s;}
.fb-like-btn.liked{color:#d64545;}
.fb-like-btn.liked .fb-heart-fill{opacity:1;transform:scale(1);}
.fb-like-btn.liked .fb-heart-outline{opacity:0;}
.fb-like-btn.loading .fb-heart-wrap{opacity:.45;}

/* 「更多」菜单（向上弹出） */
.fb-more-wrap{position:relative;flex:none;max-width:60px;overflow:visible;
  transition:max-width .32s cubic-bezier(.32,.72,0,1),opacity .22s ease;}
.fb-bar.compact .fb-more-wrap{max-width:0;opacity:0;overflow:hidden;pointer-events:none;}
.fb-menu{position:absolute;bottom:52px;right:0;z-index:70;background:var(--surface,#fff);border:1px solid var(--border-light,#f0e7de);
  border-radius:10px;min-width:150px;box-shadow:0 10px 30px rgba(44,37,32,.16);padding:6px;display:none;}
.fb-menu.open{display:block;}
.fb-menu button{width:100%;text-align:left;background:none;border:none;padding:10px 12px;border-radius:6px;
  font-family:inherit;font-size:13.5px;color:var(--ink-primary,#2c2520);cursor:pointer;white-space:nowrap;}
.fb-menu button:hover{background:var(--surface-sunken,#faf6f1);}
.fb-menu button.danger{color:#c0392b;}

/* ---------- 文章页脚 meta：行式布局 ---------- */
.article-footer .meta-text .pm-row{display:flex;gap:16px;padding:6px 0;font-size:13.5px;align-items:baseline;flex-wrap:wrap;}
.article-footer .meta-text .pm-label{width:60px;flex:none;color:var(--ink-tertiary,#8d8074);
  font-family:'Consolas','Monaco',monospace;font-size:11.5px;}
.article-footer .meta-text .pm-value{color:var(--ink-primary,#2c2520);min-width:0;}
.article-footer .meta-text .pm-row a{color:var(--accent,#c2410c);text-decoration:none;}
.article-footer .meta-text .pm-row a:hover{text-decoration:underline;}
.article-footer .meta-text .pm-row .tags{margin-top:0;}
