/* ==========================================================================
   素材下载页专属样式（materials.html）
   --------------------------------------------------------------------------
   与主站共用 site.css 的设计令牌（颜色/圆角/断点），这里只加素材页的
   卡片网格、分类筛选与下载按钮。
   ========================================================================== */

/* --------------------------------------------------------------- 分类筛选 */
.mat__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 28px;
}
.mat__filter {
  height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  color: var(--t2);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.mat__filter:hover { background: rgba(255, 255, 255, .07); color: var(--t1); }
.mat__filter.is-active {
  background: var(--brand-soft);
  border-color: rgba(59, 157, 221, .45);
  color: var(--brand-2);
}
.mat__filter b { font-weight: 800; margin-left: 4px; opacity: .75; }

/* --------------------------------------------------------------- 素材网格 */
.mat__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 24px;
}

.mat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow: hidden;
  transition: transform .2s ease, border-color .2s ease;
}
.mat:hover { transform: translateY(-3px); border-color: var(--line-strong); }

/* 预览图：静态 PNG（透明背景），素材本体是静态矢量图，不做动图 */
.mat__thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
/* 人物/道具是透明底的矢量图 —— 棋盘格让人一眼看出"这里能透出背景"；
   场景本身是满幅画面，不该透出格纹（否则像图没加载全）。 */
.mat[data-kind="characters"] .mat__thumb,
.mat[data-kind="props"] .mat__thumb {
  background:
    linear-gradient(45deg, rgba(255,255,255,.035) 25%, transparent 25%) 0 0/16px 16px,
    linear-gradient(-45deg, rgba(255,255,255,.035) 25%, transparent 25%) 0 8px/16px 16px,
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,.035) 75%) 8px -8px/16px 16px,
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.035) 75%) -8px 0/16px 16px,
    var(--bg-surface);
}
/* 场景是横图，contain 居中，上下留白用纯色 */
.mat[data-kind="scenes"] .mat__thumb img { padding: 0; object-fit: contain; }
.mat__thumb img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 12px;
  display: block;
}
.mat__kind {
  position: absolute;
  left: 10px; top: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--t1);
  background: rgba(8, 8, 12, .72);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(4px);
}

.mat__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 16px 18px;
  flex: 1;
}
.mat__name { font-size: 16px; font-weight: 700; }
.mat__desc {
  font-size: 13px;
  color: var(--t3);
  line-height: 1.65;
  flex: 1;
}
.mat__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.mat__tags span {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--t3);
  background: rgba(255, 255, 255, .05);
}
.mat__meta {
  font-size: 11.5px;
  color: var(--t4);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* 下载按钮：素材包较小，用轻量描边样式 */
.mat__dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  margin-top: 4px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .04);
  color: var(--t1);
  font-size: 13.5px;
  font-weight: 700;
  transition: background .16s ease, border-color .16s ease;
}
.mat__dl:hover { background: var(--brand-soft); border-color: rgba(59, 157, 221, .45); }
.mat__dl svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.mat__dl.is-missing { opacity: .5; pointer-events: none; }

/* ------------------------------------------------------- 空态 / 加载失败 */
.mat__empty {
  padding: 46px 26px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--t3);
  font-size: 14px;
  line-height: 1.8;
}
.mat__empty strong { color: var(--t1); display: block; margin-bottom: 6px; font-size: 15.5px; }
.mat__empty code {
  display: inline-block;
  margin-top: 10px;
  padding: 5px 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .05);
  color: var(--accent);
  font-size: 12.5px;
}

/* ------------------------------------------------------------ 使用说明 */
.mat__how {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 22px;
}
.mat__step {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .02);
}
.mat__step-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-2);
  font-size: 13px;
  font-weight: 800;
}
.mat__step h3 { font-size: 15px; margin-bottom: 6px; }
.mat__step p { font-size: 13px; color: var(--t3); line-height: 1.7; }
.mat__step code { color: var(--accent); font-size: 12.5px; }

/* --------------------------------------------------------------- 响应式 */
@media (max-width: 860px) {
  .mat__grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; }
}
@media (max-width: 560px) {
  .mat__grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .mat__body { padding: 12px 12px 14px; }
  .mat__name { font-size: 14.5px; }
  .mat__desc { display: none; }   /* 窄屏优先给图，描述让位 */
  .mat__thumb img { padding: 8px; }
}
