/* =========================================================
   About me: favorite songs, as records in their sleeves
   Loaded only on about-me.html, after about-me.css.
   Each song is an album sleeve with its vinyl peeking out. Click
   and the disc slides out and spins, its label in that record's
   ink, and the song's player opens below.
   Motion: transform only; off under reduced motion.
   ========================================================= */

.songs-section { padding-top: 0; }
.records {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-12) var(--space-8);
  list-style: none; margin: 0; padding: var(--space-4) 0 0;
}
@media (max-width: 899.98px) { .records { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 479.98px) { .records { gap: var(--space-8) var(--space-4); } }

.record { min-width: 0; }

/* The clickable sleeve-and-disc. It leaves room on the right for the disc to slide out. */
.record-play {
  position: relative; display: block; width: 100%; padding: 0 22% 0 0; margin: 0;
  background: none; border: 0; cursor: pointer; font: inherit; color: inherit; -webkit-appearance: none; appearance: none;
}
.record-play:focus-visible { outline: 2px solid var(--brand); outline-offset: 6px; border-radius: 4px; }

/* The sleeve: a square card, slightly askew, with the cover on its face. */
.record-sleeve {
  position: relative; z-index: 2; display: block; aspect-ratio: 1; padding: 6px;
  background: #fffefa; border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(22, 24, 29, .14), 0 14px 26px -14px rgba(22, 24, 29, .45);
  transform: rotate(var(--tilt, 0deg));
  transition: transform var(--motion-300) var(--ease-out), opacity var(--motion-300) var(--ease-out);
}
.sleeve-art { display: block; width: 100%; height: 100%; object-fit: cover; }
/* Placeholder cover: the record's ink in a halftone wash, with a sun over a swell. */
.sleeve-placeholder {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 10px 12px;
  color: #fff; font-family: var(--mono); font-size: var(--text-meta); letter-spacing: .08em; text-transform: uppercase;
  background:
    radial-gradient(circle at 70% 34%, rgba(255, 255, 255, .9) 0 9%, rgba(255, 255, 255, 0) 9.5%),
    repeating-radial-gradient(circle at 70% 34%, rgba(255, 255, 255, .16) 0 2px, transparent 2px 9px),
    linear-gradient(160deg, color-mix(in srgb, var(--record-ink) 78%, #fff) 0%, var(--record-ink) 62%, color-mix(in srgb, var(--record-ink) 70%, #000) 100%);
}
.sleeve-placeholder::after { /* a swell across the bottom of the cover */
  content: ""; position: absolute; left: 0; right: 0; bottom: 22%; height: 18%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 24' preserveAspectRatio='none'%3E%3Cpath d='M0 14q15-10 30 0t30 0 30 0 30 0V24H0z' fill='%23fff' fill-opacity='.22'/%3E%3Cpath d='M0 14q15-10 30 0t30 0 30 0 30 0' fill='none' stroke='%23fff' stroke-opacity='.75' stroke-width='1.4'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.sleeve-no { align-self: flex-end; font-size: .75rem; opacity: .85; }

/* The vinyl: grooves, a sheen, and a label in the record's ink. Tucked mostly inside the sleeve. */
.record-disc {
  position: absolute; z-index: 1; top: 4%; right: 2%; width: 74%; aspect-ratio: 1; border-radius: 50%;
  transform: translateX(-19%); /* at rest only a sliver shows past the sleeve's right edge */
  transition: transform 520ms var(--ease-out);
}
.record-vinyl, .record-disc::after { position: absolute; inset: 0; border-radius: 50%; }
.record-disc {
  background:
    radial-gradient(circle, transparent 0 31%, rgba(255, 255, 255, .06) 31.5% 32%, transparent 32.5%),
    repeating-radial-gradient(circle, #1a1c22 0 1.2px, #24272f 1.2px 2.6px),
    #16181d;
  box-shadow: 0 6px 14px -6px rgba(22, 24, 29, .6);
}
.record-disc::after { /* a soft highlight across the grooves; it stays put while the disc spins under it */
  content: "";
  background: conic-gradient(from 20deg, transparent 0 12%, rgba(255, 255, 255, .14) 16%, transparent 22% 62%, rgba(255, 255, 255, .1) 66%, transparent 72%);
}
.record-label {
  position: absolute; inset: 33%; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--record-ink) 0 46%, color-mix(in srgb, var(--record-ink) 72%, #fff) 46% 54%, var(--record-ink) 54%);
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--record-ink) 70%, #fff);
}
.record-label::after { /* the spindle hole */
  content: ""; position: absolute; inset: 44%; border-radius: 50%; background: var(--paper);
}

/* A small play / pause badge pinned to the sleeve's corner. */
.record-state {
  position: absolute; z-index: 3; left: 10px; bottom: 10px; display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%; background: var(--raised); color: var(--record-ink);
  border: 1px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  transition: transform var(--motion-150) var(--ease-out);
}
.record-state svg { width: 16px; height: 16px; fill: currentColor; }
.record-state .icon-pause { display: none; }

@media (hover: hover) and (pointer: fine) {
  .record-play:hover .record-disc { transform: translateX(-8%); }
  .record-play:hover .record-sleeve { transform: rotate(0deg); }
  .record-play:hover .record-state { transform: scale(1.06); }
}
.record-play:active .record-state { transform: scale(.94); }

/* Playing: the disc slides out and its label spins; the badge switches to pause. */
.record.is-playing .record-sleeve { transform: rotate(0deg); }
.record.is-playing .record-disc { transform: translateX(0); }
.record.is-playing .record-label { animation: record-spin 1.8s linear infinite; }
.record.is-playing .icon-play { display: none; }
.record.is-playing .icon-pause { display: block; }
@keyframes record-spin { to { transform: rotate(360deg); } }

/* Title, artist and the one-line note, set like a liner note. */
.record-text { margin-top: var(--space-4); }
.record-title { margin: 0; font-family: var(--serif); font-size: var(--step-1); font-weight: 500; line-height: 1.25; color: var(--ink); }
.record-artist { margin: 2px 0 0; font-family: var(--mono); font-size: var(--text-meta); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.record-note { margin: var(--space-2) 0 0; font-family: var(--serif); font-style: italic; font-size: var(--text-secondary); line-height: 1.45; color: var(--ink-soft); }

/* The line that opens under a playing record: bouncing bars, a progress line that fills over
   the 30-second preview, and a link to the full song on Spotify. */
.record-player { margin-top: var(--space-3); }
.player-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); min-height: 32px; }
.player-bars { display: flex; align-items: flex-end; gap: 3px; height: 16px; flex: none; }
.player-bars i { width: 3px; height: 100%; background: var(--record-ink); transform-origin: bottom; animation: bar-bounce 900ms ease-in-out infinite; }
.player-bars i:nth-child(2) { animation-delay: -300ms; }
.player-bars i:nth-child(3) { animation-delay: -600ms; }
.player-bars i:nth-child(4) { animation-delay: -150ms; }
@keyframes bar-bounce { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
.player-track { position: relative; flex: 1 1 auto; min-width: 24px; height: 3px; border-radius: 3px; background: color-mix(in srgb, var(--record-ink) 20%, transparent); overflow: hidden; }
.player-fill { position: absolute; inset: 0; background: var(--record-ink); transform: scaleX(0); transform-origin: left; transition: transform 250ms linear; }
.player-link { flex: 1 0 100%; font-family: var(--mono); font-size: var(--text-meta); letter-spacing: .04em; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.player-link:hover { color: var(--ink); }
/* While the clip loads, the bars rest; if it can't play, only the Spotify link is offered. */
.record.is-loading .player-bars i { animation-play-state: paused; transform: scaleY(.3); }
.record.is-error .player-bars, .record.is-error .player-track { display: none; }
.record.is-error .record-disc, .record.is-error .record-label { animation: none; }

/* Records slide up into place when the section reaches the screen. */
html.js-reveal .record[data-reveal]:not(.is-revealed) .record-sleeve { opacity: 0; transform: rotate(var(--tilt, 0deg)) translate3d(0, 14px, 0); }

@media (prefers-reduced-motion: reduce) {
  .record-sleeve, .record-disc, .record-state { transition: none; }
  .record.is-playing .record-label, .player-bars i { animation: none; }
  .player-fill { transition: none; }
  .player-bars i { transform: scaleY(.7); }
}
.record-album { text-transform: none; letter-spacing: .02em; }
