/* ══════════════════════════════════════════════════════
   Chronicle · 编年史日历 + 单年页面
   ══════════════════════════════════════════════════════ */

/* ── 离散色档（6 级）── */
:root {
  --chr-tier-strong-down: #a8071a;          /* ≤ -20% */
  --chr-tier-down:        #cf1322;          /* -20% ~ -10% */
  --chr-tier-soft-down:   rgba(207,19,34,0.22); /* -10% ~ 0% */
  --chr-tier-soft-up:     rgba(56,158,13,0.22); /* 0 ~ 10% */
  --chr-tier-up:          #389e0d;          /* 10% ~ 20% */
  --chr-tier-strong-up:   #237804;          /* ≥ 20% */
}

/* ── 日历容器 ── */
.chronicle-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}

.chronicle-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 28px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}
.chronicle-legend-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chronicle-legend-swatch {
  display: inline-block;
  width: 26px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.06);
}
.chronicle-legend-tip {
  font-size: 12px;
  color: var(--gray);
}

/* ── 滚动容器（窄屏横滚） ── */
.chronicle-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}

/* ── 日历网格 ── */
.chronicle-grid {
  display: grid;
  grid-template-columns: 96px repeat(10, minmax(96px, 1fr));
  gap: 6px;
  min-width: 820px;
  margin-bottom: 32px;
}

.chronicle-decade {
  align-self: center;
  font-family: "Inter", sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  padding-right: 16px;
  text-align: right;
  border-right: 1px solid var(--border);
}

.chronicle-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 1 / 1;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  overflow: hidden;
  min-height: 80px;
}

.chronicle-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.10);
  border-color: var(--accent);
  z-index: 2;
}

.chronicle-cell--empty {
  background: transparent;
  border: 1px dashed var(--border);
  pointer-events: none;
  opacity: 0.4;
}

.chronicle-cell-year {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}

.chronicle-cell-return {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  align-self: flex-start;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1.2;
  margin-top: 6px;
  background: rgba(0,0,0,0.10);
  color: inherit;
}

.chronicle-cell-title {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: var(--card-bg);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  color: var(--text);
  opacity: 0;
  transition: opacity 0.12s ease;
  pointer-events: none;
}
.chronicle-cell:hover .chronicle-cell-title {
  opacity: 0.97;
}

/* ── 6 档离散染色 ── */
.chronicle-cell[data-tier="strong-down"] {
  background: var(--chr-tier-strong-down);
  border-color: var(--chr-tier-strong-down);
  color: #fff;
}
.chronicle-cell[data-tier="down"] {
  background: var(--chr-tier-down);
  border-color: var(--chr-tier-down);
  color: #fff;
}
.chronicle-cell[data-tier="soft-down"] {
  background: var(--chr-tier-soft-down);
}
.chronicle-cell[data-tier="soft-up"] {
  background: var(--chr-tier-soft-up);
}
.chronicle-cell[data-tier="up"] {
  background: var(--chr-tier-up);
  border-color: var(--chr-tier-up);
  color: #fff;
}
.chronicle-cell[data-tier="strong-up"] {
  background: var(--chr-tier-strong-up);
  border-color: var(--chr-tier-strong-up);
  color: #fff;
}

/* 在白字格子上让徽章可读 */
.chronicle-cell[data-tier="strong-down"] .chronicle-cell-return,
.chronicle-cell[data-tier="down"] .chronicle-cell-return,
.chronicle-cell[data-tier="up"] .chronicle-cell-return,
.chronicle-cell[data-tier="strong-up"] .chronicle-cell-return {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

/* ── 引用 / 致谢 ── */
.chronicle-source {
  font-size: 12px;
  color: var(--gray);
  text-align: center;
  margin-top: 8px;
  line-height: 1.6;
}

/* ══════════════════════════════════════════════════════
   单年详情页 · year detail
   ══════════════════════════════════════════════════════ */

.year-hero {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  text-align: left;
}
.year-hero-number {
  font-family: "Inter", sans-serif;
  font-size: clamp(96px, 14vw, 200px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 2px 16px rgba(0,0,0,0.4);
  font-variant-numeric: tabular-nums;
}
.year-hero-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 18px;
  min-width: 280px;
}
.year-hero-tag {
  font-family: "Rock Salt", "Inter", cursive;
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.04em;
}
.year-hero-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: #ffffff;
  text-shadow: 0 1px 8px rgba(0,0,0,0.45);
}
.year-hero-stats {
  display: flex;
  gap: 14px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.year-hero-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  font-size: 12px;
}
.year-hero-stat-label { color: rgba(255,255,255,0.65); }
.year-hero-stat-value {
  color: #ffffff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.year-hero-stat-value--green { color: #95de64; }
.year-hero-stat-value--red   { color: #ffa39e; }

/* ── 走势图下色带注释 ── */
.chart-band-note {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--gray);
  text-align: center;
}

/* ── 摘要段 ── */
.year-summary {
  font-size: 16px;
  line-height: 1.85;
  color: var(--text);
  max-width: 880px;
  margin: 0 auto 16px;
}
.year-summary p { margin-bottom: 12px; }
.year-summary p:last-child { margin-bottom: 0; }
.year-summary h3 {
  font-size: 17px;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.year-summary h3:first-child { margin-top: 0; }

/* ── 时代背景 关键史实 时间线布局 ── */
/* 结构: [日期 100px] [灰线 2px,贯穿] [标题+正文]  */
.year-summary ul.era-history-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
}
.year-summary .era-history-list li {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0 20px;
  margin: 0;
}
.year-summary .era-history-list .era-history-date {
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  padding-top: 2px;
  white-space: nowrap;
}
.year-summary .era-history-list .era-history-content {
  border-left: 2px solid var(--border);
  padding: 0 0 20px 20px;
  margin-top: -2px;
}
.year-summary .era-history-list li:last-child .era-history-content {
  padding-bottom: 0;
}
.year-summary .era-history-list .era-history-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.45;
  margin-bottom: 4px;
}
.year-summary .era-history-list .era-history-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.75;
}
@media (max-width: 640px) {
  .year-summary .era-history-list li {
    grid-template-columns: 72px 1fr;
    gap: 0 12px;
  }
  .year-summary .era-history-list .era-history-date {
    font-size: 12px;
  }
  .year-summary .era-history-list .era-history-content {
    padding: 0 0 18px 14px;
  }
}
.year-summary ul {
  margin: 8px 0 12px 0;
  padding-left: 22px;
}
.year-summary ul li { margin-bottom: 6px; }
.year-summary table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 12px 0;
}
.year-summary table th,
.year-summary table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.year-summary table th {
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-section);
}

/* ── 大事时间线 ── */
.year-timeline {
  max-width: 880px;
  margin: 0 auto;
  position: relative;
  padding-left: 36px;
}
.year-timeline::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 12px;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  padding: 0 0 14px 12px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -29px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 2px solid var(--text-secondary);
}
/* 涨/跌 dot 颜色 */
.timeline-item--up .timeline-dot   { border-color: var(--green); background: var(--green); }
.timeline-item--down .timeline-dot { border-color: var(--red);   background: var(--red); }
/* key 单独 = 蓝 dot;key 与 up/down 同时存在 = 保留 up/down 颜色 + 蓝色发光环 */
.timeline-item--key:not(.timeline-item--up):not(.timeline-item--down) .timeline-dot {
  border-color: var(--accent);
  background: var(--accent);
}
.timeline-item--key .timeline-dot {
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* 颜色图例 */
.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 auto 20px;
  max-width: 880px;
  padding-left: 36px;
  font-size: 12px;
  color: var(--text-secondary);
}
.timeline-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.timeline-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--text-secondary);
  background: var(--card-bg);
}
.timeline-legend-dot--up   { border-color: var(--green); background: var(--green); }
.timeline-legend-dot--down { border-color: var(--red);   background: var(--red); }
.timeline-legend-dot--key  { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
.timeline-date {
  display: inline-block;
  font-family: "Inter", monospace;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin-bottom: 4px;
}
.timeline-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 4px;
}
.timeline-desc {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* ── 简易"返回日历"按钮 ── */
.year-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  transition: all 0.15s;
}
.year-back-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── 响应式 ── */
@media (max-width: 880px) {
  .chronicle-grid {
    grid-template-columns: 64px repeat(10, minmax(72px, 1fr));
    gap: 4px;
    min-width: 800px;
  }
  .chronicle-decade { font-size: 13px; padding-right: 8px; }
  .chronicle-cell { min-height: 64px; padding: 6px; border-radius: 5px; }
  .chronicle-cell-year { font-size: 14px; }
  .chronicle-cell-return { font-size: 10px; padding: 1px 4px; margin-top: 4px; }
  .chronicle-cell-title { font-size: 11px; padding: 4px; }
  .year-timeline { padding-left: 24px; }
  .year-timeline::before { left: 6px; }
  .timeline-dot { left: -21px; width: 10px; height: 10px; }
  .year-hero { gap: 16px; }
  .year-hero-meta { padding-bottom: 8px; min-width: auto; }
}
