/* ---------- foundation ---------- */

:root {
  --bg: #0c0d10;
  --bg-raise: #14161b;
  --line: rgba(255, 255, 255, 0.08);
  --text: #e8e6e1;
  --text-dim: #9a978f;
  --text-faint: #6b6963;
  --accent: 255, 179, 71; /* rgb triplet, replaced per-album from artwork */
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(120, 90, 60, 0.10), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(60, 80, 120, 0.08), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(var(--accent), 0.35); }

a { color: inherit; }

/* ---------- header ---------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
  padding: 44px clamp(20px, 5vw, 56px) 28px;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 18px; }

.brand-disc {
  width: 58px;
  height: 58px;
  flex: none;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--bg) 0 13%, rgba(230, 233, 240, 0.85) 14% 18%, rgba(255, 255, 255, 0.05) 19% 32%, transparent 33%),
    conic-gradient(from 200deg, rgba(255, 255, 255, 0) 0deg, rgba(255, 220, 170, 0.55) 40deg, rgba(255, 255, 255, 0) 95deg, rgba(160, 200, 255, 0.35) 165deg, rgba(255, 255, 255, 0) 230deg, rgba(255, 190, 220, 0.35) 300deg, rgba(255, 255, 255, 0) 360deg),
    radial-gradient(circle, #23252b 0 100%);
  box-shadow: 0 0 0 1px var(--line), 0 6px 18px rgba(0, 0, 0, 0.5);
  animation: spin 14s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.brand-text h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.05;
}

.tagline { margin: 6px 0 0; color: var(--text-dim); font-size: 14px; }

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  margin-left: auto;
}

.stats {
  margin: 0;
  color: var(--text-faint);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-height: 1em;
}

.controls { display: flex; gap: 10px; }

#search, #sort {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 9px 14px;
  outline: none;
  transition: border-color 0.2s;
}

#search { width: min(280px, 60vw); }
#search:focus, #sort:focus { border-color: rgba(var(--accent), 0.6); }
#search::placeholder { color: var(--text-faint); }

/* ---------- grid ---------- */

main { padding: 36px clamp(20px, 5vw, 56px) 60px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 34px 26px;
}

.card {
  all: unset;
  cursor: pointer;
  display: block;
  position: relative;
  opacity: 0;
  animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
  animation-delay: calc(min(var(--i), 24) * 28ms);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.card:hover, .card:focus-visible { z-index: 6; }
.card:focus-visible .cover { outline: 2px solid rgba(var(--accent), 0.8); outline-offset: 3px; }

.sleeve { position: relative; aspect-ratio: 1; }

.cover {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg-raise);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 10px 24px rgba(0, 0, 0, 0.45);
  transform: translateX(0);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.25, 1), box-shadow 0.45s;
}

.disc {
  position: absolute;
  z-index: 1;
  top: 3.5%;
  left: 6%;
  width: 93%;
  height: 93%;
  border-radius: 50%;
  background-image:
    radial-gradient(circle, var(--bg) 0 7.5%, rgba(235, 238, 244, 0.9) 8% 10.5%, rgba(255, 255, 255, 0.10) 11% 17%, transparent 17.5%),
    conic-gradient(from 210deg, rgba(255, 255, 255, 0) 0deg, rgba(255, 255, 255, 0.30) 38deg, rgba(255, 255, 255, 0.02) 85deg, rgba(255, 255, 255, 0.16) 150deg, rgba(255, 255, 255, 0.02) 215deg, rgba(255, 255, 255, 0.24) 295deg, rgba(255, 255, 255, 0) 360deg),
    var(--art, radial-gradient(circle, #3a3d45, #23252b));
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10), 0 8px 20px rgba(0, 0, 0, 0.55);
  transform: translateX(0) rotate(0deg);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.card:hover .disc, .card:focus-visible .disc { transform: translateX(34%) rotate(120deg); }
.card:hover .cover, .card:focus-visible .cover {
  transform: translateX(-7%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 16px 34px rgba(0, 0, 0, 0.55);
}

.meta { margin-top: 12px; display: grid; gap: 2px; }

.meta .title {
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta .sub {
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* skeleton loading */

.skel .cover { background: linear-gradient(100deg, #16181d 40%, #1d2027 50%, #16181d 60%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
.skel .bar { height: 12px; border-radius: 6px; margin-top: 12px; width: 75%; background: #16181d; }
.skel .bar.short { width: 45%; margin-top: 7px; height: 10px; }

@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- status / error ---------- */

.status {
  max-width: 560px;
  margin: 60px auto;
  padding: 28px 32px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.6;
  text-align: center;
}

.status strong { color: var(--text); }

/* ---------- footer ---------- */

.site-footer {
  padding: 26px clamp(20px, 5vw, 56px) 44px;
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 13.5px;
}

.site-footer p { margin: 4px 0; }
.site-footer .fine { color: var(--text-faint); font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; }

/* ---------- detail overlay ---------- */

.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: clamp(10px, 3vw, 36px); }
.overlay[hidden] { display: none; }

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(8, 9, 11, 0.72);
  background-size: cover;
  background-position: center;
  filter: blur(48px) brightness(0.32) saturate(1.2);
  transform: scale(1.15);
}

.overlay::after { content: ""; position: absolute; inset: 0; background: rgba(8, 9, 11, 0.45); }

.panel {
  position: relative;
  z-index: 2;
  width: min(1020px, 100%);
  max-height: min(88vh, 860px);
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: clamp(20px, 3vw, 40px);
  padding: clamp(22px, 3vw, 40px);
  background: rgba(18, 19, 24, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 18px;
  box-shadow: 0 0 90px rgba(var(--accent), 0.22), 0 30px 80px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px);
  overflow: hidden;
  animation: pop 0.3s cubic-bezier(0.2, 0.8, 0.25, 1);
}

@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.98); } }

.panel-art { position: relative; }

.panel-art img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 0 60px rgba(var(--accent), 0.30), 0 18px 44px rgba(0, 0, 0, 0.55);
  background: var(--bg-raise);
  position: sticky;
  top: 0;
}

.panel-info { min-width: 0; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding-right: 6px; scrollbar-width: thin; scrollbar-color: rgba(var(--accent), 0.5) transparent; }

.eyebrow { margin: 0; color: rgba(var(--accent), 1); filter: saturate(0.7) brightness(1.35); font-size: 12.5px; letter-spacing: 0.09em; text-transform: uppercase; }

#panel-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.08;
}

.artist-row { display: flex; align-items: center; gap: 10px; font-size: 15.5px; color: var(--text-dim); }
.artist-row img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px var(--line); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips:empty { display: none; }

.chip {
  font-size: 12px;
  color: var(--text-dim);
  padding: 4px 11px;
  border: 1px solid rgba(var(--accent), 0.35);
  border-radius: 999px;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.popularity { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-faint); }
.pop-track { flex: 0 1 160px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.10); overflow: hidden; }
.pop-fill { display: block; height: 100%; border-radius: 2px; background: rgb(var(--accent)); filter: saturate(0.75) brightness(1.2); }
.pop-value { color: var(--text-dim); }

.wiki { border-left: 2px solid rgba(var(--accent), 0.5); padding: 2px 0 2px 14px; }
.wiki p { margin: 0 0 6px; color: var(--text-dim); font-size: 14px; line-height: 1.65; }
.wiki a { color: var(--text-faint); font-size: 12.5px; text-decoration: none; }
.wiki a:hover { color: var(--text); }

.tracklist { margin: 4px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }

.tracklist li {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.tracklist .tno { color: var(--text-faint); font-variant-numeric: tabular-nums; width: 20px; flex: none; text-align: right; font-size: 12.5px; }
.tracklist .tname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tracklist .tag-e { flex: none; font-size: 9.5px; color: var(--text-faint); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; }
.tracklist .tdur { color: var(--text-faint); font-variant-numeric: tabular-nums; font-size: 12.5px; flex: none; }

.embed-slot { min-height: 0; }
.embed-slot iframe { width: 100%; height: 152px; border: 0; border-radius: 12px; display: block; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; padding-bottom: 2px; }

.btn {
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  transition: transform 0.15s, background 0.15s;
}

.btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.06); }
.btn.primary { background: rgb(var(--accent)); border-color: transparent; color: #101114; filter: saturate(0.8); }
.btn.primary:hover { background: rgb(var(--accent)); filter: saturate(0.9) brightness(1.08); }

.icon-btn {
  all: unset;
  cursor: pointer;
  position: absolute;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(20, 21, 26, 0.75);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 22px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.icon-btn:hover, .icon-btn:focus-visible { color: var(--text); background: rgba(40, 42, 50, 0.9); }

.close-btn { top: 14px; right: 14px; }
.nav-btn { z-index: 3; }
.prev-btn { top: 50%; left: clamp(6px, 1.5vw, 22px); transform: translateY(-50%); }
.next-btn { top: 50%; right: clamp(6px, 1.5vw, 22px); transform: translateY(-50%); }

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  .site-header { align-items: stretch; }
  .header-right { align-items: flex-start; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 26px 18px; }

  .panel { grid-template-columns: 1fr; max-height: 92vh; overflow-y: auto; }
  .panel-info { overflow: visible; padding-right: 0; }
  .panel-art img { position: static; max-width: 320px; margin: 0 auto; display: block; }
  .prev-btn { left: 10px; top: auto; bottom: 12px; transform: none; }
  .next-btn { right: 10px; top: auto; bottom: 12px; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-disc { animation: none; }
  .card { animation-duration: 0.01s; animation-delay: 0s; }
  .cover, .disc, .btn { transition: none; }
  .panel { animation: none; }
}
