/* ===== Design tokens ===== */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --ink: #0d0d0f;
  --ink-2: #525257;
  --ink-3: #8a8a90;
  --Line: #ececef;
  --line-2: #f3f3f5;
  --accent: #4f46e5;
  --accent-soft: #eef0fe;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 16, 24, .04), 0 2px 8px rgba(16, 16, 24, .04);
  --shadow-md: 0 8px 24px rgba(16, 16, 24, .07), 0 2px 6px rgba(16, 16, 24, .04);
  --shadow-lg: 0 24px 60px rgba(16, 16, 24, .12), 0 8px 20px rgba(16, 16, 24, .06);
  --player-h: 84px;
  --maxw: 1080px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  transition: background .35s ease, color .35s ease;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: calc(var(--player-h) + 28px);
  line-height: 1.5;
}

body.album-cover-clicked {
  background: #d1d5db;
}

h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ===== Top bar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(140%) blur(2px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }
.brand__mark {
  width: 22px; height: 22px; border-radius: 7px;
  background: var(--ink);
  position: relative;
}
.brand__mark::after {
  content: ""; position: absolute; inset: 6px;
  border-radius: 50%; background: var(--bg);
}
.brand__name { font-size: 15px; letter-spacing: -.01em; }
.topbar__nav { display: flex; gap: 28px; }
.topbar__nav a {
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  transition: color .2s var(--ease);
}
.topbar__nav a:hover { color: var(--ink); }

/* ===== Layout ===== */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: 64px 0; border-top: 1px solid var(--line); }
#about { padding-top: 0; }
.section__head { margin-bottom: 28px; }
.section__head h2 { font-size: 26px; font-weight: 700; }
.section__sub { margin: 6px 0 0; color: var(--ink-3); font-size: 14.5px; }

/* ===== Hero ===== */
.hero {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
  padding: 72px 0 64px;
}
.hero__art {
  position: relative;
  display: grid;
  gap: 24px;
}
.hero__art img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transform: translateY(0);
  transition: transform .25s var(--ease);
}
.hero__song-list {
  width: 100%;
  max-width: 360px;
}
.hero__song-list .song {
  padding: 12px;
}
.hero__badge {
  position: absolute;
  top: 16px; left: 16px;
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
  font-size: 12px; font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  letter-spacing: .01em;
}
.hero__tracks {
  width: 100%;
}
.hero__tracks .section__head { margin-bottom: 16px; }
.hero__tracks h2 { font-size: 22px; }
.hero__tracks .section__sub { margin: 4px 0 0; }
.hero__eyebrow {
  margin: 0 0 12px;
  font-size: 13px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero__title { font-size: clamp(40px, 6vw, 64px); font-weight: 800; line-height: 1.02; }
.hero__artist { margin: 14px 0 0; font-size: 20px; font-weight: 600; color: var(--ink-2); }
.hero__desc {
  margin: 22px 0 0;
  max-width: 46ch;
  color: var(--ink-2);
  font-size: 16px;
}
.hero__facts {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 0;
  margin: 26px 0 0;
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
}
.hero__facts span { color: var(--ink-3); font-weight: 500; margin-right: 7px; }
.hero__facts .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--line); }
.hero__actions { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 24px;
  border-radius: 999px;
  font-size: 15px; font-weight: 600;
  transition: transform .18s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}
.btn:active { transform: scale(.97); }
.btn .ic { width: 20px; height: 20px; fill: currentColor; }
.btn--primary { background: var(--ink); color: #fff; box-shadow: var(--shadow-md); }
.btn--primary:hover { background: #000; box-shadow: var(--shadow-lg); }
.btn--ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn--ghost svg { width: 18px; height: 18px; fill: currentColor; }
.btn--ghost:hover { background: #f3f3f5; }

/* play/pause icon swap */
.ic--pause { display: none; }
.is-playing .ic--play { display: none; }
.is-playing .ic--pause { display: inline; }

/* ===== Track list ===== */
.tracklist {
  list-style: none;
  margin: 0;
  padding: 0;
}
.track {
  display: grid;
  grid-template-columns: 36px 8px 44px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .18s var(--ease);
  border: 1px solid transparent;
}
.track + .track { margin-top: 8px; }
.track:hover { background: var(--surface-2); }
.track__index {
  position: relative;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  color: var(--ink-3);
  font-size: 15px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.track__num { transition: opacity .15s var(--ease); }
.track__playicon {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  opacity: 0;
  transition: opacity .15s var(--ease);
}
.track__playicon svg { width: 17px; height: 17px; fill: var(--ink); }
.track:hover .track__num { opacity: 0; }
.track:hover .track__playicon { opacity: 1; }

.track__title { font-size: 15.5px; font-weight: 600; color: var(--ink); }
.track__sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.track__art {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
  flex: none;
}

.track__gap {
  width: 8px;
  height: 1px;
}
.track__dur {
  font-size: 14px; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.track__btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-2);
  transition: background .18s var(--ease), color .18s var(--ease);
}
.track__btn svg { width: 18px; height: 18px; fill: currentColor; }
.track__btn:hover { background: var(--accent-soft); color: var(--accent); }

/* equalizer shown on the active track */
.track__eq { display: none; align-items: flex-end; gap: 2px; height: 16px; }
.track__eq span {
  width: 3px; background: var(--accent); border-radius: 2px;
  animation: eq 900ms var(--ease) infinite;
}
.track__eq span:nth-child(1) { animation-delay: -200ms; }
.track__eq span:nth-child(2) { animation-delay: -500ms; }
.track__eq span:nth-child(3) { animation-delay: -100ms; }
@keyframes eq {
  0%, 100% { height: 5px; } 50% { height: 16px; }
}

/* active track state */
.track.is-active { background: var(--accent-soft); }
.track.is-active .track__title { color: var(--accent); }
.track.is-active .track__num,
.track.is-active .track__playicon { display: none; }
.track.is-active .track__eq { display: flex; }
.track.is-active.is-paused .track__eq span { animation-play-state: paused; }

/* ===== Split section (about / notes) ===== */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; }
.prose { color: var(--ink-2); font-size: 16px; margin: 0 0 18px; max-width: 52ch; }
.prose em { color: var(--ink); font-style: italic; }
.credits {
  margin-top: 28px;
  display: grid; gap: 12px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.credits div { display: flex; flex-direction: column; font-size: 15px; font-weight: 600; }
.credits span { font-size: 12px; font-weight: 500; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 3px; }
.lyrics {
  margin: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 26px 28px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.85;
  white-space: pre-line;
  min-height: 220px;
}

/* ===== Gallery ===== */
.gallery {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
.gallery__item {
  margin: 0;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
  overflow: hidden;
}
.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery__item:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.gallery__item[data-tone="a"] { background: #f5f4ff; }
.gallery__item[data-tone="b"] { background: #f1f6f9; }
.gallery__item[data-tone="c"] { background: #f7f3ee; }
.gallery__item[data-tone="d"] { background: #f3f5f1; }
.gallery__item[data-tone="e"] { background: #eef6ff; }

/* ===== Footer ===== */
.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 24px 56px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}
.footer__brand { display: flex; align-items: center; gap: 14px; }
.footer__brand div { display: flex; flex-direction: column; }
.footer__brand strong { font-size: 15px; }
.footer__brand span { font-size: 13px; color: var(--ink-3); }
.footer__share { display: flex; gap: 22px; }
.footer__share a {
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  transition: color .2s var(--ease);
}
.footer__share a:hover { color: var(--ink); }

/* ===== Sticky player ===== */
.player {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(1080px, calc(100% - 36px));
  height: var(--player-h);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.player[data-empty="true"] { opacity: .55; }
.player__inner {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr minmax(280px, 1.4fr) 1fr;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
}

.player__now { display: flex; align-items: center; gap: 13px; min-width: 0; }
.player__now img {
  width: 52px; height: 52px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  flex: none;
}
.player__text { display: flex; flex-direction: column; min-width: 0; }
.player__title {
  font-size: 14.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player__artist { font-size: 13px; color: var(--ink-3); }

.player__center { display: flex; flex-direction: column; gap: 8px; }
.player__controls { display: flex; align-items: center; justify-content: center; gap: 10px; }
.iconbtn {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-2);
  transition: background .18s var(--ease), color .18s var(--ease), transform .15s var(--ease);
}
.iconbtn svg { width: 22px; height: 22px; fill: currentColor; }
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.iconbtn:active { transform: scale(.92); }
.iconbtn--main {
  width: 46px; height: 46px;
  background: var(--ink); color: #fff;
  box-shadow: var(--shadow-sm);
}
.iconbtn--main svg { width: 24px; height: 24px; }
.iconbtn--main:hover { background: #000; color: #fff; }

.player__progress { display: flex; align-items: center; gap: 12px; }
.time { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; width: 36px; text-align: center; flex: none; }

.scrub { flex: 1; padding: 8px 0; cursor: pointer; }
.scrub__track {
  position: relative;
  height: 5px; border-radius: 999px;
  background: var(--line);
}
.scrub__fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0%;
  border-radius: 999px;
  background: var(--ink);
}
.scrub__knob {
  position: absolute; top: 50%; left: 0;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: var(--shadow-sm);
  transform: translate(-50%, -50%) scale(0);
  transition: transform .15s var(--ease);
}
.scrub:hover .scrub__knob,
.scrub:focus-visible .scrub__knob { transform: translate(-50%, -50%) scale(1); }
.scrub:hover .scrub__fill { background: var(--accent); }

.player__right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.volume { width: 92px; padding: 8px 0; cursor: pointer; }
.volume__track {
  position: relative;
  height: 5px; border-radius: 999px;
  background: var(--line);
}
.volume__fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 80%;
  border-radius: 999px;
  background: var(--ink);
}
.volume:hover .volume__fill { background: var(--accent); }

/* volume icon swap */
.ic--muted { display: none; }
.is-muted .ic--vol { display: none; }
.is-muted .ic--muted { display: inline; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding: 40px 0 48px; }
  .hero__art { max-width: 320px; }
  .hero__art img { transform: translateY(0); }
  .split { grid-template-columns: 1fr; gap: 40px; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .player__right { display: none; }
  .player__inner { grid-template-columns: 1fr minmax(0, 1.4fr); }
}

@media (max-width: 620px) {
  main { padding: 0 18px; }
  .topbar__nav { display: none; }
  .section { padding: 48px 0; }
  .track { grid-template-columns: 28px 6px 36px 1fr auto; gap: 12px; padding: 12px; }
  .track__btn { display: none; }
  .player { bottom: 0; left: 0; transform: none; width: 100%; border-radius: 20px 20px 0 0; height: 76px; }
  .player__inner { grid-template-columns: 1fr auto; gap: 12px; padding: 0 14px; }
  .player__center { order: -1; }
  .player__progress { display: none; }
  .player__now img { width: 46px; height: 46px; }
  body { padding-bottom: 92px; }
  .hero__facts { gap: 12px; }
}

@media (max-width: 480px) {
  .track__art { width: 36px; height: 36px; border-radius: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; }
}
