/* ============ 内容页样式（含用户提供 HTML 的教程风格） ============ */

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  align-items: start;
  margin: 14px 0 30px;
}
@media (max-width: 1024px) {
  .article-layout { grid-template-columns: 1fr; }
  .toc-side { display: none; }
}

.article-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 32px 40px;
}
@media (max-width: 700px) {
  .article-card { padding: 20px 18px; border-radius: 0; }
}

/* 标题区 */
#articleHead h1 {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 16px;
}
@media (max-width: 700px) { #articleHead h1 { font-size: 21px; } }

.art-meta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-3);
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.art-meta .cat-badge {
  background: var(--pink); color: #fff;
  padding: 2px 10px; border-radius: 4px; font-size: 12px;
}
.art-meta .author-link { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 600; }
.art-meta .author-link:hover { color: var(--primary); }
.art-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: #c8ccd1; }
.art-status {
  background: #fff3cd; color: #8a5a00;
  font-size: 12px; padding: 2px 10px; border-radius: 4px;
}
.art-status.rejected { background: #fdecea; color: #c0392b; }

/* ============ 正文 Markdown 样式（参考用户教程 HTML） ============ */
.art-content {
  font-size: 16px;
  line-height: 1.8;
  color: #212529;
  margin-top: 24px;
  word-break: break-word;
}
.art-content > *:first-child { margin-top: 0; }

.art-content h1 {
  font-size: 24px; margin: 36px 0 16px;
  border-bottom: 3px solid #0d6efd; padding-bottom: 10px; font-weight: 700;
}
.art-content h2 {
  font-size: 21px; margin: 40px 0 16px;
  color: #343a40;
  border-left: 5px solid #0d6efd; padding-left: 14px; font-weight: 600;
  scroll-margin-top: 90px;
}
.art-content h3 {
  font-size: 18px; margin: 28px 0 12px; color: #495057; font-weight: 600;
  scroll-margin-top: 90px;
}
.art-content h4 { font-size: 16px; margin: 20px 0 10px; font-weight: 600; color: #0d6efd; }
.art-content p { margin-bottom: 14px; }
.art-content a { color: #0d6efd; text-decoration: none; font-weight: 500; }
.art-content a:hover { text-decoration: underline; }
.art-content ul, .art-content ol { margin: 0 0 16px 24px; }
.art-content li { margin-bottom: 6px; }
.art-content li::marker { color: var(--primary); }
.art-content strong { font-weight: 700; }
.art-content img { border-radius: 10px; margin: 12px 0; }
.art-content hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
.art-content table {
  border-collapse: collapse; width: 100%; margin: 16px 0;
  font-size: 14px;
}
.art-content th, .art-content td {
  border: 1px solid var(--border); padding: 9px 12px; text-align: left;
}
.art-content th { background: #f6f8fa; font-weight: 600; }
.art-content tr:nth-child(even) td { background: #fafbfc; }
.art-content blockquote {
  border-left: 4px solid var(--border); padding: 4px 16px;
  color: var(--text-2); margin: 16px 0;
}

/* 提示框 */
.art-content .md-box {
  border-left: 5px solid;
  border-radius: 4px;
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 15px;
}
.art-content .md-box-title {
  font-weight: 700; font-size: 15px;
  margin-bottom: 8px;
}
.art-content .md-box > *:last-child { margin-bottom: 0; }
.art-content .md-box.highlight { background: #e7f1ff; border-left-color: #0d6efd; }
.art-content .md-box.info { background: #e8f6fd; border-left-color: #00aeec; }
.art-content .md-box.warning { background: #fff3cd; border-left-color: #ffc107; color: #664d03; }
.art-content .md-box.success { background: #d1e7dd; border-left-color: #198754; color: #0f5132; }
.art-content .md-box.danger { background: #fdecea; border-left-color: #dc3545; color: #842029; }
.art-content .md-box.note { background: #f6f8fa; border-left-color: #6c757d; }

/* 代码块 */
.code-wrap {
  position: relative;
  margin: 16px 0 24px;
  background: #212529;
  border-radius: 8px;
  overflow: hidden;
}
.code-wrap pre {
  margin: 0;
  padding: 16px 16px 14px;
  overflow-x: auto;
  color: #f8f9fa;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
  background: transparent;
}
.code-wrap .copy-btn {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(255,255,255,.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 4px;
  padding: 3px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.code-wrap .copy-btn:hover { background: rgba(255,255,255,.25); }
.code-wrap .copy-btn.copied { background: #198754; border-color: #198754; }
.code-wrap code { font-family: inherit; background: transparent; }
.hljs { background: transparent !important; padding: 0 !important; }

.art-content code {
  background: rgba(33, 37, 41, .08);
  color: #d63384;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 14px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}
.art-content pre code { color: #f8f9fa; background: transparent; padding: 0; }

/* 标签 */
.art-tags { margin: 28px 0 0; }
.art-tags .tag { font-size: 13px; padding: 4px 12px; }

/* 互动按钮 */
.art-actions {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin: 24px 0;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.act-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 14px;
  transition: all .15s;
}
.act-btn .ic { font-size: 16px; }
.act-btn:hover { border-color: var(--pink); color: var(--pink); }
.act-btn.active { background: var(--pink); border-color: var(--pink); color: #fff; }
.act-btn.active .ic { animation: pop .3s; }
@keyframes pop { 50% { transform: scale(1.35); } }

/* 作者卡片 */
.author-card {
  display: flex; align-items: center; gap: 14px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 24px 0;
}
.author-card .ac-info { flex: 1; min-width: 0; }
.author-card .ac-name { font-weight: 700; font-size: 15px; }
.author-card .ac-role { font-size: 12px; color: var(--pink); margin-left: 6px; }
.author-card .ac-bio { font-size: 13px; color: var(--text-2); margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.author-card .ac-stats { display: flex; gap: 16px; margin-top: 6px; font-size: 12px; color: var(--text-3); }

/* 评论 */
.comment-box { margin-top: 10px; }
.comment-input textarea {
  width: 100%; height: 84px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; resize: vertical; outline: none; font-size: 14px;
  transition: border .15s;
}
.comment-input textarea:focus { border-color: var(--primary); }
.comment-input-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  margin-top: 10px;
}
.comment-input-foot .hint { margin-right: auto; color: var(--text-3); font-size: 13px; }
.c-item {
  display: flex; gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.c-item:last-child { border-bottom: none; }
.c-body { flex: 1; min-width: 0; }
.c-head { display: flex; align-items: center; gap: 8px; }
.c-name { font-weight: 600; font-size: 14px; }
.c-role { font-size: 11px; color: var(--pink); }
.c-time { font-size: 12px; color: var(--text-3); margin-left: auto; }
.c-content { margin-top: 6px; font-size: 14px; line-height: 1.7; word-break: break-word; }
.c-del { border: none; background: none; color: var(--text-3); font-size: 12px; cursor: pointer; }
.c-del:hover { color: var(--danger); }

/* 目录 */
.toc-side { position: sticky; top: calc(var(--nav-h) + 14px); }
.toc-card {
  background: #fff; border-radius: 12px; box-shadow: var(--shadow);
  padding: 18px 16px;
  max-height: 70vh; overflow-y: auto;
}
.toc-title { font-weight: 700; font-size: 15px; margin-bottom: 12px; }
.toc-list { display: flex; flex-direction: column; gap: 2px; }
.toc-list a {
  font-size: 13px; color: var(--text-2); padding: 5px 8px; border-radius: 6px;
  line-height: 1.4; border-left: 2px solid transparent;
}
.toc-list a:hover { background: var(--hover-bg); color: var(--primary); }
.toc-list a.active { color: var(--primary); border-left-color: var(--primary); background: rgba(0,174,236,.06); font-weight: 600; }
.toc-empty { color: var(--text-3); font-size: 13px; }

/* 相关推荐 */
.related-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 6px; border-radius: 8px; cursor: pointer;
}
.related-item:hover { background: var(--hover-bg); }
.related-item img {
  width: 74px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; flex-shrink: 0;
}
.related-item .r-t {
  font-size: 13px; line-height: 1.45; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.related-item .r-m { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ============ 移动端适配 ============ */
@media (max-width: 540px) {
  .article-layout { gap: 12px; margin: 8px 0 20px; }
  .art-content { font-size: 15px; line-height: 1.75; margin-top: 16px; }
  .art-content h1 { font-size: 20px; margin: 24px 0 12px; }
  .art-content h2 { font-size: 18px; margin: 28px 0 12px; padding-left: 10px; }
  .art-content h3 { font-size: 16px; margin: 20px 0 10px; }
  .art-content ul, .art-content ol { margin-left: 18px; }
  .art-content .md-box { padding: 12px 14px; margin: 16px 0; font-size: 14px; }
  .art-content .md-box-title { font-size: 14px; }
  .code-wrap { margin: 14px 0 18px; border-radius: 6px; }
  .code-wrap pre { padding: 12px; font-size: 12.5px; }
  .code-wrap .copy-btn { top: 6px; right: 6px; padding: 2px 10px; font-size: 11px; }
  .art-content code { font-size: 13px; }
  .art-actions { gap: 8px; padding: 14px 0; margin: 18px 0; }
  .act-btn { padding: 7px 14px; font-size: 13px; border-radius: 18px; }
  .author-card { padding: 12px 14px; gap: 10px; }
  .author-card .ac-bio { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .comment-input textarea { height: 72px; font-size: 13px; }
  .c-item { gap: 10px; padding: 12px 0; }
  .art-meta { gap: 10px; font-size: 12px; padding-bottom: 14px; }
  .crumb { margin: 12px 0 4px; font-size: 12px; }
}
@media (max-width: 400px) {
  .art-content { font-size: 14.5px; }
  .art-content h2 { font-size: 17px; }
  .act-btn { padding: 6px 12px; font-size: 12px; }
  .act-btn .label { display: none; }
}
