/* =============================================================
 * 城市日历（/pc/calendar.html）专用样式
 * 设计语言：复用 tokens.css 的政务红语义令牌，保持与全站一致。
 * 组件样式集中此处，避免污染 pc.css 主体；仅使用令牌变量，不重定义语义变量。
 * ============================================================= */

.cal-page {
  --cal-gap: 10px;
}

/* 概览统计条 */
.cal-overview {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 4px 0 20px;
}
.cal-overview .stat {
  flex: 1 1 180px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .15s, transform .12s;
}
.cal-overview .stat:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.cal-overview .stat b {
  display: block;
  font-size: 26px;
  line-height: 1.1;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.cal-overview .stat span {
  font-size: 13px;
  color: var(--muted-foreground);
}

/* 日历卡片 */
.cal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}
.cal__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.cal__title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.cal__title h2 {
  margin: 0;
  font-size: 22px;
  color: var(--foreground);
}
.cal__title .en {
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.cal__nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cal__nav .cur {
  min-width: 116px;
  text-align: center;
  font-weight: 600;
  font-size: 16px;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}
.cal__btn {
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s, color .15s;
}
.cal__btn:hover { background: var(--brand-tint); border-color: var(--primary); color: var(--primary); }
/* 导航箭头（内联 SVG，跟随 currentColor，与 .totop 统一风格）*/
.cal__btn svg { width: 18px; height: 18px; display: block; }
.cal__today {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: filter .15s;
}
.cal__today:hover { filter: brightness(1.06); }

/* 星期行 */
.cal__week,
.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--cal-gap);
}
.cal__week {
  margin-bottom: 8px;
}
.cal__week span {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-foreground);
  padding: 4px 0;
}
.cal__week span.we { color: var(--brand-warm); }

/* 日期格 */
.cal__cell {
  min-height: 96px;
  max-height: 140px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--background);
  padding: 6px 7px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.cal__cell.is-out { opacity: .45; background: transparent; }
.cal__cell.is-today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.cal__cell.has-events { cursor: pointer; background: var(--card); }
.cal__cell.has-events:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.cal__cell.is-selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--brand-tint-strong); background: var(--brand-tint); }

.cal__dnum {
  font-size: 13px;
  font-weight: 600;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}
.cal__cell.is-out .cal__dnum { color: var(--muted-foreground); }
.cal__cell.is-today .cal__dnum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
}

/* 事件小条 */
.cal__ev {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  line-height: 1.25;
  color: var(--foreground);
  background: var(--brand-tint);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  overflow: hidden;
}
.cal__ev .dot {
  flex: 0 0 auto;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.cal__ev .txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal__more {
  font-size: 11px;
  color: var(--muted-foreground);
  padding-left: 2px;
}

/* 当日事件面板 */
.cal__panel {
  margin-top: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}
.cal__panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.cal__panel-head h3 {
  margin: 0;
  font-size: 17px;
  color: var(--foreground);
}
.cal__panel-head .cnt {
  font-size: 13px;
  color: var(--muted-foreground);
}
.cal__empty {
  color: var(--muted-foreground);
  font-size: 14px;
  padding: 18px 4px;
  text-align: center;
}
.ev-list { display: flex; flex-direction: column; gap: 12px; }
.ev-card {
  display: block;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 13px 15px;
  background: var(--background);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.ev-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.ev-card__cat {
  display: inline-block;
  font-size: 12px;
  color: var(--primary);
  background: var(--brand-tint);
  border-radius: 999px;
  padding: 2px 10px;
  margin-bottom: 7px;
}
.ev-card__title {
  margin: 0 0 6px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--foreground);
}
.ev-card__meta {
  font-size: 12.5px;
  color: var(--muted-foreground);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.ev-card__meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-foreground); display: inline-block; }
.ev-card__summary {
  margin: 7px 0 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted-foreground);
}

/* 加载态 */
.cal__loading {
  text-align: center;
  color: var(--muted-foreground);
  padding: 40px 0;
  font-size: 14px;
}

/* 响应式：移动端单格收窄 */
@media (max-width: 640px) {
  .cal { padding: 12px; }
  .cal__cell { min-height: 74px; padding: 4px 5px; }
  .cal__ev .txt { font-size: 11px; }
  .cal__grid, .cal__week { gap: 5px; }
  .cal__dnum { font-size: 12px; }
}

/* =============================================================
 * 布局优化：左右分栏 → 上下结构
 * 让月视图占满整行获得最大展示空间，侧栏说明/提示移到底部横向铺开。
 * 作用域限定 body[data-page="calendar"]，不影响其他使用 .layout 的页面。
 * ============================================================= */
body[data-page="calendar"] .layout {
  grid-template-columns: 1fr;   /* 单列：主内容在上、侧栏在下 */
  gap: 28px;                    /* 与全站 28px 区块间距规范一致 */
}
/* 侧栏取消 sticky，改为底部三列横向铺开，避免纵向冗长占用日历空间 */
body[data-page="calendar"] .layout > .sidebar {
  position: static;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
body[data-page="calendar"] .cal__panel { margin-top: 4px; }

@media (max-width: 960px) {
  /* 平板 / 手机：侧栏说明回归单列堆叠 */
  body[data-page="calendar"] .layout > .sidebar {
    grid-template-columns: 1fr;
  }
}
