/* ============================================================
   视觉微调层（polish）——在既有样式之上做统一的“手感”优化，不改布局与配色：
   · 主题色、深色模式规则全部沿用；这里只调整圆角/阴影/过渡/反馈
   · 每个页面在 </head> 前引入，保证同优先级时本文件生效
   · 所有动效都放在 prefers-reduced-motion: no-preference 里
   ============================================================ */

:root {
  --polish-ease: cubic-bezier(.22, .61, .36, 1);
  --polish-tint: var(--theme-color-rgb, 57, 159, 255);
}

html { -webkit-text-size-adjust: 100%; }
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(var(--polish-tint), .22); }

h1 { letter-spacing: .02em; }

/* ── 首页 / 博客卡片 ───────────────────────────────────────── */
.blog-card {
  border-radius: 14px;
  border: 1px solid rgba(var(--polish-tint), .12);
  transition: transform .25s var(--polish-ease), box-shadow .25s var(--polish-ease), border-color .25s var(--polish-ease);
}
.blog-card__cover { border-radius: 13px 13px 0 0; }   /* 与卡片圆角 14px 对齐，避免封面四角“冒出”卡片 */
.blog-card:hover {
  border-color: rgba(var(--polish-tint), .35);
  box-shadow: 0 10px 28px rgba(var(--polish-tint), .16);
}
.blog-card__title { letter-spacing: .01em; }

/* ── 论坛 ─────────────────────────────────────────────────── */
.bbs-topic-item { transition: background .15s, box-shadow .2s var(--polish-ease); }
/* 悬停时插一条左侧主题色竖条、标题跟着变蓝 —— 已去掉：
   竖条会压在零内边距的行（个人主页 / 收藏面板）首字上，标题变蓝也像「正在浏览」。 */
.bbs-topic-title { transition: color .15s; }

.bbs-modal { border-radius: 16px; box-shadow: 0 12px 48px rgba(0, 0, 0, .16); }
.bbs-modal-overlay { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

.bbs-search-btn { transition: opacity .2s, transform .12s; }
.bbs-modal-primary { transition: opacity .15s, transform .12s; }
.bbs-search-btn:active, .bbs-modal-primary:active,
.bbs-page-btn:active, .bbs-login-btn:active, .bbs-admin-btn:active, .fs-btn:active { transform: scale(.97); }

/* 输入框聚焦：边框之外再加一圈淡色光晕，位置感更明确 */
.bbs-modal input:focus, .bbs-modal textarea:focus, .bbs-modal select:focus,
#bbs-search-input:focus {
  border-color: var(--theme-color, #399FFF);
  box-shadow: 0 0 0 3px rgba(var(--polish-tint), .16);
  outline: none;
}

/* ── 文件管理 ─────────────────────────────────────────────── */
.fs-card { border-radius: 16px; }
.fs-item { border-radius: 12px; transition: box-shadow .2s var(--polish-ease), border-color .2s, transform .2s var(--polish-ease); }
.fs-item:hover { border-color: rgba(var(--polish-tint), .25); }
.fs-modal-box { border-radius: 16px; box-shadow: 0 12px 48px rgba(0, 0, 0, .16); }
.fs-upload { border-radius: 14px; }
.fs-upload:hover, .fs-upload.dragover { border-color: var(--theme-color, #399FFF); background: rgba(var(--polish-tint), .06); }

/* ── 动效（尊重“减少动效”设置） ───────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .bbs-modal-overlay, .fs-overlay { animation: polish-fade .18s ease-out; }
  .bbs-modal, .fs-modal-box { animation: polish-pop .24s var(--polish-ease); }
  @keyframes polish-fade { from { opacity: 0; } to { opacity: 1; } }
  @keyframes polish-pop  { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
}

/* ── 锚点 / 深链：固定导航会盖住目标位置 ─────────────────── */
[id] { scroll-margin-top: 96px; }

/* ── 首页 / 列表搜索条 ───────────────────────────────────── */
.blog-search-wrap { position: relative; }
.blog-search-wrap .blog-search {
  padding-right: 46px;
}
.blog-search-wrap .blog-search::-webkit-search-cancel-button,
.blog-search-wrap .blog-search::-webkit-search-decoration,
.blog-search-wrap .blog-search::-webkit-search-results-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.blog-search-clear {
  position: absolute;
  right: 9px;
  top: 50%;
  width: 26px;
  height: 26px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(var(--polish-tint), .14);
  color: #5b6472;
  cursor: pointer;
  transition: background .18s var(--polish-ease), color .18s var(--polish-ease), transform .12s var(--polish-ease);
}
.blog-search-clear[hidden] { display: none; }
.blog-search-clear:hover { background: rgba(var(--polish-tint), .26); color: #26303d; }
.blog-search-clear:active { transform: translateY(-50%) scale(.9); }
.blog-search-clear svg { width: 13px; height: 13px; display: block; }
[data-theme="dark"] .blog-search-clear { background: rgba(255,255,255,.1); color: #a8a8c0; }
[data-theme="dark"] .blog-search-clear:hover { background: rgba(255,255,255,.18); color: #e0e0f0; }

.blog-search-meta {
  margin: 7px 2px 0;
  font-size: 12px;
  line-height: 1.4;
  color: #8d94a3;
  min-height: 16px;
}
.blog-search-meta:empty { display: none; }
[data-theme="dark"] .blog-search-meta { color: #6b6b85; }

/* 搜索命中高亮：只换底色不改字色（卡片标题有各自主题色，inherit 才不会打架），
   底色 + 一条内阴影下划线，浅色/暗色下都能一眼看到命中位置。 */
mark.search-hit {
  padding: 0 2px;
  border-radius: 3px;
  background: rgba(var(--polish-tint), .32);
  box-shadow: inset 0 -2px 0 rgba(var(--polish-tint), .6);
  color: inherit;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
[data-theme="dark"] mark.search-hit {
  background: rgba(var(--polish-tint), .4);
  box-shadow: inset 0 -2px 0 rgba(var(--polish-tint), .75);
  color: #e6e6f2;
}

/* 搜索栏吸顶：仅在没有标签筛选行时启用，避免在标签页占掉半屏。
   首屏（自然位置）保持透明，滚过之后由 JS 加 .is-stuck 再出底板。 */
#blog-toolbar:not(:has(.filter-bar)) {
  position: sticky;
  /* 与导航栏底边严丝合缝：高度由 navbar.js 写成 --reori-nav-h，悬停展开时一起下移 */
  top: var(--reori-nav-h, 60px);
  z-index: 30;
  margin: -4px 0 18px;
  padding: 9px 12px 7px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  transition: padding .22s var(--polish-ease);
}
/* 吸顶后：贴着导航底边、和内容同宽的一条底板（不铺满整屏）。
   上边框保持透明、背景从元素自身顶边开始铺，和导航之间不留缝。 */
#blog-toolbar:not(:has(.filter-bar)).is-stuck {
  padding-top: 7px;
  padding-bottom: 9px;
  border-color: rgba(15, 23, 42, .07);
  border-top-color: transparent;
  border-radius: 0 0 14px 14px;
  background: rgba(255, 255, 255, .97);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, .07);
}
[data-theme="dark"] #blog-toolbar:not(:has(.filter-bar)).is-stuck {
  border-color: rgba(255, 255, 255, .07);
  border-top-color: transparent;
  background: rgba(20, 21, 33, .97);
  box-shadow: 0 10px 22px rgba(0, 0, 0, .45);
}
/* 吸顶时导航底边不再投影：两块之间不留深色缝，拼成一条（JS 同步 body 类名）。
   同时把导航换成和搜索栏同一层白，避免导航下缘透出深色内容、和底板「接不上」。 */
body.has-stuck-toolbar #blog-navbar {
  box-shadow: none;
  background: rgba(255, 255, 255, .97);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
[data-theme="dark"] body.has-stuck-toolbar #blog-navbar {
  background: rgba(20, 21, 33, .97);
}
.blog-toolbar-sentinel {
  height: 1px;
  margin-top: -1px;
  pointer-events: none;
}

/* ── 列表空状态 ──────────────────────────────────────────── */
.blog-empty {
  padding: 44px 20px 40px;
  text-align: center;
  border: 1px dashed rgba(var(--polish-tint), .28);
  border-radius: 16px;
  background: rgba(255, 255, 255, .6);
}
.blog-empty__icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(var(--polish-tint), .1);
  color: var(--theme-color, #399FFF);
  font-size: 20px;
  line-height: 1;
}
.blog-empty__title { font-size: 15px; font-weight: 600; color: #303746; }
.blog-empty__desc { margin-top: 4px; font-size: 13px; color: #8d94a3; }
.blog-empty__clear {
  margin-top: 16px;
  padding: 7px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--theme-color, #399FFF);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: filter .18s var(--polish-ease), transform .12s var(--polish-ease);
}
.blog-empty__clear:hover { filter: brightness(1.06); }
.blog-empty__clear:active { transform: scale(.97); }
[data-theme="dark"] .blog-empty { background: rgba(26, 27, 42, .6); border-color: rgba(255, 255, 255, .1); }
[data-theme="dark"] .blog-empty__title { color: #c8c8d8; }
[data-theme="dark"] .blog-empty__desc { color: #6b6b85; }

/* 卡片底部强调条：8px -> 4px，悬停时不再压住内容 */
.blog-card::after { height: 4px; border-radius: 0 0 14px 14px; }

/* ── 首页「站点速览」模块 ─────────────────────────────────── */
.hx {
  margin: 4px 0 12px;
  padding: 20px 22px 16px;
  border: 1px solid rgba(var(--polish-tint), .16);
  border-radius: 16px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(var(--polish-tint), .1) 0%, rgba(var(--polish-tint), 0) 55%),
    linear-gradient(135deg, rgba(255, 255, 255, .82), rgba(255, 255, 255, .62));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 24px rgba(var(--polish-tint), .07);
}
.hx__head { margin-bottom: 14px; }
.hx__eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--theme-color, #399FFF);
}
.hx__title {
  margin: 2px 0 4px;
  font-size: 19px;
  font-weight: 700;
  color: #222;
  letter-spacing: .01em;
}
.hx__desc { margin: 0; font-size: 13px; color: #7c8494; }

.hx__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}
.hx__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid rgba(var(--polish-tint), .14);
  border-radius: 12px;
  background: rgba(255, 255, 255, .66);
  color: inherit;
  text-decoration: none;
  transition: transform .22s var(--polish-ease), border-color .22s var(--polish-ease),
              box-shadow .22s var(--polish-ease), background .22s var(--polish-ease);
}
.hx__item:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--polish-tint), .4);
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 8px 20px rgba(var(--polish-tint), .14);
}
.hx__item:active { transform: translateY(0) scale(.995); }
.hx__icon {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(var(--polish-tint), .1);
  color: var(--theme-color, #399FFF);
}
.hx__icon svg { width: 17px; height: 17px; }
.hx__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.hx__label { font-size: 14px; font-weight: 600; color: #2b3240; }
.hx__sub { font-size: 12px; color: #8d94a3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx__arrow {
  margin-left: auto;
  color: #b6bcc9;
  font-size: 15px;
  transition: transform .22s var(--polish-ease), color .22s var(--polish-ease);
}
.hx__item:hover .hx__arrow { transform: translateX(3px); color: var(--theme-color, #399FFF); }

.hx__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed rgba(var(--polish-tint), .2);
}
.hx__stat { padding: 0 4px; text-align: center; }
.hx__stat dt { font-size: 11px; color: #8d94a3; letter-spacing: .02em; }
.hx__stat dd {
  margin: 3px 0 0;
  font-size: 16px;
  font-weight: 700;
  color: #2b3240;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

[data-theme="dark"] .hx {
  border-color: rgba(255, 255, 255, .08);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(var(--polish-tint), .14) 0%, rgba(var(--polish-tint), 0) 55%),
    linear-gradient(135deg, rgba(26, 27, 42, .92), rgba(22, 23, 36, .86));
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
}
[data-theme="dark"] .hx__title { color: #d8d8e8; }
[data-theme="dark"] .hx__desc { color: #7a7a92; }
[data-theme="dark"] .hx__item { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .08); }
[data-theme="dark"] .hx__item:hover { background: rgba(255, 255, 255, .08); border-color: rgba(var(--polish-tint), .45); }
[data-theme="dark"] .hx__label { color: #d2d2e2; }
[data-theme="dark"] .hx__sub { color: #6b6b85; }
[data-theme="dark"] .hx__arrow { color: #4c4c64; }
[data-theme="dark"] .hx__stats { border-top-color: rgba(255, 255, 255, .1); }
[data-theme="dark"] .hx__stat dt { color: #6b6b85; }
[data-theme="dark"] .hx__stat dd { color: #d2d2e2; }

/* ── 尊重「减少动效」 ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .blog-card,
  .blog-card__cover img,
  .blog-card::before,
  .blog-card::after,
  .blog-html-fragment,
  .blog-card-wrapper,
  .hx__item,
  .hx__arrow,
  .blog-search-clear { transition: none !important; }

  .blog-card:hover { transform: none; }
  .blog-card:hover .blog-card__cover img { transform: none; }
  .blog-html-fragment,
  .blog-card-wrapper { opacity: 1; transform: none; }
  .hx__item:hover { transform: none; }
  .hx__item:hover .hx__arrow { transform: none; }
}

/* ── 窄屏 ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hx { padding: 16px 14px 12px; border-radius: 14px; }
  .hx__grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .hx__item { padding: 10px; gap: 8px; }
  .hx__icon { width: 30px; height: 30px; }
  .hx__sub { display: none; }
  .hx__arrow { display: none; }
  .hx__stats { grid-template-columns: repeat(2, 1fr); row-gap: 10px; }
  .hx__stat dd { font-size: 15px; }
}

/* ── 文字对比度：日期 / 说明这类小字在深色下偏淡 ─────────────── */
.blog-card__date { color: #7d8494; }
[data-theme="dark"] .blog-card__desc { color: #9a9ab4; }
[data-theme="dark"] .blog-card__date { color: #8a8aa6; }
[data-theme="dark"] .hx__sub { color: #8a8aa6; }
[data-theme="dark"] .blog-search-meta { color: #8a8aa6; }
[data-theme="dark"] .footer__line { color: #7a7a92; }
/* ── 外观：页面标题 + 一条渐隐主题色短横线 ──────────────────── */
#page-title {
  font-size: clamp(26px, 3.2vw, 31px);
  font-weight: 800;
  letter-spacing: -.012em;
  line-height: 1.25;
  margin-bottom: 18px;
}
#page-title::after {
  content: '';
  display: block;
  width: 52px;
  height: 3px;
  margin: 11px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg,
              rgba(var(--polish-tint), 0),
              var(--theme-color, #399FFF),
              rgba(var(--polish-tint), 0));
  opacity: .78;
}
[data-theme="dark"] #page-title::after { opacity: .9; }

/* ── 外观：首页欢迎卡片（blogs.json 里的 hero 片段） ─────────── */
.hero {
  position: relative;
  overflow: hidden;
  margin: 2px 0 12px;
  padding: 26px 28px 25px;
  border: 1px solid rgba(var(--polish-tint), .16);
  border-radius: 18px;
  background:
    radial-gradient(130% 170% at 100% 0%, rgba(var(--polish-tint), .17) 0%, rgba(var(--polish-tint), 0) 62%),
    linear-gradient(135deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .68));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(var(--polish-tint), .07);
}
/* 右上一圈柔光，给纯色块一点体积感（不参与命中，不挡点击） */
.hero::after {
  content: '';
  position: absolute;
  right: -70px;
  top: -90px;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--polish-tint), .2), rgba(var(--polish-tint), 0) 68%);
  pointer-events: none;
}
.hero__body { position: relative; z-index: 1; }
.hero__eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--theme-color, #399FFF);
}
.hero__title {
  margin: 7px 0 6px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.005em;
  color: #1f2530;
}
.hero__desc { margin: 0; font-size: 13.5px; line-height: 1.6; color: #6b7280; }

[data-theme="dark"] .hero {
  border-color: rgba(255, 255, 255, .08);
  background:
    radial-gradient(130% 170% at 100% 0%, rgba(var(--polish-tint), .18) 0%, rgba(var(--polish-tint), 0) 62%),
    linear-gradient(135deg, rgba(26, 27, 42, .94), rgba(22, 23, 36, .82));
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
[data-theme="dark"] .hero__title { color: #e4e4f2; }
[data-theme="dark"] .hero__desc { color: #9a9ab4; }

/* ── 外观：搜索框左侧放大镜图标 ─────────────────────────────── */
.blog-search-wrap::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  background: no-repeat center / contain
    url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d8494' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.7-3.7'/%3E%3C/svg%3E");
  pointer-events: none;
}
.blog-search-wrap .blog-search { padding-left: 40px; }

/* ── 外观：细滚动条（不占位、圆角、深浅两套） ───────────────── */
html { scrollbar-width: thin; scrollbar-color: rgba(15, 23, 42, .2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, .18);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, .3);
  background-clip: padding-box;
}
[data-theme="dark"] html { scrollbar-color: rgba(255, 255, 255, .2) transparent; }
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .18);
  background-clip: padding-box;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .28);
  background-clip: padding-box;
}

/* ── 外观：窄屏收一收 ──────────────────────────────────────── */
@media (max-width: 640px) {
  #page-title { font-size: 22px; margin-bottom: 14px; }
  .hero { padding: 20px 18px 18px; border-radius: 16px; }
  .hero__title { font-size: 19px; }
  .hero__desc { font-size: 13px; }
  .blog-search-wrap .blog-search { padding-left: 36px; }
}
