/* ============================================================
   Pengyouquan · media.css（书影音 / 文档下载 · 自定义页面模板）
   任务 5 · 结构与类名对齐设计稿《页-书影音.html》《页-文档下载.html》
   数据源 = 文章 + 分类（无插件依赖）：
   · 一篇文章 = 一张卡片；封面/标题/标签/浏览数来自 ListedPostVo 官方字段
   · 设计稿的评分与文件大小没有对应字段 → 诚实降级不渲染
   纪律：颜色全走 tokens 变量；圆角只从 --r-main 派生；阴影全站唯一两个 token
   ============================================================ */

/* ── 页面宽容器（与图库页同宽体系）── */
.md-wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── 页头卡 ── */
/* margin-bottom：与下方内容（筛选条/卡片网格）统一拉开一档，
   修复手机端「页头卡和列表连在一起」（2026-09-18 用户反馈） */
.md-head { padding: 22px 20px; margin-bottom: 16px; }
.md-head h1 { font-size: 20px; font-weight: 500; line-height: 1.4; }
.md-sub { font-size: var(--fs-meta); color: var(--text-time); margin-top: 5px; }
.md-desc {
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.md-stats {
  display: flex;
  gap: 6px 16px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: var(--fs-meta);
  color: var(--text-2);
}
.md-stats b { font-weight: 500; color: var(--brand); }

/* ── 筛选条（按钮由 media.js 按 data-tags 动态生成；无 JS 时整条不出现）── */
.filters {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.filters[hidden] { display: none; }
.f {
  padding: 5px 14px;
  border-radius: var(--r-full);
  font-size: 13px;
  background: var(--bg-card);
  color: var(--text-2);
  box-shadow: var(--shadow-card);
  transition: color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.f:hover { color: var(--brand); }
.f.on {
  background: var(--brand);
  color: #ffffff;
  box-shadow: none;
}

/* ══════════════ 书影音 · 卡片墙 ══════════════ */
.shelf {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.bk {
  display: block;
  cursor: pointer;
}
.bk[hidden] { display: none; }
.bk .cv {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--r-main);
  overflow: hidden;
  background: var(--bg-inset);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.bk:hover .cv {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.bk .cv img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
html.dark .bk .cv img { filter: brightness(0.88); }
.bk .cv-fb {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 500;
  color: var(--brand);
  opacity: 0.55;
}
.bk .kind {
  position: absolute;
  left: 6px;
  top: 6px;
  font-size: 10px;
  color: #ffffff;
  border-radius: 3px;
  padding: 1px 6px;
  line-height: 1.5;
  background: rgb(87 107 149 / 88%);
}
.bk .tt {
  margin-top: 9px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.42;
  color: var(--text-1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bk:hover .tt { color: var(--brand); }
.bk .au {
  margin-top: 3px;
  font-size: var(--fs-meta);
  color: var(--text-time);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ══════════════ 文档下载 · 文件卡网格 ══════════════ */
.dl-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.dl {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--r-main);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.dl[hidden] { display: none; }
.dl:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}
.dl .ft {
  width: 48px;
  height: 48px;
  border-radius: var(--r-main);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  flex-shrink: 0;
  letter-spacing: 0.3px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
}
.dl .fx { flex: 1; min-width: 0; }
.dl h3 {
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text-1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dl .meta {
  font-size: var(--fs-meta);
  color: var(--text-time);
  margin-top: 5px;
}
.dl .btn {
  display: inline-block;
  margin-top: 9px;
  padding: 5px 16px;
  border-radius: var(--r-full);
  background: var(--brand);
  color: #ffffff;
  font-size: 12.5px;
  transition: background-color 0.15s var(--ease);
}
.dl .btn:hover { background: var(--brand-2); }

/* ── 文件类型色（V3.4「文件直下」模式角标；V3.5 增网页青绿；功能色家族，与品牌色无关） ── */
:root {
  --ft-doc: #3f7bf5;    /* 文档 蓝 */
  --ft-xls: #21a665;    /* 表格 绿 */
  --ft-ppt: #f2762a;    /* 演示 橙 */
  --ft-pdf: #e5484d;    /* PDF 红 */
  --ft-zip: #8b6fd6;    /* 压缩包 紫 */
  --ft-img: #d8a03d;    /* 图片 琥珀 */
  --ft-web: #14a8a0;    /* 网页 青绿（html/htm，V3.5 新增） */
  --ft-other: #7c8aa0;  /* 其他 灰蓝 */
}
.dl .ft.ft-doc   { background: var(--ft-doc); }
.dl .ft.ft-xls   { background: var(--ft-xls); }
.dl .ft.ft-ppt   { background: var(--ft-ppt); }
.dl .ft.ft-pdf   { background: var(--ft-pdf); }
.dl .ft.ft-zip   { background: var(--ft-zip); }
.dl .ft.ft-img   { background: var(--ft-img); }
.dl .ft.ft-web   { background: var(--ft-web); }
.dl .ft.ft-other { background: var(--ft-other); }

/* ── 下载页搜索框（V3.5：文件多时按名称过滤；hidden 由 download.js 解析成功后解除）── */
.dl-q {
  width: 100%;
  padding: 9px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-main);
  background: var(--bg-card);
  color: var(--text-1);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.dl-q::placeholder { color: var(--text-2); opacity: 0.7; }
.dl-q:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent);
}
/* 搜索/筛选无结果时占满整行（.dl-grid 是多列网格，卡片类空态默认只占一格） */
.dl-grid .dl-none { grid-column: 1 / -1; }

/* ── 友链卡（V3.6：links.html；整卡可点，logo 圆角方 + 名称 + 一句话）── */
.lk-grid { grid-template-columns: repeat(2, 1fr); }
.lk {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}
.lk:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.lk-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-chip);
}
/* 无 logo 的首字头像：品牌淡底 + 品牌色字 */
.lk-txt {
  display: grid;
  place-items: center;
  font-size: 19px;
  font-weight: 500;
  color: var(--brand);
  background: var(--brand-soft);
}
.lk-info { flex: 1; min-width: 0; }
.lk-info h3 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.lk-info p {
  margin-top: 3px;
  font-size: var(--fs-meta);
  color: var(--text-3);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── 到底提示 / 空态 ── */
.md-more {
  margin-top: 16px;
  padding: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--text-time);
  background: var(--bg-card);
  border-radius: var(--r-main);
  box-shadow: var(--shadow-card);
}
.md-more b { color: var(--brand); font-weight: 500; }
.pyq-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-meta);
}

/* ── 断点 ── */
@media (max-width: 1023px) {
  .shelf { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 767px) {
  .shelf { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .dl-grid { grid-template-columns: 1fr; gap: 14px; }
  .lk-grid { grid-template-columns: 1fr; gap: 14px; }
  .md-head { padding: 18px 16px; margin-bottom: 14px; }
  .filters { gap: 6px; }
  .f { padding: 4px 11px; font-size: 12.5px; }
  .dl-q { padding: 8px 12px; margin-bottom: 12px; font-size: 13px; }
}
