/**
 * Kang0234 · Butterfly 高级质感包
 * ① 全站毛玻璃（iOS fixed 兼容背景层 + 玻璃卡片）② 评论区皮肤 ③ 友链页高级卡片
 */
:root {
  --kg-primary: #49b1f5;
  --kg-primary-2: #2d8cf0;
  --kg-glass-bg: rgba(255, 255, 255, 0.56);
  --kg-glass-border: rgba(255, 255, 255, 0.7);
  --kg-shadow: 0 8px 32px rgba(31, 45, 61, 0.09);
  --kg-blur: 22px;
}

/* ========== ① 全站毛玻璃 ========== */

/* 背景光斑层：fixed 伪元素（iOS Safari 不支持 background-attachment: fixed 的标准解法） */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(48rem 32rem at 12% -8%, rgba(73, 177, 245, 0.18), transparent 62%),
    radial-gradient(42rem 30rem at 92% 12%, rgba(179, 136, 255, 0.14), transparent 60%),
    radial-gradient(40rem 34rem at 55% 108%, rgba(77, 208, 225, 0.12), transparent 62%),
    linear-gradient(180deg, #f7fafd 0%, #f2f6fb 100%);
}
/* 细颗粒噪点，提升质感 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.55 0 0 0 0 0.75 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* 玻璃卡片工具类 */
.glass-card {
  background: var(--kg-glass-bg) !important;
  backdrop-filter: blur(var(--kg-blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--kg-blur)) saturate(1.5);
  border: 1px solid var(--kg-glass-border);
  box-shadow: var(--kg-shadow) !important;
}

/* 主体卡片全部玻璃化 */
#nav:not(.fixed),
.layout > #post,
.layout > #page,
.layout > #archive,
#recent-posts > .recent-post-item,
#aside-content .card-widget,
#footer-wrap {
  position: relative;
}

#recent-posts > .recent-post-item,
#aside-content .card-widget {
  background: var(--kg-glass-bg);
  backdrop-filter: blur(var(--kg-blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--kg-blur)) saturate(1.5);
  border: 1px solid var(--kg-glass-border);
  box-shadow: var(--kg-shadow);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
#recent-posts > .recent-post-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 40px rgba(49, 96, 142, 0.16);
}

/* 文章页 / 独立页 主卡片 */
.layout > #post,
.layout > #page,
.layout > #archive {
  background: var(--kg-glass-bg);
  backdrop-filter: blur(var(--kg-blur)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--kg-blur)) saturate(1.5);
  border: 1px solid var(--kg-glass-border);
  box-shadow: var(--kg-shadow);
  border-radius: 14px;
}

/* 导航栏毛玻璃（滚动后固定态） */
#nav.fixed {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(var(--kg-blur)) saturate(1.6);
  -webkit-backdrop-filter: blur(var(--kg-blur)) saturate(1.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
}
/* 侧栏跟随区 */
#aside-content .sticky_layout {
  background: transparent;
  box-shadow: none;
}
/* 页脚透明融入背景 */
#footer {
  background: transparent !important;
}
#footer::before {
  display: none;
}

/* ========== ② 评论区皮肤（Twikoo · 跟随 Butterfly 主色） ========== */

.kang-comment-card {
  margin-top: 2.2rem;
  padding: 1.3rem 1.4rem 1.5rem;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(73, 177, 245, 0.055), rgba(255, 255, 255, 0.4));
  border: 1px solid rgba(73, 177, 245, 0.16);
}
.kang-comment-card {
  font-size: 0.95em;
  color: #2c3e50;
}
.kang-comment-card a {
  color: var(--kg-primary);
}
.kang-comment-card button {
  box-shadow: none;
}

/* 标题行 */
.tk-comments-title {
  margin-bottom: 0.9rem !important;
  font-weight: 700;
  color: #2c3e50;
}
.tk-comments-count {
  color: #2c3e50;
}

/* 提交区：玻璃输入框 */
.tk-submit {
  margin-bottom: 1.1rem;
}
.kang-comment-card .el-textarea__inner,
.kang-comment-card .tk-meta-input .el-input__inner {
  background: rgba(255, 255, 255, 0.85) !important;
  border: 1px solid rgba(73, 177, 245, 0.28) !important;
  border-radius: 12px !important;
  color: #2c3e50 !important;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.kang-comment-card .el-textarea__inner:focus,
.kang-comment-card .tk-meta-input .el-input__inner:focus {
  border-color: rgba(73, 177, 245, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(73, 177, 245, 0.12) !important;
}
/* 发送按钮：渐变胶囊 */
.kang-comment-card .tk-send {
  background: linear-gradient(135deg, var(--kg-primary), #6fb8ff) !important;
  border: none !important;
  color: #fff !important;
  border-radius: 999px !important;
  box-shadow: 0 4px 14px rgba(73, 177, 245, 0.35) !important;
  transition: transform 0.2s, box-shadow 0.2s;
}
.kang-comment-card .tk-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(73, 177, 245, 0.45) !important;
}
/* 预览按钮：幽灵胶囊 */
.kang-comment-card .tk-preview {
  background: rgba(255, 255, 255, 0.85) !important;
  border: 1px solid rgba(120, 160, 200, 0.28) !important;
  border-radius: 999px !important;
  color: #5a7e9a !important;
}

/* 楼层卡片 */
.tk-comment {
  padding: 0.85rem 0.95rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(120, 160, 200, 0.12);
  border-radius: 12px;
  margin-bottom: 0.7rem;
  transition: border-color 0.25s;
  animation: kcFadeUp 0.45s ease both;
}
.tk-comment:hover {
  border-color: rgba(73, 177, 245, 0.35);
}
.kang-comment-card .tk-avatar-img {
  border-radius: 50%;
  border: 2px solid rgba(73, 177, 245, 0.35);
}
.tk-nick {
  font-weight: 600;
  color: var(--kg-primary) !important;
}
.tk-tag {
  background: linear-gradient(135deg, #49b1f5, #b388ff) !important;
  color: #fff !important;
  border-radius: 999px !important;
  border: none !important;
}
.tk-time {
  color: rgba(90, 110, 130, 0.55);
  font-size: 0.82em;
}
.tk-content {
  line-height: 1.7;
  word-break: break-word;
}
.tk-content img {
  max-width: 100%;
}
/* 操作行 */
.kang-comment-card .tk-reply,
.kang-comment-card .tk-action {
  color: rgba(90, 110, 130, 0.65);
  cursor: pointer;
  transition: color 0.2s;
}
.kang-comment-card .tk-reply:hover,
.kang-comment-card .tk-action:hover {
  color: var(--kg-primary);
}
/* 子回复区 */
.tk-replies {
  margin-top: 0.4rem;
}
.tk-replies .tk-comment {
  background: rgba(255, 255, 255, 0.5);
  animation: none;
}
/* 加载更多 */
.tk-expand {
  border: 1px dashed rgba(73, 177, 245, 0.45) !important;
  border-radius: 999px !important;
  color: var(--kg-primary) !important;
  background: transparent !important;
  transition: background 0.2s, border-color 0.2s;
}
.tk-expand:hover {
  background: rgba(73, 177, 245, 0.08) !important;
  border-color: var(--kg-primary) !important;
}
/* 预览 / 表情 / 管理弹层 */
.tk-preview-panel {
  background: rgba(255, 255, 255, 0.72);
  border-radius: 12px;
}
.OwO {
  border-radius: 12px;
}
.OwO .OwO-body {
  border-radius: 12px;
}
.tk-comments .el-dialog {
  border-radius: 16px;
}

/* ========== ③ 友链页高级卡片（对齐主题 .container 前缀特异性） ========== */

.container .flink .flink-list {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important;
  gap: 1.1rem;
  padding: 1.1rem 0 0 !important;
  overflow: visible !important;
  text-align: left;
}
.container .flink .flink-list > .flink-list-item {
  position: relative;
  float: none !important;
  width: auto !important;
  height: auto !important;
  line-height: inherit;
  margin: 0 !important;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(120, 160, 200, 0.16);
  box-shadow: 0 4px 18px rgba(31, 45, 61, 0.06);
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.22, 0.68, 0.35, 1), box-shadow 0.35s, border-color 0.35s;
  animation: kcFadeUp 0.5s ease both;
}
/* 渐变描边（hover 点亮） */
.container .flink .flink-list > .flink-list-item::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  padding: 1.5px;
  background: linear-gradient(135deg, var(--kg-primary), #b388ff 55%, #4dd0e1);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}
/* 干掉主题自带的 scale 填充底色 */
.container .flink .flink-list > .flink-list-item::before {
  display: none;
}
.container .flink .flink-list > .flink-list-item:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 38px rgba(49, 96, 142, 0.18);
}
.container .flink .flink-list > .flink-list-item:hover::after {
  opacity: 1;
}
/* 友链页主区加宽（覆盖 hide-aside 的 80% 布局，更大气） */
html.hide-aside .layout > #page {
  width: 100% !important;
  max-width: 1080px;
}

/* 卡片：grid 双行布局（头像左跨两行，名称/描述右侧堆叠） */
.container .flink .flink-list > .flink-list-item a {
  display: grid;
  grid-template-columns: 54px 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.9rem;
  row-gap: 2px;
  align-items: center;
  padding: 1rem 1.1rem;
  color: inherit;
  text-decoration: none;
  text-align: left;
}
.container .flink .flink-list > .flink-list-item a .flink-item-icon {
  grid-row: 1 / span 2;
  grid-column: 1;
}
.container .flink .flink-list > .flink-list-item a .flink-item-name {
  grid-row: 1;
  grid-column: 2;
}
.container .flink .flink-list > .flink-list-item a .flink-item-desc {
  grid-row: 2;
  grid-column: 2;
}
/* 头像：圆形 + 悬停光环（覆盖主题 float / width:0 收缩） */
.container .flink .flink-list > .flink-list-item a .flink-item-icon {
  float: none !important;
  overflow: hidden;
  margin: 0 !important;
  width: 54px !important;
  height: 54px !important;
  border-radius: 50% !important;
  border: 2px solid rgba(73, 177, 245, 0.35);
  box-shadow: 0 0 0 4px rgba(73, 177, 245, 0.08);
  transition: transform 0.4s ease, box-shadow 0.4s;
  flex-shrink: 0;
  background: #fff;
}
.container .flink .flink-list > .flink-list-item a .flink-item-icon img,
.container .flink .flink-list > .flink-list-item a .flink-avatar {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: 50%;
}
.container .flink .flink-list > .flink-list-item:hover a .flink-item-icon {
  width: 54px !important;
  margin: 0 !important;
  transform: scale(1.1) rotate(8deg);
  box-shadow: 0 0 0 6px rgba(73, 177, 245, 0.14), 0 6px 16px rgba(73, 177, 245, 0.3);
}
.container .flink .flink-list > .flink-list-item .flink-item-name {
  display: block;
  padding: 0 !important;
  height: auto !important;
  font-size: 1.02em;
  font-weight: 700;
  color: #2c3e50;
  white-space: normal !important;
  line-height: 1.4;
}
.container .flink .flink-list > .flink-list-item .flink-item-desc {
  padding: 2px 0 0 !important;
  height: auto !important;
  font-size: 0.84em;
  color: rgba(90, 110, 130, 0.8);
  white-space: normal !important;
  line-height: 1.5;
  overflow: visible;
}

/* 分组标题：渐变竖线 */
.container .flink .flink-name {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.3em;
  font-weight: 700;
  color: #2c3e50;
  margin: 1.4rem 0 0.2rem;
  padding-left: 0.9rem;
  border-left: 4px solid;
  border-image: linear-gradient(180deg, var(--kg-primary), #b388ff) 1;
  line-height: 1.4;
}
.kang-links-note {
  text-align: center;
  color: rgba(90, 110, 130, 0.65);
  font-size: 0.95em;
  letter-spacing: 0.06em;
  margin: 0.4rem 0 0.6rem;
}

/* ========== 移动端降档 ========== */
@media screen and (max-width: 768px) {
  :root {
    --kg-blur: 10px;
    --kg-glass-bg: rgba(255, 255, 255, 0.78);
  }
  .kang-comment-card {
    padding: 1rem 0.9rem;
    margin-top: 1.6rem;
  }
  /* 输入 16px 防 iOS 聚焦自动放大 */
  .kang-comment-card .el-textarea__inner,
  .kang-comment-card .tk-meta-input .el-input__inner {
    font-size: 16px;
  }
  .kang-comment-card .el-textarea__inner {
    min-height: 88px;
  }
  /* 昵称/邮箱/网址 竖排铺满 */
  .kang-comment-card .tk-meta-input {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }
  .kang-comment-card .tk-meta-input .el-input {
    width: 100%;
  }
  /* 头像与楼层紧凑化 */
  .kang-comment-card .tk-avatar-img {
    width: 34px !important;
    height: 34px !important;
  }
  .tk-comment {
    padding: 0.7rem 0.7rem;
  }
  .tk-content {
    font-size: 0.95em;
    line-height: 1.65;
  }
  /* 操作触控区 */
  .kang-comment-card .tk-reply,
  .kang-comment-card .tk-action {
    padding: 6px 8px;
  }
  /* 发送按钮大触控 */
  .kang-comment-card .tk-send {
    min-height: 44px;
    padding: 0 22px;
  }
  .flink-list {
    grid-template-columns: 1fr;
  }
}

/* 尊重动效偏好 */
@media (prefers-reduced-motion: reduce) {
  .tk-comment,
  .flink-list-item {
    animation: none !important;
  }
  #recent-posts > .recent-post-item:hover,
  .flink-list-item:hover {
    transform: none;
  }
}

/* ========== ④ 封面与统计美化 ========== */

/* 首页文章卡片：封面 hover 微缩放（卡片 overflow hidden 已带圆角） */
#recent-posts > .recent-post-item .post_cover img.post-bg {
  transition: transform 0.65s cubic-bezier(0.22, 0.61, 0.36, 1), filter 0.65s;
}
#recent-posts > .recent-post-item:hover .post_cover img.post-bg {
  transform: scale(1.05);
  filter: saturate(1.12);
}
/* 首页卡片封面与文字分界处的柔光分隔 */
#recent-posts > .recent-post-item .post_cover {
  box-shadow: 1px 0 18px rgba(73, 177, 245, 0.1);
}
#recent-posts > .recent-post-item.odd .post_cover {
  box-shadow: -1px 0 18px rgba(73, 177, 245, 0.1);
}

/* 文章页顶部大封面：渐变遮罩提升标题可读性 + 轻入场 */
#page-header.post-bg {
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
#page-header.post-bg::before {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.16) 0%, rgba(0, 0, 0, 0.32) 100%);
}
#post-info .post-title {
  animation: kcFadeUp 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

/* 文章 meta：阅读量数字微高亮 */
#post-info .post-meta span[onclick*="page_pv"],
#post-info .post-meta .post-meta-pv-cv {
  opacity: 0.95;
}

/* 归档页小封面圆角 */
.article-sort-item-img img {
  border-radius: 10px;
}

/* 侧栏「网站资讯」卡片：数字主题色加粗 */
#aside-content .webinfo-item .item-count {
  color: #49b1f5;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
#aside-content .webinfo-item {
  padding: 4px 0;
}

/* 页脚统计行（kang-stats.js 注入） */
#footer .kang-footer-stats, #footer-wrap .kang-footer-stats {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  justify-content: center;
  gap: 26px;
  flex-wrap: wrap;
  font-size: 0.92em;
  opacity: 0.92;
}
#footer .kang-footer-stats, #footer-wrap .kang-footer-stats .kang-stat i {
  margin-right: 6px;
  opacity: 0.85;
}
#footer .kang-footer-stats, #footer-wrap .kang-footer-stats b {
  font-weight: 600;
  margin-left: 2px;
  font-variant-numeric: tabular-nums;
}
#footer .kang-footer-stats, #footer-wrap .kang-footer-stats .kang-stat {
  position: relative;
  padding: 0 4px;
}
/* 统计数字加载完成前的占位不跳动 */
#footer .kang-footer-stats, #footer-wrap .kang-footer-stats b:empty::after,
#footer .kang-footer-stats, #footer-wrap .kang-footer-stats b:has(> :empty)::after {
  content: '—';
  opacity: 0.5;
}

/* 封面图失败兜底：主题色渐变占位 */
img.post-bg.error,
.post_cover img.post-bg.error {
  background: linear-gradient(135deg, #49b1f5 0%, #b388ff 100%);
}

@media (prefers-reduced-motion: reduce) {
  #recent-posts > .recent-post-item .post_cover img.post-bg,
  #post-info .post-title {
    transition: none;
    animation: none;
  }
}
