/* ============================================================
   .grid.cards 整张卡片可点击
   原理：把卡片内最后一个链接（标题链接）的 ::after 伪元素
   拉伸覆盖整张卡片，于是点击卡片任意位置都会触发该链接。
   封面图链接与标题链接指向同一个 URL，所以二者重叠无影响。
   参考：https://github.com/squidfunk/mkdocs-material/issues/6269
   ============================================================ */

.md-typeset .grid.cards > ul > li {
  position: relative;
}

.md-typeset .grid.cards > ul > li:hover {
  cursor: pointer;
}

/* 标题链接的 ::after 覆盖整卡 */
.md-typeset .grid.cards > ul > li > p:last-of-type a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* 封面图：填满卡片宽度、统一圆角 */
.md-typeset .grid.cards > ul > li > p:first-of-type > a > img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.1rem;
}

/* 封面图链接去掉默认内边距影响，悬停时轻微放大 */
.md-typeset .grid.cards > ul > li > p:first-of-type > a {
  display: block;
  overflow: hidden;
  border-radius: 0.1rem;
}

.md-typeset .grid.cards > ul > li > p:first-of-type > a > img {
  transition: transform 0.2s ease;
}

.md-typeset .grid.cards > ul > li:hover > p:first-of-type > a > img {
  transform: scale(1.03);
}

/* ============================================================
   页脚组件：社团运行时 + 不蒜子访问统计
   ============================================================ */
.md-footer-meta .vstc-footer-extra {
  margin-top: 0.4rem;
  font-size: 0.62rem;
  line-height: 1.6;
  opacity: 0.75;
}

.md-footer-meta .vstc-footer-extra .vstc-runtime {
  white-space: nowrap;
}

/* ============================================================
   自建卡片音乐播放器
   固定左下角；渐变卡片 + 3D 倾斜 + 歌单面板 + 收起悬浮按钮
   ============================================================ */
.vstc-mp {
  /* 主题色（可被 JS / 颜色设置覆盖） */
  --vc: #4a9fe0;
  --vc-l: #63c7ec;
  --vc-d: #4f86e0;
  position: fixed;
  left: 2rem;
  bottom: 2.5rem;
  width: 340px;
  max-width: calc(100vw - 2rem);
  z-index: 100;
  perspective: 900px;
  font-feature-settings: "tnum";
}

.vstc-mp-card {
  position: relative;
  padding: 14px 16px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--vc-l) 0%, var(--vc) 60%, var(--vc-d) 100%);
  box-shadow: 0 10px 30px rgba(40, 120, 200, 0.35);
  transform-style: preserve-3d;
  touch-action: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  will-change: transform;
  cursor: grab; /* 提示可拖动；按钮/进度条会覆盖为各自光标 */
}

.vstc-mp.dragging { user-select: none; }
.vstc-mp.dragging .vstc-mp-card { cursor: grabbing; transition: none; }

.vstc-mp-card:hover {
  box-shadow: 0 16px 40px rgba(40, 120, 200, 0.45);
}

/* 头部：封面 + 信息 + 可视化条 */
.vstc-mp-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vstc-mp-cover {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.vstc-mp-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vstc-mp.playing .vstc-mp-cover {
  animation: vstc-mp-spin 12s linear infinite;
}

.vstc-mp-info {
  flex: 1 1 auto;
  min-width: 0;
}

.vstc-mp-title {
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1.3;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.vstc-mp-artist {
  margin-top: 2px;
  font-size: 0.62rem;
  opacity: 0.85;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* 可视化均衡条（CSS 动画，播放时跳动） */
.vstc-mp-eq {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  flex: 0 0 auto;
  height: 16px;
}

.vstc-mp-eq span {
  width: 3px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.9);
}

.vstc-mp.playing .vstc-mp-eq span {
  animation: vstc-mp-eq 0.9s ease-in-out infinite;
}

.vstc-mp.playing .vstc-mp-eq span:nth-child(2) { animation-delay: 0.25s; }
.vstc-mp.playing .vstc-mp-eq span:nth-child(3) { animation-delay: 0.5s; }
.vstc-mp.playing .vstc-mp-eq span:nth-child(4) { animation-delay: 0.15s; }

/* 歌词字幕（单行同步） */
.vstc-mp-lrc {
  height: 0;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
  font-size: 0.64rem;
  line-height: 1rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.95);
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: height 0.2s ease, opacity 0.2s ease, margin-top 0.2s ease;
}

.vstc-mp-lrc.show {
  height: 1rem;
  margin-top: 10px;
  opacity: 1;
}

/* 进度条（含拖动手柄）+ 时长 */
.vstc-mp-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.vstc-mp-progress {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  height: 14px;
  cursor: pointer;
  touch-action: none;
}

.vstc-mp-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
}

.vstc-mp-played {
  position: relative;
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: #fff;
}

.vstc-mp-played::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transform: translateY(-50%) scale(0);
  transition: transform 0.15s ease;
}

.vstc-mp-progress:hover .vstc-mp-played::after,
.vstc-mp.dragging .vstc-mp-played::after {
  transform: translateY(-50%) scale(1);
}

.vstc-mp-time {
  flex: 0 0 auto;
  font-size: 0.56rem;
  opacity: 0.85;
  white-space: nowrap;
}

/* 底部：歌单胶囊 + 控制按钮 */
.vstc-mp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.vstc-mp-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 40%;
  padding: 5px 10px;
  border: none;
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.6rem;
  cursor: pointer;
}

.vstc-mp-pill:hover { background: rgba(255, 255, 255, 0.32); }

.vstc-mp-pill-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.vstc-mp-pill svg { flex: 0 0 auto; width: 14px; height: 14px; fill: currentColor; }

.vstc-mp-ctrl {
  display: flex;
  align-items: center;
  gap: 4px;
}

.vstc-mp-btn {
  display: flex;
  padding: 3px;
  border: none;
  border-radius: 50%;
  color: #fff;
  background: none;
  cursor: pointer;
}

.vstc-mp-btn:hover { background: rgba(255, 255, 255, 0.2); }
.vstc-mp-btn svg { width: 19px; height: 19px; fill: currentColor; }

.vstc-mp-play {
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--vc-d);
  background: rgba(255, 255, 255, 0.95);
}

.vstc-mp-play:hover { background: #fff; }
.vstc-mp-play svg { width: 18px; height: 18px; }

/* 歌单面板（卡片上方展开） */
.vstc-mp-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  margin-bottom: 8px;
  max-height: 0;
  overflow: hidden;
  border-radius: 12px;
  background: var(--md-default-bg-color, #fff);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transition: max-height 0.25s ease;
}

.vstc-mp-panel.open {
  max-height: 260px;
  overflow-y: auto;
}

.vstc-mp-list {
  margin: 0;
  padding: 6px;
  list-style: none;
}

.vstc-mp-list li {
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.vstc-mp-list li:hover { background: rgba(74, 159, 224, 0.12); }
.vstc-mp-list li.active { background: rgba(74, 159, 224, 0.18); }

.vstc-mp-li-name {
  font-size: 0.7rem;
  color: var(--md-default-fg-color, #222);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.vstc-mp-li-art {
  font-size: 0.58rem;
  color: var(--md-default-fg-color--light, #888);
}

/* 收起态：悬浮圆形按钮 */
.vstc-mp-fab {
  display: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--vc-l), var(--vc-d));
  box-shadow: 0 6px 18px rgba(40, 120, 200, 0.4);
  touch-action: none;
  cursor: pointer;
}

.vstc-mp-fab svg { width: 24px; height: 24px; fill: currentColor; }

/* 颜色设置：调色按钮 + 色板弹层 */
.vstc-mp-color {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  padding: 3px;
  border: none;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
  opacity: 0.85;
  cursor: pointer;
}

.vstc-mp-color:hover { background: rgba(255, 255, 255, 0.38); opacity: 1; }
.vstc-mp-color svg { width: 14px; height: 14px; fill: currentColor; }

.vstc-mp-colors {
  position: absolute;
  top: 42px;
  right: 14px;
  display: none;
  grid-template-columns: repeat(3, 20px);
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
  background: var(--md-default-bg-color, #fff);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.vstc-mp-colors.open { display: grid; }

.vstc-mp-sw {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 50%;
  cursor: pointer;
}

.vstc-mp-sw:hover { transform: scale(1.12); }

.vstc-mp-color-input {
  grid-column: 1 / -1;
  width: 100%;
  height: 24px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.vstc-mp.collapsed { width: auto; }
.vstc-mp.collapsed .vstc-mp-card,
.vstc-mp.collapsed .vstc-mp-panel { display: none; }
.vstc-mp.collapsed .vstc-mp-fab { display: flex; }
.vstc-mp.playing.collapsed .vstc-mp-fab { animation: vstc-mp-spin 8s linear infinite; }

@keyframes vstc-mp-eq {
  0%, 100% { height: 4px; }
  50% { height: 16px; }
}

@keyframes vstc-mp-spin {
  to { transform: rotate(360deg); }
}

/* 移动端缩小占位 */
@media screen and (max-width: 76.1875em) {
  .vstc-mp { left: 1rem; bottom: 1.5rem; width: 300px; }
}

/* 尊重减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  .vstc-mp.playing .vstc-mp-cover,
  .vstc-mp.playing .vstc-mp-eq span,
  .vstc-mp.playing.collapsed .vstc-mp-fab {
    animation: none;
  }
  .vstc-mp-card { transition: none; }
}
