/**
 * 17-text-list.css —— 分类页的纯文字榜单（不显示缩略图）。
 *
 * 设计依据（联网查证后应用）：
 *   - 「Slop is design with no author」——问题是没做选择，不是丑
 *   - 渐变是头号 AI 特征（purple/blue gradient）→ 全部去掉
 *   - 「card soup」：不要什么都塞进卡片 → 改为无容器的榜单行
 *   - 「radius should be a design decision」→ 不统一圆角，行用 4px，标签 2px
 *   - 「make the primary thing bigger, closer, heavier」→ 排名数字承担层级
 *   - Linear 式的克制：靠对齐、间距、字重建立秩序，不靠装饰
 *
 * 密度切换（C 方案）：纯 CSS `:has()` + radio，不引入任何 JS。
 *   标准 = 3 列，紧凑 = 4 列；字号与描述行数保持不变。
 */

/* ---------- 把源站 4 列图卡网格改成单列，让 FAQ 独占首行 ---------- */
body.category-page .thumbs-list-content {
  grid-template-columns: 1fr;
  gap: 0;
}

/* FAQ 作为列表上方的引言块，占满整行 */
body.category-page .thumbs-list-content .category-desc-wrapper {
  grid-column: 1 / -1;
  max-height: 86px;
  margin: 0 0 8px;
  padding: 0 2px 8px;
  border-bottom: 1px solid #ececf1;
}

body.category-page .thumbs-list-content .category-desc-wrapper .category-desc {
  max-height: 58px;
  font-size: 12px;
  line-height: 1.55;
  color: #6b6b76;
}

/* ---------- 密度切换控件 ---------- */
.density-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 0 0 6px;
  font-size: 11px;
  line-height: 1;
  color: #a0a0ab;
}

.density-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.density-bar label {
  cursor: pointer;
  padding: 2px 0;
  border-bottom: 1px solid transparent;
  transition:
    color 0.14s ease,
    border-color 0.14s ease;
}

.density-bar label:hover {
  color: #6b6b76;
}

#d-standard:checked ~ label[for='d-standard'],
#d-compact:checked ~ label[for='d-compact'] {
  color: #ff9701;
  border-bottom-color: #ff9701;
}

.density-radio:focus-visible ~ label[for='d-standard'],
.density-radio:focus-visible ~ label[for='d-compact'] {
  outline: 2px solid #ff9701;
  outline-offset: 2px;
}

/* ---------- 列表容器 ---------- */
.site-text-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 20px;
  row-gap: 0;
  margin-bottom: 14px;
  max-width: 100%;
  min-width: 0;
}

/* 紧凑模式：4 列，列间距收窄。字号与描述行数不变（按用户要求不再压缩文字） */
body:has(#d-compact:checked) .site-text-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 14px;
}

/* 侧栏占 250px 后，内容区只剩 844px，3 列每列仅 268px，描述被截断太狠。
   的尺寸计算，把 .link-content 宽度压成了 0，所以放弃，改用媒体查询。
   侧栏收窄到 200px 后，1440 视口下内容区约 894px，3 列每列约 285px。 */

/* 侧栏收窄，给内容区多留一点宽度 */
body.category-page .category-sidebar {
  width: 200px;
}

body.category-page .category-sidebar-list {
  width: 200px;
}

/* ---------- 单个条目：没有卡片、没有边框、没有圆角包袱 ---------- */
.site-text-row {
  position: relative;
  display: grid;
  grid-template-columns: 20px 24px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  border-bottom: 1px solid #f2f2f6;
  border-radius: 4px;
  max-width: 100%;
  min-width: 0;
  transition: background 0.14s ease;
}

/* 悬停才出现背景——默认状态让文字自己组织秩序 */
.site-text-row:hover {
  background: #f8f8fb;
  border-bottom-color: #ffe0b8;
}

.site-text-hit {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.site-text-hit:focus-visible {
  outline: 2px solid #ff9701;
  outline-offset: -1px;
}

/* 排名：整行最强的视觉信号 */
.site-text-order {
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: right;
  color: #c8c8d3;
  transition: color 0.14s ease;
}

/* 前三名单独点亮——有意制造层级，而不是所有行一个样 */
.site-text-row:nth-child(-n + 3) .site-text-order {
  color: #ff9701;
}

.site-text-row:hover .site-text-order {
  color: #ff7a00;
}

/* 站点图标：直接放 sprite，不套圆形底座 / 边框 / 内阴影（装饰不携带信息） */
.site-text-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.site-text-icon .icon-site {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  overflow: visible;
}

.site-text-icon .icon-site:before {
  width: 16px;
  height: 16px;
  margin: 0;
  transform: scale(1.1);
  transform-origin: center center;
  border-radius: 50%;
}

/* 4 个新站的图标还没进源站 sprite：纯色首字母，不用渐变 */
.site-text-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: #c9c9d4;
  border-radius: 2px;
  user-select: none;
}

/* 文字区 */
.site-text-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.site-text-head {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.site-text-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: #1a1a1e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 标签：方正、小、无圆角包袱 */
.site-text-tag {
  flex: 0 0 auto;
  padding: 0 3px;
  border-radius: 2px;
  font-size: 9px;
  font-weight: 700;
  line-height: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.site-text-tag-ai {
  color: #6b5bd6;
  background: #efecfa;
}

.site-text-tag-zh {
  color: #1f8a4c;
  background: #e8f6ee;
}

.site-text-desc {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.4;
  color: #9a9aa5;
}

/* ---------- 出站按钮：只有图标 ---------- */
.site-text-go {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: #c2c2cd;
  text-decoration: none;
  flex: 0 0 auto;
  transition: color 0.14s ease;
}

.site-text-row:hover .site-text-go {
  color: #ff9701;
}

.site-text-go .icon-mask {
  width: 11px;
  height: 11px;
}

/* ---------- 深色模式 ---------- */
.dark .site-text-row {
  border-bottom-color: #26262d;
}

.dark .site-text-row:hover {
  background: #202027;
  border-bottom-color: #4a3a1c;
}

.dark .site-text-name {
  color: #ececf2;
}

.dark .site-text-desc {
  color: #7c7c88;
}

.dark .site-text-order {
  color: #43434e;
}

.dark .site-text-go {
  color: #55555f;
}

.dark .site-text-row:hover .site-text-go {
  color: #ff9701;
}

.dark .site-text-tag-ai {
  color: #a99bff;
  background: #2b2545;
}

.dark .site-text-tag-zh {
  color: #5fd08a;
  background: #1d3628;
}

.dark .site-text-initial {
  background: #3a3a45;
}

.dark .density-bar {
  color: #55555f;
}

.dark body.category-page .thumbs-list-content .category-desc-wrapper,
body.category-page.dark .thumbs-list-content .category-desc-wrapper {
  border-bottom-color: #2b2b33;
}

/* ---------- 减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  .site-text-row,
  .site-text-order,
  .site-text-go,
  .density-bar label {
    transition: none;
  }
}

/* ---------- 分类侧栏（数据驱动渲染）---------- */
.category-sidebar {
  min-width: 0;
}

.category-sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.category-sidebar-link {
  display: block;
  padding: 6px 10px;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: #6b6b76;
  text-decoration: none;
  transition:
    color 0.14s ease,
    background 0.14s ease,
    border-color 0.14s ease;
}

.category-sidebar-link:hover {
  color: #ff9701;
  background: #fffaf2;
}

/* 当前分类：用左侧竖线标记，而不是整块高亮 */
.category-sidebar-link.is-active {
  border-left-color: #ff9701;
  background: #fffaf2;
  color: #1a1a1e;
  font-weight: 600;
}

.dark .category-sidebar-link {
  color: #8b8b97;
}

.dark .category-sidebar-link:hover {
  color: #ff9701;
  background: #202027;
}

.dark .category-sidebar-link.is-active {
  border-left-color: #ff9701;
  background: #202027;
  color: #ececf2;
}