/* ============================================================
   资源库页面 · 设计系统重构 (基于 dHorde resources 设计稿)
   仅作用于资源页面 (.resources)，不影响站点其它页面。
   主题色沿用站点主蓝 #2773ff，深墨蓝 + 暖珊瑚 signal 点缀。
   ============================================================ */

/* ---------- Design Tokens (scoped to .resources) ---------- */
.resources {
  /* 深墨蓝中性色 */
  --ink-900: #0e1726;
  --ink-800: #16223a;
  --ink-700: #283449;
  --ink-600: #44516a;
  --ink-500: #647189;
  --ink-400: #8a97ad;
  --ink-300: #b6c0d0;
  --ink-200: #dde3ec;
  --ink-100: #eef1f6;
  --ink-50:  #f6f8fb;

  /* 主题蓝（站点主色 #2773ff） */
  --brand-700: #1b62e6;
  --brand-600: #2773ff;
  --brand-500: #3f86ff;
  --brand-400: #5b9bff;
  --brand-100: #e8f1ff;
  --brand-050: #f3f7ff;

  /* 暖珊瑚（HOT / 活动中 / 强调） */
  --signal-600: #e8632e;
  --signal-500: #ff7a45;
  --signal-100: #ffeee6;

  --bg:        #ffffff;
  --bg-soft:   #f5f7fa;
  --surface:   #ffffff;
  --border:    #e6ebf2;
  --border-strong: #d4dce8;

  --text:      #16223a;
  --text-soft: #55617a;
  --text-mute: #8a97ad;

  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 26px; --r-pill: 999px;

  --sh-1: 0 1px 2px rgb(14 23 38 / .06), 0 1px 1px rgb(14 23 38 / .04);
  --sh-2: 0 8px 24px -8px rgb(14 23 38 / .18), 0 2px 6px -2px rgb(14 23 38 / .10);
  --sh-3: 0 18px 40px -12px rgb(14 23 38 / .20);
  --sh-brand: 0 12px 28px -10px rgb(39 115 255 / .45);

  --ease-out: cubic-bezier(.22, .61, .36, 1);
  --t-fast: 140ms var(--ease-out);
  --t-mid: 260ms var(--ease-out);

  --maxw: 1200px;

  background: var(--bg-soft);
  min-height: 100vh;
  padding-top: 64px;
}

/* 兼容现有 back_color 容器 */
.resources.back_color { background: var(--bg-soft); }

/* 资源库页头部：深色固定吸顶（与 search/contact 一致，避免被覆盖） */
.heads.fixhead {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  box-shadow: inset 0 -1px 0 rgb(245 241 241 / .2);
}

/* ---------- Layout helpers ---------- */
.resources .container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 20px; }
.resources .section { padding-block: 44px; }
.resources .section--tight { padding-block: 28px; }
.resources .eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--brand-600); font-weight: 500;
}

/* ---------- Buttons ---------- */
.resources .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: .72rem 1.2rem; border-radius: var(--r-pill);
  font-weight: 600; font-size: 14px; line-height: 1;
  border: 1px solid transparent; text-decoration: none;
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), border-color var(--t-fast);
  white-space: nowrap; cursor: pointer;
}
.resources .btn--primary { background: var(--brand-600); color: #fff; box-shadow: var(--sh-brand); }
.resources .btn--primary:hover { background: var(--brand-700); transform: translateY(-1px); }
.resources .btn--ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.resources .btn--ghost:hover { border-color: var(--brand-500); color: var(--brand-600); background: var(--brand-050); }
.resources .btn--soft { background: var(--brand-050); color: var(--brand-700); }
.resources .btn--soft:hover { background: var(--brand-100); }
.resources .btn--block { width: 100%; }
.resources .btn--sm { padding: .5rem .85rem; font-size: 12px; }

/* ---------- Badges / tags ---------- */
.resources .tag {
  display: inline-flex; align-items: center; gap: .3em;
  font-size: 12px; font-weight: 600; padding: .2rem .55rem; border-radius: var(--r-pill); line-height: 1.4;
}
.resources .tag--type { background: var(--bg-soft); color: var(--text-soft); font-family: "IBM Plex Mono", ui-monospace, monospace; }
.resources .tag--hot { background: var(--signal-100); color: var(--signal-600); }

/* ---------- Page hero (interior) ---------- */
.resources .page-hero {
  padding-block: 48px 28px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--brand-050), var(--bg-soft));
}
.resources .page-hero h1 { font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; margin-top: 12px; }
.resources .page-hero p { color: var(--text-soft); margin-top: 12px; max-width: 60ch; font-size: 16px; line-height: 1.6; }
.resources .page-hero .searchbar {
  display: flex; align-items: center; gap: 10px; margin-top: 22px; max-width: 560px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill);
  padding: .55rem .6rem .55rem 1.1rem; box-shadow: var(--sh-1);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.resources .page-hero .searchbar:focus-within { border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-050); }
.resources .page-hero .searchbar input { flex: 1; border: none; outline: none; background: transparent; font: inherit; font-size: 15px; color: var(--text); }
.resources .page-hero .searchbar input::placeholder { color: var(--text-mute); }
.resources .page-hero .searchbar svg { width: 18px; height: 18px; color: var(--text-mute); flex: none; }
.resources .page-hero .searchbar .btn { flex: none; }

/* ---------- Filter bar ---------- */
.resources .filterbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 26px; }
.resources .chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  padding: .5rem 1rem; border-radius: var(--r-pill); font-size: 14px; font-weight: 500;
  transition: all var(--t-fast); cursor: pointer; text-decoration: none; line-height: 1.2;
}
.resources .chip:hover { border-color: var(--brand-400); color: var(--brand-700); }
.resources .chip[aria-pressed="true"],
.resources .chip.active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.resources .filterbar .spacer { flex: 1 1 auto; }
.resources .select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: .55rem 2rem .55rem .8rem;
  font: inherit; font-size: 14px; background: var(--surface); color: var(--text); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23647189' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .55rem center;
  background-size: 1rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  min-width: 110px;
}
.resources .select:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-050); }
.resources .filterbar .inline-filter { display: inline-flex; align-items: center; gap: 10px; }
.resources .filterbar .filter-label { display: inline-flex; align-items: center; gap: .5rem; font-size: 14px; color: var(--text-soft); white-space: nowrap; }
.resources .res-count { text-align: center; color: var(--text-mute); font-size: 13px; margin-top: 18px; }

/* ---------- Login gate ---------- */
.resources .gate {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  border: 1px dashed var(--brand-400); background: var(--brand-050);
  border-radius: var(--r-md); padding: 18px 22px; margin-bottom: 26px;
}
.resources .gate .txt { flex: 1; min-width: 220px; font-size: 14px; color: var(--text-soft); line-height: 1.6; }
.resources .gate .txt b { color: var(--brand-700); }
.resources .gate .actions { display: flex; gap: 10px; }

/* ---------- Breadcrumb ---------- */
.resources .breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-mute); margin-bottom: 12px; flex-wrap: wrap; }
.resources .breadcrumb a { color: var(--brand-600); text-decoration: none; }
.resources .breadcrumb a:hover { color: var(--brand-700); }
.resources .breadcrumb .sep { color: var(--ink-300); }

/* ---------- Resource grid ---------- */
.resources .res-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

.resources .res-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); overflow: hidden; text-decoration: none; color: inherit;
  transition: transform var(--t-mid), box-shadow var(--t-mid), border-color var(--t-mid);
  animation: cardIn .5s var(--ease-out) both;
}
.resources .res-card:hover { transform: translateY(-4px); box-shadow: var(--sh-2); border-color: var(--brand-400); }

.resources .res-card .cover {
  position: relative; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--ink-800), var(--brand-700)); color: #fff; overflow: hidden;
}
.resources .res-card .cover .cover-img { width: 100%; height: auto; display: block; }
.resources .res-card .cover .type-ic { width: 46px; height: 46px; opacity: .92; }
.resources .res-card .cover .tag--type {
  position: absolute; top: 12px; left: 12px;
  background: rgb(255 255 255 / .16); color: #fff; backdrop-filter: blur(4px);
}
.resources .res-card--news .cover { background: linear-gradient(140deg, var(--ink-800), var(--signal-600)); }
.resources .res-card .cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgb(14 23 38 / .35));
  opacity: 0; transition: opacity var(--t-mid);
}
.resources .res-card:hover .cover::after { opacity: 1; }

.resources .res-card .body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.resources .res-card .title { font-weight: 600; font-size: 17px; line-height: 1.4; color: var(--ink-900);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.resources .res-card .excerpt { font-size: 13px; color: var(--text-soft); line-height: 1.55; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.resources .res-card .foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--border); padding-top: 12px; margin-top: auto;
}
.resources .res-card .stat { font-size: 12px; color: var(--text-mute); display: flex; align-items: center; gap: 6px; }
.resources .res-card .stat svg { width: 14px; height: 14px; flex: none; }

@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.resources .res-grid .res-card:nth-child(1) { animation-delay: .02s; }
.resources .res-grid .res-card:nth-child(2) { animation-delay: .05s; }
.resources .res-grid .res-card:nth-child(3) { animation-delay: .08s; }
.resources .res-grid .res-card:nth-child(4) { animation-delay: .11s; }
.resources .res-grid .res-card:nth-child(5) { animation-delay: .14s; }
.resources .res-grid .res-card:nth-child(6) { animation-delay: .17s; }
.resources .res-grid .res-card:nth-child(7) { animation-delay: .20s; }
.resources .res-grid .res-card:nth-child(8) { animation-delay: .23s; }
.resources .res-grid .res-card:nth-child(9) { animation-delay: .26s; }
.resources .res-grid .res-card:nth-child(10) { animation-delay: .29s; }

.resources #emptyState { display: none; text-align: center; color: var(--text-mute); padding: 48px 0; }

/* ---------- Pagination (pager) ---------- */
.resources .resource-pagination {
  margin-top: 40px; display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap;
}
.resources .resource-pagination a,
.resources .resource-pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px; padding: 0 .6rem;
  border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); font-weight: 600; font-size: 14px; text-decoration: none;
  transition: all var(--t-fast);
}
.resources .resource-pagination a:hover { border-color: var(--brand-400); color: var(--brand-700); background: var(--brand-050); }
.resources .resource-pagination .active,
.resources .resource-pagination .pagination-page.active {
  background: var(--brand-600); border-color: var(--brand-600); color: #fff;
}
.resources .resource-pagination .pagination-ellipsis { border: none; background: none; min-width: auto; }

/* ---------- Detail-page server search (in filterbar) ---------- */
.resources .resource-search-box { display: inline-flex; align-items: center; margin-left: auto; flex-shrink: 0; }
.resources .resource-search-box .search-form {
  display: flex; align-items: center; border: 1px solid var(--border); border-radius: var(--r-pill);
  overflow: hidden; background: var(--surface); transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.resources .resource-search-box .search-form:focus-within { border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-050); }
.resources .resource-search-box .search-input {
  width: 200px; height: 38px; padding: 0 16px; border: none; outline: none;
  font: inherit; font-size: 14px; color: var(--text); background: transparent;
}
.resources .resource-search-box .search-input::placeholder { color: var(--text-mute); }
.resources .resource-search-box .search-btn {
  height: 38px; padding: 0 20px; background: var(--brand-600); color: #fff;
  border: none; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background var(--t-fast);
}
.resources .resource-search-box .search-btn:hover { background: var(--brand-700); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .resources .res-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .resources .page-hero { padding-block: 32px 20px; }
  .resources .page-hero h1 { font-size: 26px; }
  .resources .page-hero p { font-size: 14px; }
  .resources .res-grid { grid-template-columns: 1fr; gap: 16px; }
  .resources .filterbar { gap: 8px; }
  .resources .chip { padding: .45rem .8rem; font-size: 13px; }
  .resources .filterbar .spacer { flex-basis: 100%; height: 0; }
  .resources .resource-search-box { margin-left: 0; width: 100%; }
  .resources .resource-search-box .search-form { width: 100%; }
  .resources .resource-search-box .search-input { flex: 1; width: auto; }
  .resources .gate { padding: 16px; }
}
@media (max-width: 480px) {
  .resources .container { padding-inline: 15px; }
  .resources .page-hero .searchbar { flex-wrap: wrap; }
  .resources .page-hero .searchbar .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .resources .res-card { opacity: 1; transform: none; }
}
