/* =====================================================
   主页专用样式（仅作用于 layouts/index.html）
   风格：在 XMin 极简骨架之上稍作现代处理（卡片+轻阴影+强调色）
   颜色变量定义在 dark.css（全站加载），支持夜间模式
   ===================================================== */
.home { display: block; }

.home h2 {
  font-size: 1.15em;
  margin: 0 0 .8em;
  padding-left: .6em;
  border-left: 4px solid var(--accent);
  line-height: 1.3;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius, 10px);
  box-shadow: var(--card-shadow);
  padding: 1.4em 1.6em;
  margin-bottom: 1.6em;
}

/* ---------- 夜间模式切换按钮（固定右上角，仅主页出现） ---------- */
.theme-toggle {
  position: fixed;
  top: 1em;
  right: 1em;
  z-index: 100;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 1.05em;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--card-shadow);
  transition: border-color .12s ease, transform .12s ease;
}
.theme-toggle:hover { border-color: var(--accent); transform: translateY(-1px); }

/* ---------- 个人横幅 ---------- */
.home-hero { text-align: center; }
.home-hero .hero-content { margin-bottom: .6em; }
.home-hero .hero-content img {
  float: none !important;      /* 覆盖 _index.markdown 内联的 float:right */
  display: block;
  margin: 0 auto .6em;
  max-width: 110px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,.14);
}
.home-hero h1 { text-align: center; margin: .2em 0; font-size: 1.6em; }
.hero-stats {
  display: flex; justify-content: center;
  gap: .6em 2.2em; flex-wrap: wrap;
}
.hero-stats .stat { font-size: .92em; color: var(--muted); }
.hero-stats b { color: var(--accent); font-size: 1.15em; margin-right: .15em; }

/* ---------- 写作足迹方块图 ---------- */
.home-contrib { overflow-x: auto; }
.contrib-grid {
  display: block;
  width: 100%;
  max-width: 676px;
  height: auto;
  margin: .4em auto 0;
}
.contrib-meta {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: .4em 1em;
  margin-top: .9em;
  font-size: .85em; color: var(--muted);
}
.legend { display: inline-flex; align-items: center; gap: 3px; }
.legend .lg { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* 7 档热度色（GitHub 绿系），同时用于 SVG rect 的 fill 与图例 span 的背景 */
.lv0 { fill: var(--lv0); background: var(--lv0); }
.lv1 { fill: var(--lv1); background: var(--lv1); }
.lv2 { fill: var(--lv2); background: var(--lv2); }
.lv3 { fill: var(--lv3); background: var(--lv3); }
.lv4 { fill: var(--lv4); background: var(--lv4); }
.lv5 { fill: var(--lv5); background: var(--lv5); }
.lv6 { fill: var(--lv6); background: var(--lv6); }

/* 长空白期"缩略列"：虚线空框，表示时间跳变（hover 有说明） */
.gap-cell {
  fill: var(--gap-fill);
  stroke: var(--gap-stroke);
  stroke-width: 1;
  stroke-dasharray: 2 2;
}

/* ---------- 分类卡片 ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .8em;
}
.cat-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: var(--radius, 10px);
  padding: .9em 1em;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.cat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow);
  border-color: var(--accent);
  text-decoration: none;
}
.cat-name { display: block; font-weight: 600; color: var(--text); }
.cat-count { display: block; font-size: .82em; color: var(--accent); margin-top: .25em; }

/* ---------- 全部文章按年份分组 ---------- */
.year-block { margin-bottom: 1.1em; }
.year-block h3 {
  font-size: 1.02em;
  margin: 0 0 .45em;
  color: var(--text);
  border-bottom: 1px dashed var(--hr-color);
  padding-bottom: .3em;
}
.year-count { font-size: .8em; color: var(--muted); font-weight: 400; margin-left: .4em; }
.year-list { list-style: none; margin: 0; padding: 0; }
.year-list li { padding: .28em 0; line-height: 1.5; }
.year-list .date { color: var(--muted); margin-right: .8em; font-size: .9em; font-family: monospace; }
.year-list a { color: var(--accent); text-decoration: none; }
.year-list a:hover { text-decoration: underline; }

/* 窄屏：统计行与贡献图元信息纵向排布 */
@media (max-width: 480px) {
  .hero-stats { flex-direction: column; gap: .3em; }
  .contrib-meta { flex-direction: column; align-items: flex-start; }
}
