/* ============================================================
   A股+黄金日报 — 报纸风格样式
   设计理念：传统大报质感 — 高信息密度 + 权威感 + 视觉节奏
   ============================================================ */

/* ===== CSS 变量 ===== */
:root {
  --color-bg:         #f5f0e8;   /* 新闻纸底色 */
  --color-paper:      #fdfaf2;   /* 报纸白 */
  --color-text:       #1a1a1a;   /* 正文黑 */
  --color-title:      #111;      /* 标题黑 */
  --color-red:        #c0392b;   /* A 股涨=红 */
  --color-green:      #27ae60;   /* A 股跌=绿 */
  --color-muted:      #6b6b6b;   /* 辅助灰 */
  --color-gold:       #b8860b;   /* 金色强调 */
  --color-gold-light: #d4a843;   /* 金色浅 */
  --color-rule:       #3a3a3a;   /* 分隔线 */
  --color-rule-light: #c4bfb3;   /* 轻分隔 */
  --color-tag-bg:     #e8e0d0;   /* 标签底 */

  --font-heading:     'Noto Serif SC', 'SimSun', 'STSong', 'Songti SC', serif;
  --font-body:        'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
  --font-mono:        'JetBrains Mono', 'SF Mono', 'Consolas', monospace;

  --gap-col:          24px;
  --max-width:        1200px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  min-height: 100vh;
  padding: 20px 0 40px;
}

/* 报纸纸张纹理 (CSS only, 无额外资源) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(180,160,120,0.03) 2px,
      rgba(180,160,120,0.03) 4px
    );
  pointer-events: none;
  z-index: -1;
}

/* ===== 报头 Masthead ===== */
.masthead {
  max-width: var(--max-width);
  margin: 0 auto 0;
  padding: 32px var(--gap-col) 20px;
  text-align: center;
  position: relative;
}

.masthead::after {
  content: '';
  display: block;
  margin: 20px auto 0;
  width: 100%;
  height: 3px;
  background: var(--color-rule);
}

.masthead-title {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--color-title);
  user-select: none;
}

.masthead-title .gold-accent {
  color: var(--color-gold);
}

.masthead-meta {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--color-muted);
}

.masthead-meta .dot { font-size: 0.4rem; vertical-align: middle; }

.masthead-divider {
  border: none;
  border-top: 1px solid var(--color-rule-light);
  margin: 0 auto;
  max-width: var(--max-width);
}

/* ===== 报纸主容器 ===== */
.newspaper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gap-col);
}

/* ===== 头条区 — 三大指数 Hero ===== */
.hero-section {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1px;
  background: var(--color-rule);
  border: 2px solid var(--color-rule);
  margin-top: 24px;
}

.hero-card {
  background: var(--color-paper);
  padding: 28px 24px 22px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-card-label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 10px;
}

.hero-card-price {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1.1;
}

.hero-card-change {
  margin-top: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.hero-card-change .arrow { font-size: 1.2rem; }

.hero-card-sub {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--color-muted);
}

/* 颜色 — A 股：红涨绿跌 */
.red  { color: var(--color-red); }
.green { color: var(--color-green); }
.flat  { color: var(--color-muted); }

/* ===== 二栏区 — 市场情绪 + 黄金报价 ===== */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

/* 区块盒子 */
.box {
  background: var(--color-paper);
  border: 1px solid var(--color-rule-light);
  padding: 24px 28px;
}

.box-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 2px;
  padding-bottom: 12px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--color-rule);
  display: flex;
  align-items: center;
  gap: 8px;
}

.box-title .icon { font-size: 1.1rem; }

/* 情绪指标 */
.sentiment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.sentiment-item {
  text-align: center;
  padding: 12px 8px;
  background: #faf7ef;
  border: 1px solid var(--color-rule-light);
}

.sentiment-value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.2;
}

.sentiment-label {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--color-muted);
  letter-spacing: 1px;
}

/* 黄金金价 Box 特殊样式 */
.gold-section {
  position: relative;
  overflow: hidden;
}

.gold-section::before {
  content: '';
  position: absolute;
  top: -4px;
  right: -4px;
  width: 60px;
  height: 26px;
  background: var(--color-gold);
  transform: rotate(45deg) translate(4px, -20px);
  opacity: 0.85;
}

.gold-prices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.gold-item {
  text-align: center;
  padding: 16px 8px;
}

.gold-item-name {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  color: var(--color-muted);
  letter-spacing: 1px;
}

.gold-item-price {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 900;
  margin-top: 6px;
  color: var(--color-gold);
}

.gold-item-change {
  margin-top: 4px;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ===== 板块热搜区 ===== */
.sectors-section {
  margin-top: 24px;
}

.sectors-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.sectors-table thead {
  border-bottom: 2px solid var(--color-rule);
}

.sectors-table th {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  letter-spacing: 2px;
  color: var(--color-muted);
  text-align: left;
  padding: 10px 12px;
  font-weight: 700;
}

.sectors-table th:last-child,
.sectors-table th:nth-child(2),
.sectors-table th:nth-child(4) {
  text-align: right;
}

.sectors-table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--color-rule-light);
  vertical-align: middle;
}

.sectors-table tbody tr:hover {
  background: #faf7ef;
}

.sector-rank {
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--color-tag-bg);
  color: var(--color-muted);
}

.sector-rank.top-1 { background: #e74c3c; color: #fff; }
.sector-rank.top-2 { background: #e67e22; color: #fff; }
.sector-rank.top-3 { background: #f39c12; color: #fff; }

.sector-name { font-weight: 600; }
.sector-leader { font-size: 0.82rem; color: var(--color-muted); }

/* ===== 一句话复盘区 ===== */
.summary-section {
  margin-top: 24px;
  background: var(--color-paper);
  border: 1px solid var(--color-rule-light);
  border-left: 5px solid var(--color-rule);
  padding: 20px 28px;
}

.summary-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 2px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-text {
  font-size: 1rem;
  line-height: 1.8;
  color: #333;
}

/* ===== 页脚 ===== */
.footer {
  max-width: var(--max-width);
  margin: 32px auto 0;
  padding: 20px var(--gap-col) 0;
  text-align: center;
  border-top: 1px solid var(--color-rule-light);
  font-size: 0.78rem;
  color: var(--color-muted);
  line-height: 1.8;
}

.footer a { color: var(--color-muted); text-decoration: underline; }

/* ===== 加载状态 ===== */
.loading {
  text-align: center;
  padding: 80px 20px;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--color-muted);
}

.loading-spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-rule-light);
  border-top-color: var(--color-rule);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* 错误状态 */
.error-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-red);
  font-family: var(--font-heading);
}

.error-state .emoji { font-size: 3rem; display: block; margin-bottom: 12px; }

/* ===== 历史日报归档页 ===== */
.archive-page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gap-col);
}

.archive-list {
  list-style: none;
  margin-top: 24px;
}

.archive-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-rule-light);
  background: var(--color-paper);
  transition: background 0.15s;
}

.archive-item:hover { background: #faf7ef; }

.archive-item a {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  color: var(--color-text);
  text-decoration: none;
  font-weight: 700;
}

.archive-item a:hover { color: var(--color-gold); }

.archive-item .date-tag {
  font-size: 0.82rem;
  color: var(--color-muted);
  background: var(--color-tag-bg);
  padding: 2px 10px;
  border-radius: 2px;
}

.archive-item .snapshot {
  font-size: 0.85rem;
  color: var(--color-muted);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .masthead-title { font-size: 1.8rem; letter-spacing: 3px; }
  .hero-section { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .sentiment-grid { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .gold-prices { grid-template-columns: 1fr 1fr; }
  .hero-card-price { font-size: 1.8rem; }
  .gold-item-price { font-size: 1.3rem; }
}

@media (max-width: 480px) {
  body { padding: 10px 0 20px; }
  .masthead { padding: 20px 12px 14px; }
  .masthead-title { font-size: 1.4rem; letter-spacing: 2px; }
  .masthead-meta { font-size: 0.8rem; flex-wrap: wrap; gap: 8px; }
  .newspaper { padding: 0 10px; }
  .hero-card { padding: 18px 12px; }
  .hero-card-price { font-size: 1.4rem; }
  .box { padding: 16px; }
  .sentiment-grid { grid-template-columns: 1fr 1fr; }
  .sectors-table { font-size: 0.78rem; }
  .sectors-table th, .sectors-table td { padding: 8px 6px; }
}