/* =========================================================================
   Industry Cluster Map — 页面样式
   复用 /assets/styles.css 的设计变量与 .page-header / .container 等骨架，
   这里只定义本页特有组件。配色取站点既有的 navy / crimson / gold。
   ========================================================================= */

:root {
  --im-f: #1d6a4f;      /* manufacturing cluster */
  --im-f-bg: #e8f5ef;
  --im-m: #8a5a1a;      /* wholesale market */
  --im-m-bg: #fdf3e3;
  --im-s: #5b4b8a;      /* online seller hub */
  --im-s-bg: #f0edf9;
}

/* ---------- 搜索框（位于浅色 page-header 内） ---------- */
.im-searchwrap { margin: 2rem 0 0.75rem; max-width: 520px; position: relative; }
.im-search {
  width: 100%;
  box-sizing: border-box;
  padding: 0.875rem 2.75rem 0.875rem 2.75rem;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.im-search:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(10, 37, 64, .08);
}
.im-search-icon {
  position: absolute; left: 0.875rem; top: 50%; transform: translateY(-50%);
  color: var(--text-light); pointer-events: none; line-height: 0;
}
.im-search-clear {
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  background: none; border: 0; cursor: pointer; padding: 0.375rem;
  color: var(--text-light); line-height: 0; border-radius: 6px; display: none;
}
.im-search-clear:hover { background: var(--bg-alt); color: var(--text); }
.im-search-clear.show { display: block; }
.im-searchhint { font-size: 0.875rem; color: var(--text-light); margin: 0; }
.im-hintcount { color: var(--navy); font-weight: 600; margin-left: 0.5rem; }

/* ---------- 统计条 ---------- */
.im-stats {
  display: flex; flex-wrap: wrap; gap: 2.5rem;
  padding: 1.75rem 0; border-bottom: 1px solid var(--border);
}
.im-stat .n {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.75rem; font-weight: 600; color: var(--navy);
  display: block; line-height: 1.1;
}
.im-stat .l {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-light); font-weight: 500;
}

/* ---------- 分区 ---------- */
.im-section { padding: 3.5rem 0; }
.im-section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); }
.im-section-head { margin-bottom: 1.75rem; }
.im-section-head h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.625rem; margin: 0 0 0.5rem; color: var(--navy);
}
.im-section-head p {
  color: var(--text-muted); margin: 0; max-width: 68ch;
  font-size: 0.9375rem; line-height: 1.7;
}

/* ---------- 板块卡片（带图标） ---------- */
.im-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
}
.im-card {
  text-align: left; cursor: pointer; font: inherit;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 1.25rem; display: flex; gap: 0.875rem; align-items: flex-start;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.im-card:hover {
  border-color: var(--navy);
  box-shadow: 0 8px 24px rgba(10, 37, 64, .08);
  transform: translateY(-2px);
}
.im-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.im-card-icon {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--bg-alt); color: var(--navy);
  transition: background .18s ease, color .18s ease;
}
.im-card-icon svg { width: 21px; height: 21px; }
.im-card:hover .im-card-icon { background: var(--navy); color: #fff; }

.im-card-body { flex: 1 1 auto; min-width: 0; display: block; }
.im-card-top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.625rem; margin-bottom: 0.375rem;
}
.im-card-h {
  font-size: 1rem; color: var(--navy); font-weight: 600; line-height: 1.35;
}
.im-count {
  font-size: 0.75rem; color: var(--text-light); white-space: nowrap;
  background: var(--bg-alt); padding: 0.125rem 0.5rem; border-radius: 20px;
  font-weight: 600;
}
.im-card:hover .im-count { background: #fff; }
.im-card-eg {
  display: block; font-size: 0.8125rem; color: var(--text-light); line-height: 1.55;
}

/* ---------- 徽章 ---------- */
.im-badge {
  display: inline-flex; align-items: center;
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.02em;
  padding: 0.1875rem 0.5rem; border-radius: 4px; white-space: nowrap;
}
.im-badge-f { background: var(--im-f-bg); color: var(--im-f); }
.im-badge-m { background: var(--im-m-bg); color: var(--im-m); }
.im-badge-s { background: var(--im-s-bg); color: var(--im-s); }

.im-vf {
  display: inline-flex; align-items: center; gap: 0.3125rem;
  font-size: 0.6875rem; white-space: nowrap; color: var(--text-light);
}
.im-vf::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: 0 0 auto;
}
.im-vf-v { color: var(--im-f); }
.im-vf-w { color: var(--text-muted); }
.im-vf-r { color: #94a3b8; }

/* ---------- 图例 ---------- */
.im-legend {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}
.im-legend-item {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 1.25rem; background: #fff;
  border-top: 3px solid var(--border);
}
.im-legend-f { border-top-color: var(--im-f); }
.im-legend-m { border-top-color: var(--im-m); }
.im-legend-s { border-top-color: var(--im-s); }
.im-legend-item h4 {
  margin: 0 0 0.625rem; font-size: 0.9375rem;
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.im-legend-n { font-weight: 400; color: var(--text-light); font-size: 0.8125rem; }
.im-legend-item p {
  margin: 0 0 0.75rem; font-size: 0.875rem; line-height: 1.6; color: var(--text-muted);
}
.im-legend-item dl { margin: 0; font-size: 0.8125rem; line-height: 1.55; }
.im-legend-item dt {
  font-weight: 600; color: var(--text); margin-top: 0.5rem;
  font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.im-legend-item dd { margin: 0.1875rem 0 0; color: var(--text-muted); }

/* ---------- 结果区 ---------- */
.im-results { padding: 3rem 0 4rem; }
.im-back {
  background: none; border: 0; font: inherit; cursor: pointer;
  color: var(--text-muted); font-size: 0.875rem; padding: 0.375rem 0;
  margin-bottom: 1rem; display: inline-flex; align-items: center; gap: 0.5rem;
  transition: color .2s ease;
}
.im-back:hover { color: var(--crimson); }

.im-results-head { margin-bottom: 1.5rem; }
.im-results-head h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.75rem; margin: 0 0 0.375rem; color: var(--navy);
}
.im-results-head .im-meta { font-size: 0.875rem; color: var(--text-light); }

.im-groups { display: flex; flex-direction: column; gap: 2rem; }
.im-group > h3 {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-light); margin: 0 0 0.625rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border); font-weight: 600;
}
.im-group > h3 span { color: var(--text-light); font-weight: 400; }

.im-list { list-style: none; margin: 0; padding: 0; }
.im-row { border-bottom: 1px solid var(--border); }
.im-row-btn {
  width: 100%; box-sizing: border-box; text-align: left; font: inherit;
  background: none; border: 0; cursor: pointer; padding: 0.875rem 0.5rem;
  display: flex; align-items: flex-start; gap: 0.875rem; transition: background .15s ease;
}
.im-row-btn:hover { background: var(--bg-alt); }
.im-row-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.im-row-main { flex: 1 1 auto; min-width: 0; }
.im-row-cat {
  display: block; font-size: 0.9375rem; color: var(--navy);
  font-weight: 600; margin-bottom: 0.1875rem;
}
.im-row-loc { display: block; font-size: 0.8125rem; color: var(--text-muted); }
.im-row-side {
  flex: 0 0 auto; display: flex; flex-direction: column;
  align-items: flex-end; gap: 0.375rem; padding-top: 0.125rem;
}
.im-chev {
  flex: 0 0 auto; color: var(--text-light); padding-top: 0.25rem;
  transition: transform .2s ease; line-height: 0;
}
.im-row-btn[aria-expanded="true"] .im-chev { transform: rotate(90deg); }

.im-detail { padding: 0 0.5rem 1.25rem; display: none; }
.im-detail.open { display: block; }
.im-detail-grid {
  display: grid; gap: 0.875rem 1.75rem; margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  background: var(--bg-alt); padding: 1.125rem 1.25rem; border-radius: 8px;
}
.im-detail dt {
  font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-light); font-weight: 600; margin-bottom: 0.25rem;
}
.im-detail dd {
  margin: 0; color: var(--text-muted); font-size: 0.875rem; line-height: 1.6;
}
.im-src {
  margin: 0.875rem 0 0; font-size: 0.8125rem; color: var(--text-light);
  padding-left: 0.75rem; border-left: 2px solid var(--border); line-height: 1.6;
}
.im-src strong { color: var(--text-muted); }
/* Browse 区的搜索引导 */
.im-search-cta {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin-top: 0.75rem; padding: 0.5rem 0.9rem;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 0.8125rem; color: var(--navy); background: #fff;
  text-decoration: none;
}
.im-search-cta:hover { border-color: var(--navy); }
/* ---------- 板块长文 ---------- */
.im-brief {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.35rem 1.6rem;
  margin-bottom: 2rem;
}
/* 图文混排：第一张右浮（why 段），第二张左浮（where 段）；
   ::after 清浮动，防止最后的段落溢出到图下 */
.im-brief::after { content: ''; display: block; clear: both; }
.im-brief-fig {
  float: right; width: 44%;
  margin: 0.2rem 0 0.7rem 1.25rem;
}
.im-brief-fig-left {
  float: left;
  margin: 0.2rem 1.25rem 0.7rem 0;
}
.im-brief-fig img {
  display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 6px;
}
.im-brief-block + .im-brief-block { margin-top: 0.85rem; }
.im-brief-block h3 {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--crimson); font-weight: 600; margin: 0 0 0.4rem;
}
.im-brief-block p {
  margin: 0; font-size: 0.9375rem; line-height: 1.7;
  color: var(--text-muted); max-width: 76ch;
}
.im-brief-note {
  margin: 1.25rem 0 0; padding-top: 0.875rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem; line-height: 1.6; color: var(--text-light);
}

/* ---------- 单条详情内的 CTA 按钮 ---------- */
.im-detail-cta { margin: 1.125rem 0 0; }
.im-cta-inline {
  display: flex; align-items: center; gap: 0.875rem;
  background: var(--navy); color: #fff !important;
  padding: 0.875rem 1.125rem; border-radius: 8px;
  text-decoration: none; max-width: 420px;
  transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}
.im-cta-inline:hover {
  background: var(--crimson);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(200, 16, 46, .24);
}
.im-cta-inline-icon {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 7px;
  background: rgba(255, 255, 255, .14);
  display: grid; place-items: center;
}
.im-cta-inline-icon svg { width: 19px; height: 19px; }
.im-cta-inline-text { flex: 1 1 auto; min-width: 0; display: block; }
.im-cta-inline-main {
  display: block; font-size: 0.9375rem; font-weight: 600; line-height: 1.3;
}
.im-cta-inline-sub {
  display: block; font-size: 0.75rem; color: rgba(255, 255, 255, .72);
  margin-top: 0.125rem;
}
.im-cta-inline-arrow { flex: 0 0 auto; line-height: 0; opacity: .8; }
.im-cta-inline-arrow svg { width: 17px; height: 17px; }
.im-cta-inline:hover .im-cta-inline-arrow { opacity: 1; }

.im-empty { padding: 2.5rem 0; color: var(--text-muted); }
.im-empty p { margin: 0 0 0.5rem; }
.im-empty strong { color: var(--text); }

/* ---------- CTA ---------- */
.im-cta {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff; padding: 4rem 0;
}
.im-cta-inner { max-width: 640px; }
.im-cta h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.5rem, 3vw, 2rem); margin: 0 0 0.875rem; color: #fff;
}
.im-cta p {
  font-size: 1rem; line-height: 1.7; color: rgba(255, 255, 255, .82); margin: 0 0 1.5rem;
}
.im-cta-btn {
  display: inline-block; background: #fff; color: var(--navy);
  padding: 0.8125rem 1.75rem; border-radius: 6px;
  font-size: 0.9375rem; font-weight: 600; text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
}
.im-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
  color: var(--navy);
}
.im-cta-small {
  font-size: 0.8125rem; color: rgba(255, 255, 255, .58);
  margin: 1rem 0 0 !important;
}

/* ---------- 数据说明 ---------- */
.im-note { background: var(--bg-alt); border-top: 1px solid var(--border); padding: 3rem 0; }
.im-note h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.25rem; color: var(--navy); margin: 0 0 0.875rem;
}
.im-note p {
  font-size: 0.875rem; line-height: 1.75; color: var(--text-muted);
  max-width: 78ch; margin: 0 0 0.75rem;
}
.im-note .im-scope {
  font-size: 0.8125rem; color: var(--text-light);
  padding-left: 0.875rem; border-left: 2px solid var(--border); margin-top: 1.25rem;
}
.im-note .im-rev { font-size: 0.8125rem; color: var(--text-light); margin-top: 1rem; }

/* ---------- RTL（阿拉伯语） ---------- */
[dir="rtl"] .im-search { padding-right: 2.75rem; padding-left: 2.75rem; }
[dir="rtl"] .im-search-icon { left: auto; right: 0.875rem; }
[dir="rtl"] .im-search-clear { right: auto; left: 0.5rem; }
[dir="rtl"] .im-src { padding-left: 0; padding-right: 0.75rem; border-left: 0; border-right: 2px solid var(--border); }
[dir="rtl"] .im-note .im-scope { padding-left: 0; padding-right: 0.875rem; border-left: 0; border-right: 2px solid var(--border); }
[dir="rtl"] .im-chev { transform: rotate(180deg); }
[dir="rtl"] .im-row-btn[aria-expanded="true"] .im-chev { transform: rotate(90deg); }

@media (max-width: 640px) {
  .im-stats { gap: 1.25rem 2rem; }
  .im-section { padding: 2.5rem 0; }
  .im-row-btn { flex-wrap: wrap; }
  .im-row-side { flex-direction: row; align-items: center; width: 100%; justify-content: flex-start; }
  .im-cta { padding: 3rem 0; }
  /* 窄屏图文混排退化为上下排 */
  .im-brief-fig, .im-brief-fig-left { float: none; width: 100%; margin: 0 0 0.9rem; }
}

/* ===== 长文加载骨架（分片按需加载时的占位，避免布局跳动） ===== */
.im-brief-skeleton { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 8px; }
.im-sk { display: block; height: 13px; border-radius: 6px; background: #e9edf3;
         background-image: linear-gradient(90deg, #e9edf3 0%, #f4f6f9 50%, #e9edf3 100%);
         background-size: 200% 100%; animation: im-sk 1.3s ease-in-out infinite; }
.im-sk-h { height: 18px; width: 34%; margin-bottom: 4px; }
.im-sk-short { width: 62%; }
@keyframes im-sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .im-sk { animation: none; } }
