/* ============================================
 * 批次3：文章页组件
 * 1. 阅读进度条
 * 2. 点赞/打赏/上下篇导航
 * 3. 代码块折叠 + 语言标签 + 复制按钮
 * 4. 手机悬浮工具栏
 * 5. 图片全屏查看
 * 6. TOC 悬浮高亮
 * ============================================ */
/* ===== 1. 阅读进度条（顶部朱砂条）===== */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  z-index: 1101;
  background: linear-gradient(90deg, #49b1f5, #2f9bf0, #6bc0f7);
  box-shadow: 0 0 8px rgba(73,177,245,0.5);
  transition: width 0.1s linear;
}
[data-theme="dark"] .read-progress {
  background: linear-gradient(90deg, #6bc0f7, #8fd0fa);
  box-shadow: 0 0 8px rgba(107,192,247,0.5);
}
/* ===== 2. 文章底部操作区 ===== */
.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  justify-content: center;
  margin: 1.5rem 0;
  padding: 1rem;
  border-radius: 0.8rem;
  background: rgba(73,177,245,0.03);
  border: 1px solid rgba(73,177,245,0.12);
}
[data-theme="dark"] .post-actions {
  background: rgba(107,192,247,0.04);
  border-color: rgba(107,192,247,0.15);
}
.post-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(73,177,245,0.3);
  background: transparent;
  color: #49b1f5;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
}
.post-action-btn:hover {
  background: rgba(73,177,245,0.08);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px -4px rgba(73,177,245,0.4);
}
.post-action-btn.liked {
  background: rgba(73,177,245,0.12);
  border-color: var(--theme-color);
}
[data-theme="dark"] .post-action-btn {
  color: #8fd0fa;
  border-color: rgba(107,192,247,0.3);
}
[data-theme="dark"] .post-action-btn:hover {
  background: rgba(107,192,247,0.1);
}
[data-theme="dark"] .post-action-btn.liked {
  background: rgba(107,192,247,0.15);
}
.post-action-btn .like-count {
  font-weight: 700;
}
/* 上下篇导航卡片 */
.post-nav-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}
.post-nav-card {
  display: block;
  padding: 0.9rem 1rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(73,177,245,0.15);
  background: rgba(73,177,245,0.03);
  text-decoration: none !important;
  transition: all 0.25s ease;
  min-width: 0;
}
.post-nav-card:hover {
  border-color: rgba(73,177,245,0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px -6px rgba(73,177,245,0.35);
}
[data-theme="dark"] .post-nav-card {
  border-color: rgba(107,192,247,0.15);
  background: rgba(107,192,247,0.04);
}
[data-theme="dark"] .post-nav-card:hover {
  border-color: rgba(107,192,247,0.4);
}
.post-nav-card .nav-label {
  font-size: 0.72rem;
  opacity: 0.6;
  margin-bottom: 0.3rem;
}
.post-nav-card .nav-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--theme-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.post-nav-card.next {
  text-align: right;
}
@media (max-width: 768px) {
  .post-nav-cards {
    grid-template-columns: 1fr;
  }
  .post-nav-card.next {
    text-align: left;
  }
}
/* ===== 3. 代码块美化 ===== */
#article-container figure.highlight {
  margin: 1rem 0;
  border-radius: 0.6rem;
  overflow: hidden;
  border: 1px solid rgba(73,177,245,0.15);
}
#article-container figure.highlight .code-lang {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: rgba(73,177,245,0.06);
  border-bottom: 1px solid rgba(73,177,245,0.12);
  font-size: 0.72rem;
  color: var(--font-color);
  opacity: 0.8;
}
[data-theme="dark"] #article-container figure.highlight .code-lang {
  background: rgba(107,192,247,0.08);
  border-bottom-color: rgba(107,192,247,0.15);
}
/* macOS 圆点 */
.code-lang::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c94f4f;
  box-shadow: 12px 0 0 #c9a94f, 24px 0 0 #4f9e6f;
  flex: none;
}
.code-lang .lang-name {
  margin-left: 1.2rem;
}
/* 折叠按钮 */
.code-toggle {
  margin-left: auto;
  padding: 0.1rem 0.5rem;
  font-size: 0.68rem;
  border-radius: 0.35rem;
  border: 1px solid rgba(73,177,245,0.3);
  background: transparent;
  color: var(--theme-color);
  cursor: pointer;
  flex: none;
}
.code-toggle:hover {
  background: rgba(73,177,245,0.08);
}
[data-theme="dark"] .code-toggle {
  border-color: rgba(107,192,247,0.3);
}
[data-theme="dark"] .code-toggle:hover {
  background: rgba(107,192,247,0.1);
}
/* 折叠状态：隐藏代码体 */
figure.highlight.collapsed .code-container,
figure.highlight.collapsed table {
  display: none;
}
figure.highlight.collapsed {
  border-radius: 0.6rem;
}
/* 复制按钮 */
.copy-btn {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  z-index: 2;
  padding: 0.15rem 0.5rem;
  font-size: 0.68rem;
  border-radius: 0.35rem;
  border: 1px solid rgba(73,177,245,0.3);
  background: rgba(255,255,255,0.85);
  color: var(--theme-color);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}
figure.highlight {
  position: relative;
}
figure.highlight:hover .copy-btn {
  opacity: 1;
}
.copy-btn.copied {
  opacity: 1;
  background: rgba(90,158,111,0.15);
  border-color: #5a9e6f;
  color: #5a9e6f;
}
/* ===== 4. 手机悬浮工具栏 ===== */
.mobile-toolbar {
  display: none;
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  gap: 0.3rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: rgba(245,241,232,0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(73,177,245,0.2);
  box-shadow: 0 8px 24px -8px rgba(7,17,27,0.035);
}
[data-theme="dark"] .mobile-toolbar {
  background: rgba(26,23,20,0.92);
  border-color: rgba(107,192,247,0.25);
}
.mobile-toolbar .tb-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--font-color);
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}
.mobile-toolbar .tb-btn:hover,
.mobile-toolbar .tb-btn.active {
  background: rgba(73,177,245,0.1);
  color: var(--theme-color);
}
[data-theme="dark"] .mobile-toolbar .tb-btn:hover,
[data-theme="dark"] .mobile-toolbar .tb-btn.active {
  background: rgba(107,192,247,0.15);
}
@media (max-width: 768px) {
  .mobile-toolbar {
    display: flex;
  }
  #footer {
    padding-bottom: 4rem;
  }
}
/* ===== 5. 图片全屏查看 ===== */
.img-viewer-mask {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20,17,14,0.9);
  backdrop-filter: blur(4px);
  cursor: zoom-out;
  animation: fade-in 0.2s ease;
}
.img-viewer-mask img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,0.7);
}
/* ===== 6. TOC 悬浮高亮 ===== */
#aside-content .toc-link {
  position: relative;
  transition: all 0.2s ease;
}
#aside-content .toc-link.toc-active {
  color: var(--theme-color) !important;
  font-weight: 700;
}
#aside-content .toc-link.toc-active::before {
  content: "";
  position: absolute;
  left: -0.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  border-radius: 2px;
  background: var(--theme-color);
}
/* ===== 7. 阅读布局：正文收窄为舒适行长，段落留呼吸感 ===== */
#article-container {
  max-width: 44rem;
  margin-left: auto;
  margin-right: auto;
  padding: 1.2rem 1.6rem;
}
#article-container p {
  margin-bottom: 1.1em;
}
#article-container li {
  margin-bottom: 0.4em;
}
@media (max-width: 768px) {
  #article-container {
    max-width: none;
    padding: 0.9rem 1rem;
  }
}
/* ===== 8. 版权信息区：不透明实底，背景图上清晰可读 ===== */
#post .post-copyright {
  background: #fff;
  border-color: rgba(73,177,245,0.25);
  padding: 1rem 1.25rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
[data-theme="dark"] #post .post-copyright {
  background: #121212;
  border-color: rgba(107,192,247,0.25);
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
/* ===== 9. 标签 pills：实底，背景图上清晰可读 ===== */
#post .tag_share .post-meta__tags {
  background: #fff;
}
[data-theme="dark"] #post .tag_share .post-meta__tags {
  background: #121212;
}
/* ===== 10. 分享图标：字体本地化 =====
 * sharejs 的 iconfont 走 jsdelivr，在部分网络下字体加载失败导致图标变方框。
 * 字体已下载到 /fonts/sharejs/，用更高特异性的选择器强制使用本地字体；
 * 图标圆圈加实底，背景图上清晰可读。 */
@font-face {
  font-family: "share-local-iconfont";
  src: url("/fonts/sharejs/iconfont.woff2?v=3871ed57") format("woff2"), url("/fonts/sharejs/iconfont.woff?v=4ac164a6") format("woff"), url("/fonts/sharejs/iconfont.ttf?v=172f0a35") format("truetype");
  font-display: swap;
}
body #post .tag_share .social-share,
body #post .tag_share .social-share * {
  font-family: "share-local-iconfont" !important;
}
body #post .tag_share .social-share .social-share-icon {
  background: #fff;
}
[data-theme="dark"] body #post .tag_share .social-share .social-share-icon {
  background: #121212;
}
/* 悬停时恢复品牌色底 + 白色图标（特异性必须盖过上面的实底规则） */
body #post .tag_share .social-share .social-share-icon:hover {
  background: #666;
  border-color: #666;
  color: #fff;
}
body #post .tag_share .social-share .social-share-icon.icon-weibo:hover {
  background: #ff763b;
  border-color: #ff763b;
}
body #post .tag_share .social-share .social-share-icon.icon-qq:hover {
  background: #56b6e7;
  border-color: #56b6e7;
}
body #post .tag_share .social-share .social-share-icon.icon-wechat:hover {
  background: #7bc549;
  border-color: #7bc549;
}
body #post .tag_share .social-share .social-share-icon.icon-twitter:hover {
  background: #1da1f2;
  border-color: #1da1f2;
}
body #post .tag_share .social-share .social-share-icon.icon-facebook:hover {
  background: #44619d;
  border-color: #44619d;
}
/* ===== 11. 打赏弹窗：虚拟币地址卡片 ===== */
.post-reward .reward-all.crypto-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: fit-content;
  min-width: 300px;
  max-width: 360px;
  margin: 0 auto;
  padding: 16px 14px;
  text-align: left;
}
.crypto-item {
  border: 1px solid rgba(73,177,245,0.18);
  border-radius: 0.6rem;
  padding: 0.55rem 0.7rem;
  background: rgba(73,177,245,0.04);
}
.crypto-item .crypto-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--theme-color);
  margin-bottom: 0.25rem;
}
.crypto-item .crypto-addr-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.crypto-item .crypto-addr {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  word-break: break-all;
  color: var(--font-color);
  opacity: 0.85;
  user-select: all;
}
.crypto-item .crypto-copy {
  flex: none;
  padding: 0.25rem 0.7rem;
  font-size: 0.72rem;
  border-radius: 999px;
  border: 1px solid rgba(73,177,245,0.4);
  background: transparent;
  color: var(--theme-color);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.crypto-item .crypto-copy:hover {
  background: rgba(73,177,245,0.1);
}
.crypto-item .crypto-copy.copied {
  border-color: #5a9e6f;
  color: #5a9e6f;
}
[data-theme="dark"] .crypto-item {
  border-color: rgba(107,192,247,0.2);
  background: rgba(107,192,247,0.05);
}
[data-theme="dark"] .crypto-item .crypto-copy {
  border-color: rgba(107,192,247,0.4);
}
[data-theme="dark"] .crypto-item .crypto-copy:hover {
  background: rgba(107,192,247,0.1);
}
@-moz-keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@-webkit-keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@-o-keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
