/* =====================================================================
   公用模板 · 数据页组件（宫格 / 列表 / 分页）
   ---------------------------------------------------------------------
   由 SiteRenderer 在渲染数据页时自动引入：/tpl/{code}/css/data.css
   全部规则使用 :where()（零特异性），模板自身的 style.css / site.css
   中同名的 .article-* 规则优先，因此本文件既是「缺省皮肤」又不覆盖模板设计。
   结构可由模板目录下的 partials/data-*.html 覆盖。
   ===================================================================== */

/* ===== 组件一：宫格 data-grid ===== */
:where(.data-grid) {
  /* 卡片块居中：flex 换行 + 居中，最后一行不足时整行居中（不贴左） */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.data-grid) > * {
  flex: 0 1 260px;
  max-width: 320px;
  min-width: 0;
  box-sizing: border-box;
}

:where(.data-card) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  border: 1px solid rgba(20, 35, 60, 0.09);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
}

:where(.data-card:hover) {
  transform: translateY(-4px);
  border-color: rgba(21, 91, 212, 0.45);
  box-shadow: 0 16px 32px -18px rgba(20, 40, 80, 0.35);
}

:where(.data-card-media) {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #eef1f6;
}

:where(.data-card-media img) {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

:where(.data-card:hover .data-card-media img) {
  transform: scale(1.04);
}

:where(.data-card-empty) {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  font-weight: 700;
  color: #b6bfcd;
  background: linear-gradient(135deg, #eff6ff, #f5f3ff);
}

:where(.data-card-body) {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 16px 18px 18px;
}

:where(.data-card-title) {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  color: inherit;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

:where(.data-card:hover .data-card-title) {
  color: #155bd4;
}

:where(.data-card-summary) {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.7;
  color: #6b7686;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

:where(.data-card-date) {
  margin-bottom: 10px;
  font-size: 12px;
  color: #98a1b0;
}

:where(.data-card-more) {
  margin-top: auto;
  font-size: 13px;
  font-weight: 600;
  color: #155bd4;
}

/* ===== 组件二：列表 data-list ===== */
:where(.data-list) {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid rgba(20, 35, 60, 0.08);
  border-radius: 10px;
  background: #fff;
}

:where(.data-item) {
  border-bottom: 1px solid #f0f2f5;
}

:where(.data-item:last-child) {
  border-bottom: 0;
}

:where(.data-link) {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  color: inherit;
  text-decoration: none;
  transition: background 0.2s ease;
}

:where(.data-link:hover) {
  background: #f8fafc;
}

:where(.data-date) {
  flex: none;
  width: 86px;
  padding-top: 4px;
  border-right: 1px solid #e8ebf0;
  color: #155bd4;
}

:where(.data-date strong) {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.1;
}

:where(.data-date span) {
  font-size: 12px;
  color: #98a1b0;
}

:where(.data-item-main) {
  display: block;
  min-width: 0;
}

:where(.data-item-title) {
  overflow: hidden;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:where(.data-link:hover .data-item-title) {
  color: #155bd4;
}

:where(.data-item-summary) {
  overflow: hidden;
  margin: 4px 0 0;
  font-size: 13px;
  color: #6b7686;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 组件三：分页 data-pagination ===== */
:where(.data-footer) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

:where(.data-meta) {
  margin: 0;
  font-size: 13px;
  color: #98a1b0;
}

:where(.data-pagination) {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-left: auto;
}

:where(.data-pagination .page-link) {
  display: inline-block;
  min-width: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(20, 35, 60, 0.12);
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
  color: #5c6b84;
  background: #fff;
  text-decoration: none;
}

:where(.data-pagination .page-link:hover) {
  border-color: #155bd4;
  color: #155bd4;
}

:where(.data-pagination .page-link.current) {
  border-color: #155bd4;
  background: #155bd4;
  color: #fff;
}

:where(.data-pagination .page-link.disabled) {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

:where(.data-pagination .ellipsis) {
  align-self: center;
  padding: 0 2px;
  color: #98a1b0;
  font-size: 13px;
}

:where(.data-empty) {
  padding: 40px 24px;
  text-align: center;
  color: #97a1b0;
  font-size: 14px;
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  :where(.data-grid) > * {
    flex-basis: 200px;
    max-width: 260px;
  }
}

@media (max-width: 640px) {
  :where(.data-grid) > * {
    flex-basis: 100%;
    max-width: 100%;
  }

  :where(.data-link) {
    gap: 12px;
    padding: 14px 12px;
  }

  :where(.data-date) {
    width: 62px;
  }

  :where(.data-pagination) {
    width: 100%;
    margin-left: 0;
  }
}
