/**
 * Playlist 页面样式
 * 外层白框（.pl-panel）は主题の Tailwind 类（見 content/playlist/_index.md）。
 * 构成：
 *   - Playlist    … Spotify プレイリスト埋め込みのラッパー（.pl-embed。角丸は外側で统一裁切）
 *   - Liner Notes … 曲カード（.ln-grid / .song-card。紧凑プレイヤー＋星评价＋感想）
 *                   データは data/playlist/*.yaml、生成は _shortcodes/liner-notes.html
 * 星评价 .stars-wrap は bookshelf.css と同じ实装（このページは bookshelf.css を読まないため再定义）。
 * 区块标题 .bs-heading の样式は _partials/section-toc.html 側（书架と Playlist 共用）。
 */

.playlist {
  color: var(--color-foreground);
}

/* ===== 白框（Playlist / Liner Notes 共用） =====
   ※ bookshelf.css の .bs-panel と同一内容。両ページの余白を揃えるため、
     片方を変えたらもう片方も合わせること（意図的に共通化していない）。
   padding は Tailwind の p-8（2rem）と同値をここでも明示しておく。
   こう書いておけば、狭い画面だけ余白を詰める指定を CSS 側で完結できる。 */
.playlist .pl-panel {
  padding: 2rem;
}
@media (max-width: 480px) {
  /* 極端に狭い画面のみ。ここを詰めないと Spotify プレイヤーの幅が足りなくなる */
  .playlist .pl-panel {
    padding: 1.5rem;
  }
}

/* ===== Playlist：埋め込みのラッパー ===== */
/* iframe 自体の角丸は使わず、外側で裁切る（深色モードで白い角が出るのを防ぐ）
   白框の内側なので影は付けない（二重に影が出て濁るため） */
.playlist .pl-embed {
  border-radius: 12px;
  overflow: hidden;
}
.playlist .pl-embed iframe {
  display: block;
  width: 100%;
  border: 0;
}

/* ===== Liner Notes：1行までの表示枠 =====
   ※ bookshelf.css の .years-scroll / .years-hint が姉妹実装（同じ考え方・別の値）。
     ヒントの見た目を変えるときは両方を合わせること。
   max-height は JS（_shortcodes/liner-notes.html）が1行分を実測して px で上書きする。
   曲カードは高さが不揃いなので、CSS 側で概算値は持たない。 */
.playlist .ln-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  /* カードの影が縁で切れないための余白。同じ幅の負 margin で打ち消す */
  padding: 0.25rem;
  margin: -0.25rem;
  /* スクロールバーは非表示（スクロール自体は可能。上のヒントで存在を伝える）。
     テーマの base.css が全体に scrollbar-width: thin を当てているので確実に上書きする。 */
  scrollbar-width: none;
}
.playlist .ln-scroll::-webkit-scrollbar {
  display: none;
}

/* スクロールできるときだけ表示されるヒント */
.playlist .ln-hint {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  /* bookshelf.css の .years-hint と同値（見出しとの距離を書架側と揃える） */
  margin: -1.125rem 0 1rem;
  font-size: 0.72rem;
  line-height: 1;
  color: var(--color-muted-foreground);
  transition: opacity 0.3s ease;
}
.playlist .ln-wrap.is-scrollable .ln-hint {
  display: flex;
}
.playlist .ln-wrap.is-end .ln-hint {
  opacity: 0;
}
.playlist .ln-hint svg {
  flex: none;
  animation: ln-bob 1.6s ease-in-out infinite;
}
@keyframes ln-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(2px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .playlist .ln-hint svg {
    animation: none;
  }
}

/* ===== Liner Notes：曲カードの网格 =====
   固定断点を使わず auto-fit + minmax にすることで、
   「2列だけど1列が狭すぎてプレイヤーが崩れる」状态が構造上発生しない。
   コンテナ幅が 300px×2＋gap 以上あれば2列、足りなければ自動で1列。 */
.playlist .ln-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  align-items: stretch; /* 同じ行のカードを等高にする */
}

.playlist .song-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 0;
  min-width: 0; /* 长いテキストでカードが押し広げられるのを防ぐ */
  padding: 1.15rem;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}
@media (max-width: 480px) {
  /* 手机では内边距を詰めて、プレイヤーに幅を譲る */
  .playlist .song-card {
    padding: 0.9rem;
  }
}
/* カード自体はクリックできないので、移動はさせず影と枠線だけ強める
   （上下に動くと「押せそう」に見えてしまうため） */
.playlist .song-card:hover {
  border-color: color-mix(in oklab, var(--color-primary) 35%, var(--color-border));
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.08);
}

/* 曲名・アーティスト・星 */
.playlist .sc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.playlist .sc-meta {
  min-width: 0; /* 长い曲名の折返し・省略を効かせるために必要 */
}
.playlist .sc-title {
  display: -webkit-box;
  -webkit-line-clamp: 2; /* 长い曲名は2行で省略 */
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
}
.playlist .sc-artist {
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--color-muted-foreground);
}
.playlist .sc-stars {
  flex-shrink: 0; /* 星は折返さない */
}

/* Spotify 紧凑プレイヤー（高さ 152px 固定。幅で拡縮しないので比例崩れは起きない） */
.playlist .sc-embed {
  border-radius: 10px;
  overflow: hidden;
}
.playlist .sc-embed iframe {
  display: block;
  width: 100%;
  height: 152px;
  border: 0;
}

/* 感想（flex-grow で同じ行のカード高さを揃える） */
.playlist .sc-review {
  flex-grow: 1;
  margin: 0;
  padding: 0.85rem 0.95rem;
  background: var(--color-muted);
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.75;
  /* 改行はテンプレート側で <br> に変換済み（pre-wrap は使わない。
     使うとショートコードのインデントがそのまま字下げとして表示されるため） */
  overflow-wrap: anywhere;
}

/* タグ＋日付 */
.playlist .sc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: auto; /* 常にカード最下部 */
}
.playlist .sc-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
/* タグは主题色（--color-primary）の淡い下地。カラースキームを変えると自動で追従する */
.playlist .sc-tag {
  padding: 3px 9px;
  border-radius: 999px;
  /* 各1行目は後備（color-mix 非対応ブラウザ用） */
  background: var(--color-muted);
  background: color-mix(in oklab, var(--color-primary) 10%, transparent);
  border: 1px solid var(--color-border);
  border: 1px solid color-mix(in oklab, var(--color-primary) 18%, transparent);
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--color-primary);
}
.playlist .sc-date {
  flex-shrink: 0;
  font-size: 0.7rem;
  color: var(--color-muted-foreground);
  opacity: 0.75;
}

/* ===== 星评价 .stars-wrap（rating が空なら非表示。小数対応。bookshelf.css と同じ） ===== */
.playlist .sc-stars:empty {
  display: none;
}
.playlist .stars-wrap {
  position: relative;
  display: inline-block;
  font-size: 0.85rem;
  line-height: 1;
  white-space: nowrap;
}
.playlist .stars-wrap .stars-empty {
  color: var(--color-muted-foreground);
  opacity: 0.3;
}
.playlist .stars-wrap .stars-fill {
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
  color: #e6a817;
}
