/* 自定义样式（Butterfly） */

/* 卡片半透明，露出背景图 */
#recent-posts .recent-post-item,
#aside-content .card-widget,
#post,
#page,
#archive,
#tag,
#category,
.layout > .pagination {
  background: rgba(255, 255, 255, 0.88);
}

[data-theme="dark"] #recent-posts .recent-post-item,
[data-theme="dark"] #aside-content .card-widget,
[data-theme="dark"] #post,
[data-theme="dark"] #page,
[data-theme="dark"] #archive,
[data-theme="dark"] #tag,
[data-theme="dark"] #category,
[data-theme="dark"] .layout > .pagination {
  background: rgba(18, 18, 18, 0.85);
}

/* 正文链接样式（沿用原来的风格） */
#article-container p a,
#article-container li a {
  color: #0593d3;
  border-bottom: 1px dashed #0593d3;
  font-weight: bold;
}

#article-container p a:hover,
#article-container li a:hover {
  color: #f28a31;
  border-bottom-color: #f28a31;
}

/* 文章结尾标记 */
.post-end-tag {
  margin: 2rem 0 1rem;
  color: #aaa;
  font-size: 14px;
  text-align: center;
}

.post-end-tag i {
  margin: 0 .3em;
  color: #ff6b6b;
}

/* 侧边栏“音乐”卡片里的播放器 */
#card-music .aplayer {
  margin: 0;
  box-shadow: none;
  border-radius: 6px;
}

/* 侧边栏头像：鼠标悬停时转一圈（和原来 NexT 的效果一样） */
#aside-content .card-info .avatar-img img {
  transition: transform 1s ease-out;
}

#aside-content .card-info .avatar-img:hover img {
  transform: rotate(360deg);
}

/* 首页显示带格式的摘要 / 视频（见 scripts/index-media-excerpt.js） */
/* 这些卡片取消固定高度和两行摘要限制，其他卡片不受影响 */
#recent-posts .recent-post-item:has(.index-rich) {
  height: auto;
}

/* 高度改成 auto 后，卡片上下没有留白，内容会贴着卡片底边，这里补上 */
#recent-posts .recent-post-item:has(.index-rich) > .recent-post-info {
  padding-top: 32px;
  padding-bottom: 36px;
}

@media screen and (max-width: 768px) {
  #recent-posts .recent-post-item:has(.index-rich) > .recent-post-info {
    padding-top: 20px;
    padding-bottom: 24px;
  }
}

#recent-posts .recent-post-item .content:has(.index-rich) {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

/* 段落、标题、列表之间的间距，和文章页接近但更紧凑 */
#recent-posts .index-rich > :first-child {
  margin-top: 0;
}

#recent-posts .index-rich > :last-child {
  margin-bottom: 0;
}

#recent-posts .index-rich p {
  margin: 0 0 .6rem;
}

#recent-posts .index-rich :is(h1, h2, h3, h4, h5, h6) {
  margin: .8rem 0 .4rem;
  font-size: 1.1em;
  font-weight: bold;
}

#recent-posts .index-rich :is(ul, ol) {
  margin: 0 0 .6rem;
  padding-left: 1.5em;
}

#recent-posts .index-rich img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

#recent-posts .index-rich iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  margin-top: .5rem;
  border-radius: 8px;
}

/* 上一篇 / 下一篇、相关文章卡片里只显示文字，不显示视频 */
.pagination-related iframe {
  display: none;
}

/* 文章里的视频（B 站、YouTube 等）：宽度铺满正文，按 16:9 显示 */
/* iframe 没写宽高时浏览器默认只有 300×150，所以这里统一设置 */
#article-container iframe[src*="player.bilibili.com"],
#article-container iframe[src*="youtube.com"],
#article-container iframe[src*="youtube-nocookie.com"],
#article-container iframe[src*="v.qq.com"],
#article-container iframe[src*="player.youku.com"],
#article-container iframe[src*="player.vimeo.com"] {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 1rem auto;
  border-radius: 8px;
}

/* ---------- 深色模式补充 ---------- */
/* GitHub 图标的颜色 #24292e 在深色背景上看不见 */
[data-theme="dark"] .card-info-social-icons .fa-github {
  color: #e6e6e6 !important;
}

/* 播放器默认是白底，深色模式下改成深色 */
[data-theme="dark"] .aplayer {
  background: #262626;
  color: #ccc;
}

[data-theme="dark"] .aplayer .aplayer-info .aplayer-music .aplayer-title,
[data-theme="dark"] .aplayer .aplayer-lrc p.aplayer-lrc-current {
  color: #eee;
}

[data-theme="dark"] .aplayer .aplayer-info .aplayer-music .aplayer-author,
[data-theme="dark"] .aplayer .aplayer-info .aplayer-controller .aplayer-time,
[data-theme="dark"] .aplayer .aplayer-lrc p {
  color: #999;
}

[data-theme="dark"] .aplayer .aplayer-lrc::before {
  background: linear-gradient(180deg, #262626 0, rgba(38, 38, 38, 0) 100%);
}

[data-theme="dark"] .aplayer .aplayer-lrc::after {
  background: linear-gradient(180deg, rgba(38, 38, 38, 0) 0, rgba(38, 38, 38, .8) 100%);
}

[data-theme="dark"] .aplayer .aplayer-list ol li {
  border-top-color: #333;
  color: #bbb;
}

[data-theme="dark"] .aplayer .aplayer-list ol li:hover,
[data-theme="dark"] .aplayer .aplayer-list ol li.aplayer-list-light {
  background: #333;
}

[data-theme="dark"] .aplayer .aplayer-info .aplayer-controller .aplayer-time .aplayer-icon path {
  fill: #999;
}

/* ---------- 中英切换（见 source/js/translate-en.js） ---------- */
/* 右下角的「EN / 中」按钮：文字按钮，字号比图标小一点 */
#rightside #translateEnLink {
  font-size: 14px;
  font-weight: bold;
}

/* 自动翻译后左下角的提示条 */
#translate-toast {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 1001;
  max-width: calc(100vw - 40px);
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(30, 30, 30, .9);
  color: #fff;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}

#translate-toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#translate-toast a {
  margin-left: .5em;
  color: #49b1f5;
  text-decoration: underline;
}
