/* 大宗商品研究站 —— 统一设计 tokens 与组件 */
:root {
  --bg: #f7f5f2;
  --card: #ffffff;
  --ink: #1c1917;
  --sub: #78716c;
  --hair: #e7e5e4;
  --accent: #b45309;        /* 铜棕 */
  --accent-soft: #fdf3e7;
  --red: #c2410c;           /* 厄尔尼诺/过热/利多 */
  --red-soft: #fdeee4;
  --blue: #1d6fa5;          /* 拉尼娜/过冷/利空 */
  --blue-soft: #e8f1f8;
  --green: #15803d;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(28, 25, 23, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", "Segoe UI", sans-serif;
  --serif: "Songti SC", "STSong", Georgia, serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── 头部 ── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(247, 245, 242, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hair);
}
.header-inner {
  max-width: 1060px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); }
.brand .logo { font-size: 20px; }
.brand .name { font-weight: 700; font-size: 17px; letter-spacing: 0.02em; }
.brand .tag { font-size: 12px; color: var(--sub); }
.site-nav { display: flex; gap: 4px; }
.site-nav a {
  padding: 6px 14px; border-radius: 999px; text-decoration: none;
  color: var(--sub); font-size: 14px; font-weight: 500;
  transition: all 0.15s ease;
}
.site-nav a:hover { color: var(--ink); background: rgba(28, 25, 23, 0.05); }
.site-nav a.active { color: var(--accent); background: var(--accent-soft); }

/* ── 布局 ── */
.container { max-width: 1060px; margin: 0 auto; padding: 28px 20px 64px; }
.page-title { font-family: var(--serif); font-size: 30px; font-weight: 700; margin-bottom: 6px; }
.page-desc { color: var(--sub); font-size: 14px; margin-bottom: 24px; }
.section-title {
  font-size: 15px; font-weight: 700; letter-spacing: 0.06em;
  margin: 36px 0 14px; display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--hair); }
.section-title .sub { font-weight: 400; font-size: 12px; color: var(--sub); letter-spacing: 0; }

/* ── 卡片 ── */
.card {
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card-link { text-decoration: none; color: inherit; display: block; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.card-link:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(28, 25, 23, 0.10); }

/* ── 徽章 ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-nino { background: var(--red-soft); color: var(--red); }
.badge-nina { background: var(--blue-soft); color: var(--blue); }
.badge-neutral { background: #f1efec; color: var(--sub); }
.badge-hot { background: var(--red-soft); color: var(--red); }
.badge-cold { background: var(--blue-soft); color: var(--blue); }
.badge-up { background: var(--red-soft); color: var(--red); }
.badge-down { background: var(--blue-soft); color: var(--blue); }
.badge-mixed { background: #f4f1ec; color: #8a7360; }
.badge-none { background: #f1efec; color: var(--sub); }

/* ── ENSO 横幅 ── */
.enso-banner { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: center; }
.enso-banner .phase-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.enso-banner .oni-value { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.enso-banner .meta { color: var(--sub); font-size: 13px; }
.enso-banner .spark-box { text-align: right; }
.enso-banner .spark-label { font-size: 12px; color: var(--sub); margin-bottom: 4px; }

/* ── 拥挤度榜 ── */
.crowd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.crowd-list { list-style: none; }
.crowd-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 4px; border-bottom: 1px dashed var(--hair); font-size: 14px;
}
.crowd-list li:last-child { border-bottom: none; }
.crowd-list .cname { width: 84px; font-weight: 600; }
.crowd-list .cpct { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; }
.crowd-list a { text-decoration: none; color: inherit; display: flex; align-items: center; gap: 10px; width: 100%; }
.crowd-list a:hover .cname { color: var(--accent); }

/* ── 分位条 ── */
.pct-track {
  position: relative; flex: 1; height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, #cfe0ee 0%, #f1efec 30%, #f1efec 70%, #f5d9c4 100%);
  min-width: 90px;
}
.pct-marker {
  position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--card); border: 3px solid var(--sub);
}
.pct-marker.hot { border-color: var(--red); }
.pct-marker.cold { border-color: var(--blue); }

/* ── 品种卡片 ── */
.sector-label { font-family: var(--serif); font-size: 19px; font-weight: 700; margin: 30px 0 12px; display: flex; align-items: baseline; gap: 10px; }
.sector-label .en { font-size: 12px; color: var(--sub); font-weight: 400; letter-spacing: 0.08em; }
.commodity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.commodity-card .cc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.commodity-card .cc-name { font-weight: 700; font-size: 16px; }
.commodity-card .cc-en { font-size: 11px; color: var(--sub); letter-spacing: 0.05em; text-transform: uppercase; }
.commodity-card .cc-note { font-size: 12.5px; color: var(--sub); line-height: 1.55; min-height: 40px; margin: 6px 0 12px; }
.commodity-card .cc-cot { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--sub); }
.commodity-card .cc-cot .val { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.commodity-card .cc-nocot { font-size: 12px; color: var(--sub); }

/* ── 图表面板 ── */
.panel { margin-bottom: 20px; }
.panel h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.panel .panel-sub { font-size: 12.5px; color: var(--sub); margin-bottom: 14px; }
.chart-wrap { width: 100%; overflow: hidden; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-legend { display: flex; gap: 18px; font-size: 12px; color: var(--sub); margin-top: 10px; flex-wrap: wrap; }
.chart-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .swatch { width: 14px; height: 4px; border-radius: 2px; }

/* ── 强度标尺 ── */
.gauge-track {
  position: relative; height: 22px; border-radius: 999px; margin: 26px 6px 34px;
  background: linear-gradient(90deg, #1d6fa5 0%, #7fb3d5 20%, #e8e4de 38%, #e8e4de 62%, #f0b48a 80%, #c2410c 100%);
}
.gauge-marker {
  position: absolute; top: -8px; transform: translateX(-50%);
  width: 4px; height: 38px; background: var(--ink); border-radius: 2px;
}
.gauge-marker::after {
  content: attr(data-label); position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--ink);
}
.gauge-ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--sub); margin: -28px 6px 0; }

/* ── 品种综合结论 ── */
.verdict-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 4px 22px; }
.verdict-item { padding: 10px 0; border-bottom: 1px dashed var(--hair); }
.verdict-item .v-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.verdict-item .v-sector { font-size: 11px; color: var(--sub); }
.verdict-item .v-head .badge { margin-left: auto; }
.verdict-item .v-reason { font-size: 12.5px; color: var(--sub); line-height: 1.55; }
.sig-text { display: inline-block; margin-right: 6px; font-size: 12px; color: var(--sub); }

/* ── 影响映射表 ── */
.impact-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.impact-table th {
  text-align: left; padding: 10px 12px; font-size: 12px; color: var(--sub);
  border-bottom: 1px solid var(--hair); font-weight: 600; letter-spacing: 0.04em;
}
.impact-table td { padding: 10px 12px; border-bottom: 1px solid var(--hair); vertical-align: top; }
.impact-table tr:last-child td { border-bottom: none; }
.cond { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.cond-dry { background: var(--red-soft); color: var(--red); }
.cond-wet { background: var(--blue-soft); color: var(--blue); }

/* ── COT 表 ── */
.cot-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.cot-table th {
  text-align: right; padding: 10px 12px; font-size: 12px; color: var(--sub);
  border-bottom: 1px solid var(--hair); font-weight: 600; white-space: nowrap;
}
.cot-table th:first-child, .cot-table td:first-child { text-align: left; }
.cot-table td { padding: 11px 12px; border-bottom: 1px solid var(--hair); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cot-table td .sub-en { display: block; font-size: 11px; color: var(--sub); }
.cot-row { cursor: pointer; transition: background 0.12s ease; }
.cot-row:hover { background: #fbf9f6; }
.cot-row.open { background: #fbf9f6; }
.cot-detail td { padding: 4px 12px 20px; white-space: normal; }
.pos { color: var(--red); font-weight: 600; }
.neg { color: var(--blue); font-weight: 600; }

/* ── 页脚 ── */
.site-footer {
  border-top: 1px solid var(--hair); margin-top: 40px;
  padding: 24px 20px 40px; text-align: center;
  font-size: 12px; color: var(--sub); line-height: 1.8;
}
.site-footer a { color: var(--accent); text-decoration: none; }

/* ── 影响地图 ── */
#impact-map svg { display: block; width: 100%; height: auto; }
.region-blob { transition: opacity 0.15s ease, stroke-width 0.15s ease; }
#impact-map [data-region]:hover .region-blob,
#impact-map [data-region].active .region-blob { opacity: 0.55; stroke-width: 2.2; stroke-opacity: 0.9; }
#impact-map [data-region]:hover .region-label,
#impact-map [data-region].active .region-label { font-weight: 700; }
.region-label { pointer-events: none; }
.impact-row { cursor: pointer; transition: background 0.15s ease; }
.impact-row:hover { background: #fbf9f6; }
.impact-row.flash { animation: rowflash 1.6s ease; }
@keyframes rowflash {
  0%, 100% { background: transparent; }
  15%, 55% { background: var(--accent-soft); }
}

/* ── 地图图层筛选 ── */
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 5px 14px; border-radius: 999px; border: 1px solid var(--hair);
  background: var(--card); color: var(--sub); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.15s ease; font-family: inherit;
}
.chip:hover { color: var(--ink); border-color: #d6d2cb; background: #fbf9f6; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter-select {
  margin-left: auto; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--hair);
  background: var(--card); color: var(--ink); font-size: 13px; font-family: inherit; cursor: pointer; outline: none;
}
#impact-map [data-region].dimmed { opacity: 0.12; pointer-events: none; }
.impact-row.dimmed { opacity: 0.35; }

/* ── 气候因子卡片 ── */
.climate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.climate-card .cc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.climate-card .cc-name { font-weight: 700; font-size: 15px; }
.climate-card .cc-en { font-size: 11px; color: var(--sub); font-weight: 400; letter-spacing: 0.04em; }
.climate-card .cc-value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.climate-card .cc-value .cc-date { font-size: 12px; color: var(--sub); font-weight: 400; letter-spacing: 0; }
.climate-card .cc-spark { margin: 8px 0; }
.climate-card .cc-note { font-size: 12.5px; color: var(--sub); line-height: 1.6; }
.climate-card .cc-note a { color: var(--accent); text-decoration: none; }
.climate-card .mjo-zones { font-size: 12.5px; color: var(--sub); margin-top: 4px; }
.climate-card .mjo-zones b { color: var(--ink); font-variant-numeric: tabular-nums; }
.ftag {
  display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11px;
  background: #f1efec; color: var(--sub); font-weight: 600; white-space: nowrap; margin-right: 4px;
}

/* ── reveal 动画 ── */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (max-width: 760px) {
  .enso-banner { grid-template-columns: 1fr; }
  .enso-banner .spark-box { text-align: left; }
  .crowd-grid { grid-template-columns: 1fr; }
  .cot-table th:nth-child(3), .cot-table td:nth-child(3) { display: none; }
  .impact-table th:nth-child(5), .impact-table td:nth-child(5) { display: none; }
  .page-title { font-size: 24px; }
  .filter-select { margin-left: 0; flex: 1; }
}
