/* Music Player Component Styles */

:root {
  /* Use site fonts */
  --music-font: "Geist", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Subtle squircle radius for album art (Spotify-like, not too rounded) */
  --album-squircle-radius: 6px;
}

/* Wrapper for the whole player */
.music-player {
  opacity: 0; /* hidden until data shows */
  width: 100%; /* stretch full available width (mobile first) */
  /* Removed fixed max-width to allow responsive scaling */
  height: auto;
  background-color: #000;
  border-radius: 8px;
  padding: 16px;
  box-sizing: border-box;
  /* subtle shadow   */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  font-family: var(--music-font);
  margin: 12px 0; /* space between alexa row and social icons */
}

/* --------------------------------------------------------------
   Desktop / large-screen refinement
   -------------------------------------------------------------- */
@media (min-width: 1024px) {
  /* Cap the overall player width so both the black container and the
     dot-matrix grid stay compact on laptops/desktops while aligning with
     the main content column (flush left within the wrapper). */
  .music-player {
    max-width: 560px; /* tweak to taste */
    margin-left: 0; /* left-aligned */
    margin-right: 0; /* prevent centering */
  }
}

.grid-container {
  display: grid;
  /* Each of the 49 columns shares equal flexible space */
  grid-template-columns: repeat(49, minmax(0, 1fr));
  gap: 2px;
  width: 100%;
  margin-bottom: 12px;
}

.grid-square {
  width: 100%;
  aspect-ratio: 1 / 1; /* keep each square a perfect square */
  background-color: rgba(102, 102, 102, 0.6);
  transition: background-color 0.05s ease-out;
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.album-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.album-thumbnail {
  width: 40px;
  height: 40px;
  background-size: cover; /* kept if inline style sets background later */
  background-position: center;
  border-radius: var(--album-squircle-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.1s ease;
}

.album-thumbnail::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.25);
  border-radius: inherit;
  z-index: 1;
  transition: background-color 0.2s ease;
}

.album-thumbnail:hover::before {
  background-color: rgba(0, 0, 0, 0.5);
}

#play-pause-button svg {
  z-index: 2;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.9;
  transition: opacity 0.2s ease;
}

/* Progressive blur-in for album image */
#album-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Ensure image matches container squircle exactly */
  border-radius: inherit;
  filter: blur(16px);
  transform: scale(1.05);
  opacity: 0.2;
  transition: filter 0.4s ease, opacity 0.4s ease, transform 0.4s ease;
}

#album-img.loaded {
  filter: blur(0);
  opacity: 1;
  transform: scale(1);
}

.album-thumbnail:active,
.volume-control-container:active {
  transform: scale(0.9);
}

.volume-control-container {
  cursor: pointer;
  position: relative;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease;
}

.volume-control-container svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.volume-control-container:hover svg {
  opacity: 0.9;
}

.track-info {
  display: flex;
  flex-direction: column;
  /* Keep the text block vertically centered relative to the thumbnail */
  justify-content: center;
}

.track-title {
  user-select: none;
  font-size: 14px;
  font-weight: 500;
  /* Default to no gap; we add a small gap only when meta line is present */
  margin-bottom: 0;
  line-height: 1.2;
  opacity: 0.9;
  color: #fff;
}

.track-time {
  user-select: none;
  font-size: 11.5px;
  color: #9ca3af;
  line-height: 1.2;
  margin-top: 1px;
}

/* Tiny gap only when the meta line is present */
.track-info.has-meta .track-title { margin-bottom: 1px; }

/* If the line is empty, remove it from layout entirely */
.track-time:empty {
  display: none;
}

#audio-player {
  display: none;
}

/* Generic fade-in blur utility so JS can re-trigger it */
.fade-in-blur {
  animation: textFadeInBlur 0.5s ease-out forwards;
  opacity: 0; /* start hidden until animation runs */
}

/* ----------------------------------------------------------------------------
   Custom overrides: hide play/pause & volume icons, keep thumbnail intact
   ---------------------------------------------------------------------------- */
#play-icon,
#pause-icon,
#volume-on-icon,
#volume-off-icon {
  display: none !important; /* ensure JS cannot re-show them */
}

/* Completely hide the volume control container so layout stays clean */
#volume-button {
  display: none !important;
}
