/* ==========================================================================
   天涯社 (Tianya Society) 顶级视觉美化定制样式
   适配：Joe 主题 (Typecho) 全端响应式 + 亮色 / 暗黑双模自适应
   版本：v2.0 - 2026 Crafted with Passion
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 全局基础体验与极简纤细滚动条
   -------------------------------------------------------------------------- */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
  letter-spacing: 0.2px;
}

/* 文本选择高光 */
::selection {
  background: rgba(59, 130, 246, 0.25);
  color: #1d4ed8;
}
html[data-night='night'] ::selection {
  background: rgba(96, 165, 250, 0.35);
  color: #93c5fd;
}

/* 现代极简细滑滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 9999px;
  transition: background 0.3s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b82f6;
}
html[data-night='night'] ::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.5);
}
html[data-night='night'] ::-webkit-scrollbar-thumb:hover {
  background: #60a5fa;
}

/* --------------------------------------------------------------------------
   2. 顶部导航栏毛玻璃（Glassmorphism）与 Logo 完美自适应
   -------------------------------------------------------------------------- */
.joe_header {
  background: rgba(255, 255, 255, 0.82) !important;
  backdrop-filter: blur(16px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8) !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.03) !important;
  transition: all 0.3s ease;
}

html[data-night='night'] .joe_header {
  background: rgba(24, 24, 27, 0.85) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.28) !important;
}

/* Logo 尺寸自适应与双模适配 */
.joe_header__above-logo {
  display: flex !important;
  align-items: center !important;
  height: 60px !important;
  margin-right: 20px !important;
  padding-right: 0 !important;
}

.joe_header__above-logo::after {
  display: none !important;
}

.joe_header__above-logo img {
  max-width: 175px !important;
  max-height: 44px !important;
  object-fit: contain !important;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.joe_header__above-logo:hover img {
  transform: scale(1.02);
}

.joe_header__above-logo svg.profile-color-modes {
  display: none !important;
}

/* 黑夜模式下自动适配 Logo 滤镜与文字白化反相 */
html[data-night='night'] .joe_header__above-logo img {
  display: block !important;
  filter: invert(1) hue-rotate(180deg) brightness(1.2) !important;
}

html[data-night='night'] .joe_header__above-logo svg.profile-color-modes {
  display: none !important;
}

/* 导航项微动效 */
.joe_header__above-nav .item .link {
  font-weight: 500;
  transition: all 0.25s ease;
  border-radius: 6px;
  padding: 6px 12px;
}

.joe_header__above-nav .item .link:hover,
.joe_header__above-nav .item .link.current {
  color: #2563eb !important;
  background: rgba(37, 99, 235, 0.06);
}

html[data-night='night'] .joe_header__above-nav .item .link:hover,
html[data-night='night'] .joe_header__above-nav .item .link.current {
  color: #60a5fa !important;
  background: rgba(96, 165, 250, 0.1);
}

/* --------------------------------------------------------------------------
   3. 卡片圆角、柔和多层阴影与优雅上浮动效 (Card Micro-interactions)
   -------------------------------------------------------------------------- */
.joe_index,
.joe_aside__item,
.joe_detail,
.joe_comment {
  border-radius: 14px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02), 0 6px 18px rgba(0, 0, 0, 0.03) !important;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.joe_aside__item:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -4px rgba(37, 99, 235, 0.1), 0 4px 12px rgba(0, 0, 0, 0.04) !important;
}

/* 推荐与热门网格卡片 */
.joe_index__banner-recommend .item,
.joe_index__hot-list .item {
  border-radius: 12px !important;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
}

.joe_index__hot-list .item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* --------------------------------------------------------------------------
   4. 文章列表卡片交互与图片缩放动效
   -------------------------------------------------------------------------- */
.joe_list__item {
  transition: all 0.3s ease;
  padding: 16px 14px !important;
  border-radius: 12px;
  margin-bottom: 4px;
}

.joe_list__item:hover {
  background: rgba(37, 99, 235, 0.035);
  transform: translateX(4px);
}

html[data-night='night'] .joe_list__item:hover {
  background: rgba(255, 255, 255, 0.035);
}

.joe_list__item .thumbnail {
  border-radius: 10px !important;
  overflow: hidden;
}

.joe_list__item .thumbnail img {
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.joe_list__item:hover .thumbnail img {
  transform: scale(1.06);
}

.joe_list__item .information .title {
  font-weight: 700;
  transition: color 0.3s ease;
}

.joe_list__item .information .title:hover {
  color: #2563eb !important;
}

html[data-night='night'] .joe_list__item .information .title:hover {
  color: #60a5fa !important;
}

/* 文章标签徽章 */
.joe_list__item .information .title .badge {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%) !important;
  border-radius: 4px;
  font-size: 11px;
  padding: 1px 7px;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   5. 侧边栏博主卡片与头像旋转呼吸炫光 (Breathing Glow Avatar)
   -------------------------------------------------------------------------- */
.joe_aside__item.author {
  padding-top: 50px !important;
}

.joe_aside__item.author .user {
  position: relative;
}

.joe_aside__item.author .avatar {
  border: 3px solid rgba(255, 255, 255, 0.95) !important;
  box-shadow: 0 0 0 2px #3b82f6, 0 8px 24px rgba(37, 99, 235, 0.3) !important;
  transition: transform 0.75s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.5s ease !important;
}

.joe_aside__item.author .avatar:hover {
  transform: rotate(360deg) scale(1.08);
  box-shadow: 0 0 20px #38bdf8, 0 0 35px rgba(99, 102, 241, 0.65) !important;
}

.joe_aside__item.author .link {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #0f172a 0%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: opacity 0.3s ease;
}

html[data-night='night'] .joe_aside__item.author .link {
  background: linear-gradient(135deg, #f8fafc 0%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.joe_aside__item.author .motto {
  font-size: 12.5px;
  color: #64748b;
  margin-top: 4px;
}

html[data-night='night'] .joe_aside__item.author .motto {
  color: #94a3b8;
}

/* --------------------------------------------------------------------------
   6. 文章详情页与排版美化 (Typography & Code Blocks)
   -------------------------------------------------------------------------- */
.joe_detail__article {
  font-size: 15.5px;
  line-height: 1.85 !important;
  color: var(--main);
}

.joe_detail__article h2 {
  position: relative;
  padding: 8px 16px !important;
  margin: 32px 0 18px 0 !important;
  font-weight: 700;
  font-size: 21px;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.08) 0%, rgba(99, 102, 241, 0.02) 100%);
  border-left: 4px solid #3b82f6 !important;
  border-radius: 0 8px 8px 0;
}

html[data-night='night'] .joe_detail__article h2 {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.16) 0%, rgba(99, 102, 241, 0.03) 100%);
}

.joe_detail__article h3 {
  position: relative;
  padding-left: 12px;
  border-left: 3px solid #8b5cf6;
  font-weight: 600;
  font-size: 18px;
  margin: 24px 0 14px 0;
}

.joe_detail__article blockquote {
  background: rgba(37, 99, 235, 0.045) !important;
  border-left: 4px solid #3b82f6 !important;
  border-radius: 0 10px 10px 0 !important;
  padding: 14px 20px !important;
  color: #334155;
  margin: 18px 0;
}

html[data-night='night'] .joe_detail__article blockquote {
  background: rgba(255, 255, 255, 0.04) !important;
  color: #94a3b8;
}

/* 代码块 Mac 风格三色红黄绿圆点 */
.joe_detail__article pre {
  position: relative;
  padding-top: 38px !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
  overflow: hidden;
}

.joe_detail__article pre::before {
  content: '';
  position: absolute;
  top: 13px;
  left: 15px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5f56;
  box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
  z-index: 2;
}

/* --------------------------------------------------------------------------
   7. 浮动工具栏与页脚美化 (Action Buttons & Clean Footer)
   -------------------------------------------------------------------------- */
.joe_action_item {
  border-radius: 50% !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease !important;
}

.joe_action_item:hover {
  transform: scale(1.12);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3) !important;
}

.joe_footer {
  padding: 28px 0 !important;
  background: transparent !important;
  border-top: 1px solid rgba(226, 232, 240, 0.6);
  font-size: 13.5px;
}

html[data-night='night'] .joe_footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.joe_footer a {
  color: var(--routine);
  text-decoration: none;
  transition: color 0.3s ease;
}

.joe_footer a:hover {
  color: #2563eb !important;
}

html[data-night='night'] .joe_footer a:hover {
  color: #60a5fa !important;
}

/* --------------------------------------------------------------------------
   8. 移动端全局适配与细节微调 (Mobile Full Optimizations)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* 解决水平横向溢出滚动 (横条) */
  html, body, #Joe {
    overflow-x: hidden !important;
    width: 100% !important;
  }

  /* 顶部导航条居中与左右按钮对称 */
  .joe_header__above .joe_container {
    padding: 0 12px !important;
    height: 52px !important;
    min-height: 52px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .joe_header__above-slideicon,
  .joe_header__above-searchicon {
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0 !important;
  }

  .joe_header__above-logo {
    height: 50px !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .joe_header__above-logo img {
    max-width: 135px !important;
    max-height: 36px !important;
  }

  /* 容器与主体外边距优化 */
  .joe_container {
    padding: 0 10px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .joe_main {
    padding: 10px 0 20px 0 !important;
    max-width: 100% !important;
  }

  /* 移动端文章列表与排版 */
  .joe_list__item {
    padding: 12px 8px !important;
    border-radius: 10px !important;
    margin-bottom: 10px !important;
  }

  .joe_list__item.single .thumbnail {
    height: 110px !important;
    border-radius: 8px !important;
  }

  .joe_list__item .information .title {
    font-size: 15px !important;
    line-height: 1.4 !important;
  }

  /* 移动端文章详情页专属美化 */
  .joe_detail {
    padding: 15px 12px !important;
    border-radius: 12px !important;
  }

  .joe_detail__title {
    font-size: 18px !important;
    line-height: 1.45 !important;
    margin-bottom: 10px !important;
  }

  .joe_detail__article {
    font-size: 14.5px !important;
    line-height: 1.75 !important;
  }

  .joe_detail__article h2 {
    font-size: 17px !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    margin: 20px 0 12px !important;
  }

  .joe_detail__article h3 {
    font-size: 15.5px !important;
    padding-left: 8px !important;
    margin: 16px 0 10px !important;
  }

  /* 解决移动端代码块与表格溢出屏幕问题 */
  .joe_detail__article pre[class*="language-"] {
    font-size: 12px !important;
    padding: 12px 10px !important;
    border-radius: 8px !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .joe_detail__article table {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .joe_detail__article img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px !important;
  }

  /* 浮动按钮轻巧贴边 */
  .joe_action {
    right: 12px !important;
    bottom: 24px !important;
  }

  .joe_action_item {
    width: 38px !important;
    height: 38px !important;
  }

  .joe_action_item svg {
    width: 18px !important;
    height: 18px !important;
  }
}

/* --------------------------------------------------------------------------
   9. 天涯社专属云盘资源下载卡片 (Tianya Netdisk Download Card Widget)
   -------------------------------------------------------------------------- */
.tianya-download-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0;
  padding: 18px 22px;
  background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.06);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

html[data-night='night'] .tianya-download-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(96, 165, 250, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.tianya-download-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.14);
  border-color: rgba(59, 130, 246, 0.45);
}

.tianya-download-card .card-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2563eb, #6366f1);
  border-radius: 12px;
  margin-right: 18px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.tianya-download-card .card-icon svg {
  fill: #ffffff !important;
  width: 28px;
  height: 28px;
}

.tianya-download-card .card-info {
  flex: 1;
  min-width: 0;
  margin-right: 18px;
}

.tianya-download-card .card-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.4;
  margin-bottom: 6px;
  word-break: break-word;
}

html[data-night='night'] .tianya-download-card .card-title {
  color: #f8fafc;
}

.tianya-download-card .card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tianya-download-card .meta-tag {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  padding: 2px 8px;
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  border-radius: 6px;
  font-weight: 500;
}

html[data-night='night'] .tianya-download-card .meta-tag {
  background: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
}

.tianya-download-card .card-action {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.tianya-download-card .card-pwd {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px dashed rgba(245, 158, 11, 0.5);
  border-radius: 6px;
  font-size: 12px;
  color: #d97706;
  transition: all 0.25s ease;
  user-select: none;
}

.tianya-download-card .card-pwd:hover {
  background: rgba(245, 158, 11, 0.2);
  transform: scale(1.02);
}

.tianya-download-card .copy-hint {
  font-size: 11px;
  opacity: 0.8;
  text-decoration: underline;
}

.tianya-download-card .card-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  color: #ffffff !important;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tianya-download-card .card-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
  background: linear-gradient(135deg, #1d4ed8 0%, #4338ca 100%);
}

@media (max-width: 768px) {
  .tianya-download-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    gap: 14px;
  }
  
  .tianya-download-card .card-action {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  
  .tianya-download-card .card-btn {
    padding: 6px 14px;
    font-size: 13px;
  }
}
.tianya-download-card br { display: none !important; }
.tianya-download-card p { margin: 0 !important; padding: 0 !important; display: contents !important; }

/* 下载卡片软件/压缩包图标专属美化 */
.tianya-download-card .card-icon {
  background: transparent !important;
  box-shadow: none !important;
  width: 50px !important;
  height: 50px !important;
}
.tianya-download-card .card-icon img {
  width: 50px !important;
  height: 50px !important;
  object-fit: contain !important;
  filter: drop-shadow(0 4px 10px rgba(37, 99, 235, 0.28));
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}
.tianya-download-card:hover .card-icon img {
  transform: scale(1.1) rotate(-4deg);
}
