/* 气候页专属样式 */

/* 主色：优先用 site.css 的 --brand，缺失时退回 --accent。
   浏览器缓存了旧版 site.css（没有 --brand）时，选中态会变成白底白字。 */
:root { --cl-brand: var(--brand, var(--accent, #2563eb)); }

/* ---------- 通用块 ---------- */

.cl-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 4px;
}
.cl-head h2 { font-size: 18px; margin: 0; }
.cl-note { font-size: 13px; color: var(--text-muted); margin: 6px 0 12px; }

.cl-rank-tabs, .cl-map-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}

/* ---------- 气候地图 ---------- */

.cl-map-panel { margin-bottom: 20px; }

.cl-map-stage {
  display: grid; grid-template-columns: 1fr 190px; gap: 14px; align-items: start;
}
.cl-map-canvas-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #dfeaf5;
}
.cl-map-canvas-wrap canvas {
  display: block; width: 100%; height: 460px; cursor: grab;
}
.cl-map-tip {
  position: absolute; z-index: 5;
  display: flex; flex-direction: column; gap: 1px;
  padding: 7px 10px;
  background: rgba(26, 34, 51, .92); color: #fff;
  border-radius: 8px; font-size: 12px; line-height: 1.45;
  pointer-events: none; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(26, 34, 51, .22);
}
.cl-map-tip b { font-size: 13px; }

.cl-legend { padding-top: 4px; }
.cl-legend-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.cl-legend-bar {
  height: 12px; border-radius: 999px; border: 1px solid var(--border);
}
.cl-legend-ticks {
  position: relative; height: 16px;
  font-size: 11px; color: var(--text-muted); margin-top: 5px;
}
.cl-legend-ticks span {
  position: absolute; top: 0; white-space: nowrap;
}

@media (max-width: 780px) {
  .cl-map-stage { grid-template-columns: 1fr; }
  .cl-map-canvas-wrap canvas { height: 320px; }
}

/* ---------- 关键指标 ---------- */

.cl-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin: 20px 0;
}
.cl-fact {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
}
.cl-fact-k { font-size: 12px; color: var(--text-muted); letter-spacing: .02em; }
.cl-fact-v { font-size: 26px; font-weight: 700; margin: 4px 0 2px; letter-spacing: -0.01em; }
.cl-fact-sub { font-size: 12px; color: var(--text-muted); }

/* ---------- 图表 ---------- */

.cl-svg { display: block; width: 100%; height: auto; margin-top: 6px; }
.cl-grid line { stroke: rgba(26, 34, 51, .09); stroke-width: 1; }
.cl-yl { fill: var(--text-muted); font-size: 11px; text-anchor: end; }
.cl-yl-unit { text-anchor: start; }
.cl-xl { fill: var(--text-muted); font-size: 12px; text-anchor: middle; }
.cl-axis { stroke: rgba(26, 34, 51, .22); stroke-width: 1; }
.cl-zero { stroke: #93a2bd; stroke-width: 1; stroke-dasharray: 5 4; }

.cl-band {
  fill: url(#clGrad);
  fill: #f0b98a;
  opacity: .92;
}
.cl-rbar { fill: #5b9bd5; opacity: .85; }
.cl-path { fill: none; stroke: #c2410c; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.cl-dot { fill: #c2410c; stroke: #fff; stroke-width: 1.5; }

/* ---------- 榜单 ---------- */

.cl-rank-panel { margin-bottom: 20px; }
.cl-rank { list-style: none; margin: 0; padding: 0; }
.cl-rank-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(72px, 128px) 108px;
  align-items: center; gap: 10px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.cl-rank-item:last-child { border-bottom: 0; }
.cl-rank-no {
  font-variant-numeric: tabular-nums; font-weight: 700;
  color: var(--text-muted); text-align: right;
}
.cl-rank-item:nth-child(-n+3) .cl-rank-no { color: var(--accent); }
.cl-rank-name { display: flex; flex-direction: column; min-width: 0; }
.cl-rank-name .cl-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-rank-name em {
  font-style: normal; font-size: 11px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 国家/地区列：国旗 + 中文国名 */
.cl-rank-cc {
  display: flex; align-items: center; min-width: 0;
  font-size: 12.5px; color: var(--text-muted);
  text-decoration: none;
}
.cl-rank-cc .cl-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-rank-cc:hover { color: var(--accent); }
.cl-rank-cc:hover .flag { box-shadow: 0 0 0 1px var(--accent); }
.cl-rank-city { color: inherit; text-decoration: none; min-width: 0; }
.cl-rank-city:hover .cl-rank-name { color: var(--accent); }
.cl-rank-val {
  text-align: right; font-variant-numeric: tabular-nums; font-weight: 600;
}

@media (max-width: 560px) {
  .cl-rank-item { grid-template-columns: 26px minmax(0, 1fr) minmax(64px, 96px) 82px; font-size: 13px; gap: 8px; }
}

/* ---------- 气候类型分区 ---------- */

.cl-groups {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.cl-group {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 12px 14px; background: var(--bg);
}
.cl-group-head { display: flex; align-items: center; gap: 8px; }
.cl-group-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--gc); flex: none;
}
.cl-group-head h3 { font-size: 15px; margin: 0; }
.cl-group-n { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.cl-group-desc { font-size: 12px; color: var(--text-muted); margin: 8px 0 10px; line-height: 1.6; }
.cl-group-codes { display: flex; flex-wrap: wrap; gap: 5px; }
.cl-chip {
  font-size: 12px; text-decoration: none; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px;
}
.cl-chip span { color: #a2aab8; margin-left: 3px; }
.cl-chip:hover { border-color: var(--accent); color: var(--accent); }

.cl-zone-table { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.cl-zone {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 12px 14px; background: var(--bg);
  scroll-margin-top: 20px;
}
.cl-zone-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.cl-zone-head h3 { font-size: 15px; margin: 0; }
.cl-zone-head code {
  font-size: 11px; color: var(--text-muted);
  background: var(--bg-soft); border-radius: 4px; padding: 1px 5px;
}
.cl-zone-n { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.cl-zone-desc { font-size: 12px; color: var(--text-muted); margin: 8px 0; line-height: 1.6; }
.cl-zone-cities { list-style: none; margin: 0; padding: 0; }
.cl-zone-cities li {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 13px; padding: 3px 0; border-top: 1px dashed var(--border);
}
.cl-zone-cities em { font-style: normal; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ---------- 直方图 ---------- */

.cl-two {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.cl-hist { display: flex; flex-direction: column; gap: 3px; }
.cl-hist-row {
  display: grid; grid-template-columns: 74px 1fr 52px;
  align-items: center; gap: 8px; font-size: 12px;
}
.cl-hist-label { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cl-hist-bar { height: 12px; background: var(--bg-soft); border-radius: 3px; overflow: hidden; }
.cl-hist-bar i { display: block; height: 100%; background: #7ea6d8; border-radius: 3px; }
.cl-hist-n { text-align: right; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ---------- 表格 ---------- */

.cl-table-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.cl-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.cl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cl-table th, .cl-table td {
  padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.cl-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-soft); font-weight: 600; color: var(--text-muted);
}
.cl-table tbody tr:last-child th, .cl-table tbody tr:last-child td { border-bottom: 0; }
.cl-table tbody tr:hover { background: #f7f9fc; }
.cl-table td { font-variant-numeric: tabular-nums; }
.cl-city-link { color: inherit; text-decoration: none; }
.cl-city-link:hover .cl-city-name { color: var(--accent); }
.cl-city-name { display: flex; flex-direction: column; }
.cl-city-name em {
  font-style: normal; font-size: 11px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px;
}

/* ---------- 名称行与国旗 ---------- */

.cl-name-line {
  display: flex; align-items: center; gap: 6px; min-width: 0;
}
.cl-name-text {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cl-flag {
  flex: none;
  width: 18px; height: 13px; border-radius: 2px;
}
.cl-empty { text-align: center; color: var(--text-muted); padding: 24px; }
.cl-table-more { font-size: 13px; color: var(--text-muted); margin-top: 10px; }
.cl-table-more .btn { margin-left: 6px; }

/* ---------- 分页 ---------- */

.cl-pager {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 14px;
}
.cl-pager .btn { min-width: 34px; }
.cl-pager .btn.is-active { background: var(--cl-brand); border-color: var(--cl-brand); color: #fff; }
.cl-pager .btn[disabled] { opacity: .45; cursor: default; }
.cl-pager-gap { color: var(--text-muted); font-size: 13px; padding: 0 2px; }

/* ---------- 气候推荐页 ---------- */

.cl-pref-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.cl-pref {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg); cursor: pointer; font: inherit; color: inherit;
  transition: border-color .15s ease, background .15s ease;
}
.cl-pref:hover { border-color: var(--cl-brand); }
.cl-pref.is-active {
  border-color: var(--cl-brand);
  background: color-mix(in srgb, var(--cl-brand) 8%, var(--bg));
}
.cl-pref-ico {
  display: inline-flex; align-items: center; justify-content: center;
  align-self: flex-start;
  width: 30px; height: 30px; margin-bottom: 2px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--cl-brand) 10%, var(--bg-soft));
  color: var(--cl-brand);
}
.cl-pref.is-active .cl-pref-ico {
  background: var(--cl-brand); color: #fff;
}
.cl-pref-ico .ico { width: 18px; height: 18px; }
.cl-pref b { font-size: 15px; }
.cl-pref-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.cl-locate { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.cl-locate-hint { font-size: 13px; color: var(--text-muted); }
.cl-locate-hint.is-warn { color: #b4622a; }
.cl-locate-search { position: relative; margin-top: 10px; max-width: 420px; }
.cl-city-results {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 26px rgba(22, 32, 47, .14); overflow: hidden; max-height: 320px;
  overflow-y: auto;
}
.cl-city-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 9px 12px; border: 0; background: none;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.cl-city-item:last-child { border-bottom: 0; }
.cl-city-item:hover { background: var(--bg-soft); }
.cl-city-item.is-empty { color: var(--text-muted); cursor: default; font-size: 13px; }
.cl-city-cc { font-size: 12px; color: var(--text-muted); flex: none; }

.cl-recommend-table .cl-city-name em { max-width: 180px; }
.cl-topic-table td, .cl-recommend-table td { font-variant-numeric: tabular-nums; }

/* ---------- 专题页 ---------- */

.cl-topic-peers {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 18px;
}
.cl-topic-peer {
  display: inline-block; padding: 5px 13px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-soft);
  font-size: 13px; color: inherit; text-decoration: none;
}
.cl-topic-peer:hover { border-color: var(--cl-brand); color: var(--cl-brand); }
.cl-topic-peer.is-active {
  background: var(--cl-brand); border-color: var(--cl-brand); color: #fff;
}
.cl-topic-peer.is-active:hover { border-color: var(--cl-brand); color: #fff; }
.cl-month-tabs { margin-bottom: 14px; }
.cl-month-tabs .btn.is-active { background: var(--cl-brand); border-color: var(--cl-brand); color: #fff; }

/* ---------- 排行入口卡片 ---------- */

.cl-more-grid {
  display: grid; gap: 12px; margin-top: 10px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.cl-more-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-soft); color: inherit; text-decoration: none;
  transition: border-color .15s ease, transform .15s ease;
}
.cl-more-card:hover { border-color: var(--cl-brand); transform: translateY(-1px); }
.cl-more-k { font-size: 15px; font-weight: 600; }
.cl-more-v { font-size: 22px; font-weight: 700; color: var(--cl-brand); font-variant-numeric: tabular-nums; }
.cl-more-d { font-size: 13px; color: var(--text-muted); }

/* ---------- 热力表 ---------- */

.cl-matrix-wrap { overflow-x: auto; margin-top: 8px; }
.cl-matrix { width: 100%; border-collapse: collapse; font-size: 12px; }
.cl-matrix th, .cl-matrix td {
  padding: 5px 6px; text-align: center; border: 1px solid var(--border);
  white-space: nowrap;
}
.cl-matrix thead th { background: var(--bg-soft); color: var(--text-muted); font-weight: 600; }
.cl-matrix tbody th { background: var(--bg-soft); font-weight: 600; }
.cl-cell {
  background: color-mix(in srgb, #d1495b calc(var(--w) * 1%), #f2f6fb);
  color: #16202f; font-variant-numeric: tabular-nums;
}
.cl-cell-mean { background: var(--bg-soft); font-weight: 600; }
.cl-cell-empty { color: var(--text-muted); }
.cl-cell-rain { display: block; font-size: 10px; color: rgba(22, 32, 47, .62); }
.cl-legend-note { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* ---------- 城市详情页 ---------- */

.cl-city-hero {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.cl-city-kpi {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 11px 13px; background: var(--bg);
}
.cl-city-kpi-k { font-size: 11px; color: var(--text-muted); }
.cl-city-kpi-v { font-size: 20px; font-weight: 700; margin-top: 2px; letter-spacing: -0.01em; }
.cl-city-kpi-v small { font-size: 12px; font-weight: 500; color: var(--text-muted); margin-left: 3px; }
.cl-city-kpi-s { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.cl-zone-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px;
}
.cl-zone-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--gc); }

.cl-ranks {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.cl-rankcard {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 11px 13px; background: var(--bg);
}
.cl-rankcard-k { font-size: 11px; color: var(--text-muted); }
.cl-rankcard-v { font-size: 19px; font-weight: 700; margin-top: 2px; }
.cl-rankcard-v small { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.cl-rankcard-s { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.cl-month-table { overflow-x: auto; margin-top: 8px; }
.cl-mt { width: 100%; border-collapse: collapse; font-size: 12px; }
.cl-mt th, .cl-mt td {
  padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--border);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.cl-mt thead th { background: var(--bg-soft); color: var(--text-muted); font-weight: 600; }
.cl-mt tbody th { text-align: left; font-weight: 600; }

/* ---------- 图标（自托管内联 SVG） ---------- */

/* 指标卡 / 排名卡 */
.cl-fact-k,
.cl-city-kpi-k,
.cl-rankcard-k {
  display: flex; align-items: center; gap: 5px;
}
.cl-fact-k .ico,
.cl-city-kpi-k .ico,
.cl-rankcard-k .ico { width: 13px; height: 13px; opacity: .75; }
.cl-fact-k .fact-ico { color: var(--cl-brand); opacity: 1; }

/* 表格表头 */
.cl-table thead th,
.cl-mt thead th { white-space: nowrap; }
.th-ico { width: 12px; height: 12px; margin-right: 4px; opacity: .6; vertical-align: -0.1em; }

/* tab 按钮 */
.btn .tab-ico { width: 14px; height: 14px; margin-right: 5px; opacity: .75; }
.btn.is-active .tab-ico { opacity: 1; }

/* 榜单说明 */
.note-ico { width: 14px; height: 14px; margin-right: 5px; opacity: .7; vertical-align: -0.12em; }

/* 气候大带分组头 */
.cl-group-head .group-ico {
  width: 18px; height: 18px; color: var(--gc, var(--cl-brand));
}

/* 气候分区头 */
.cl-zone-head .zone-ico {
  width: 17px; height: 17px; color: var(--cl-brand);
}

/* 专题互链 */
.cl-topic-peer {
  display: inline-flex; align-items: center; gap: 6px;
}
.cl-topic-peer .peer-ico { width: 14px; height: 14px; opacity: .8; }
.cl-topic-peer.is-active .peer-ico { opacity: 1; }

/* 排行入口卡 */
.cl-more-k { display: flex; align-items: center; gap: 7px; }
.cl-more-k .more-ico { width: 17px; height: 17px; color: var(--cl-brand); }

/* 步骤标题 */
.cl-step-h { display: flex; align-items: center; gap: 8px; }
.cl-step-h .step-ico { width: 17px; height: 17px; color: var(--cl-brand); }
