/* Theme colors are registered so they can animate when the album changes. */
@property --bg     { syntax: "<color>"; inherits: true; initial-value: #111113; }
@property --surface{ syntax: "<color>"; inherits: true; initial-value: #1b1a17; }
@property --ink    { syntax: "<color>"; inherits: true; initial-value: #efe6d2; }
@property --muted  { syntax: "<color>"; inherits: true; initial-value: #a99c80; }
@property --accent { syntax: "<color>"; inherits: true; initial-value: #c29c4b; }
@property --on-accent { syntax: "<color>"; inherits: true; initial-value: #111113; }
@property --line   { syntax: "<color>"; inherits: true; initial-value: #3a3222; }

/* Higher Calling: sampled from the cover (black #111113, gold #C29C4B). */
:root[data-theme="gold"] {
  --bg: #111113;
  --surface: #1b1a17;
  --ink: #efe6d2;
  --muted: #a99c80;
  --accent: #c29c4b;
  --on-accent: #111113;
  --line: #3a3222;
  --display: "Cinzel", Georgia, serif;
  --title: "Cormorant Garamond", Georgia, serif;
  --title-style: italic;
  --title-weight: 600;
}

/* Ø > U R: sampled from the cover (cream #F8F4E7, blue #1D55C1, black lettering). */
:root[data-theme="blue"] {
  --bg: #f8f4e7;
  --surface: #efe9d6;
  --ink: #0a0a0c;
  --muted: #5d5a50;
  --accent: #1d55c1;
  --on-accent: #ffffff;
  --line: #ddd5bd;
  --display: "Playfair Display", Georgia, serif;
  --title: "Playfair Display", Georgia, serif;
  --title-style: normal;
  --title-weight: 900;
}

:root {
  transition: --bg .7s ease, --surface .7s ease, --ink .7s ease, --muted .7s ease,
              --accent .7s ease, --on-accent .7s ease, --line .7s ease;
}

/* No fade on first paint; only album switches animate. */
:root.no-anim { transition: none; }

@media (prefers-reduced-motion: reduce) {
  :root { transition: none; }
  .album.swap { animation: none !important; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 "Inter", system-ui, sans-serif;
  padding-bottom: 120px;
}

button { font: inherit; color: inherit; }

svg { width: 1.25em; height: 1.25em; fill: currentColor; flex: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* Header */
.site-header {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.wordmark {
  margin: 0;
  font: 700 clamp(1.6rem, 4vw, 2.2rem)/1 var(--display);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
}
.wordmark span { color: var(--accent); }
:root[data-theme="blue"] .wordmark { color: var(--ink); letter-spacing: .02em; }

.album-switch {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.album-switch button {
  border: 0;
  background: transparent;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
  color: var(--muted);
  transition: background-color .3s, color .3s;
  white-space: nowrap;
}
.album-switch button:hover { color: var(--ink); }
.album-switch button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* Album */
main { max-width: 1100px; margin: 0 auto; padding: 24px; }

.album {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: start;
}
.album.swap { animation: swap .5s ease; }
@keyframes swap {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.cover-wrap { position: sticky; top: 24px; }
.cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 24px 60px -20px rgb(0 0 0 / .55);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.album-title {
  margin: 0 0 16px;
  font-family: var(--title);
  font-style: var(--title-style);
  font-weight: var(--title-weight);
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 1.05;
  color: var(--accent);
}
:root[data-theme="blue"] .album-title { color: var(--ink); }

.provisional {
  margin: 0 0 16px;
  padding: 8px 12px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  color: var(--muted);
  font-size: .9rem;
}

.album-actions { display: flex; gap: 10px; margin-bottom: 20px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn:hover { filter: brightness(1.08); }

/* Track list */
.tracks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }

.track {
  display: grid;
  grid-template-columns: 2.25rem 1fr auto auto;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.track-num {
  grid-column: 1;
  display: grid;
  place-items: center;
  height: 52px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.track-num svg { display: none; color: var(--accent); }

.track-title {
  grid-column: 2;
  padding: 14px 0;
  text-align: left;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.track-dur {
  grid-column: 3;
  color: var(--muted);
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
}

.track button.track-play-btn {
  grid-column: 1 / 3;
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  gap: 8px;
  align-items: center;
  border: 0;
  padding: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}

.track:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.track:hover .track-num span { display: none; }
.track:hover .track-num .i-play { display: block; }

.track.current .track-title { color: var(--accent); }
.track.current .track-num span { display: none; }
.track.current .track-num .i-eq { display: block; }
.track.current:hover .track-num .i-eq { display: none; }
.track.current.playing:hover .track-num .i-play { display: none; }
.track.current.playing:hover .track-num .i-pause { display: block; }
.track.current:not(.playing) .track-num .i-eq { display: none; }
.track.current:not(.playing) .track-num .i-play { display: block; }

.download {
  grid-column: 4;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-right: 4px;
  border-radius: 50%;
  color: var(--muted);
  transition: color .2s, background-color .2s;
}
.download:hover { color: var(--accent); background: var(--surface); }

/* Animated "now playing" bars */
.i-eq rect { animation: eq 1s ease-in-out infinite; transform-origin: bottom; transform-box: fill-box; }
.i-eq rect:nth-child(2) { animation-delay: -.3s; }
.i-eq rect:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }

/* Footer */
.site-footer {
  max-width: 1100px;
  margin: 24px auto 0;
  padding: 24px;
  color: var(--muted);
  font-size: .85rem;
}

/* Player bar */
.player {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1.4fr);
  align-items: center;
  gap: 16px;
  padding: 12px 24px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  z-index: 10;
}
.player[hidden] { display: none; }

.player-cover { width: 48px; height: 48px; border-radius: 4px; object-fit: cover; }
.player-meta { display: flex; flex-direction: column; min-width: 0; }
.player-title, .player-album { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-title { font-weight: 600; }
.player-album { color: var(--muted); font-size: .85rem; }

.player-controls { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover { color: var(--accent); }
.icon-btn.play { width: 48px; height: 48px; background: var(--accent); color: var(--on-accent); }
.icon-btn.play:hover { color: var(--on-accent); filter: brightness(1.08); }
.icon-btn.play .i-pause, .player.playing .icon-btn.play .i-play { display: none; }
.player.playing .icon-btn.play .i-pause { display: block; }

.player-progress { display: flex; align-items: center; gap: 10px; }
.time { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; min-width: 2.6em; }
.time:last-child { text-align: right; }

input[type="range"] {
  --pct: 0%;
  flex: 1;
  min-width: 0;
  height: 20px;
  margin: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--pct), var(--line) var(--pct));
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--accent);
}
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--accent); }

/* Narrow screens */
@media (max-width: 760px) {
  .site-header { padding: 20px 16px 4px; }
  main { padding: 16px; }
  .site-footer { padding: 16px; }
  .album { grid-template-columns: 1fr; }
  .cover-wrap { position: static; max-width: 420px; margin: 0 auto; width: 100%; }
  .album-switch { width: 100%; }
  .album-switch button { flex: 1; padding: 8px 10px; }

  .player {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "cover meta controls" "progress progress progress";
    gap: 8px 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  }
  .player-cover { grid-area: cover; width: 40px; height: 40px; }
  .player-meta { grid-area: meta; }
  .player-controls { grid-area: controls; }
  .player-progress { grid-area: progress; }
  body { padding-bottom: 150px; }
}
