/* ============================================================
   DESIGN TOKENS
   Moody / cinematic direction. Warm near-black, brass accent
   (VU-meter / tape-deck dial), muted teal for "now playing".
   ============================================================ */

:root {
  --font-display: "Rufina", Georgia, serif;
  --font-body: "Work Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;

  --radius: 10px;
  --border-hair: 1px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --bg: #0d0e0f;
  --bg-elevated: #17181a;
  --card-bg: #16171a;
  --card-border: #2a2b2e;
  --header-border: #232426;

  --text: #ede8e0;
  --text-muted: #8a8680;
  --text-faint: #57544f;

  --accent: #c08a3e;
  --accent-strong: #d9a352;
  --now-playing: #6f9184;

  --shadow: 0 12px 30px -14px rgba(0, 0, 0, 0.6);
  --grain-opacity: 0.05;
}

[data-theme="light"] {
  --bg: #f3efe6;
  --bg-elevated: #ffffff;
  --card-bg: #fbf9f4;
  --card-border: #e2dccc;
  --header-border: #e2dccc;

  --text: #201d18;
  --text-muted: #6b6558;
  --text-faint: #a49c8a;

  --accent: #a86c26;
  --accent-strong: #8f5a1d;
  --now-playing: #4c6c5e;

  --shadow: 0 12px 24px -16px rgba(32, 29, 24, 0.18);
  --grain-opacity: 0.035;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 0.35s var(--ease),
    color 0.35s var(--ease);
  min-height: 100vh;
}

/* Subtle film-grain overlay — the one signature texture on the page */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

a {
  color: inherit;
}

/* ---------------- Header ---------------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(20px, 4vw, 48px);
  border-bottom: var(--border-hair) solid var(--header-border);
  position: sticky;
  top: 0;
  background: var(--bg);
  backdrop-filter: blur(6px);
  z-index: 10;
  transition:
    border-color 0.35s var(--ease),
    background-color 0.35s var(--ease);
}

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

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  flex-shrink: 0;
  object-fit: cover;
  box-shadow: 0 10px 24px -18px rgba(0, 0, 0, 0.45);
}

.brand-name {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: 0.04em;
}

.theme-toggle {
  background: none;
  border: var(--border-hair) solid var(--card-border);
  border-radius: 100px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-muted);
  transition:
    color 0.25s var(--ease),
    border-color 0.25s var(--ease),
    transform 0.2s var(--ease);
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.theme-toggle:active {
  transform: scale(0.92);
}

.theme-toggle .icon {
  width: 18px;
  height: 18px;
}
.icon-sun {
  display: none;
}
.icon-moon {
  display: block;
}
[data-theme="light"] .icon-sun {
  display: block;
}
[data-theme="light"] .icon-moon {
  display: none;
}

/* ---------------- Layout ---------------- */

.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(28px, 4vw, 56px) clamp(20px, 4vw, 48px) 80px;
}

.intro {
  position: relative;
  width: 100%;
  margin-bottom: clamp(28px, 3vw, 48px);
  padding: 28px 24px 24px 26px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.intro::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 4px;
  background: var(--accent);
  border-radius: 999px;
}

.intro h2 {
  margin: 0 0 16px;
  font-family: "Skranji", var(--font-display);
  font-weight: 400;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.2;
}

.intro p {
  margin: 0 0 12px;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-muted);
}

.intro p:last-child {
  margin-bottom: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: clamp(18px, 2.4vw, 28px);
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.empty-state {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 60px 0;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 24px;
  margin-top: 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
}

.social-links p {
  margin: 0;
  font-size: 0.92rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.social-links ul {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-decoration: none;
  transition:
    transform 0.2s var(--ease),
    background-color 0.2s var(--ease),
    border-color 0.2s var(--ease);
  border: 1px solid transparent;
}

.social-links a:hover,
.social-links a:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
}

.social-links svg {
  width: 18px;
  height: 18px;
}

.copyright {
  margin-top: 18px;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
}

.copyright p {
  margin: 0;
}

.empty-state code {
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ---------------- Card ---------------- */

.card {
  background: var(--card-bg);
  border: var(--border-hair) solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 430px;
  box-shadow: var(--shadow);
  transition:
    border-color 0.3s var(--ease),
    transform 0.3s var(--ease),
    background-color 0.35s var(--ease);
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.card.is-playing {
  border-color: var(--now-playing);
}

.cover-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  overflow: hidden;
  background: var(--bg-elevated);
}

.cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.94);
  transition: transform 0.5s var(--ease);
}

.card:hover .cover-wrap img {
  transform: scale(1.035);
}

.playing-dot {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--now-playing);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  box-shadow: 0 0 0 0 var(--now-playing);
}

.card.is-playing .playing-dot {
  opacity: 1;
  animation: pulse 1.8s ease-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--now-playing) 55%, transparent);
  }
  70% {
    box-shadow: 0 0 0 8px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

.card-body {
  padding: 18px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.track-title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.3;
  margin: 0;
}

.track-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.audio-wrap {
  margin-top: auto;
  padding-top: 6px;
}

audio {
  width: 100%;
  height: 34px;
  accent-color: var(--accent);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* Visible keyboard focus */
a:focus-visible,
button:focus-visible,
audio:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
