/* ==========================================================================
   开源拾遗 · 项目卡片 / 分类 / 推荐 / 收录标准
   在 style.css（基础样式）之上加载。
   ========================================================================== */

/* ---------- 配色（6 套，卡片顶部描边与首字母标记取色） ---------- */
.tone-1 { --tone: #b5482c; --tone-soft: #f5e4dc; }
.tone-2 { --tone: #6e7f63; --tone-soft: #e6ece0; }
.tone-3 { --tone: #c8943f; --tone-soft: #f6ecd8; }
.tone-4 { --tone: #2f5d59; --tone-soft: #dfeae7; }
.tone-5 { --tone: #4a5a8a; --tone-soft: #e4e7f2; }
.tone-6 { --tone: #7b4a63; --tone-soft: #f0e2e9; }

[data-theme="dark"] .tone-1 { --tone: #e08a6d; --tone-soft: #3a2a24; }
[data-theme="dark"] .tone-2 { --tone: #a8bd9a; --tone-soft: #2b3327; }
[data-theme="dark"] .tone-3 { --tone: #dfb56a; --tone-soft: #3a3121; }
[data-theme="dark"] .tone-4 { --tone: #7fb3ad; --tone-soft: #243330; }
[data-theme="dark"] .tone-5 { --tone: #9aa8d6; --tone-soft: #282d40; }
[data-theme="dark"] .tone-6 { --tone: #c791ad; --tone-soft: #35262e; }

/* ---------- 项目网格 ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 1.8vw, 22px);
  margin-top: 18px;
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.project-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--tone);
  opacity: .85;
}
.project-card:hover,
.project-card:focus-within {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--tone) 42%, var(--line));
  box-shadow: var(--shadow-md);
}

.card-main {
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
  padding: 20px 20px 12px;
  color: inherit;
  text-decoration: none;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-initial {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--tone-soft);
  color: var(--tone);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .02em;
}
.card-category {
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: .02em;
}

.card-title {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  word-break: break-word;
}
.card-main:hover .card-title { color: var(--rust); }

.card-summary {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}
.card-tags li {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--paper-3);
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.4;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 12px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.card-meta .lang {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-2);
}
.card-meta .stars {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
}
.card-meta .stars .icon { width: 12px; height: 12px; }

/* 状态与类型徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.5;
  white-space: nowrap;
}
.status-not-tested { color: var(--ink-3); border-color: var(--line-strong); }
.status-install-tested { color: #2f5d59; border-color: rgba(47, 93, 89, .35); }
.status-smoke-tested { color: #6e7f63; border-color: rgba(110, 127, 99, .4); }
.status-experiment-verified { color: #b5482c; border-color: rgba(181, 72, 44, .4); }
[data-theme="dark"] .status-install-tested { color: #8ec4bd; }
[data-theme="dark"] .status-smoke-tested { color: #b3c9a6; }
[data-theme="dark"] .status-experiment-verified { color: #e79b80; }

.type-snippet,
.type-download,
.type-repository { color: var(--ink-3); }

.card-repo {
  align-self: flex-end;
  margin: 0 20px 16px;
  font-size: 12px;
  color: var(--ink-3);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.card-repo:hover,
.card-repo:focus-visible {
  color: var(--rust);
  border-bottom-color: var(--rust);
}

/* 搜索命中高亮 */
mark.hit {
  background: color-mix(in srgb, var(--rust) 20%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

/* ---------- 分类入口 ---------- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.category-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: border-color .2s var(--ease), transform .2s var(--ease), background-color .2s var(--ease);
}
.category-card:hover,
.category-card:focus-visible {
  border-color: var(--rust);
  transform: translateY(-2px);
  background: var(--paper-3);
}
.category-name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}
.category-count {
  font-size: 12px;
  color: var(--ink-3);
}

/* ---------- 编辑推荐 ---------- */
.pick-list {
  display: grid;
  gap: 12px;
}
.pick-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--tone);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  color: inherit;
  text-decoration: none;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.pick-card:hover,
.pick-card:focus-visible {
  transform: translateX(3px);
  border-color: color-mix(in srgb, var(--tone) 45%, var(--line));
}
.pick-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
}
.pick-summary {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-2);
}
.pick-meta {
  font-size: 12px;
  color: var(--ink-3);
}

/* ---------- 最近收录 ---------- */
.recent-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.recent-list li { border-bottom: 1px solid var(--line); }
.recent-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 2px;
  color: inherit;
  text-decoration: none;
}
.recent-name {
  font-size: 14.5px;
  color: var(--ink);
  transition: color .2s var(--ease);
}
.recent-list a:hover .recent-name,
.recent-list a:focus-visible .recent-name { color: var(--rust); }
.recent-cat {
  flex: none;
  font-size: 12px;
  color: var(--ink-3);
}

/* ---------- 收录标准 ---------- */
.standards-band {
  padding-block: clamp(48px, 7vw, 88px);
  background: var(--paper-3);
  border-block: 1px solid var(--line);
}
.standard-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2.6vw, 32px);
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}
.standard {
  position: relative;
  padding-top: 18px;
  border-top: 1px solid var(--line-strong);
}
.standard-num {
  display: block;
  margin-bottom: 10px;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: .16em;
  color: var(--rust);
}
.standard h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 18px;
}
.standard p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-2);
}

/* ---------- 说明 ---------- */
.projects-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-3);
}
.projects-note .icon { flex: none; width: 15px; height: 15px; margin-top: 2px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  .project-grid { grid-template-columns: minmax(0, 1fr); }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .standard-list { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .card-title { font-size: 18px; }
}

@media (max-width: 460px) {
  .category-grid { grid-template-columns: minmax(0, 1fr); }
  .card-main { padding: 16px 16px 10px; }
  .card-repo { margin: 0 16px 14px; }
}
