/* =============================================================
   components.css — 通用组件：按钮 / 卡片 / 曲目行 / 标签 / 搜索
   ============================================================= */

/* ------------------------------- 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  transition: transform var(--fast) var(--ease), background var(--fast) var(--ease),
    border-color var(--fast) var(--ease), opacity var(--fast) var(--ease);
}

.btn:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--grad);
  color: #0a0a12;
  border: 0;
  box-shadow: 0 8px 22px rgba(120, 110, 255, 0.28);
}

.btn--primary:hover {
  filter: brightness(1.06);
  background: var(--grad);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}

.btn--ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  color: var(--text-dim);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease),
    transform var(--fast) var(--ease);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn.is-on {
  color: var(--accent);
}

/* ------------------------------- 视图头部 */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.page-head__eyebrow {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.page-head h1 {
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.page-head__sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

/* ------------------------------- Hero */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  grid-template-areas:
    "body art"
    "actions art";
  align-items: center;
  column-gap: 26px;
  padding: 34px 36px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--line);
  background: radial-gradient(120% 140% at 0% 0%, rgba(167, 139, 250, 0.28) 0%, transparent 55%),
    radial-gradient(100% 120% at 100% 100%, rgba(56, 189, 248, 0.24) 0%, transparent 60%),
    var(--surface);
}

.hero__body {
  grid-area: body;
  align-self: end;
}

.hero__actions {
  grid-area: actions;
  align-self: start;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.hero__eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.hero__title {
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.hero__artist {
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 15px;
}

.hero__meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.hero__art {
  grid-area: art;
  position: relative;
  justify-self: end;
  align-self: center;
  width: min(100%, 260px);
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: rotate(-2deg);
  transition: transform var(--mid) var(--ease);
}

.hero__art:hover {
  transform: rotate(0deg) scale(1.02);
}

.hero__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__art::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  border-radius: inherit;
}

/* ------------------------------- 区块标题 */
.section {
  margin-top: 40px;
}

.section:first-child {
  margin-top: 0;
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section__title {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.section__more {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: color var(--fast) var(--ease);
}

.section__more:hover {
  color: var(--accent);
}

/* ------------------------------- 卡片网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 20px 18px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  min-width: 0;
}

.card__art {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-sm);
  transition: transform var(--mid) var(--ease), box-shadow var(--mid) var(--ease);
}

.card:hover .card__art {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.card__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms var(--ease);
}

.card:hover .card__art img {
  transform: scale(1.06);
}

.card__play {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--grad);
  color: #0a0a12;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(10px) scale(0.9);
  transition: opacity var(--mid) var(--ease), transform var(--mid) var(--ease);
}

.card:hover .card__play,
.card.is-current .card__play {
  opacity: 1;
  transform: none;
}

.card__play .icon {
  width: 20px;
  height: 20px;
}

.card__title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card__sub {
  font-size: 12.5px;
  color: var(--muted);
}

.card__text {
  min-width: 0;
}

.card__badge .eq {
  height: 10px;
  color: #fff;
}

.card__badge {
  position: absolute;
  left: 10px;
  top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(8, 8, 12, 0.62);
  color: #fff;
  backdrop-filter: blur(8px);
}

/* 正在播放的均衡器 */
.eq {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.eq span {
  display: block;
  width: 2.5px;
  border-radius: 99px;
  background: currentColor;
  animation: eqBar 900ms ease-in-out infinite;
}

.eq span:nth-child(1) {
  height: 40%;
  animation-delay: -0.2s;
}
.eq span:nth-child(2) {
  height: 90%;
  animation-delay: -0.55s;
}
.eq span:nth-child(3) {
  height: 60%;
  animation-delay: -0.85s;
}

@keyframes eqBar {
  0%,
  100% {
    transform: scaleY(0.35);
  }
  50% {
    transform: scaleY(1);
  }
}

.is-playing .eq {
  display: inline-flex;
}

.is-playing .card__play .icon-play,
.is-playing .card__play .icon-play-fill {
  display: none;
}

/* ------------------------------- 搜索框 */
.search {
  position: relative;
  display: flex;
  align-items: center;
  height: 42px;
  padding: 0 14px 0 40px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
  min-width: 220px;
}

.search:focus-within {
  border-color: var(--accent);
  background: var(--surface);
}

.search .icon {
  position: absolute;
  left: 14px;
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.search input {
  width: 100%;
  border: 0;
  background: none;
  outline: none;
  font-size: 14px;
}

.search input::placeholder {
  color: var(--muted);
}

.search__clear {
  display: none;
  margin-left: 6px;
  color: var(--muted);
}

.search.has-value .search__clear {
  display: grid;
}

/* ------------------------------- 标签 chips */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: all var(--fast) var(--ease);
}

.chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.chip.is-active {
  color: #0a0a12;
  background: var(--text);
  border-color: transparent;
}

[data-theme="light"] .chip.is-active {
  color: #fff;
  background: #16161f;
}

/* ------------------------------- 曲目列表 */
.tracklist {
  display: flex;
  flex-direction: column;
}

.tl-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 2.4fr) minmax(0, 1.4fr) 76px 60px 76px;
  gap: 14px;
  align-items: center;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.tl-head__dur {
  text-align: right;
}

.tl-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 2.4fr) minmax(0, 1.4fr) 76px 60px 76px;
  gap: 14px;
  align-items: center;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--fast) var(--ease);
}

.tl-row:hover {
  background: var(--surface-2);
}

.tl-row.is-current {
  background: var(--accent-soft);
}

.tl-row.is-current .tl-row__title {
  color: var(--accent);
}

.tl-row__idx {
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tl-row__playicon {
  width: 15px;
  height: 15px;
  opacity: 0;
  transition: opacity var(--fast) var(--ease);
}

.tl-row:hover .tl-row__idx .num {
  display: none;
}

.tl-row:hover .tl-row__playicon {
  opacity: 1;
}

.tl-row.is-current .tl-row__idx {
  color: var(--accent);
}

.tl-row.is-playing .tl-row__playicon,
.tl-row.is-playing .num {
  display: none;
}

.tl-row.is-playing .eq {
  display: inline-flex;
}

.tl-row__main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.tl-row__art {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  overflow: hidden;
  flex: none;
  background: var(--surface-3);
}

.tl-row__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tl-row__text {
  min-width: 0;
}

.tl-row__title {
  font-size: 14.5px;
  font-weight: 550;
  color: var(--text);
}

.tl-row__artist {
  font-size: 12.5px;
  color: var(--muted);
}

.tl-row__album {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tl-row__genre {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--surface-3);
  border-radius: 99px;
  padding: 3px 9px;
  justify-self: start;
  white-space: nowrap;
}

.tl-row__dur {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.tl-row__act {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.tl-row__act .icon-btn {
  width: 32px;
  height: 32px;
}

.tl-row.is-liked .js-like {
  color: var(--accent-3);
}

/* ------------------------------- 空状态 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 72px 20px;
  text-align: center;
  color: var(--muted);
}

.empty__icon {
  width: 56px;
  height: 56px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--muted);
}

.empty h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
}

.empty p {
  font-size: 13.5px;
  max-width: 320px;
}

/* ------------------------------- 弹出菜单 */
.menu {
  position: fixed;
  z-index: var(--z-toast);
  min-width: 176px;
  padding: 6px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: menuIn 140ms var(--ease) both;
}

@keyframes menuIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-dim);
  text-align: left;
}

.menu__item:hover {
  background: var(--surface-3);
  color: var(--text);
}

.menu__item .icon {
  width: 16px;
  height: 16px;
}

/* ------------------------------- Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--player-h) + 24px);
  transform: translate(-50%, 12px);
  z-index: var(--z-toast);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--mid) var(--ease), transform var(--mid) var(--ease);
}

.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 900px) {
  .toast {
    bottom: calc(var(--player-h) + var(--tabbar-h) + 18px);
  }
}

/* ------------------------------- 移动端适配 */
/* ------------------------------- 页脚小字 */
.footnote {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 20px;
  }

  .page-head .btn {
    align-self: flex-start;
  }

  .search {
    width: 100%;
    min-width: 0;
  }

  .hero {
    grid-template-columns: 96px minmax(0, 1fr);
    grid-template-areas:
      "art body"
      "actions actions";
    column-gap: 16px;
    padding: 18px;
    align-items: start;
  }

  .hero__body {
    align-self: center;
  }

  .hero__art {
    justify-self: start;
    width: 96px;
    border-radius: 12px;
    transform: none;
  }

  .hero__eyebrow {
    margin-bottom: 6px;
    font-size: 10px;
  }

  .hero__title {
    font-size: 23px;
  }

  .hero__artist {
    margin-top: 3px;
    font-size: 13.5px;
  }

  .hero__meta {
    font-size: 11.5px;
  }

  .hero__actions {
    margin-top: 16px;
    align-self: start;
  }

  .hero__actions .btn {
    flex: 1;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 16px 12px;
  }

  .card__play {
    opacity: 1;
    transform: none;
    width: 38px;
    height: 38px;
    right: 8px;
    bottom: 8px;
  }

  .tl-head {
    display: none;
  }

  .tl-row {
    grid-template-columns: 26px minmax(0, 1fr) auto auto;
    gap: 10px;
    padding: 8px;
  }

  .tl-row__album,
  .tl-row__genre {
    display: none;
  }

  .tl-row__act .js-more {
    display: none;
  }

  .section {
    margin-top: 30px;
  }
}
