/* ============================================================
   首页 / 列表页组件（纸感主题）
   
   首页用的是 .container + .hero + .post-list + .card-grid 结构，
   这套组件补齐纸感主题下缺少的布局与卡片样式。
   ============================================================ */

/* ---------- 页面容器 ---------- */
.container {
  width: var(--track);
  max-width: calc(100vw - 48px);
  margin: 0 auto;
  padding: 0 0 100px;
}

/* ---------- 首页 Hero ---------- */
/* 首页 hero 是独立区块（不同于文章页内嵌 hero） */
.container > .hero {
  margin: 0 0 12px;
  padding: 72px 0 48px;
  max-width: none;
}

.hero-title {
  margin: 0 0 18px;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.16;
  font-weight: 800;
  letter-spacing: -.022em;
  color: var(--ink);
}

.hero-title .accent {
  background: linear-gradient(135deg, var(--accent), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  margin: 0 0 30px;
  font-size: 17px;
  line-height: 1.85;
  color: var(--muted);
  max-width: 560px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---------- 按钮 ---------- */
/* 两个 hero 按钮视觉权重一致：都是描边胶囊，差距只在主次色。
   不做一个实心一个描边 —— 那样看起来像两个不同层级的控件。 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-soft);
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all .18s cubic-bezier(.4, 0, .2, 1);
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-icon {
  flex: 0 0 auto;
  opacity: .85;
  transition: transform .18s, opacity .18s;
}
.btn:hover .btn-icon {
  opacity: 1;
}

/* 主按钮：同为描边，仅用主色区分，不做实心填充 */
.btn-primary {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line-strong));
  background: color-mix(in srgb, var(--accent) 6%, var(--card));
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover .btn-icon {
  transform: translateX(2px);
}

/* ---------- 区块 ---------- */
.section {
  margin: 0 0 64px;
}

/* 「关于」里的联系方式等正文链接：全局 <a> 重置后默认为墨色，
   这里让它们显示为主色 + 淡底边，看得出可点 */
.section p a,
.section p a:visited {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  transition: border-color .15s;
}
.section p a:hover { border-bottom-color: var(--accent); }

.section-title {
  margin: 0 0 24px;
  padding-bottom: 14px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.section-more {
  margin: 22px 0 0;
  font-size: 14.5px;
  font-weight: 600;
}
.section-more a { color: var(--accent); text-decoration: none; }
.section-more a:hover { text-decoration: underline; }

/* ---------- 文章列表 ---------- */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.post-item:last-child { border-bottom: none; }

.post-date {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.post-link {
  display: inline-block;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.008em;
  color: var(--ink);
  text-decoration: none;
  transition: color .15s;
}
.post-link:hover { color: var(--accent); text-decoration: none; }

.post-desc {
  margin: 7px 0 0;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------- 项目卡片 ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: transform .18s cubic-bezier(.4,0,.2,1), border-color .18s, box-shadow .18s;
}
.card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--shadow);
}

.card-title {
  margin: 0 0 8px;
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -.008em;
  color: var(--ink);
}

.card-desc {
  flex: 1;
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.card-links {
  display: flex;
  gap: 14px;
  font-size: 13.5px;
  font-weight: 600;
}
.card-links a {
  color: var(--accent);
  text-decoration: none;
}
.card-links a:hover { text-decoration: underline; }

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 40px;
  padding: 44px max(24px, calc((100vw - var(--track)) / 2)) 56px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper-2) 45%, transparent);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--ink);
}
.footer-brand .brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.footer-nav {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-nav a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: color .15s;
}
.footer-nav a:hover { color: var(--accent); }

.footer-copy {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: .01em;
}
.footer-copy a { color: var(--muted); text-decoration: none; }
.footer-copy a:hover { color: var(--accent); }

/* ---------- 文章归档页 ---------- */
.archive-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.archive-item {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.archive-item:last-child { border-bottom: none; }

.archive-link {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  flex-wrap: wrap;
  /* 全局 <a> 重置后需要显式继承墨色，
     否则整块链接的日期/标题会跟着取默认值 */
  color: inherit;
}
.archive-link:hover .archive-title { color: var(--accent); }

.archive-date {
  flex: 0 0 auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: .03em;
}

.archive-title {
  flex: 0 0 auto;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  transition: color .15s;
}

.archive-summary {
  flex: 1 1 240px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
}

/* 标签按钮（可点击筛选）
   从 span 改成 button 后需要清掉浏览器默认外观 */
.archive-tag {
  flex: 0 0 auto;
  padding: 2px 9px;
  border: none;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.6;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}

.archive-tag:hover {
  background: var(--accent);
  color: #fff;
}

.archive-tag:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 搜索命中标签时的强调 */
.archive-tag.is-hit {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

html[data-theme="dark"] .archive-tag.is-hit {
  background: var(--accent-ink);
  color: #14161a;
}
@media (prefers-color-scheme: dark) {
  html[data-theme-auto] .archive-tag.is-hit {
    background: var(--accent-ink);
    color: #14161a;
  }
}

/* ---------- 归档页搜索框 ---------- */
.archive-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 12px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: border-color .16s, box-shadow .16s;
}

/* 聚焦时用主色描边 + 淡光晕，和站内输入框保持一套语言 */
.archive-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

.archive-search-icon {
  flex: 0 0 16px;
  color: var(--muted);
  margin-right: 10px;
}
.archive-search:focus-within .archive-search-icon { color: var(--accent); }

/* 去掉 type=search 在 WebKit/Blink 下的原生清除按钮，
   否则会和我们自己的 ✕ 重复出现两个 */
.archive-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  outline: none;
  background: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
}
.archive-search input::placeholder { color: var(--muted); }
.archive-search input::-webkit-search-cancel-button,
.archive-search input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.archive-search-clear {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 6px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}

/* 关键：上面写了 display:inline-flex，会盖掉浏览器给 [hidden] 的
   display:none（UA 规则的优先级低于作者样式），
   导致没输入内容时 ✕ 也一直显示。必须显式补回。 */
.archive-search-clear[hidden] { display: none; }

.archive-search-clear:hover {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* 同理：空态提示块也带 [hidden] */
.archive-empty[hidden] { display: none; }

/* 命中词高亮：用主色淡底，和正文里的 ==重点== 是同一套视觉 */
.archive-title mark,
.archive-summary mark,
.archive-snippet mark {
  background: var(--accent-soft);
  color: var(--accent-ink);
  padding: 1px 2px;
  border-radius: 3px;
  -webkit-text-fill-color: currentColor;
}

/* 正文命中时的上下文片段 */
.archive-snippet {
  flex: 1 1 100%;
  margin: 10px 0 0;
  padding: 9px 12px;
  border-left: 2px solid var(--line-strong);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--paper-2);
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--muted);
}

.archive-snippet-label {
  display: inline-block;
  margin-right: 8px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--line);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  vertical-align: 1px;
}

/* 片段本身也是 li 的直接子元素，但 archive-item 是 flex，
   需要让它独占一行 */

/* 过滤中的条数提示 */
#archive-status.is-filtering { color: var(--accent-ink); font-weight: 700; }

/* 无结果 */
.archive-empty {
  margin: 26px 0 0;
  padding: 22px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper-2);
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  line-height: 1.8;
}

.archive-empty-reset {
  border: none;
  background: none;
  padding: 0;
  color: var(--accent);
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.archive-empty-reset:hover { border-bottom-color: var(--accent); }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .container {
    width: auto;
    max-width: none;
    padding: 0 20px 80px;
  }
  .container > .hero {
    padding: 44px 0 32px;
  }
  .hero-title { font-size: 32px; }
  .hero-sub { font-size: 16px; }
  .card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .section { margin-bottom: 48px; }
  .post-link { font-size: 17.5px; }
}
