/* ==========================================================
   站点自定义样式：音乐播放器 + 关于页面
   由 _config.kratos-rebirth.yml 的 additional_injections.head 引入
   ========================================================== */

/* ---------- 音乐播放器 ----------
   APlayer 开启 fixed 后会把挂载点自己变成 .aplayer，所以这里用 #kr-music.aplayer 的写法 */

#kr-music.kr-music-hidden {
  display: none !important;
}

#kr-music.aplayer.aplayer-fixed {
  left: 20px;
  bottom: 20px;
  width: 400px;
  max-width: calc(100vw - 32px);
}

#kr-music.aplayer.aplayer-fixed .aplayer-body {
  left: 20px;
  bottom: 20px;
  right: auto;
  width: 400px !important;
  max-width: calc(100vw - 32px);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

#kr-music.aplayer.aplayer-fixed .aplayer-info {
  /* APlayer 的吸底模板默认把信息区内联隐藏，这里强制显示 */
  display: block !important;
  border-bottom: none;
}

#kr-music.aplayer.aplayer-fixed .aplayer-list {
  width: 400px;
  max-width: calc(100vw - 32px);
  margin-bottom: 84px;
  border: 1px solid rgba(127, 127, 127, 0.18);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

#kr-music.aplayer.aplayer-fixed .aplayer-lrc {
  display: none;
}

/* 收起 / 展开交给右下角工具栏的音乐按钮，这里隐藏 APlayer 自带的箭头 */
#kr-music.aplayer.aplayer-fixed .aplayer-miniswitcher {
  display: none;
}

/* 迷你模式（窄屏）只保留封面按钮 */
#kr-music.aplayer.aplayer-fixed.aplayer-narrow,
#kr-music.aplayer.aplayer-fixed.aplayer-narrow .aplayer-body {
  width: 66px !important;
  max-width: 66px;
}

#kr-music.aplayer.aplayer-fixed.aplayer-narrow .aplayer-body {
  height: 66px;
  border-radius: 50%;
  overflow: hidden;
}

#kr-music.aplayer {
  font-family: inherit;
}

#kr-music .aplayer-title,
#kr-music .aplayer-author {
  color: #2f2f2f;
}

#kr-music-switch.active {
  color: #e58b9c;
}

@media (max-width: 768px) {
  /* 展开后铺满可用宽度：用 left/right 撑开，比 100vw 稳 */
  #kr-music.aplayer.aplayer-fixed {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto !important;
    max-width: none;
  }

  #kr-music.aplayer.aplayer-fixed .aplayer-body {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto !important;
    max-width: none;
    padding-right: 0;
  }

  #kr-music.aplayer.aplayer-fixed .aplayer-list {
    width: auto !important;
    max-width: none;
    margin-bottom: 80px;
    max-height: 46vh;
  }

  #kr-music.aplayer.aplayer-fixed .aplayer-list ol {
    max-height: 46vh;
  }

  #kr-music.aplayer.aplayer-fixed .aplayer-info .aplayer-music {
    width: calc(100% - 96px);
  }

  /* 手机上缺一个「收起」入口就回不到圆形，把 APlayer 自带的箭头放出来 */
  #kr-music.aplayer.aplayer-fixed .aplayer-miniswitcher {
    display: block;
    width: 16px;
  }

  /* 收起状态：圆形小按钮 */
  #kr-music.aplayer.aplayer-fixed.aplayer-narrow {
    left: 10px;
    right: auto;
    width: 56px !important;
    max-width: 56px;
  }

  #kr-music.aplayer.aplayer-fixed.aplayer-narrow .aplayer-body {
    left: 10px;
    right: auto;
    width: 56px !important;
    max-width: 56px;
    height: 56px;
  }
}
/* ---------- 深色模式下的播放器 ----------
   主题的深色样式会给 ol / ul / p 上 color:#eee，播放器列表标题继承了它，
   在浅色列表底上就看不见了，所以这里把整块播放器一起切到深色。 */
html[data-theme="dark"] #kr-music.aplayer {
  /* APlayer 根容器自带 background:#fff，圆角和列表下方空隙会露出来 */
  background: #232a35;
}

html[data-theme="dark"] #kr-music.aplayer .aplayer-body,
html[data-theme="dark"] #kr-music.aplayer .aplayer-info {
  background: #232a35;
}

html[data-theme="dark"] #kr-music.aplayer .aplayer-miniswitcher {
  /* 右侧那根 18px 的收起条默认是 #e6e6e6 */
  background: #2d3644;
}

html[data-theme="dark"] #kr-music.aplayer .aplayer-notice {
  background: #2d3644;
  color: #cfd8e3;
}

html[data-theme="dark"] #kr-music.aplayer .aplayer-info {
  border-top-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] #kr-music.aplayer .aplayer-list {
  background: #232a35;
  border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] #kr-music.aplayer .aplayer-list ol {
  color: #e6e6e6;
}

html[data-theme="dark"] #kr-music.aplayer .aplayer-list ol li {
  color: #e6e6e6;
  border-top-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] #kr-music.aplayer .aplayer-list ol li:hover,
html[data-theme="dark"] #kr-music.aplayer .aplayer-list ol li.aplayer-list-light {
  background: #2d3644;
}

html[data-theme="dark"] #kr-music.aplayer .aplayer-list-title {
  color: #e6e6e6;
}

html[data-theme="dark"] #kr-music.aplayer .aplayer-list-author {
  color: #9fb0c4;
}

html[data-theme="dark"] #kr-music.aplayer .aplayer-list-index {
  color: #7e8da0;
}

html[data-theme="dark"] #kr-music .aplayer-title {
  color: #e6e6e6;
}

html[data-theme="dark"] #kr-music .aplayer-author {
  color: #9fb0c4;
}

html[data-theme="dark"] #kr-music.aplayer .aplayer-time {
  color: #9fb0c4;
}

html[data-theme="dark"] #kr-music.aplayer .aplayer-bar {
  background: #4a5462;
}

html[data-theme="dark"] #kr-music.aplayer .aplayer-icon path {
  fill: #cfd8e3;
}

/* ---------- 评论（Giscus） ---------- */
.comment-post {
  margin-top: 24px;
}

.comment-post .kr-comments {
  padding: 0 4px;
}

.comment-post .giscus,
.comment-post .giscus-frame {
  width: 100%;
  border: none;
}

/* 还没配置好 category_id 时，本地预览显示的提示 */
.kr-comments-setup {
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(127, 127, 127, 0.08);
  font-size: 13px;
  line-height: 1.8;
}

.kr-comments-setup p {
  margin: 0 0 6px;
}

.kr-comments-setup ol {
  margin: 0 0 8px 1.3em;
  padding: 0;
}

.kr-comments-setup code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(127, 127, 127, 0.16);
}

/* ---------- 关于页面 ---------- */
.kr-profile {
  margin: 0 auto;
  max-width: 760px;
  text-align: left;
}

/* 主题会给每张带 alt 的图片自动追加说明，这里不需要 */
.kratos-page-content .kr-profile span.img-caption,
.kratos-page-content .kr-profile span.kr-img-caption {
  display: none;
}

.kratos-page-content .kr-profile img.with-caption {
  margin-bottom: 0;
}

.kr-profile-header {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-radius: 16px;
  background: rgba(127, 127, 127, 0.08);
}

.kr-profile-meta {
  flex: 1;
  min-width: 0;
}

.kr-profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  flex-shrink: 0;
}

.kr-profile-name {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
}

.kr-profile-intro {
  margin: 4px 0 0;
  font-size: 14px;
  opacity: 0.75;
}

.kr-profile-alias {
  margin: 6px 0 0;
  font-size: 13px;
  opacity: 0.6;
}

.kr-profile-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.kr-profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(127, 127, 127, 0.08);
  transition: transform 0.2s ease, background 0.2s ease;
}

.kr-profile-row:hover {
  transform: translateY(-2px);
  background: rgba(127, 127, 127, 0.14);
}

.kr-profile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(127, 127, 127, 0.15);
  color: inherit;
  text-decoration: none;
  flex-shrink: 0;
}

a.kr-profile-icon:hover {
  color: #e58b9c;
}

.kr-profile-label {
  font-size: 13px;
  opacity: 0.7;
  min-width: 84px;
  flex-shrink: 0;
}

.kr-profile-value {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
  text-decoration: none;
}

a.kr-profile-value:hover {
  text-decoration: underline;
}

.kr-profile-note {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  opacity: 0.6;
}

@media (max-width: 600px) {
  .kr-profile-header {
    flex-direction: column;
    text-align: center;
  }

  .kr-profile-list {
    grid-template-columns: 1fr;
  }
}

/* ---------- 首页横幅：给文字加一层压暗，保证可读 ---------- */
.kratos-cover.kratos-cover-2::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.18) 0%, rgba(0, 0, 0, 0.38) 100%);
  pointer-events: none;
}

.kratos-cover.kratos-cover-2 .desc,
.kratos-cover.kratos-cover-2 .desc2 {
  position: relative;
  z-index: 1;
}

.kratos-cover.kratos-cover-2 .desc h2,
.kratos-cover.kratos-cover-2 .desc2 h2 {
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.kratos-cover.kratos-cover-2 .desc span,
.kratos-cover.kratos-cover-2 .desc2 span {
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

/* ---------- 404 页面 ---------- */
/* 主题的 404 样式写在页面内联 <style> 里、且 #main 是 flex 容器，
   所以这里用更高优先级把内容撑满并居中。 */
#main .page404 {
  flex: 0 0 100%;
  width: 100%;
}

.page404 .kratos-hentry {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  flex-wrap: nowrap;
}

.page404 .kratos-hentry .col-md-7,
.page404 .kratos-hentry .col-md-5 {
  float: none;
  max-width: 100%;
}

.page404 .kratos-hentry .col-md-7 {
  flex: 0 0 300px;
  width: 300px;
}

.page404 .kratos-hentry .col-md-5 {
  flex: 0 0 420px;
  width: 420px;
}

.page404 .kratos-hentry img {
  max-width: 100%;
  margin: 0 auto;
  display: block;
}

.page404 .kratos-hentry .errtxt {
  margin-top: 0;
}

.page404 .kratos-hentry .back-p,
.page404 .kratos-hentry .back-index {
  display: block;
  width: 168px;
  margin: 10px auto;
  padding: 9px 0;
  text-align: center;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .page404 .kratos-hentry {
    flex-direction: column;
    gap: 16px;
  }

  .page404 .kratos-hentry .col-md-7,
  .page404 .kratos-hentry .col-md-5 {
    flex: 0 0 auto;
    width: 100%;
  }
}
/* ---------- 音乐播放器：音量条 ---------- */
#kr-music.aplayer.aplayer-fixed .aplayer-body {
  overflow: visible;
}

/* 卡片高度自适应：控制条比 66px 略高，别让它溢出到卡片外面 */
#kr-music.aplayer.aplayer-fixed .aplayer-body {
  height: auto !important;
  min-height: 66px;
  padding-bottom: 3px;
  box-sizing: border-box;
}
#kr-music.aplayer.aplayer-fixed .aplayer-body .aplayer-pic {
  border-radius: 14px 0 0 14px;
}

#kr-music.aplayer .aplayer-info .aplayer-controller .aplayer-volume-wrap {
  position: relative;
  z-index: 120;
}

/* 浮层：贴合音量条，尺寸和播放器卡片一致的圆角/描边/底色 */
#kr-music.aplayer .aplayer-info .aplayer-controller .aplayer-volume-wrap .aplayer-volume-bar-wrap {
  position: absolute;
  left: 50%;
  bottom: 22px;
  right: auto;
  transform: translateX(-50%);
  width: 15px;
  height: 0;
  padding: 4px 0;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transition: height 0.2s ease, opacity 0.16s ease;
  z-index: 130;
}

html[data-theme="dark"] #kr-music.aplayer .aplayer-info .aplayer-controller .aplayer-volume-wrap .aplayer-volume-bar-wrap {
  background: #1c1c1e;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

#kr-music.aplayer .aplayer-info .aplayer-controller .aplayer-volume-wrap:hover .aplayer-volume-bar-wrap,
#kr-music.aplayer .aplayer-info .aplayer-controller .aplayer-volume-wrap .aplayer-volume-bar-wrap.aplayer-volume-bar-wrap-active {
  height: 42px;
  opacity: 1;
}

/* 轨道：3px，颜色/圆角和播放器进度条一致 */
#kr-music.aplayer .aplayer-info .aplayer-controller .aplayer-volume-wrap .aplayer-volume-bar-wrap .aplayer-volume-bar {
  position: relative;
  right: auto;
  bottom: 0;
  width: 3px;
  height: 34px;
  border-radius: 2px;
  background: #cdcdcd;
  overflow: hidden;
}

html[data-theme="dark"] #kr-music.aplayer .aplayer-info .aplayer-controller .aplayer-volume-wrap .aplayer-volume-bar-wrap .aplayer-volume-bar {
  background: rgba(255, 255, 255, 0.28);
}

#kr-music.aplayer .aplayer-info .aplayer-controller .aplayer-volume-wrap .aplayer-volume-bar-wrap .aplayer-volume-bar .aplayer-volume {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 100%;
  min-height: 2px;
  border-radius: 2px;
  background: #e58b9c;
}

/* ---------- 音乐标题走马灯 ---------- */
/* 保持 APlayer 原本的 20px 高度（不要撑高，否则控制条会被挤到卡片外面），
   改成把行高压到 20px，文字就不会被下沿裁掉 */
#kr-music .aplayer-info .aplayer-music {
  height: 20px;
  overflow: hidden;
  line-height: 19px;
}

#kr-music .aplayer-info .aplayer-music .kr-music-line,
#kr-music .aplayer-info .aplayer-music .aplayer-title,
#kr-music .aplayer-info .aplayer-music .aplayer-author {
  line-height: 19px;
}

#kr-music .aplayer-info .aplayer-music .aplayer-title,
#kr-music .aplayer-info .aplayer-music .aplayer-author {
  display: inline;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

#kr-music .aplayer-info .aplayer-music .kr-music-line {
  display: block;
  width: max-content;
  max-width: none;
  white-space: nowrap;
}

#kr-music .aplayer-info .aplayer-music .kr-music-line.kr-marquee {
  padding-right: 48px;
  animation: kr-marquee-scroll var(--kr-dur, 10s) linear infinite alternate;
  will-change: transform;
}

#kr-music:hover .aplayer-info .aplayer-music .kr-music-line.kr-marquee {
  animation-play-state: paused;
}

@keyframes kr-marquee-scroll {
  0%, 8% { transform: translateX(0); }
  92%, 100% { transform: translateX(var(--kr-dist, 0)); }
}

@media (prefers-reduced-motion: reduce) {
  #kr-music .aplayer-info .aplayer-music .kr-music-line.kr-marquee {
    animation: none;
  }
}