/* ============================================================
   文章正文 Markdown 渲染样式
   ------------------------------------------------------------
   配套 js/markdown-renderer.js 使用，用于 news-view.html / tech-view.html。
   保持与官网深海军蓝主题一致。
   ============================================================ */

.article-content {
  box-sizing: border-box;
  width: 100%;
  max-width: 772px;
  margin-inline: auto;
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.85;
  color: #1f2937;  /* 深色文字，适配白色卡片背景 */
  overflow-wrap: break-word;
  word-break: normal;
}

/* Shared article abstract/quote block used by editor, admin preview and public detail. */
.article-summary {
  box-sizing: border-box;
  width: 100%;
  max-width: 772px;
  margin: 0 auto 1.75rem;
  padding: 1rem 1.25rem;
  border: 0;
  border-left: 4px solid #1E6FD9;
  border-radius: 0 8px 8px 0;
  background: #F1F5F9;
  color: #475569;
  font: normal 15px/1.8 "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Helvetica Neue", Helvetica, Arial, sans-serif;
  white-space: pre-line;
}

.article-summary p {
  margin: 0;
}

/* 暗色容器内使用时套此类 */
.article-content-dark {
  color: #E2E8F0;
}
.article-content-dark h1, .article-content-dark h2,
.article-content-dark h3, .article-content-dark h4 {
  color: #F1F5F9;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
  color: #0A1626;
  margin-top: 2em;
  margin-bottom: 0.8em;
  font-weight: 600;
  line-height: 1.35;
}

.article-content h1 { font-size: 29px; border-bottom: 1px solid rgba(30, 111, 217, 0.18); padding-bottom: 0.4em; }
.article-content h2 { font-size: 24px; color: #123F70; }
.article-content h3 { font-size: 20px; color: #174F86; }
.article-content h4 { font-size: 18px; color: #0E2A47; }
.article-content h5 { font-size: 17px; }
.article-content h6 { font-size: 16px; }
.article-content.article-content-dark h1,
.article-content.article-content-dark h2,
.article-content.article-content-dark h3,
.article-content.article-content-dark h4,
.article-content.article-content-dark h5,
.article-content.article-content-dark h6 { color: #F1F5F9; }

.article-content p {
  margin: 0 0 1.2em;
}

.article-content a {
  color: #38BDF8;
  text-decoration: none;
  border-bottom: 1px solid rgba(56, 189, 248, 0.3);
  transition: border-color 0.2s, color 0.2s;
}

.article-content a:hover {
  color: #7DD3FC;
  border-bottom-color: #7DD3FC;
}

.article-content ul,
.article-content ol {
  margin: 0 0 1.2em 1.2em;
  padding-left: 1.2em;
}

.article-content li {
  margin-bottom: 0.5em;
}

.article-content ul li::marker {
  color: #38BDF8;
}

.article-content blockquote {
  margin: 1.5em 0;
  padding: 1em 1.2em;
  border-left: 4px solid #38BDF8;
  background: #F1F5F9;
  border-radius: 0 8px 8px 0;
  color: #475569;
  font-style: italic;
}

.article-content blockquote p:last-child {
  margin-bottom: 0;
}

.article-content pre {
  background: #0A1626;
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 8px;
  padding: 1em;
  overflow-x: auto;
  margin: 1.2em 0;
}

.article-content code {
  font-family: "JetBrains Mono", Consolas, Monaco, monospace;
  font-size: 0.9em;
  background: rgba(10, 22, 38, 0.6);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: #38BDF8;
}

.article-content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.article-content table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 15px;
}

.article-content .article-table-scroll,
.article-content .cherry-table-container,
.article-content figure {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 1.5em 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.article-content .article-table-scroll table,
.article-content .cherry-table-container table,
.article-content figure table {
  width: max-content;
  min-width: 100%;
  margin: 0;
}

.article-content th,
.article-content td {
  border: 1px solid #D7E1EC;
  padding: 0.75em 1em;
  text-align: left;
}

.article-content th {
  background: #EDF5FF;
  color: #123F70;
  font-weight: 600;
}

.article-content tr:nth-child(even) {
  background: #F8FAFC;
}

.article-content img {
  display: block;
  width: auto !important;
  max-width: 100% !important;
  max-inline-size: 100% !important;
  height: auto !important;
  object-fit: contain;
  border-radius: 8px;
  margin: 0.75rem auto;
}

.article-content p:empty { display: none; }
.article-content p:has(> img:only-child) { margin: 0 0 0.75rem; line-height: 0; overflow: visible; }
.article-content p:has(> img:only-child) > img { margin: 0 auto; }
.article-content p:has(> img:only-child) + p:has(> img:only-child) { margin-top: -0.25rem; }

.article-content hr {
  border: none;
  border-top: 1px solid rgba(56, 189, 248, 0.2);
  margin: 2em 0;
}

/* Mermaid 图表容器 */
.article-content .mermaid {
  background: #0A1626;
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 8px;
  padding: 1em;
  margin: 1.5em 0;
  text-align: center;
  overflow-x: auto;
}

/* KaTeX 公式 */
.article-content .katex {
  font-size: 1.05em;
  color: #0A1626;
}

.article-content .katex-display {
  margin: 1.5em 0;
  overflow-x: auto;
}

/* 代码高亮主题微调：让 github-dark 更融入 */
.article-content .hljs {
  background: transparent;
  padding: 0;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .article-content {
    font-size: 16px;
  }
  .article-content h1 { font-size: 24px; }
  .article-content h2 { font-size: 21px; }
  .article-content h3 { font-size: 19px; }
}
