/* ============================================================
   AI 开源项目排行榜 - 样式文件
   ============================================================
   设计语言：终端 / 代码美学
   - 深色蓝黑底（不是纯黑），GitHub 标志绿做强调
   - 排名数字用等宽字体，像终端里跑出来的排行榜
   - 移动端优先：手机单列，宽屏两列
   ============================================================ */

/* ---------- 设计变量（整个页面的颜色/字体都从这里来） ---------- */
:root {
  /* 颜色 */
  --bg: #0B0F14;            /* 页面背景：深蓝黑 */
  --panel: #141C25;         /* 卡片背景 */
  --panel-hover: #1A2430;   /* 卡片悬浮背景 */
  --border: #26323F;        /* 分隔线/边框 */
  --text: #E6EDF3;          /* 主文字（GitHub 浅色） */
  --muted: #8B949E;         /* 次要文字 */
  --accent: #3FB950;        /* GitHub 绿：Stars / 前三名 */
  --amber: #D29922;         /* 琥珀：最近更新 */
  --purple: #8957E5;        /* AI 紫：标题点缀 */

  /* 字体 */
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  /* 背景微妙的渐变，避免死板的纯色 */
  background-image: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(137, 87, 229, 0.08), transparent);
}

/* 键盘操作时显示焦点框（无障碍） */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 顶部标题 ---------- */
.site-header {
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 20px 24px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.site-title {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 700;
  letter-spacing: -0.5px;
  /* 标题带一点紫色渐变点缀 */
  background: linear-gradient(120deg, var(--text) 60%, var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.site-subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

/* ---------- 分类标签 ---------- */
.category-tabs {
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 20px 4px;
  display: flex;
  gap: 8px;
  /* 手机端横向滑动，不换行 */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.tab-btn:hover {
  color: var(--text);
  border-color: var(--muted);
}
/* 当前选中的分类标签：绿底 */
.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #04140a;
  font-weight: 600;
}
/* 分类数量小徽标 */
.tab-count {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.75;
  margin-left: 4px;
}

/* ---------- 排序工具条 ---------- */
.toolbar {
  max-width: 1080px;
  margin: 16px auto 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: 13px;
  color: var(--muted);
  margin-right: 2px;
}

.sort-buttons { display: flex; gap: 8px; }

.sort-btn {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}
.sort-btn:hover { color: var(--text); border-color: var(--muted); }
.sort-btn.active {
  color: var(--amber);
  border-color: var(--amber);
  background: rgba(210, 153, 34, 0.08);
}

.repo-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

/* ---------- 榜单列表 ---------- */
.repo-list {
  max-width: 1080px;
  margin: 16px auto 0;
  padding: 0 20px 40px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* 宽屏：两列 */
@media (min-width: 720px) {
  .repo-list { grid-template-columns: 1fr 1fr; }
}

/* ---------- 项目卡片 ---------- */
.repo-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  /* 卡片交错淡入（延迟由 JS 设置） */
  animation: card-in 0.35s ease both;
}
.repo-card:hover {
  background: var(--panel-hover);
  border-color: var(--muted);
  transform: translateY(-1px);
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 卡片第一行：排名 + Stars */
.card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

/* 排名数字：等宽大字，前三名用绿色 */
.rank {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: -0.5px;
}
.rank.top {
  color: var(--accent);
}

.stars {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  white-space: nowrap;
}

/* 仓库名 + 作者 */
.repo-name {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  word-break: break-all;
}
.repo-name a {
  color: var(--text);
  text-decoration: none;
}
.repo-name a:hover { color: var(--accent); }

.repo-owner {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin-top: -4px;
}

/* 多分类小标记 */
.multi-tag {
  display: inline-block;
  font-size: 11px;
  color: var(--purple);
  border: 1px solid var(--purple);
  border-radius: 4px;
  padding: 0 5px;
  margin-left: 6px;
  vertical-align: 1px;
}

/* 描述：最多两行，超出省略 */
.repo-desc {
  font-size: 13.5px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 英文原文：正常换行显示，最多 2 行，超出省略（卡片高度因此稳定） */
.repo-desc-en {
  font-size: 11.5px;
  color: rgba(139, 148, 158, 0.65);
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* 底部元数据行 */
.card-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.meta-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

/* 语言：小色点 + 名称 */
.lang-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* 语言小色点的颜色由 JavaScript 内联设置（见 app.js 的 LANGUAGE_COLORS），
   这样语言名带特殊字符（如 C++、C#）也不会产生 CSS 解析问题 */

/* ---------- 状态提示（加载中 / 出错 / 空数据） ---------- */
.status-box {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.status-box .status-icon { font-size: 32px; margin-bottom: 12px; }
.status-box .status-title { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.status-box .status-detail { font-size: 13px; line-height: 1.8; }

.retry-btn {
  margin-top: 16px;
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 8px 20px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.2s ease;
}
.retry-btn:hover { background: rgba(63, 185, 80, 0.12); }

/* ---------- 页脚 ---------- */
.site-footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.footer-note { margin-top: 4px; opacity: 0.7; }

/* ---------- 尊重"减少动态效果"的系统设置 ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
