/* ==========================================================================
   模板库「参考模板」板块：筛选胶囊 + 2:3 封面卡片网格。
   纯 CSS/SVG 预览，沿用 Coverly 设计 token（tokens.css），不新造颜色。
   ========================================================================== */

/* 板块标题（与 .blog-section-title 同款） */
.tpl-section-title {
  font-family: var(--font-serif);
  font-size: var(--text-h2);
  color: var(--text-primary);
  text-align: center;
  margin: 0 0 var(--sp-2);
}

.tpl-section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--text-body);
  margin: 0 0 var(--sp-5);
}

/* 体裁筛选胶囊条（radiogroup） */
.tpl-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: var(--sp-5);
}

.tpl-filter-radio {
  appearance: none;
  border: 1px solid var(--border-subtle);
  background: rgba(139, 124, 246, 0.08);
  color: var(--text-secondary);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: var(--text-small);
  font-family: var(--font-sans);
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out),
    border-color 0.2s var(--ease-out);
}

.tpl-filter-radio:hover {
  background: rgba(139, 124, 246, 0.15);
  color: var(--text-primary);
}

.tpl-filter-radio.is-active {
  background: var(--brand-1);
  color: #fff;
  border-color: var(--brand-1);
}

.tpl-filter-radio:focus-visible {
  outline: 2px solid var(--brand-1);
  outline-offset: 2px;
}

/* 卡片网格：桌面 4 / 平板 3 / 移动 2 */
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

@media (max-width: 1024px) {
  .tpl-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

@media (max-width: 640px) {
  .tpl-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

/* 模板卡片 */
.tpl-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-align: left;
  transition: transform 0.2s var(--ease-out), border-color 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out);
}

.tpl-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
}

.tpl-card:focus-visible {
  outline: 2px solid var(--brand-1);
  outline-offset: 2px;
}

/* 2:3 SVG 预览块 */
.tpl-preview {
  aspect-ratio: 2 / 3;
  width: 100%;
}

.tpl-svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* 卡面信息 */
.tpl-card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tpl-name {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
  line-height: 1.35;
}

.tpl-genre {
  align-self: flex-start;
  background: rgba(139, 124, 246, 0.12);
  color: var(--link);
  font-size: 12px;
  line-height: 1.5;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.tpl-note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: #6b6b6b;
}

.tpl-copied {
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
  margin-top: 2px;
}

/* 暗色主题可读性覆写（预览 SVG 自身不受影响） */
[data-theme='dark'] .tpl-name {
  color: #f5f5f7;
}

[data-theme='dark'] .tpl-note {
  color: var(--text-secondary);
}
