/* === Reading Progress Bar === */
.reading-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: #004e98;
  width: 0%;
  z-index: 999;
  transition: width 0.1s linear;
}

/* === Share Buttons === */
.share-bar {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  flex-wrap: wrap;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  color: var(--text);
}
.share-btn:hover { border-color: #004e98; color: #004e98; }
.share-btn-fb { color: #1877f2; }
.share-btn-fb:hover { background: #1877f20d; border-color: #1877f2; }
.share-btn-x { color: #000; }
.share-btn-line { color: #06c755; }
.share-btn-line:hover { background: #06c7550d; border-color: #06c755; }
.share-btn-copy:hover { background: #004e980d; }

/* === Related Articles (延伸閱讀) === */
.related-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.related-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.related-card {
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.15s;
  text-decoration: none;
  color: inherit;
}
.related-card:hover { border-color: #004e98; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.related-card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: #f0f0f0;
  overflow: hidden;
}
.related-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-card-body { padding: 10px; }
.related-card-title { font-size: 13px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.related-card-sub { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

@media (max-width: 640px) {
  .related-grid { grid-template-columns: 1fr; }
}

/* === Article Page — CNA 中央社文字風格 === */

.article-page {
  display: flex;
  gap: 24px;
  max-width: 1200px;
  margin: calc(var(--header-h) + 20px) auto 0;
  padding: 20px 24px;
}

/* === Left: Article === */
.article-main {
  flex: 1;
  min-width: 0;
}

/* Hero image */
.art-hero-img {
  width: 100%;
  overflow: hidden;
  margin-bottom: 16px;
  border-radius: 2px;
}
.art-hero-img img { width: 100%; height: auto; display: block; }

/* Category */
.art-category {
  display: inline-block;
  background: #004e98;
  color: white;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 2px;
  font-weight: 600;
  margin-bottom: 10px;
}

/* Title: CNA style */
.art-title {
  font-family: "Microsoft JhengHei", "SF Pro TC", "PingFang TC", "Noto Sans TC", sans-serif;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.35;
  color: #004e98;
  margin-bottom: 10px;
}

/* Meta bar */
.art-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.art-author { display: flex; align-items: center; gap: 10px; }
.art-author-avatar {
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.art-author-avatar img { width: 100%; height: 100%; }
.art-author-info { display: flex; flex-direction: column; }
.art-author-name { font-weight: 600; font-size: 14px; color: var(--text); }
.art-author-sub { font-size: 12px; color: #004e98; }

.art-stats { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-secondary); }
.art-stat-item { display: flex; align-items: center; gap: 3px; color: #004e98; }

.art-source-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: #e8f0fe; color: #004e98;
  padding: 6px 14px; border-radius: 4px;
  font-size: 13px; font-weight: 600; transition: background 0.15s;
}
.art-source-btn:hover { background: #d0e2fc; }
.art-source-btn img { width: 16px; height: 16px; }

/* Summary */
.art-summary {
  background: #f8f9fa;
  border-left: 3px solid #004e98;
  padding: 10px 16px;
  border-radius: 0;
  font-size: 14px;
  line-height: 1.7;
  color: #454545;
  margin-bottom: 20px;
}
.art-summary-label { font-weight: 600; color: #232323; margin-bottom: 2px; }

/* === Article Body — CNA typography === */
.art-body {
  font-family: "Microsoft JhengHei", "SF Pro TC", "PingFang TC", "Noto Sans TC", sans-serif;
  font-size: 18px;
  line-height: 1.8;
  letter-spacing: 0.5px;
  color: #232323;
}

.art-body h1 { font-size: 26px; font-weight: 600; color: #004e98; margin: 28px 0 10px; }
.art-body h2 { font-size: 20px; font-weight: 600; color: #232323; margin: 24px 0 8px; padding: 0; border: none; }
.art-body h3 { font-size: 18px; font-weight: 600; color: #232323; margin: 18px 0 6px; }
.art-body p { margin-bottom: 20px; }
.art-body blockquote {
  border-left: 3px solid #004e98;
  padding: 8px 16px;
  margin: 16px 0;
  background: #f8f9fa;
  border-radius: 0;
  font-style: normal;
  color: #232323;
}
.art-body strong { color: #232323; }
.art-body code { background: #f0f0f0; padding: 1px 5px; border-radius: 2px; font-size: 14px; color: #004e98; }
.art-body ul, .art-body ol { padding-left: 24px; margin-bottom: 16px; }
.art-body li { margin-bottom: 6px; line-height: 1.7; }
.art-body hr { border: none; border-top: 1px solid #ddd; margin: 24px 0; }
.art-body a { color: #232323; text-decoration: underline; }
.art-body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.art-body th { background: #f0f4ff; padding: 8px 12px; text-align: left; font-weight: 600; border: 1px solid #e0e0e0; }
.art-body td { padding: 8px 12px; border: 1px solid #e0e0e0; }
.art-body tr:nth-child(even) td { background: #fafafa; }

/* Tags */
.art-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.tag { background: #e8f0fe; padding: 3px 10px; border-radius: 2px; font-size: 12px; color: #004e98; font-weight: 500; }

/* Source card */
.art-source-card {
  margin-top: 20px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: #f8f9fa;
  display: flex; align-items: center; gap: 14px; font-size: 13px; color: #454545;
}
.art-source-card img { width: 36px; height: 36px; }
.art-source-info { flex: 1; }
.art-source-info p { margin-bottom: 2px; }
.art-source-info a { color: #004e98; font-weight: 600; }

/* === Right Sidebar === */
.article-sidebar {
  width: 340px;
  min-width: 300px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-h) + 20px);
  max-height: calc(100vh - var(--header-h) - 40px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}

.sidebar-rec-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--text); }

.rec-card {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  border-radius: 4px;
  padding: 4px;
  transition: background 0.12s;
  text-decoration: none;
  color: inherit;
}
.rec-card:hover { background: var(--bg-hover); }

.rec-thumb {
  width: 168px; height: 94px;
  border-radius: 4px;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  background: #f0f0f0;
}
.rec-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rec-thumb-emoji { font-size: 28px; opacity: 0.3; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); }
.rec-thumb-title { position: absolute; bottom: 0; left: 0; right: 0; padding: 4px 6px; background: linear-gradient(transparent,rgba(0,0,0,0.5)); font-size: 10px; color: white; font-weight: 600; line-height: 1.2; }
.rec-thumb-badge { position: absolute; bottom: 3px; right: 3px; background: rgba(0,0,0,0.8); color: white; font-size: 10px; padding: 1px 4px; border-radius: 2px; }

.rec-meta { flex: 1; min-width: 0; }
.rec-title { font-size: 13px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 3px; }
.rec-sub { font-size: 11px; color: var(--text-secondary); line-height: 1.4; }
.rec-sub span + span::before { content: ' · '; }

/* === Comments === */
.comments-section { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.comments-header { display: flex; align-items: center; gap: 20px; margin-bottom: 16px; }
.comments-count { font-size: 15px; font-weight: 600; }
.comments-sort { font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.comment-input-area { display: flex; gap: 10px; margin-bottom: 20px; }
.comment-input-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-chip); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 16px; overflow: hidden; }
.comment-input-avatar img { width: 100%; height: 100%; }
.comment-input-field { flex: 1; }
.comment-input-field input { border: none; border-bottom: 1px solid var(--border); padding: 6px 0; font-size: 14px; outline: none; background: transparent; width: 100%; }
.comment-input-field input:focus { border-bottom-color: #004e98; }
.comment-input-actions { display: none; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.comment-input-field:focus-within .comment-input-actions { display: flex; }
.comment-btn-cancel { padding: 6px 14px; border: none; border-radius: 16px; font-size: 13px; cursor: pointer; background: transparent; }
.comment-btn-submit { padding: 6px 14px; border: none; border-radius: 16px; font-size: 13px; cursor: pointer; background: var(--bg-chip); color: var(--text-secondary); }
.comment-btn-submit.active { background: #004e98; color: white; }
.comment-item { display: flex; gap: 10px; margin-bottom: 12px; }
.comment-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-chip); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--text-secondary); overflow: hidden; }
.comment-avatar img { width: 100%; height: 100%; }
.comment-body { flex: 1; }
.comment-author { font-size: 13px; font-weight: 600; margin-bottom: 1px; }
.comment-author span { font-weight: 400; color: var(--text-secondary); margin-left: 4px; }
.comment-text { font-size: 14px; line-height: 1.5; margin-bottom: 4px; }
.comment-actions { display: flex; gap: 10px; }
.comment-action-btn { background: none; border: none; cursor: pointer; font-size: 12px; color: var(--text-secondary); }

/* === Responsive === */
@media (max-width: 1100px) {
  .article-sidebar { width: 280px; min-width: 250px; }
  .rec-thumb { width: 130px; height: 73px; }
}
@media (max-width: 900px) {
  .article-page { flex-direction: column; padding: 16px; }
  .article-sidebar { width: 100%; min-width: auto; position: static; max-height: none; }
  .rec-card { max-width: 100%; }
}
@media (max-width: 640px) {
  .art-title { font-size: 24px; }
  .art-body { font-size: 16px; }
  .art-meta-bar { flex-direction: column; align-items: flex-start; }
}

.article-loading { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
