/* ==========================================================================
   SONG CARD — the cover opens a preview card
   --------------------------------------------------------------------------
   The artwork is the player. Play a thirty-second excerpt; when it ends the
   cover cross-fades to the streaming links in the same square. Built by
   `song_card_dialog()` in build/build_site.py, driven by assets/js/song-card.js.
   Colours come from the tokens at the top of this file — nothing new is invented.
   ========================================================================== */

/* The cover on the song page, made into a button. */
.cover-open {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: var(--r-md);
  overflow: hidden;
  line-height: 0;
}
.cover-open:focus-visible { outline: 3px solid var(--plum); outline-offset: 4px; }
.cover-open img { width: 100%; height: auto; display: block; }
.cover-open::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(45, 33, 40, .55), rgba(45, 33, 40, 0) 45%);
  opacity: 0;
  transition: opacity .25s ease;
}
.cover-open:hover::after,
.cover-open:focus-visible::after { opacity: 1; }

.cover-open__badge {
  position: absolute;
  left: 50%;
  bottom: var(--s-4);
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: .45rem .9rem;
  background: rgba(248, 244, 238, .95);
  color: var(--plum-deep);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 6px 20px -10px rgba(45, 33, 40, .8);
}
.cover-open__badge svg { width: 12px; height: 12px; fill: currentColor; }
.cover-open:hover .cover-open__badge { background: #fff; }

/* ---------- the dialog ---------- */
dialog.song-card {
  width: min(420px, calc(100vw - 2 * var(--s-4)));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  background: var(--cream-2);
  color: var(--ink);
  box-shadow: 0 30px 80px -30px rgba(45, 33, 40, .75);
  overflow: visible;
}
dialog.song-card::backdrop {
  background: rgba(35, 26, 32, .72);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

dialog.song-card[open] { animation: songCardIn .28s ease both; }
@keyframes songCardIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.song-card__cover {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-md) var(--r-md) 0 0;
  overflow: hidden;
  background: var(--plum-deep);
}

.song-card__art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .62s ease, transform .62s ease;
}
.song-card__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(45, 33, 40, .82) 0%, rgba(45, 33, 40, .18) 34%, rgba(45, 33, 40, 0) 60%);
  transition: opacity .3s ease;
  pointer-events: none;
}
.song-card__tag {
  position: absolute;
  left: var(--s-4);
  top: var(--s-4);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: .18rem .5rem;
  border-radius: var(--r-sm);
  background: rgba(45, 33, 40, .62);
  color: var(--cream);
  font-size: .625rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  transition: opacity .3s ease;
}
.song-card__tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mauve);
}
.song-card--playing .song-card__tag::before {
  background: var(--sage);
  animation: songCardPulse 1.7s ease-in-out infinite;
}
@keyframes songCardPulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.song-card__play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(248, 244, 238, .94);
  color: var(--plum-deep);
  cursor: pointer;
  box-shadow: 0 8px 28px -8px rgba(45, 33, 40, .7);
  transition: opacity .3s ease, background .18s ease, transform .18s ease;
}
.song-card__play:hover { background: #fff; transform: translate(-50%, -50%) scale(1.04); }
.song-card__play:focus-visible { outline: 3px solid var(--mauve); outline-offset: 3px; }
.song-card__play svg { width: 26px; height: 26px; fill: currentColor; }
.song-card__play .icon-pause { display: none; }
.song-card--playing .song-card__play .icon-play { display: none; }
.song-card--playing .song-card__play .icon-pause { display: block; }
/* Once playing, the button steps aside so the artwork can be the artwork. */
.song-card--playing .song-card__play { opacity: .18; }
.song-card--playing .song-card__play:hover,
.song-card--playing .song-card__play:focus-visible { opacity: 1; }

.song-card__bar {
  position: absolute;
  left: var(--s-4);
  right: var(--s-4);
  bottom: var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  transition: opacity .3s ease;
}
.song-card__rail {
  position: relative;
  flex: 1 1 auto;
  height: 22px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}
.song-card__rail:focus-visible { outline: 3px solid var(--mauve); outline-offset: 2px; border-radius: var(--r-sm); }
.song-card__track {
  position: relative;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: rgba(248, 244, 238, .34);
  overflow: hidden;
}
.song-card__fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--cream); border-radius: 2px; }
.song-card__clock {
  flex: 0 0 auto;
  font-size: .6875rem;
  font-variant-numeric: tabular-nums;
  color: rgba(248, 244, 238, .92);
  text-shadow: 0 1px 2px rgba(45, 33, 40, .6);
}

/* ---------- the links, in the same square ---------- */
.song-card__links {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.25rem, 4.5vw, 2rem);
  background: radial-gradient(120% 80% at 50% 0%, #5B4152 0%, #4B3445 62%, #402B3B 100%);
  color: var(--cream-2);
  opacity: 0;
  transform: scale(.985);
  pointer-events: none;
  transition: opacity .62s ease, transform .62s ease;
}
.song-card[data-state="links"] .song-card__art { opacity: 0; transform: scale(1.03); }
.song-card[data-state="links"] .song-card__scrim,
.song-card[data-state="links"] .song-card__tag,
.song-card[data-state="links"] .song-card__play,
.song-card[data-state="links"] .song-card__bar { opacity: 0; pointer-events: none; }
.song-card[data-state="links"] .song-card__links { opacity: 1; transform: none; pointer-events: auto; }

.song-card__eyebrow {
  margin: 0 0 var(--s-1);
  font-size: .625rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--mauve);
}
.song-card__heading {
  margin: 0 0 var(--s-4);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.6rem;
  line-height: 1.2;
  color: var(--cream);
}
/* The footer's .pill is a shouty uppercase chip. Inside the card that reads as a
   form submission, not a place to listen — so the labels go back to sentence
   case and sit in an even two-column grid, with the catch-all link across the
   top. */
.song-card__links .platform-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-2);
  margin: 0;
}
.song-card__links .pill {
  border-color: rgba(232, 216, 200, .34);
  background: transparent;
  color: var(--cream-2);
  font-size: .875rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  text-align: center;
  padding: .46rem .5rem;
  border-radius: var(--r-sm);
}
/* The grid items are the <li>s, not the links — so the span and the full width
   have to be set there, or every pill shrinks to its own text and the two
   columns read as a ragged list. */
.song-card__links .platform-list li { display: block; }
.song-card__links .platform-list li:first-child { grid-column: 1 / -1; }
.song-card__links a.pill { display: block; width: 100%; }
.song-card__links .pill--plum { font-weight: 700; }
.song-card__links a.pill:hover,
.song-card__links a.pill:focus-visible {
  background: var(--cream);
  border-color: var(--cream);
  color: var(--plum-deep);
}
.song-card__links .pill--plum {
  background: var(--cream);
  border-color: var(--cream);
  color: var(--plum-deep);
  font-weight: 700;
}
.song-card__note {
  margin: var(--s-4) 0 0;
  font-size: .75rem;
  color: rgba(240, 232, 222, .66);
}

/* ---------- the X, at the bottom ---------- */
.song-card__close {
  position: absolute;
  left: 50%;
  bottom: calc(-1 * var(--s-7));
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(248, 244, 238, .38);
  border-radius: 50%;
  background: rgba(45, 33, 40, .55);
  color: var(--cream);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}
.song-card__close:hover,
.song-card__close:focus-visible {
  background: var(--cream);
  border-color: var(--cream);
  color: var(--plum-deep);
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  dialog.song-card[open] { animation: none; }
  .song-card__art, .song-card__links, .song-card__play, .cover-open::after { transition: none; }
  .song-card--playing .song-card__tag::before { animation: none; }
}

/* Music detail: uncropped covers bounded by the viewport, independent story photos. */
.song-intro { padding-block: clamp(1.25rem, 4vh, 3rem); }
.song-intro .breadcrumb { margin-bottom: 1.25rem; }
.song-intro .song-cover { width: min(100%, 440px, calc(100svh - 12rem)); margin-inline: auto; min-width: 0; }
.song-intro .song-cover img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
#story .split__media img.song-story-image { display: block; width: 100%; height: auto; max-height: min(560px, 75svh); aspect-ratio: auto; object-fit: contain; margin-inline: auto; }
dialog.song-card { width: min(420px, calc(100vw - 2rem), calc(100svh - 6rem)); }
@media (max-width: 900px) {
  .song-intro .split { gap: 1.5rem; }
  .song-intro .song-cover { width: min(100%, 360px, 52svh); }
}
