/* ============================================================
   GymCalc 文章独立样式表 article.css
   所有文章 / 关于 / 联系 / 隐私 / 条款等"文章型"页面共用。
   依赖 style.css 中的 CSS 变量与导航/页脚基础样式。
   加载顺序：style.css → article.css（本文件覆盖文章布局与阅读体验）
   ============================================================ */

/* ---------- 阅读容器 ---------- */
.article-container {
  max-width: 900px;
  margin: 0 auto;
  padding: calc(var(--nav-height) + 2.25rem) 1.5rem 3.5rem;
}

/* ---------- 面包屑 ---------- */
.article-breadcrumb {
  max-width: 800px;
  margin: 0 auto 1.25rem;
  font-size: 0.82rem;
  color: var(--text-light);
  letter-spacing: 0.01em;
}
.article-breadcrumb a { color: var(--accent); text-decoration: none; font-weight: 500; }
.article-breadcrumb a:hover { text-decoration: underline; }
.article-breadcrumb span { margin: 0 0.5rem; color: #94a3b8; font-weight: 500; }
.article-breadcrumb span:last-child { color: var(--text); font-weight: 600; }

/* ---------- 文章标题区 ---------- */
.article-header {
  max-width: 800px;
  margin: 0 auto 1.75rem;
  padding: 0 0 1.5rem;
  border-bottom: 2px solid var(--border);
}
.article-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.35;
  letter-spacing: -0.02em;
  margin-bottom: 0.9rem;
}
.article-meta {
  font-size: 0.85rem;
  color: var(--text-light);
  display: inline;
}

/* ---------- 作者署名（与发布时间同行） ---------- */
.article-author-line {
  font-size: 0.85rem;
  color: var(--text-light);
  display: inline;
  margin-left: 0.9rem;
}
.article-author-line::before {
  content: "·";
  margin-right: 0.5rem;
  color: var(--text-light);
}
.article-author-line a { color: var(--accent); font-weight: 600; text-decoration: none; }
.article-author-line a:hover { text-decoration: underline; }

/* ---------- 导语 ---------- */
.article-lead {
  max-width: 800px;
  margin: 0 auto 2rem;
  font-size: 1.08rem;
  color: var(--text-light);
  line-height: 1.9;
  padding: 1.4rem 1.5rem;
  background: #eff6ff;
  border-radius: var(--radius);
}
.article-lead strong { color: var(--text); }

/* ---------- 目录 ---------- */
.toc {
  max-width: 800px;
  margin: 0 auto 2rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}
.toc h3 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 0.8rem;
  letter-spacing: 0.05em;
}
.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 2;
  column-gap: 2.2rem;
}
.toc li { margin-bottom: 0.3rem; break-inside: avoid; }
.toc a {
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.3rem 0;
  transition: color 0.2s;
}
.toc a::before { content: "→"; color: var(--accent); opacity: 0.65; font-size: 0.8rem; flex-shrink: 0; }
.toc a:hover { color: var(--accent); }

/* ---------- 正文 ---------- */
.article-content {
  max-width: 800px;
  margin: 0 auto;
}
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}
.article-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.4rem;
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  color: var(--text-light);
  line-height: 1.75;
}
.article-content blockquote p { margin-bottom: 0; }

.article-content h2,
.article-content h3,
.article-content h4,
.article-lead { scroll-margin-top: calc(var(--nav-height) + 1rem); }

.article-content h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin: 2.75rem 0 1.1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.015em;
  line-height: 1.4;
}
.article-content h2:first-child { margin-top: 0; }
.article-content h3 {
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--primary);
  margin: 2rem 0 0.85rem;
  line-height: 1.45;
}
.article-content h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  margin: 1.5rem 0 0.6rem;
}
.article-content p {
  font-size: 1.02rem;
  line-height: 1.9;
  color: var(--text);
  margin-bottom: 1.15rem;
}
.article-content p strong { color: var(--primary); font-weight: 600; }

.article-content ul,
.article-content ol {
  margin: 1.1rem 0 1.4rem;
  padding-left: 1.6rem;
}
.article-content li {
  margin-bottom: 0.7rem;
  line-height: 1.85;
  color: var(--text);
}
.article-content li::marker { color: var(--accent); font-weight: 700; }

.article-content a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid rgba(59, 130, 246, 0.35);
  transition: border-color 0.2s, color 0.2s;
}
.article-content a:hover { border-bottom-color: var(--accent); }

/* ---------- 表格 ---------- */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.article-content th,
.article-content td {
  border: 1px solid var(--border);
  padding: 0.8rem 1rem;
  text-align: left;
  line-height: 1.6;
}
.article-content th {
  background: #eff6ff;
  font-weight: 700;
  color: var(--primary);
  font-size: 0.9rem;
}
.article-content td { color: var(--text); }
.article-content tr:nth-child(even) { background: #f8fafc; }

/* ---------- 提示 / 警告 / 公式 / 高亮 ---------- */
.tip-box {
  background: #eff6ff;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.tip-box div { font-size: 0.95rem; color: var(--text-light); line-height: 1.75; }
.tip-box p { font-size: 0.95rem; color: var(--text-light); line-height: 1.75; }
.tip-box div strong { color: var(--text); }

.warning-box {
  background: #fef3c7;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.warning-box div { font-size: 0.95rem; color: var(--text); line-height: 1.75; }
.warning-box p { font-size: 0.95rem; color: var(--text-light); line-height: 1.75; }

.formula-box {
  margin: 1.25rem 0;
}
.formula-box p { margin-bottom: 0.5rem; }
.formula-box p:last-child { margin-bottom: 0; }
.formula-box code {
  display: block;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  line-height: 1.75;
  margin: 0.4rem 0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.highlight-box {
  background: #eef2ff;
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.3rem;
  margin: 1.5rem 0;
}
.highlight-box p { margin-bottom: 0.5rem; }
.highlight-box p:last-child { margin-bottom: 0; }
.highlight-box ul { margin: 0.5rem 0 0; padding-left: 1.4rem; }

/* ---------- 文内 FAQ ---------- */
.faq-inline details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 0 0 0.75rem;
  background: var(--card-bg);
  overflow: hidden;
}
.faq-inline summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--primary);
  padding: 0.9rem 1.1rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: background 0.2s;
}
.faq-inline summary::-webkit-details-marker { display: none; }
.faq-inline summary::after {
  content: "▾";
  color: var(--accent);
  font-size: 0.85rem;
  transition: transform 0.25s;
  flex-shrink: 0;
}
.faq-inline details[open] summary::after { transform: rotate(180deg); }
.faq-inline summary:hover { background: #f8fafc; }
.faq-inline .faq-answer {
  padding: 0 1.1rem 1rem;
  font-size: 0.95rem;
  color: var(--text-light);
  line-height: 1.75;
}
.faq-inline .faq-answer p:last-child { margin-bottom: 0; }

/* ---------- 原创图表 ---------- */
.article-chart {
  margin: 2rem auto;
  max-width: 720px;
  text-align: center;
}
.article-chart img {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.article-chart figcaption {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.6rem;
  line-height: 1.75;
  text-align: left;
}

/* ---------- 参考资料 ---------- */
.references-section { margin-top: 1.5rem; }
.references-section h3 { margin-top: 0; }
.references-section ol,
.article-content h3 + ol,
.article-container > h3 + ol {
  margin: 0.5rem 0 0;
  padding-left: 1.5rem;
  font-size: 0.88rem;
  color: var(--text-light);
  line-height: 1.75;
}
.references-section li,
.article-content h3 + ol li,
.article-container > h3 + ol li { margin-bottom: 0.5rem; }

/* ---------- 兜底：正文容器外的孤儿块与正文同宽 ---------- */
.article-container > h3,
.article-container > ol {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .article-container { padding: calc(var(--nav-height) + 1.25rem) 1rem 2.5rem; }
  .article-header h1 { font-size: 1.5rem; }
  .article-content h2 { font-size: 1.28rem; }
  .article-content h3 { font-size: 1.1rem; }
  .article-content p { font-size: 1rem; line-height: 1.85; }
  .article-lead { padding: 1.1rem 1.15rem; font-size: 1.02rem; }
  .toc ul { columns: 1; }
  .article-content table { font-size: 0.85rem; }
  .article-content th,
  .article-content td { padding: 0.55rem 0.7rem; }
  .formula-box code { font-size: 0.85rem; }
}
