/* ===== AI产业动态每日速递 · 样式表 ===== */
/* 设计原则：扁平、无阴影渐变滥用；CSS 变量驱动深浅色主题 */

:root {
  --bg: #f5f6f8;
  --bg-elevated: #ffffff;
  --bg-subtle: #eef0f3;
  --text: #1a1d21;
  --text-secondary: #5a6673;
  --text-tertiary: #8a97a6;
  --border: #e2e6eb;
  --border-strong: #cdd4dc;
  --accent: #0066cc;
  --accent-soft: #e6f0fb;
  --domestic: #128a5c;
  --domestic-bg: #e5f5ee;
  --oversea: #b4620a;
  --oversea-bg: #fbf0e2;
  --highlight-bg: #fff8e6;
  --highlight-border: #f0c95a;
  --radius: 10px;
  --radius-sm: 6px;
  --maxw: 1180px;
  --sidebar-w: 232px;
  --topbar-h: 60px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
}

.dark {
  --bg: #14171c;
  --bg-elevated: #1d2127;
  --bg-subtle: #262b33;
  --text: #e8ebef;
  --text-secondary: #a6b0bd;
  --text-tertiary: #6f7c8a;
  --border: #2c323b;
  --border-strong: #3a424d;
  --accent: #4d9fff;
  --accent-soft: #14304e;
  --domestic: #4bbd8a;
  --domestic-bg: #122c22;
  --oversea: #e0964a;
  --oversea-bg: #33260f;
  --highlight-bg: #2e2913;
  --highlight-border: #6b5a1f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

a { color: inherit; text-decoration: none; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { color: var(--accent); font-size: 20px; }
.brand-title { font-size: 17px; font-weight: 700; white-space: nowrap; }
.brand-sub { font-size: 12px; color: var(--text-tertiary); }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }

.topbar-controls { display: flex; align-items: center; gap: 12px; }

.view-tabs { display: flex; background: var(--bg-subtle); border-radius: var(--radius-sm); padding: 3px; }
.view-tab {
  border: none; background: transparent; color: var(--text-secondary);
  padding: 6px 14px; font-size: 13px; font-weight: 500; cursor: pointer;
  border-radius: 4px; transition: all 0.15s; white-space: nowrap;
}
.view-tab:hover { color: var(--text); }
.view-tab.active { background: var(--bg-elevated); color: var(--accent); font-weight: 600; }

.time-picker select {
  border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text);
  padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer;
  font-family: var(--font); max-width: 220px;
}

.theme-toggle, .menu-toggle {
  border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text);
  width: 36px; height: 34px; border-radius: var(--radius-sm); cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.theme-icon-dark { display: none; }
.dark .theme-icon-light { display: none; }
.dark .theme-icon-dark { display: inline; }
.menu-toggle { display: none; }

/* ===== 布局 ===== */
.layout { max-width: var(--maxw); margin: 0 auto; display: flex; gap: 24px; padding: 0 20px; }

.sidebar { width: var(--sidebar-w); flex-shrink: 0; }
.sidebar-inner {
  position: sticky; top: calc(var(--topbar-h) + 16px);
  display: flex; flex-direction: column; gap: 4px; padding: 16px 0;
}
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text-secondary); font-size: 14px; border: 1px solid transparent;
  transition: all 0.15s; text-align: left; background: none; width: 100%; font-family: var(--font);
}
.nav-item:hover { background: var(--bg-subtle); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; border-color: var(--border); }
.nav-item-label { display: flex; align-items: center; gap: 9px; }
.nav-item-icon { font-size: 15px; }
.nav-count { font-size: 11px; color: var(--text-tertiary); background: var(--bg-subtle); padding: 1px 7px; border-radius: 10px; }
.nav-item.active .nav-count { background: var(--bg-elevated); color: var(--accent); }

.main { flex: 1; min-width: 0; padding: 20px 0 60px; }

/* ===== 板块区块 ===== */
.section-block { margin-bottom: 40px; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.section-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
  padding-bottom: 10px; border-bottom: 2px solid var(--border);
}
.section-head .sec-icon { font-size: 20px; }
.section-head h2 { font-size: 19px; font-weight: 700; }
.section-head .sec-count { font-size: 12px; color: var(--text-tertiary); margin-left: auto; }

.category-group { margin-bottom: 22px; }
.category-title {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 10px; display: flex; align-items: center; gap: 7px;
}
.category-title::before { content: ""; width: 3px; height: 13px; background: var(--accent); border-radius: 2px; }

/* ===== 新闻卡片 ===== */
.card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px; margin-bottom: 10px;
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--border-strong); }
.card.highlight { background: var(--highlight-bg); border-color: var(--highlight-border); }

.card-title { font-size: 15px; font-weight: 600; line-height: 1.45; margin-bottom: 7px; }
.card-title a:hover { color: var(--accent); }
.card-title .ext { font-size: 11px; color: var(--text-tertiary); margin-left: 4px; }

.card-summary { font-size: 13.5px; color: var(--text-secondary); line-height: 1.65; }
.card-summary.clamped { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.expand-btn { border: none; background: none; color: var(--accent); font-size: 12.5px; cursor: pointer; padding: 4px 0 0; font-family: var(--font); }

.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; }
.region-badge { padding: 1px 8px; border-radius: 4px; font-weight: 600; font-size: 11px; }
.region-badge.domestic { color: var(--domestic); background: var(--domestic-bg); }
.region-badge.oversea { color: var(--oversea); background: var(--oversea-bg); }
.card-source { color: var(--text-secondary); }
.card-time { color: var(--text-tertiary); }
.select-reason { padding: 1px 8px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 11px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.tag { font-size: 11px; color: var(--text-tertiary); background: var(--bg-subtle); padding: 1px 7px; border-radius: 4px; }
.related-sources { margin-top: 8px; font-size: 12px; color: var(--text-tertiary); }
.related-sources a { color: var(--text-secondary); text-decoration: underline; text-underline-offset: 2px; margin-right: 8px; }

/* ===== 综述卡片（周/月精选）===== */
.narrative {
  background: var(--accent-soft); border: 1px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: var(--radius);
  padding: 18px 20px; margin: 20px 0 28px;
}
.narrative-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.narrative-head h2 { font-size: 17px; font-weight: 700; }
.narrative-range { font-size: 12.5px; color: var(--text-secondary); margin-left: auto; }
.narrative-body { font-size: 14px; line-height: 1.8; color: var(--text); white-space: pre-wrap; }
.narrative-toggle { display: none; }

/* ===== 状态态 ===== */
.status-slot { text-align: center; padding: 60px 20px; color: var(--text-tertiary); font-size: 14px; }
.skeleton { display: flex; flex-direction: column; gap: 12px; }
.skeleton-card { height: 90px; background: var(--bg-subtle); border-radius: var(--radius); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:.55} 50%{opacity:1} }

/* ===== 页脚 ===== */
.footer { border-top: 1px solid var(--border); margin-top: 20px; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 18px 20px; font-size: 12px; color: var(--text-tertiary); text-align: center; }

.scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }

/* ===== 平板 ===== */
@media (max-width: 1023px) {
  .layout { flex-direction: column; gap: 0; }
  .sidebar {
    width: 100%; position: sticky; top: var(--topbar-h); z-index: 30;
    background: var(--bg-elevated); border-bottom: 1px solid var(--border);
  }
  .sidebar-inner {
    position: static; flex-direction: row; overflow-x: auto; padding: 10px 4px;
    gap: 6px; -webkit-overflow-scrolling: touch;
  }
  .nav-item { width: auto; white-space: nowrap; flex-shrink: 0; }
  .nav-count { display: none; }
  .main { padding: 16px 0 50px; }
}

/* ===== 手机 ===== */
@media (max-width: 767px) {
  :root { --topbar-h: 54px; }
  .brand-sub { display: none; }
  .brand-title { font-size: 15px; }
  .view-tabs { padding: 2px; }
  .view-tab { padding: 5px 9px; font-size: 12px; }
  .topbar-inner { padding: 0 12px; gap: 8px; }
  .layout { padding: 0 12px; }

  .time-picker, .theme-toggle { display: none; }
  .menu-toggle { display: flex; }

  .sidebar {
    position: fixed; top: 0; right: 0; height: 100vh; width: 78%; max-width: 320px;
    transform: translateX(100%); transition: transform 0.25s; z-index: 45; border-left: 1px solid var(--border);
    border-bottom: none;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-inner { flex-direction: column; overflow-y: auto; height: 100%; padding: 70px 14px 20px; }
  .nav-item { width: 100%; }
  .nav-count { display: inline-block; }
  .scrim.open { display: block; }

  .drawer-extra { display: flex; flex-direction: column; gap: 12px; padding: 0 2px 16px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
  .drawer-extra select { width: 100%; padding: 9px 10px; border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text); border-radius: var(--radius-sm); font-size: 14px; font-family: var(--font); }
  .drawer-extra .theme-row { display: flex; align-items: center; justify-content: space-between; }

  .narrative-body.collapsed { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
  .narrative-toggle { display: inline-block; border: none; background: none; color: var(--accent); font-size: 13px; cursor: pointer; margin-top: 8px; font-family: var(--font); }
  .section-head h2 { font-size: 17px; }
  .card-title { font-size: 14.5px; }
}

@media (min-width: 768px) { .drawer-extra { display: none; } }
