/*
 * 股权融资页 · 投资机构检索库
 * ------------------------------------------------------------------
 * 仅负责「链接机构」板块：统计条、资金属性筛选、关键词与多维筛选、
 * 机构卡片、分页、CSV 导入导出。
 * 依赖 styles.css（变量、按钮）与 pages.css（.note 等）。
 * ------------------------------------------------------------------
 */

/* ---------- 检索面板 ---------- */

.directory {
  padding: 24px 18px 26px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse 80% 60% at 92% 0%, rgba(200, 163, 90, 0.16), transparent 62%),
    linear-gradient(155deg, #091728 0%, #122a47 56%, #091728 100%);
  box-shadow: 0 20px 46px rgba(6, 15, 28, 0.24);
  color: var(--white);
}

.dir-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-light);
}

.dir-eyebrow {
  margin: 0;
  color: var(--gold-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.dir-head h3 {
  margin: 7px 0 0;
  font-family: var(--serif);
  font-size: clamp(20px, 4.8vw, 26px);
  font-weight: 700;
}

.dir-version {
  margin: 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.dir-version span {
  color: var(--gold-soft);
}

.dir-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.dir-stats li {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 13px 12px;
  border: 1px solid rgba(234, 214, 164, 0.24);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
}

.dir-stats strong {
  color: var(--gold-soft);
  font-family: var(--serif);
  font-size: clamp(19px, 4.4vw, 26px);
  font-weight: 700;
  line-height: 1.2;
}

.dir-stats span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11.5px;
}

/* ---------- 资金属性切换 ---------- */

.dir-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.dir-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.dir-chip span {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.86);
  font-size: 11px;
  font-weight: 700;
}

.dir-chip:hover {
  border-color: rgba(234, 214, 164, 0.5);
  background: rgba(200, 163, 90, 0.12);
}

.dir-chip.is-active {
  border-color: var(--gold);
  background: var(--gold);
  color: #101c2e;
}

.dir-chip.is-active span {
  background: rgba(16, 28, 46, 0.14);
  color: #101c2e;
}

/* ---------- 搜索与筛选 ---------- */

.dir-filters {
  display: grid;
  gap: 14px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
}

.dir-search label,
.dir-field label {
  display: block;
  margin-bottom: 6px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 12px;
  font-weight: 600;
}

.dir-search input,
.dir-field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 9px;
  background: var(--white);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
}

.dir-search input::placeholder {
  color: #7a8794;
}

.dir-selects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dir-field {
  min-width: 0;
}

.dir-filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dir-reset {
  padding: 8px 16px;
  border: 1px solid rgba(234, 214, 164, 0.5);
  border-radius: 999px;
  background: transparent;
  color: var(--gold-soft);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.dir-reset:hover {
  background: rgba(200, 163, 90, 0.14);
}

.dir-count {
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 13px;
}

.dir-count strong {
  color: var(--gold-soft);
  font-size: 16px;
}

/* ---------- 机构卡片 ---------- */

.dir-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  scroll-margin-top: calc(var(--header-h) + 72px);
}

.dir-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 13px;
  background: var(--white);
  box-shadow: 0 10px 24px rgba(3, 9, 18, 0.2);
  color: var(--ink);
}

.dir-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.dir-name {
  min-width: 0;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* 「（地域）」与公司后缀整块不拆行，避免断成「有限 / 公司」 */
.dir-name-nb {
  white-space: nowrap;
}

.dir-en {
  display: block;
  margin-top: 3px;
  color: var(--muted-soft);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
}

.dir-badge {
  flex: none;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f3ead5;
  color: #6f5320;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* 政府产业基金：与类型标签区分开 */
.dir-badge--gov {
  background: #e3edf6;
  color: #274d6d;
}

.dir-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dir-meta li {
  padding: 3px 8px;
  border-radius: 6px;
  background: #eef3f7;
  color: #425463;
  font-size: 11.5px;
  line-height: 1.6;
}

.dir-card-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.dir-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.dir-actions a {
  color: #6f5320;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
}

.dir-actions a:hover,
.dir-actions a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dir-empty {
  margin: 18px 0 0;
  padding: 34px 18px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.06);
  text-align: center;
}

.dir-empty p {
  margin: 0;
  font-size: 14px;
}

.dir-empty p + p {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12.5px;
}

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

.dir-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}

/* 作者样式的 display:flex 会盖过 UA 的 [hidden]，需显式声明 */
.dir-pager[hidden] {
  display: none;
}

.dir-pager button {
  min-width: 36px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--white);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

.dir-pager button:hover:not(:disabled) {
  background: rgba(200, 163, 90, 0.22);
}

.dir-pager button[aria-current="page"] {
  border-color: var(--gold);
  background: var(--gold);
  color: #101c2e;
  font-weight: 800;
}

.dir-pager button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dir-ellipsis {
  padding: 0 3px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}

.dir-page-info {
  width: 100%;
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
  text-align: center;
}

/* ---------- 响应式 ---------- */

@media (min-width: 640px) {
  .directory {
    padding: 28px 26px 30px;
  }

  .dir-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
  }

  .dir-selects {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dir-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .directory {
    padding: 34px 36px 36px;
  }

  .dir-filters {
    gap: 16px;
    padding: 20px;
  }

  .dir-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .directory {
    padding: 20px 14px 22px;
  }

  .dir-stats {
    gap: 6px;
  }

  .dir-stats li {
    padding: 10px 9px;
  }

  .dir-selects {
    grid-template-columns: 1fr;
  }

  .dir-filters {
    padding: 13px;
  }

  .dir-chip {
    padding: 7px 12px;
    font-size: 12.5px;
  }
}
