/* ============================================================
   台湾时事观察 · 样式表
   ============================================================ */

:root {
  --red: #a3122b;
  --red-hover: #c02a45;
  --red-soft: #fdf2f3;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #fbfaf8;
  --text: #1c1b19;
  --text-2: #6b6862;
  --text-3: #9a9791;
  --border: #e4e1da;
  --border-2: #d5d1c8;
  --shadow: 0 1px 2px rgba(28, 27, 25, .04), 0 4px 16px rgba(28, 27, 25, .05);
  --shadow-hover: 0 2px 6px rgba(28, 27, 25, .07), 0 10px 28px rgba(28, 27, 25, .09);

  --c-policy: #a3122b;
  --c-exchange: #0f6e5c;
  --c-island: #b26b00;
  --c-intl: #1f5f8b;
  --c-society: #6b4e9b;
}

html[data-theme="dark"] {
  --red: #e0465f;
  --red-hover: #f0627c;
  --red-soft: #2c1a1e;
  --bg: #16171a;
  --surface: #1e2024;
  --surface-2: #23262b;
  --text: #e9e7e3;
  --text-2: #a3a09a;
  --text-3: #77746e;
  --border: #31343a;
  --border-2: #3d4148;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-hover: 0 2px 8px rgba(0, 0, 0, .35), 0 10px 28px rgba(0, 0, 0, .4);

  --c-policy: #e0465f;
  --c-exchange: #35a893;
  --c-island: #e0a03c;
  --c-intl: #5aa0d4;
  --c-society: #a58bd6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Source Han Sans SC", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

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

/* ---------------- Header ---------------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  width: 46px; height: 46px;
  flex: 0 0 46px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: var(--shadow);
}

.brand-text h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: .5px;
  font-family: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
}

.tagline { margin: 2px 0 0; font-size: 12.5px; color: var(--text-2); letter-spacing: .2px; }

.header-actions { display: flex; align-items: center; gap: 14px; }

.update-time {
  text-align: right;
  font-size: 11.5px;
  color: var(--text-2);
  line-height: 1.35;
}
.update-time strong { display: block; font-size: 13px; color: var(--text); font-weight: 600; }

.btn-ghost {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  transition: all .18s ease;
}
.btn-ghost:hover { border-color: var(--border-2); color: var(--text); background: var(--surface); }

/* ---------------- 立场声明 ---------------- */
.statement {
  background: var(--red-soft);
  border-bottom: 1px solid var(--border);
}
.statement-inner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding-top: 12px;
  padding-bottom: 12px;
  font-size: 13px;
  line-height: 1.7;
}
.statement-tag {
  flex: 0 0 auto;
  background: var(--red);
  color: #fff;
  padding: 2px 9px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 1px;
  margin-top: 2px;
}
.statement p { margin: 0; color: var(--text-2); }
.statement strong { color: var(--red); font-weight: 600; }

/* ---------------- 统计条 ---------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 22px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat-num {
  display: block;
  font-size: 26px;
  font-weight: 700;
  color: var(--red);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 12px; color: var(--text-2); }

/* ---------------- 筛选栏 ---------------- */
.filters {
  margin-top: 22px;
  padding-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 12px; }

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  padding: 6px 15px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all .18s ease;
  white-space: nowrap;
}
.chip:hover { border-color: var(--border-2); color: var(--text); }
.chip.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  font-weight: 500;
}
.chip .chip-count { opacity: .65; margin-left: 5px; font-size: 11.5px; }

.filter-tools { display: flex; gap: 10px; padding-bottom: 12px; flex-wrap: wrap; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.icon-search {
  position: absolute;
  left: 11px;
  width: 15px; height: 15px;
  fill: none;
  stroke: var(--text-3);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}
#searchInput {
  width: 230px;
  padding: 8px 30px 8px 33px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .18s ease;
}
#searchInput:focus { border-color: var(--red); }
#searchInput::placeholder { color: var(--text-3); }

.clear-btn {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}
.clear-btn:hover { color: var(--text); }

.select-box {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}
.select-box:focus { border-color: var(--red); }

/* ---------------- 主体布局 ---------------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 30px;
  margin-top: 26px;
  padding-bottom: 50px;
  align-items: start;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 14px;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  letter-spacing: .3px;
}
.section-title .bar {
  width: 3px; height: 15px;
  background: var(--red);
  border-radius: 2px;
}
.count-badge {
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 9px;
  font-family: inherit;
  font-weight: 400;
}

/* ---------------- 头条 ---------------- */
.headline-block { margin-bottom: 30px; }
.headline-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 14px;
}

.hl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: all .2s ease;
  display: block;
  position: relative;
  overflow: hidden;
}
.hl-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--cat-color, var(--red));
}
.hl-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
  border-color: var(--border-2);
}

.hl-lead { grid-row: span 3; padding: 22px 24px; }
.hl-lead .hl-title {
  font-size: 21px;
  line-height: 1.45;
  font-weight: 700;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  margin: 0 0 10px;
}
.hl-lead .hl-sum {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.75;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hl-side { display: grid; gap: 14px; }
.hl-side .hl-card { padding: 14px 16px; }
.hl-side .hl-title { font-size: 15px; font-weight: 600; margin: 0 0 6px; line-height: 1.5; }
.hl-side .hl-sum {
  font-size: 12.5px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.65;
}

.hl-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 11px;
}

/* ---------------- 时间线列表 ---------------- */
.timeline { display: flex; flex-direction: column; }

.date-group { margin-bottom: 6px; }
.date-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 20px 0 10px;
}
.date-head .date-main {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.date-head .date-week { font-size: 11.5px; color: var(--text-3); }
.date-head .date-rule { flex: 1; height: 1px; background: var(--border); }
.date-head .date-count { font-size: 11.5px; color: var(--text-3); }

.news-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 14px 17px;
  margin-bottom: 9px;
  display: block;
  position: relative;
  transition: all .18s ease;
}
.news-item:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow-hover);
  transform: translateX(2px);
}

.news-title {
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.55;
  margin: 0 0 7px;
  color: var(--text);
}
.news-item:hover .news-title { color: var(--red); }

.news-sum {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-3);
  flex-wrap: wrap;
}

.cat-tag {
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--cat-color);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
}
/* 现代浏览器下用主色着底，不支持 color-mix 时回退到上面的中性底色 */
@supports (background: color-mix(in srgb, red 10%, transparent)) {
  .cat-tag {
    background: color-mix(in srgb, var(--cat-color) 11%, transparent);
    border-color: color-mix(in srgb, var(--cat-color) 26%, transparent);
  }
}

.src-tag { color: var(--text-2); font-weight: 500; }
.meta-dot { color: var(--border-2); }

.load-more-wrap { text-align: center; margin-top: 22px; }
.btn-more {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 10px 34px;
  border-radius: 8px;
  font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
  transition: all .18s ease;
}
.btn-more:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px dashed var(--border-2);
  border-radius: 10px;
}
.empty-state p { margin: 0 0 14px; }

/* ---------------- 侧栏 ---------------- */
.col-side { position: sticky; top: 92px; display: grid; gap: 16px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 17px;
  box-shadow: var(--shadow);
}
.panel-title {
  margin: 0 0 13px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.panel-title::before {
  content: "";
  width: 2px; height: 12px;
  background: var(--red);
  border-radius: 1px;
}

/* 趋势图 */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .bar { fill: var(--red); opacity: .78; transition: opacity .15s ease; }
.chart .bar:hover { opacity: 1; }
.chart .bar-label { fill: var(--text-3); font-size: 8.5px; text-anchor: middle; }
.chart .axis { stroke: var(--border); stroke-width: 1; }

/* 分类条 */
.cat-bars { display: grid; gap: 10px; }
.cat-row { display: grid; grid-template-columns: 62px 1fr 30px; gap: 9px; align-items: center; font-size: 12px; }
.cat-row .cat-name { color: var(--text-2); }
.cat-row .cat-track { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; border: 1px solid var(--border); }
.cat-row .cat-fill { height: 100%; border-radius: 3px; background: var(--cat-color); transition: width .5s ease; }
.cat-row .cat-num { text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* 热词 */
.topics { display: flex; flex-wrap: wrap; gap: 7px; }
.topic {
  padding: 3px 10px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12px;
  transition: all .15s ease;
  cursor: pointer;
}
.topic:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.topic .topic-n { font-size: 10px; opacity: .6; margin-left: 4px; }

/* 信源 */
.source-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.source-list li { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; gap: 8px; }
.source-list a { color: var(--text-2); transition: color .15s ease; }
.source-list a:hover { color: var(--red); }
.source-list .s-count { color: var(--text-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }

.panel-tip p { margin: 0; font-size: 12px; color: var(--text-2); line-height: 1.7; }
.panel-tip code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11.5px;
  font-family: "Cascadia Mono", Consolas, monospace;
  color: var(--red);
}

/* ---------------- 推广位 ---------------- */
.ad-slot {
  max-width: 1180px;
  margin: 0 auto 18px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.ad-label {
  flex: 0 0 auto;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 5px;
  letter-spacing: .5px;
}

.ad-content { display: inline-flex; align-items: center; }
.ad-content img { display: block; max-width: 100%; height: auto; }

/* ---------------- 页脚 ---------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 26px 0 34px;
  margin-top: 20px;
}
.site-footer p { margin: 0 0 6px; font-size: 13px; }
.footer-note { font-size: 12px; color: var(--text-3); line-height: 1.7; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .col-side { position: static; grid-template-columns: repeat(2, 1fr); }
  .headline-grid { grid-template-columns: 1fr; }
  .hl-lead { grid-row: auto; }
}

@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .col-side { grid-template-columns: 1fr; }
  .filters { flex-direction: column; align-items: stretch; }
  .filter-tools { flex-direction: column; }
  #searchInput { width: 100%; }
  .select-box { width: 100%; }
  .header-inner { flex-wrap: wrap; }
  .brand-text h1 { font-size: 20px; }
  .statement-inner { flex-direction: column; gap: 8px; }
}

@media print {
  .site-header, .filters, .col-side, .load-more-wrap, .site-footer { display: none; }
}
