/*
  release-card: Figma "Release A1 (as built)", CardContent > ReleaseCardDesktop.
  Phones: details panel, then links, stacked.
  Wider screens: details panel on the left, links on the right.
*/
.release-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  width: 100%;
  max-width: var(--layout-width-container);
  padding: var(--space-s);
  border-radius: var(--border-radius-card);
  border: 1px solid var(--neutral-900); /* token-exception: Figma uses a 1px stroke, border-width token is 2px */
  /* Translucent so the shader shows through; derived from the card surface token */
  background: color-mix(in srgb, var(--surface-card) 80%, transparent);
}

/*
  The card and its panels show at once; what's inside them fades in where it sits, no movement.
  Order: 1. cover and track info, 2. Stream · Buy as one group, 3. Follow and the credits.
  Each stage starts when the one before is halfway in, so it reads as one flow; all in by 1.2s.
*/
.release-card__details > *,
.release-card__group,
.release-card__links > .release-card__credits {
  animation: release-card-fade 0.6s linear both;
}
.release-card__group:first-child { animation-delay: 0.3s; }
.release-card__group + .release-card__group,
.release-card__links > .release-card__credits {
  animation-delay: 0.6s;
}

@keyframes release-card-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/*
  Left panel: artwork, summary, track list.
  Phones (Figma "Mobile 390 compact proposal"): the cover and the summary share
  the first row, half each, so the streaming buttons start near the top.
*/
.release-card__details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: var(--space-s);
  min-width: 0;
  padding: var(--space-s);
  border-radius: var(--border-radius-card);
  background: var(--surface-container); /* neutral/900 */
}

.release-card__cover {
  position: relative;
  margin: 0;
  aspect-ratio: 1 / 1;
  border-radius: var(--border-radius-button);
  overflow: hidden;
  background: var(--surface-container);
}
.release-card__cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.preview-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  /* 48px on the cover, as in Figma (preview-button) */
  width: calc(var(--space-l) + var(--space-s));
  height: calc(var(--space-l) + var(--space-s));
  padding: 0;
  border: 0;
  border-radius: var(--border-radius-full);
  /* Same glass as the card: the card surface at 80%, so it reads on any artwork */
  background: color-mix(in srgb, var(--surface-card) 80%, transparent);
  color: var(--icon-light);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.preview-button[hidden] { display: none; }
.preview-button--small {
  width: var(--space-l);
  height: var(--space-l);
}
.preview-button:hover { transform: translate(-50%, -50%) scale(1.06); }
.preview-button:focus-visible {
  outline: var(--border-width) solid var(--action-accent-interactive);
  outline-offset: var(--border-width);
}
.preview-button svg {
  width: 100%;
  height: 100%;
}

/* Summary: artist, title, type and length, with the tracklist toggle */
/* Artist, title (spans the panel and wraps), then type · songs · length */
.release-card__summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-width: 0;
}
.release-card__artist {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin: 0;
  font-family: var(--text-style-body-m-font-family);
  font-size: var(--text-style-body-m-font-size);
  line-height: var(--text-style-body-m-line-height);
}
.release-card__avatar {
  width: var(--space-l);
  height: var(--space-l);
  border-radius: var(--border-radius-full);
  object-fit: cover;
}
.release-card__avatar[hidden] { display: none; }
.release-card__title {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--text-style-display-m-font-family);
  font-weight: var(--text-style-display-m-font-weight);
  font-size: var(--text-style-display-m-font-size);
  line-height: var(--text-style-display-m-line-height);
}
.release-card__meta {
  margin: 0;
  font-family: var(--text-style-body-s-font-family);
  font-size: var(--text-style-body-s-font-size);
  line-height: var(--text-style-body-s-line-height);
}

/* Figma Button/S, WithIconRight: full-width outlined bar (Release A1 as built) */
.tracklist-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: var(--space-l);
  padding: 0 var(--space-s);
  border: 1px solid var(--button-secondary-border-secondary); /* token-exception: Figma uses a 1px stroke, border-width token is 2px */
  border-radius: var(--border-radius-button);
  background: var(--button-primary-action);
  box-shadow: 0 var(--border-width) 0 var(--button-primary-action);
  color: var(--button-secondary-text-secondary);
  cursor: pointer;
  font-family: var(--text-style-button-text-s-font-family);
  font-weight: var(--text-style-button-text-s-font-weight);
  font-size: var(--text-style-button-text-s-font-size);
  line-height: var(--text-style-button-text-s-line-height);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.tracklist-toggle[hidden] { display: none; }
.tracklist-toggle svg {
  width: var(--space-s);
  height: var(--space-s);
}
.tracklist-toggle:hover {
  background: var(--button-secondary-bg-secondary-hover);
  color: var(--button-secondary-text-secondary-hover);
}
.tracklist-toggle:focus-visible {
  outline: var(--border-width) solid var(--action-accent-interactive);
  outline-offset: var(--border-width);
}

/* Track list: number, thumbnail, title and details */
.track-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}
.track-list[hidden] { display: none; }

/*
  Long releases: the list scrolls inside the panel after about four and a
  half rows, so the half-visible row shows there is more. Keeps the buttons
  near the top on phones and the two panels balanced on wider screens.
*/
.track-list {
  max-height: calc(var(--space-xl) * 5);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) transparent;
}
.track-list:focus-visible {
  outline: var(--border-width) solid var(--action-accent-interactive);
  outline-offset: var(--border-width);
}
.track-list__item {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  font-family: var(--text-style-body-s-font-family);
  font-size: var(--text-style-body-s-font-size);
  line-height: var(--text-style-body-s-line-height);
}
.track-list__number,
.track-list__title {
  font-weight: var(--text-style-heading-m-font-weight);
}
/* Room for two digits, right-aligned, so artwork lines up from track 1 to 99 */
.track-list__number {
  flex: none;
  min-width: 2ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.track-list__thumb {
  position: relative;
  flex: none;
  width: calc(var(--space-l) + var(--space-m));
  height: calc(var(--space-l) + var(--space-m));
  border-radius: var(--border-radius-button);
  overflow: hidden;
  background: var(--surface-card);
}
.track-list__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Title and details wrap, then cut off with an ellipsis after three lines */
.track-list__text {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

/* Phones: the cover is at least square and stretches to the row's height if the text runs taller */
.release-card__details {
  container-type: inline-size; /* lets the cover measure its column below */
}
/* Fills the row's height; crops at most 10% beyond square, and on the narrowest phones sits centred instead */
.release-card__details > .release-card__cover {
  width: 100%;
  height: 100%;
  max-height: calc((100cqi - var(--space-s)) / 2 * 1.1);
}

/* Tracklist toggle, list and credits span the panel under the cover row */
.release-card__details > .tracklist-toggle,
.release-card__details > .track-list,
.release-card__details > .release-card__credits {
  grid-column: 1 / -1;
}

/* Credits: release date, © and ℗ lines */
.release-card__credits {
  font-family: var(--text-style-body-s-font-family);
  font-size: var(--text-style-body-s-font-size);
  line-height: var(--text-style-body-s-line-height);
  color: var(--text-primary); /* text/muted is about 4.1:1 on neutral/900, under WCAG AA */
}
.release-card__credits[hidden] { display: none; }
.release-card__credits p { margin: 0; }
/* Phones show the copy after Follow, centred; wider screens the one in the track panel */
.release-card__details > .release-card__credits { display: none; }
.release-card__links > .release-card__credits { text-align: center; }

/* Right panel: link groups */
.release-card__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
  min-width: 0;
}
.release-card__group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-s);
}
.release-card__group-heading {
  margin: 0;
  text-align: center;
  font-family: var(--text-style-body-m-font-family);
  font-weight: var(--text-style-body-m-font-weight);
  font-size: var(--text-style-body-m-font-size);
  line-height: var(--text-style-body-m-line-height);
}

/* Follow: social icons */
.social-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: var(--space-s);
}
/* Icon buttons, matching the streaming buttons: light tile and dark icon, dark tile and light icon on hover */
.social-list a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--space-l) + var(--space-s));
  height: calc(var(--space-l) + var(--space-s));
  border-radius: var(--border-radius-button);
  background: var(--button-primary-bg-primary);
  box-shadow: 0 var(--border-width) 0 var(--button-primary-action);
  color: var(--button-primary-action);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease;
}
.social-list a:hover {
  background: var(--button-primary-bg-hover);
  color: var(--button-primary-text-hover);
}
.social-list a:active {
  background: var(--button-primary-bg-active);
  color: var(--button-primary-text-hover);
  box-shadow: none;
  transform: translateY(var(--border-width));
}
.social-list a:focus-visible {
  outline: var(--border-width) solid var(--action-accent-interactive);
  outline-offset: var(--border-width);
}
.social-list svg {
  width: var(--space-m);
  height: var(--space-m);
}

@media (min-width: 40rem) { /* token-exception: no breakpoint tokens yet */
  .release-card {
    display: grid;
    grid-template-columns: 2fr 3fr;
    align-items: stretch; /* the track panel fills the card's full height */
  }
  .release-card__details {
    display: flex;
    flex-direction: column;
    align-items: stretch; /* undoes the phone row's centring, so the credits sit left */
  }
  /* Full-width square cover again (undoes the phone row sizing) */
  .release-card__details > .release-card__cover {
    height: auto;
    max-height: none;
  }
  .release-card__details > .release-card__credits:not([hidden]) { display: block; }
  .release-card__links > .release-card__credits { display: none; }
  /* Tracklist button (and the list under it) sits at the bottom of the panel */
  .tracklist-toggle { margin-top: auto; }
  /* Single-track releases have no tracklist: the credits sit at the bottom instead */
  .tracklist-toggle[hidden] ~ .release-card__credits { margin-top: auto; }
}
