/* ===========================================================
   Polish · 质感精修层（第 3 层，最后加载）
   只做视觉增强：纹理、光影、过渡、细节。
   不改布局、不改断点、不引入新颜色 —— 全部基于既有变量，
   因此 5 套主题 + 明暗模式自动跟随。

   想整体回退：把各页面 <head> 里这一行删掉即可：
     <link rel="stylesheet" href="assets/polish.css">
   =========================================================== */

/* ---------- 1. 滚动条：细一点，跟主题走 ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--primary) 26%, transparent) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--primary) 22%, transparent);
  border: 3px solid transparent;
  border-radius: 99px;
  background-clip: content-box;
  transition: background-color .18s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--primary) 44%, transparent);
  background-clip: content-box;
}

/* ---------- 2. 封面：纯渐变上叠一层光晕 + 极淡斜纹 ---------- */
/* 无封面时原来是一块干净的渐变，大尺寸上会显得平；
   加两层低透明度的光（主色 + 强调色）和一层斜纹，就有纸感了。 */
.feature-cover,
.pcard-cover {
  position: relative;
  isolation: isolate;
}
.feature-cover::before,
.pcard-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(130% 100% at 8% 2%,
      color-mix(in srgb, var(--primary) 34%, transparent), transparent 56%),
    radial-gradient(92% 80% at 96% 100%,
      color-mix(in srgb, var(--accent) 26%, transparent), transparent 62%),
    radial-gradient(60% 50% at 50% 120%,
      color-mix(in srgb, var(--ink) 12%, transparent), transparent 70%);
  pointer-events: none;
}
.feature-cover::after,
.pcard-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background-image: repeating-linear-gradient(
    114deg, currentColor 0 1px, transparent 1px 10px);
  opacity: .05;
  pointer-events: none;
}
/* 占位文字压在纹理之上 */
.feature-cover .ph,
.pcard-cover .ph { z-index: 3; }

/* ---------- 3. 列表行：hover 时日期与标题一起亮起来 ---------- */
.row-title { transition: color .18s ease; }
.row:hover .row-title { color: var(--primary-dp); }
.row-date b { transition: color .18s ease; }
.row:hover .row-date b { color: var(--primary); }

/* ---------- 4. 正文 h2：左侧一道短竖线，给长文分段感 ---------- */
.prose h2 {
  position: relative;
}
.prose h2::before {
  content: "";
  position: absolute;
  left: -20px;
  top: .3em;
  width: 3px;
  height: .9em;
  border-radius: 3px;
  background: linear-gradient(180deg,
    var(--primary), color-mix(in srgb, var(--primary) 26%, transparent));
}
@media (max-width: 720px) {
  .prose h2::before { left: -12px; width: 2px; }
}

/* ---------- 5. 引用块：左侧主色条 + 极淡底色 ---------- */
.prose blockquote {
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--primary) 6%, transparent), transparent 72%);
  border-radius: 0 12px 12px 0;
  padding-top: 10px;
  padding-bottom: 10px;
  padding-right: 14px;
}
.prose blockquote > :last-child { margin-bottom: 0; }

/* ---------- 6. 表格：斑马纹 + 行悬停 ---------- */
.prose tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--soft) 52%, transparent);
}
.prose tbody tr { transition: background-color .16s ease; }
.prose tbody tr:hover {
  background: color-mix(in srgb, var(--primary) 7%, transparent);
}

/* ---------- 7. 代码块：顶部一道渐变细线 + 右上角语言标签 ---------- */
.prose pre {
  position: relative;
  box-shadow: 0 10px 30px -14px color-mix(in srgb, var(--ink) 40%, transparent);
}
.prose pre::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--primary) 85%, transparent), transparent 62%);
  opacity: .7;
}
.prose pre[data-lang]::after {
  content: attr(data-lang);
  position: absolute;
  top: 8px; right: 14px;
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: color-mix(in srgb, #E7EFF4 45%, transparent);
  pointer-events: none;
}

/* ---------- 8. 后台统计卡：悬停浮起 + 顶部细线 ---------- */
.stat-card {
  position: relative;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--primary) 70%, transparent), transparent 76%);
  opacity: 0;
  transition: opacity .2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px -12px var(--shadow-2);
  border-color: color-mix(in srgb, var(--primary) 26%, var(--rule));
}
.stat-card:hover::before { opacity: 1; }

/* ---------- 9. 登录卡片：一点柔光，别跟背景糊在一起 ---------- */
.lg-card {
  box-shadow:
    0 1px 2px var(--shadow),
    0 24px 60px -24px var(--shadow-2);
}

/* ---------- 10. 标签 / 按钮：过渡统一，别一冷一热 ---------- */
.tag-btn, .pill, .btn {
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
/* 一排标签同时上下跳会很碎，只做颜色反馈 */
.btn:active { transform: translateY(1px); }

/* ---------- 12. 后台：标签管理 ---------- */
.tag-add-bar {
  display: flex;
  gap: 10px;
  max-width: 600px;
  margin-top: 6px;
}
.tag-add-bar .input { flex: 1; }

.tag-mrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 11px 16px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--surface);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.tag-mrow:hover {
  border-color: color-mix(in srgb, var(--primary) 32%, var(--rule));
  box-shadow: 0 8px 20px -14px var(--shadow-2);
}
.tag-mrow .ord {
  width: 22px;
  color: var(--muted);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}
.tag-mrow .nm { font-size: 1.04rem; }
.tag-mrow .ct {
  font-size: .8rem;
  color: var(--muted);
  background: var(--soft);
  padding: 2px 9px;
  border-radius: 999px;
}
.tag-mrow .sp { flex: 1; }

/* 删除前的确认条：必须选一个迁移目标，避免文章"丢标签"却没人发现 */
.tag-del {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 4px;
  padding: 12px 16px;
  border: 1px dashed color-mix(in srgb, var(--warn) 48%, var(--rule));
  border-radius: 12px;
  background: color-mix(in srgb, var(--warn) 6%, transparent);
  font-size: .9rem;
}
.tag-del .tx { flex: 1 1 320px; }
.tag-del .select { max-width: 280px; }

@media (max-width: 720px) {
  .tag-mrow { flex-wrap: wrap; gap: 8px; }
  .tag-mrow .sp { display: none; }
  .tag-del .tx { flex: 1 1 100%; }
}

/* ---------- 11. 尊重系统的"减少动态效果" ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===========================================================
   12. v2.8.3 · 质感微调（可整段删除回退）
   只补前几层没覆盖到的小缺口；不重复已有规则（仅第 4 条替换原有硬线，
   删掉那一条即恢复），不动配色体系 / 五套主题 / 字体栈 / 布局断点。
   变量一律 --rf- 前缀，避免与既有 --shadow-* 等撞名。
   =========================================================== */
:root {
  --rf-ease: cubic-bezier(0, 0, .2, 1);
  --rf-fast: 150ms;
  --rf-line: color-mix(in srgb, var(--rule) 78%, transparent);
}

/* 1) 顶栏是 sticky，目录锚点跳转时给标题留一口气 */
html { scroll-padding-top: 88px; }

/* 2) 正文链接：下划线离字远一点，hover 才加深 */
.prose a {
  text-underline-offset: .22em;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--primary) 42%, transparent);
  transition: text-decoration-color var(--rf-fast) var(--rf-ease);
}
.prose a:hover { text-decoration-color: var(--primary); }

/* 3) 表格表头与斑马纹区分开 */
.prose thead th {
  background: color-mix(in srgb, var(--soft) 72%, transparent);
  font-weight: 600;
  border-bottom: 1px solid var(--rf-line);
}

/* 4) 分隔线：把原有硬线换成两端渐隐（删掉这条即恢复原样） */
.prose hr {
  height: 1px;
  border: 0;
  background: linear-gradient(90deg,
    transparent, var(--rf-line) 18%, var(--rf-line) 82%, transparent);
}

/* 5) 侧栏卡片沿用统计卡的 hover 语言，但不加位移（侧栏晃动会晕） */
.side-card {
  transition: border-color var(--rf-fast) var(--rf-ease),
              box-shadow var(--rf-fast) var(--rf-ease);
}
.side-card:hover {
  border-color: color-mix(in srgb, var(--primary) 22%, var(--rule));
  box-shadow: 0 8px 24px -18px var(--shadow-2);
}

/* 6) 手机端置顶卡改单列：
   390px 下原两列把右卡压到 ~150px，标题要折三行，摘要只剩半句。 */
@media (max-width: 720px) {
  .feature { grid-template-columns: 1fr; }
  .feature-body { padding: 18px 18px 20px; gap: 10px; }
}


/* 7) 触达面积补足 —— 视觉尺寸完全不变，只把可点区域补到 44×44
   体检实测：登录胶囊 42px、排序/标签按钮 42px、返回与复制 40–42px、
   文章目录项 40px、密码眼睛 30px，手机上容易点偏（WCAG 2.5.5 建议 44×44）。
   用伪元素扩大命中区域，不改布局、不改观感、不影响相邻文字的排版。
   注意 .nav a::after 已被下划线占用，导航项改用 ::before。 */
.entry-btn, .ico-btn, .btn, .back-link, .toc-fab, .tag-btn, .lg-eye, .toc a {
  position: relative;
}
.entry-btn::after,
.ico-btn::after,
.btn::after,
.back-link::after,
.toc-fab::after,
.tag-btn::after,
.lg-eye::after,
.toc a::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, 44px);
  height: max(100%, 44px);
  transform: translate(-50%, -50%);
}
/* 侧栏「关于作者 →」上下挨着别的链接，只补到 36，避免抢点击 */
.more { position: relative; }
.more::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, 36px);
  height: max(100%, 36px);
  transform: translate(-50%, -50%);
}
.nav a { position: relative; }
.nav a::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, 44px);
  height: max(100%, 44px);
  transform: translate(-50%, -50%);
}
