/* 每日 AI 资讯 - 左日历 + 右内容布局 */
:root {
  --bg: #fafaf7;
  --bg-card: #ffffff;
  --bg-sidebar: #f5f4ee;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e6e6e2;
  --line-strong: #d8d7d1;
  --link: #2563eb;
  --accent: #ff6b35;
  --tag-bg: #f1f0eb;
  --tag-paper: #e8eef9;
  --tag-product: #fdf2e9;
  --tag-industry: #ecf3ec;
  --tag-tool: #f3ecf6;
  --sidebar-w: 260px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- 顶栏 ---- */
.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.topbar .date {
  color: var(--muted);
  font-size: 14px;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.cal-toggle {
  display: none;  /* 桌面端隐藏，移动端显示 */
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 16px;
  cursor: pointer;
}

/* ---- 主布局 ---- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--topbar-h) - 70px);
  align-items: start;
}

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--line);
  padding: 20px 18px;
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}

.content {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 28px 40px;
}

.content-meta {
  margin-bottom: 24px;
}
.content-date {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 10px;
}
.latest-badge {
  font-size: 11px;
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: 0.5px;
}
.subtitle {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 80px 0;
}
.empty h2 { font-weight: 500; margin-bottom: 10px; }

/* ---- 单条资讯卡片 ---- */
.item {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.rank {
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.tag {
  background: var(--tag-bg);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
}
.tag-paper { background: var(--tag-paper); color: #1e3a8a; }
.tag-product { background: var(--tag-product); color: #9a3412; }
.tag-industry { background: var(--tag-industry); color: #365e36; }
.tag-tool { background: var(--tag-tool); color: #6d3a87; }

.src { color: var(--muted); }
.score { color: var(--muted); font-variant-numeric: tabular-nums; }

.title {
  font-size: 18px;
  font-weight: 600;
  margin: 6px 0 10px;
  line-height: 1.45;
}
.title a { color: var(--fg); }
.title a:hover { color: var(--link); }

.summary {
  margin: 0 0 12px;
  color: #2a2a2a;
}

.images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
}
.images img {
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f3f3f0;
}

.item-foot {
  display: flex;
  gap: 16px;
  font-size: 13.5px;
  margin-top: 6px;
}
.archive { color: var(--muted); }

/* ---- 日历侧栏 ---- */
.cal-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.cal-controls button {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--fg);
}
.cal-controls button:hover { background: var(--bg-card); }
#cal-title {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex: 1;
  text-align: center;
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-bottom: 4px;
}
.cal-weekdays > div {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 4px 0;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.cal-day, .cal-pad {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  border-radius: 6px;
  /* 内嵌 2px，让色块不顶到 cell 边缘，看起来更清爽 */
  margin: 1px;
}
.cal-empty { color: #c5c5c0; }
/* 当天（最新一期）：满颜色 */
.cal-today {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
/* 过往：淡橘色 22% */
.cal-has-past {
  background: rgba(255, 107, 53, 0.22);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
/* 当前查看的过往：中间橘色 50%（黑细框由 .cal-current 加） */
.cal-has-past.cal-current {
  background: rgba(255, 107, 53, 0.5);
}
.cal-today:hover, .cal-has-past:hover { opacity: 0.88; text-decoration: none; }
.cal-current {
  outline: 1px solid var(--fg);
  outline-offset: 2px;
}
.cal-hint, .cal-count {
  text-align: center;
  color: var(--muted);
  font-size: 11.5px;
  margin: 12px 0 0;
}
.cal-count { margin-top: 4px; }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  padding: 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-card);
}
.footer p { margin: 0; }

/* ---- 移动端 ---- */
@media (max-width: 800px) {
  .cal-toggle { display: inline-flex; margin-left: auto; }
  .topbar .date { display: none; }
  .topbar h1 { font-size: 18px; }
  .topbar { padding: 0 16px; gap: 12px; }

  .layout { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    height: auto;
    max-height: 70vh;
    border-right: none;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    transform: translateY(-100%);
    transition: transform 0.2s ease;
    z-index: 9;
  }
  .sidebar.open { transform: translateY(0); }

  .content { padding: 18px 14px 32px; }
  .item { padding: 14px 16px; }
  .title { font-size: 16.5px; }
}
