/* ============================================================================
   album.css — "Vibe Code Vibes" music page
   Custom audio player + Apple-Music-style synced karaoke lyrics.
   Reuses the site design tokens from styles.css (:root). On-brand: near-black,
   neon magenta/ember/blue, Space Grotesk + JetBrains Mono.
   ========================================================================= */

/* active nav link (this page) */
.nav__links a[aria-current="page"] { color: var(--magenta); }

/* reserve space so the sticky player never hides a Tab-focused control */
html { scroll-padding-bottom: 7rem; }

.album {
  --ly-dim:    #7c8497;             /* upcoming / unsung word — AA-safe on near-black */
  --ly-hi:     #f4f6fc;             /* the word being / already sung */
  --ly-glow:   var(--magenta-glow);
  --focus-y:   38%;                 /* where the active lyric line rests */
  padding-block: clamp(1.5rem, 4vw, 2.5rem) var(--sp-8);
}

/* ---------------------------------------------------------------- header -- */
.album__head {
  display: grid;
  grid-template-columns: minmax(0, 300px) 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.album__cover {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line-loud);
  box-shadow: var(--shadow-3);
  aspect-ratio: 1;
  background: var(--bg-2);
}
.album__cover::after {              /* soft neon bloom behind the art */
  content: "";
  position: absolute; inset: -30% -30% auto auto;
  width: 70%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, var(--magenta-glow), transparent 70%);
  filter: blur(30px); opacity: .5; pointer-events: none; z-index: -1;
}
.album__art { width: 100%; height: 100%; object-fit: cover; }

.album__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--magenta);
  margin-bottom: var(--sp-3);
}
.album__title {
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.02;
  margin-bottom: var(--sp-4);
}
.album__lede {
  color: var(--text-1);
  max-width: 46ch;
  margin-bottom: var(--sp-4);
}
.album__stats {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--text-2);
  margin-bottom: var(--sp-5);
}
.album__stats b { color: var(--text-0); font-weight: 600; }
.album__cta { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }

.album__play {
  display: inline-flex; align-items: center; gap: .6em;
  padding: .7em 1.3em;
  border-radius: 99px;
  font-family: var(--font-display); font-weight: 700; font-size: 1.2rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  background: linear-gradient(120deg, var(--magenta), var(--ember));
  box-shadow: 0 8px 24px -10px var(--magenta-glow);
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.album__play:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -8px var(--magenta-glow); }
.album__play svg { width: 1.05em; height: 1.05em; }

.album__suno {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--text-3);
  display: inline-flex; align-items: center; gap: .5em;
}
.album__suno::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--term-green); box-shadow: 0 0 8px var(--term-green);
}

/* ------------------------------------------------------------------ body -- */
.album__body {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: clamp(1.5rem, 4vw, 2.5rem);
  align-items: start;
}

/* ------------------------------------------------------------- tracklist -- */
.tracklist__label {
  font-family: var(--font-mono); font-size: var(--fs-micro);
  letter-spacing: .16em; text-transform: uppercase; color: var(--text-3);
  margin-bottom: var(--sp-3);
}
.tracklist { display: flex; flex-direction: column; gap: 2px; }
.track {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: .6rem .7rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  text-align: left;
  color: var(--text-1);
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.track:hover { background: var(--bg-2); }
.track.is-active { background: var(--bg-2); border-color: var(--line-loud); }
.track__n {
  font-family: var(--font-mono); font-size: var(--fs-small);
  color: var(--text-3); text-align: right; position: relative;
}
.track.is-active .track__n { color: var(--magenta); }
.track__ico {                        /* play/eq icon overlays the number on hover/active */
  position: absolute; inset: 0; display: none; align-items: center; justify-content: flex-end;
  color: var(--magenta);
}
.track:hover .track__n span, .track.is-active .track__n span { opacity: 0; }
.track:hover .track__ico, .track.is-active .track__ico { display: flex; }
.track__ico svg { width: 1rem; height: 1rem; }
.track__title { min-width: 0; }
.track__name {
  font-family: var(--font-display); font-weight: 500; color: var(--text-0);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.track.is-active .track__name { color: var(--magenta); }
.track__dur { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-3); }

/* --- animated equalizer bars on the active+playing track ------------------ */
.track__eq { display: none; gap: 2px; align-items: flex-end; height: 14px; }
.track.is-active.is-playing .track__ico { display: none; }
.track.is-active.is-playing .track__n span { opacity: 0; }
.track.is-active.is-playing .track__eq { display: inline-flex; }
.track__eq i {
  width: 3px; height: 100%; background: var(--magenta); border-radius: 2px;
  transform-origin: bottom; animation: eq 1s var(--ease) infinite;
}
.track__eq i:nth-child(2) { animation-delay: .2s; }
.track__eq i:nth-child(3) { animation-delay: .45s; }
@keyframes eq {
  0%, 100% { transform: scaleY(.3); }
  50%      { transform: scaleY(1); }
}

/* ---------------------------------------------------------------- lyrics -- */
.stage { position: relative; }
.lyrics {
  position: relative;
  height: clamp(360px, 62vh, 620px);
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 80% at 50% -10%, var(--magenta-soft), transparent 55%),
    var(--bg-1);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 16%, #000 78%, transparent);
          mask-image: linear-gradient(180deg, transparent, #000 16%, #000 78%, transparent);
}
.lyrics__scroll {
  position: absolute; left: 0; right: 0; top: 0;
  padding: 0 clamp(1.2rem, 4vw, 2.6rem);
  will-change: transform;
  transition: transform var(--dur-3) var(--ease);
}
.lyric {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.15rem, 2.4vw, 1.7rem);
  line-height: 1.32;
  letter-spacing: -.01em;
  padding: .34em 0;
  color: var(--ly-dim);
  opacity: var(--o, .32);
  transition: opacity var(--dur-2) var(--ease), filter var(--dur-2) var(--ease);
}
.lyric--section {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(.72rem, 1.4vw, .9rem);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  font-style: normal;
}
.lyric.is-active { color: var(--ly-hi); }

/* karaoke word wipe: --fill (0..1) reveals the "sung" bright layer L→R */
.lyric__word {
  display: inline-block;
  position: relative;
  color: var(--ly-dim);
  white-space: pre;
  transition: color var(--dur-1) linear;
}
.lyric__word::before {
  content: attr(data-w);
  position: absolute; top: 0; left: 0; bottom: 0;
  width: calc(var(--fill, 0) * 100%);
  overflow: hidden;
  white-space: pre;
  color: var(--ly-hi);
  pointer-events: none;
}
.lyric.is-past  .lyric__word { --fill: 1; }        /* fully sung lines stay lit */
.lyric.is-active .lyric__word.is-active::before {
  text-shadow: 0 0 18px var(--ly-glow);
}

/* pre-play hint / static-lyrics note */
.lyrics__hint {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-3); text-align: center; padding: var(--sp-6);
  color: var(--text-2);
}
.lyrics__hint svg { width: 30px; height: 30px; color: var(--magenta); opacity: .8; }
.lyrics__hint p { max-width: 30ch; font-size: var(--fs-small); }
.lyrics.is-playing-track .lyrics__hint { display: none; }

/* ---------------------------------------------------------------- player -- */
.player {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin-top: var(--sp-6);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(.7rem, 2vw, 1.4rem);
  padding: .7rem clamp(.8rem, 2vw, 1.2rem);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-loud);
  background: color-mix(in srgb, var(--bg-2) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: var(--shadow-2);
  transform: translateY(120%);
  opacity: 0;
  transition: transform var(--dur-2) var(--ease), opacity var(--dur-2) var(--ease);
}
.player.is-live { transform: none; opacity: 1; }

.player__cover {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  object-fit: cover; border: 1px solid var(--line);
}
.player__meta { min-width: 0; display: flex; flex-direction: column; }
.player__scrub-row { display: flex; align-items: center; gap: .7rem; }
.player__np {
  min-width: 0; margin-bottom: .3rem;
  display: flex; align-items: baseline; gap: .6rem;
}
.player__title {
  font-family: var(--font-display); font-weight: 600; color: var(--text-0);
  font-size: var(--fs-small);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player__sub { font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--text-3); white-space: nowrap; }
.player__time { font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--text-2); white-space: nowrap; }

/* range inputs (scrub + volume): on-brand neon fill, custom thumb ---------- */
.player__range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 5px; border-radius: 99px; cursor: pointer;
  background:
    linear-gradient(90deg, var(--magenta), var(--blue)) 0/ var(--pct, 0%) 100% no-repeat,
    var(--bg-4);
}
.player__range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: #fff; border: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--magenta) 50%, transparent);
  transition: transform var(--dur-1) var(--ease);
}
.player__range::-webkit-slider-thumb:hover { transform: scale(1.2); }
.player__range::-moz-range-thumb {
  width: 13px; height: 13px; border: 0; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--magenta) 50%, transparent);
}
.player__scrub { flex: 1; }

.player__controls { display: flex; align-items: center; gap: .2rem; }
.player__btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  color: var(--text-1);
  transition: color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.player__btn:hover { color: var(--text-0); background: var(--bg-4); }
.player__btn svg { width: 18px; height: 18px; }
.player__btn--play {
  width: 46px; height: 46px; color: #fff;
  background: linear-gradient(120deg, var(--magenta), var(--ember));
}
.player__btn--play:hover { color: #fff; filter: brightness(1.08); }
.player__btn--play svg { width: 20px; height: 20px; }

.player__vol { display: flex; align-items: center; gap: .5rem; }
.player__vol .player__range { width: 78px; }

/* ------------------------------------------------------------ responsive -- */
@media (max-width: 900px) {
  .album__body { grid-template-columns: 1fr; }
  .stage { order: 2; }
  .tracklist-wrap { order: 1; }
  .player__vol { display: none; }
}
@media (max-width: 620px) {
  .album__head { grid-template-columns: 1fr; text-align: left; }
  .album__cover { max-width: 220px; }
  .player { grid-template-columns: auto 1fr; }
  .player__controls { grid-column: 1 / -1; justify-content: center; justify-self: center; }
  .lyrics { height: 54vh; }
}

/* Hide the volume slider on touch devices — iOS/iPadOS Safari makes
   HTMLMediaElement.volume read-only, so the control would be inert there. */
@media (pointer: coarse) { .player__vol { display: none; } }

/* ------------------------------------------------------- reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .lyrics__scroll { transition: none; }
  .player { transition: opacity var(--dur-2) var(--ease); transform: none; }
  .track__eq i { animation: none; }
}
