/* ============================================================
   changelog.css - 更新日志中心（日历视图 + 时间线视图）
   复用 site.css 的全局 CSS 变量（主色/文字/边框/背景）
   ============================================================ */

/* 更新类型语义色：仅用于节点圆点、类型标签、细条，克制不花哨 */
:root {
  --cl-feature: #FF2442;   /* 新功能：沿用主色红 */
  --cl-feature-soft: #FFF1F2;
  --cl-improve: #2563EB;   /* 优化：蓝 */
  --cl-improve-soft: #EFF4FF;
  --cl-fix: #00B42A;       /* 修复：绿 */
  --cl-fix-soft: #EAFBEF;
}

/* ===== 布局切换：container 进入更新日志模式 ===== */
/* 日志页左右两侧栏都隐藏，可以比正文页放得更宽，给「日历 + 当日详情」两列留足余量 */
.container.is-changelog {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1560px;
}
.container.is-changelog .sidebar,
.container.is-changelog .toc-side { display: none; }
.container.is-changelog #docTitle,
.container.is-changelog .doc-meta,
.container.is-changelog #docContent { display: none; }
.container.is-changelog #announceBox.has-announce { display: none; }
#changelogView { display: none; }
.container.is-changelog #changelogView { display: block; }

/* ===== 顶部标题区 ===== */
.cl-head { margin-bottom: 22px; }
.cl-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--primary); font-weight: 500;
  letter-spacing: 1px; margin-bottom: 10px;
}
.cl-eyebrow::before {
  content: ''; width: 18px; height: 2px; border-radius: 1px; background: var(--primary);
}
.cl-title {
  font-size: 24px; font-weight: 700; color: var(--text-primary);
  margin: 0 0 8px; letter-spacing: 0.3px;
}
.cl-sub { font-size: 13.5px; color: var(--text-sub); margin: 0; line-height: 1.7; }

/* ===== 工具条：视图切换 + 月份切换 ===== */
.cl-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 22px;
}
.cl-segment {
  display: inline-flex; background: var(--bg-page);
  border-radius: 8px; padding: 3px; gap: 2px;
}
.cl-seg-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: transparent; cursor: pointer;
  font-size: 13px; color: var(--text-sub); font-weight: 500;
  padding: 7px 14px; border-radius: 6px;
  transition: background .18s, color .18s, box-shadow .18s;
  font-family: inherit;
}
.cl-seg-btn svg { width: 14px; height: 14px; }
.cl-seg-btn:hover { color: var(--text-primary); }
.cl-seg-btn.active {
  background: #fff; color: var(--primary);
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.08);
}
.cl-month-nav { display: inline-flex; align-items: center; gap: 4px; }
.cl-month-label {
  min-width: 128px; text-align: center;
  font-size: 15px; font-weight: 600; color: var(--text-primary);
}
.cl-month-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border); background: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-sub); transition: all .16s;
}
.cl-month-btn:hover { border-color: var(--primary); color: var(--primary); }
.cl-month-btn:disabled { opacity: .4; cursor: not-allowed; }
.cl-month-btn svg { width: 14px; height: 14px; }

/* ===== 日历视图：日历 + 右侧当日详情（两列等比分配，详情列保证可读宽度） ===== */
.cl-cal-layout {
  display: grid;
  /* 日历最小 660（7 列每列约 85px，够放 6 个汉字），详情最小 400；
     余量按 1.1 : 1 分给两侧 —— 原来详情固定 340px，卡片内正文只剩 262px，
     长句会被折成 4 行，太挤。改后正文可到 560px+，43 字的句子只折 2 行。 */
  grid-template-columns: minmax(660px, 1.1fr) minmax(400px, 1fr);
  gap: 22px; align-items: start;
}
/* 右侧详情：滚动跟随；高度上限 = 日历卡片高度（由 changelog.js 量出后写入 --cl-day-max），
   不高于日历，避免右栏比日历长出一截；超出部分在卡片内部滚动（日期表头固定）。 */
.cl-day-card {
  position: sticky; top: 78px;
  height: var(--cl-day-max, auto);
  max-height: var(--cl-day-max, calc(100vh - 100px));
  display: flex; flex-direction: column;
}
.cl-day-card > .cl-day-head { flex-shrink: 0; }
.cl-day-body { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
/* 内部滚动条做得细一点，别抢视线 */
.cl-day-body::-webkit-scrollbar { width: 6px; }
.cl-day-body::-webkit-scrollbar-thumb { background: #D8DADF; border-radius: 3px; }
.cl-day-body::-webkit-scrollbar-track { background: transparent; }
.cl-cal-card,
.cl-day-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 20px;
}
/* 空间不足两列最小宽（660+400+22gap=1082，再留容器内边距）时上下堆叠，
   避免日历被压细 / 详情正文被挤成竖条 */
@media (max-width: 1180px) {
  .cl-cal-layout { grid-template-columns: minmax(0, 1fr); }
  .cl-day-card { position: static; height: auto; max-height: none; display: block; }
  .cl-day-body { overflow: visible; }
}

/* 日历网格 */
.cl-cal-week {
  display: grid; grid-template-columns: repeat(7, 1fr);
  margin-bottom: 10px;
}
.cl-cal-week span {
  text-align: center; font-size: 12.5px; color: var(--text-muted);
  font-weight: 600; padding: 8px 0;
}
.cl-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cl-cell {
  position: relative; min-height: 96px; min-width: 0;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fff; cursor: default;
  display: flex; flex-direction: column; align-items: stretch;
  justify-content: flex-start; padding: 8px 9px; gap: 5px;
  font-family: inherit; text-align: left;
  transition: box-shadow .16s, border-color .16s, background .16s;
}
.cl-cell-num {
  font-size: 13px; color: var(--text-sub); line-height: 1;
  font-weight: 600; align-self: flex-start;
}
.cl-cell.not-month { background: var(--bg-page); border-color: transparent; }
.cl-cell.not-month .cl-cell-num { color: #B8BCC4; }
.cl-cell.not-month .cl-cell-t { color: #B8BCC4; }
.cl-cell.has-updates { cursor: pointer; }
.cl-cell.has-updates:hover { box-shadow: 0 4px 14px rgba(17,24,39,.09); border-color: var(--primary); }
/* 补位（上月/下月）日期也可点击切月 */
.cl-cell[data-jump] { cursor: pointer; }
.cl-cell[data-jump]:hover { box-shadow: 0 4px 14px rgba(17,24,39,.08); border-color: var(--primary); }
/* 今天：主色描边 + 数字主色 */
.cl-cell.is-today { border-color: var(--primary); }
.cl-cell.is-today .cl-cell-num { color: var(--primary); }
/* 选中：浅主色底，不做整块实心以免盖住标题 */
.cl-cell.selected { background: var(--primary-light); border-color: var(--primary); }
.cl-cell.selected .cl-cell-num { color: var(--primary); font-weight: 700; }
/* 格子内更新标题：类型色左条，单行省略 */
.cl-cell-titles { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cl-cell-t {
  position: relative; font-size: 12px; line-height: 1.35;
  color: var(--text-body); padding-left: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cl-cell-t::before {
  content: ''; position: absolute; left: 0; top: 1px; bottom: 1px;
  width: 2.5px; border-radius: 2px;
}
.cl-cell-t.k-feature::before { background: var(--cl-feature); }
.cl-cell-t.k-improve::before { background: var(--cl-improve); }
.cl-cell-t.k-fix::before { background: var(--cl-fix); }
/* 同一条公告含多条更新时，标题后跟一个「N 条」小角标（日历格子空间有限） */
.cl-cell-t .cl-cell-n {
  font-style: normal; font-size: 10px; font-weight: 600; line-height: 1;
  margin-left: 4px; padding: 1px 4px; border-radius: 8px;
  color: var(--text-muted); background: var(--bg-page);
  vertical-align: 1px;
}

/* 当日详情 */
.cl-day-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; padding-bottom: 14px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.cl-day-date { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.cl-day-count { font-size: 12px; color: var(--text-muted); }
.cl-day-empty {
  text-align: center; padding: 40px 16px; color: var(--text-muted); font-size: 13px;
}
.cl-day-empty .big { font-size: 14px; color: var(--text-sub); margin-bottom: 6px; }

/* ===== 条目卡片（当日详情 & 时间线共用） ===== */
.cl-item { position: relative; }
.cl-item + .cl-item { margin-top: 16px; }
.cl-item-card {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; background: #fff;
  border-left: 3px solid var(--kind-color, var(--primary));
  transition: box-shadow .18s, transform .18s;
}
.cl-item-card:hover {
  box-shadow: 0 4px 16px rgba(17, 24, 39, 0.07);
  transform: translateY(-1px);
}
/* 缩略图：统一排在正文下方，尺寸收小（不做左侧大封面） */
.cl-item-info { min-width: 0; }
.cl-thumbs-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px;
}
.cl-thumbs-row .cl-thumb {
  display: block; width: 58px; height: 44px; border-radius: 6px;
  overflow: hidden; background: var(--bg-page);
  border: 1px solid var(--border); padding: 0; cursor: zoom-in;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.cl-thumbs-row .cl-thumb:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(255, 36, 66, .14);
}
.cl-thumbs-row img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .25s ease;
}
.cl-thumbs-row .cl-thumb:hover img { transform: scale(1.06); }
.cl-item-top {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.cl-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 500; line-height: 1;
  padding: 4px 8px; border-radius: 20px;
}
.cl-badge svg { width: 11px; height: 11px; }
.cl-badge.feature { color: var(--cl-feature); background: var(--cl-feature-soft); }
.cl-badge.improve { color: var(--cl-improve); background: var(--cl-improve-soft); }
.cl-badge.fix { color: var(--cl-fix); background: var(--cl-fix-soft); }
.cl-item-title { font-size: 14.5px; font-weight: 600; color: var(--text-primary); }
/* 有关联链接的公告：标题本身即入口（加粗蓝色），不再单列「查看关联文档」 */
a.cl-item-title.is-link {
  color: var(--link); font-weight: 700;
  border-bottom: 1px solid transparent;
  transition: color .15s, border-color .15s;
}
a.cl-item-title.is-link:hover {
  color: var(--primary); border-bottom-color: currentColor;
}
/* 公告条目数徽标（标题右侧，>1 条才显示） */
.cl-item-num {
  margin-left: auto; flex-shrink: 0;
  font-size: 11px; font-weight: 600; line-height: 1;
  color: var(--kind-color, var(--primary));
  background: var(--bg-page); border-radius: 20px; padding: 4px 8px;
}
/* 一条条更新：紧凑列表，第一条与标题贴近 */
.cl-items {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.cl-items li {
  position: relative; padding-left: 16px;
  font-size: 13.5px; color: var(--text-body); line-height: 1.8;
  text-align: justify; word-break: break-word;
}
.cl-items li::before {
  content: ''; position: absolute; left: 3px; top: 8px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--kind-color, var(--primary)); opacity: .75;
}
.cl-items li strong { color: var(--primary); font-weight: 600; }
.cl-items li code {
  font-family: var(--font-mono, Consolas, Monaco, monospace);
  font-size: 12px; background: var(--bg-page); padding: 1px 5px; border-radius: 4px;
}
.cl-items li a { color: var(--link); }
/* 条目下方紧接补充说明时留一点间距 */
.cl-items + .cl-body { margin-top: 9px; }

/* 正文：复用轻量排版 */
.cl-body { font-size: 13.5px; color: var(--text-body); line-height: 1.85; }
.cl-body > :first-child { margin-top: 0; }
.cl-body > :last-child { margin-bottom: 0; }
.cl-body p { margin: 0 0 6px; }
.cl-body ul, .cl-body ol { margin: 6px 0; padding-left: 20px; }
.cl-body li { margin-bottom: 4px; }
.cl-body h2, .cl-body h3 { font-size: 13.5px; color: var(--text-primary); margin: 10px 0 6px; }
.cl-body a { color: var(--link); }
.cl-body code {
  font-family: var(--font-mono, Consolas, Monaco, monospace);
  font-size: 12px; background: var(--bg-page); padding: 1px 5px; border-radius: 4px;
}
.cl-body blockquote {
  border-left: 3px solid var(--border); padding-left: 10px;
  color: var(--text-sub); margin: 6px 0;
}
.cl-body img, .cl-body video { max-width: 100%; border-radius: 8px; margin: 6px 0; }
.cl-body table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12.5px; }
.cl-body th, .cl-body td { border: 1px solid var(--border); padding: 5px 10px; text-align: left; }

/* ===== 时间线视图 ===== */
.cl-tl-month { margin-bottom: 8px; }
.cl-tl-month + .cl-tl-month { margin-top: 28px; }
.cl-tl-month-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px;
}
.cl-tl-month-name { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.cl-tl-month-stat { font-size: 12px; color: var(--text-muted); }
.cl-tl-month-line { flex: 1; height: 1px; background: var(--border); }

.cl-tl-day { position: relative; padding-left: 34px; }
.cl-tl-day + .cl-tl-day { margin-top: 22px; }
/* 竖向时间线 */
.cl-tl-day::before {
  content: ''; position: absolute; left: 9px; top: 18px; bottom: -24px;
  width: 2px; background: var(--border);
}
.cl-tl-month .cl-tl-day:last-child::before { display: none; }
.cl-tl-day-label {
  position: relative; margin-bottom: 12px;
  font-size: 13px; font-weight: 600; color: var(--text-sub);
}
/* 多节点合并圆点：用当天首个类型色；简单起见统一主色外圈 */
.cl-tl-day-label::before {
  content: ''; position: absolute; left: -31px; top: 3px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 3px solid var(--primary);
}
.cl-tl-day .cl-item + .cl-item { margin-top: 12px; }

.cl-tl-empty {
  text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 13px;
}

/* ===== 统计概览（工具条下方小卡，可选） ===== */
.cl-stats { display: flex; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.cl-stat {
  flex: 1; min-width: 130px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
}
.cl-stat-ico {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.cl-stat-ico svg { width: 17px; height: 17px; }
.cl-stat.feature .cl-stat-ico { background: var(--cl-feature-soft); color: var(--cl-feature); }
.cl-stat.improve .cl-stat-ico { background: var(--cl-improve-soft); color: var(--cl-improve); }
.cl-stat.fix .cl-stat-ico { background: var(--cl-fix-soft); color: var(--cl-fix); }
.cl-stat-num { font-size: 19px; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.cl-stat-label { font-size: 12px; color: var(--text-muted); }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .cl-cal-layout { grid-template-columns: 1fr; }
  .cl-cell { padding-top: 5px; }
  .cl-cell-num { font-size: 12px; }
  .cl-title { font-size: 21px; }
}
