/* ============================================
   Before The Data — Main Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* --- CSS Variables --- */
:root {
  --bg: #ffffff;
  --bg-2: #f5f5f5;
  --tx-1: #000000;
  --tx-2: #222222;
  --tx-3: #888888;
  --bd: #e0e0e0;
  --acc: #000000;
  --sidebar-w: 230px;
  --player-h: 56px;
  --font-heading: 'Barlow Condensed', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--tx-2);
  line-height: 1.5;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }
ul { list-style: none; }

/* ============================================
   PLAYER BAR (fixed top)
   ============================================ */
#player-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--player-h);
  background: var(--bg);
  border-bottom: 1px solid var(--bd);
  display: flex; align-items: center;
  padding: 0 20px;
  z-index: 1000;
  gap: 16px;
}
#player-bar .player-art {
  width: 40px; height: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg-2);
  flex-shrink: 0;
}
#player-bar .player-controls {
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
#player-bar .player-controls button {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--tx-2);
  font-size: 18px;
  border-radius: 50%;
  transition: background .15s;
}
#player-bar .player-controls button:hover { background: var(--bg-2); }
#player-bar .player-controls .play-btn {
  width: 36px; height: 36px;
  background: var(--acc);
  color: #fff;
  border-radius: 50%;
  font-size: 16px;
}
#player-bar .player-controls .play-btn:hover { opacity: .85; }
#player-bar .player-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
#player-bar .player-info .player-title {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#player-bar .player-info .player-source {
  font-size: 11px; color: var(--tx-3); text-transform: uppercase; letter-spacing: .5px;
}
#player-bar .player-progress {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; background: var(--bd);
}
#player-bar .player-progress-fill {
  height: 100%; background: var(--acc);
  width: 0%; transition: width .3s linear;
}
#player-bar .player-right {
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
#player-bar .player-right button {
  color: var(--tx-3); font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  transition: background .15s, color .15s;
}
#player-bar .player-right button:hover { background: var(--bg-2); color: var(--tx-2); }
#player-bar .player-right .volume-slider {
  width: 80px; height: 4px;
  -webkit-appearance: none; appearance: none;
  background: var(--bd); border-radius: 2px; outline: none;
}
#player-bar .player-right .volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px;
  background: var(--acc); border-radius: 50%; cursor: pointer;
}

/* ============================================
   SIDEBAR
   ============================================ */
#sidebar {
  position: fixed; top: var(--player-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg);
  border-right: 1px solid var(--bd);
  display: flex; flex-direction: column;
  z-index: 900;
  padding: 24px 0;
  overflow-y: auto;
}
#sidebar .sidebar-brand {
  padding: 0 24px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 12px;
}
#sidebar .sidebar-brand img {
  width: 36px; height: 36px; object-fit: contain;
}
#sidebar .sidebar-brand .brand-name {
  font-family: var(--font-heading);
  font-size: 16px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
}
#sidebar .sidebar-user {
  padding: 12px 24px 16px;
  font-size: 13px; font-weight: 500; color: var(--tx-2);
  border-bottom: 1px solid var(--bd);
  margin-bottom: 16px;
}
#sidebar nav { flex: 1; }
#sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px;
  font-size: 14px; font-weight: 500;
  color: var(--tx-3);
  transition: color .15s, background .15s;
  border-left: 3px solid transparent;
}
#sidebar nav a:hover { color: var(--tx-2); background: var(--bg-2); }
#sidebar nav a.active {
  color: var(--acc); border-left-color: var(--acc); font-weight: 600;
}
#sidebar nav a .nav-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
#sidebar .sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--bd);
  display: flex; flex-wrap: wrap; gap: 8px 16px;
}
#sidebar .sidebar-footer a {
  font-size: 11px; color: var(--tx-3);
}
#sidebar .sidebar-footer a:hover { color: var(--tx-2); }

/* ============================================
   MAIN CONTENT
   ============================================ */
#main {
  margin-left: var(--sidebar-w);
  margin-top: var(--player-h);
  min-height: calc(100vh - var(--player-h));
  padding: 32px 40px 60px;
}

/* --- Section Headers --- */
.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 20px;
  border-bottom: 3px solid var(--acc);
  padding-bottom: 8px;
}
.section-header h2 {
  font-family: var(--font-heading);
  font-size: 20px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
}
.section-header .updated {
  font-size: 12px; color: var(--tx-3);
}

/* ============================================
   NEW MUSIC — Horizontal Scroll
   ============================================ */
.music-scroll {
  display: flex; gap: 20px;
  overflow-x: auto; overflow-y: hidden;
  padding-bottom: 16px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.music-scroll::-webkit-scrollbar { display: none; }

.music-card {
  flex: 0 0 170px;
  scroll-snap-align: start;
  cursor: pointer;
}
.music-card .card-art {
  position: relative;
  width: 170px; height: 170px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-2);
}
.music-card .card-art img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .2s;
}
.music-card:hover .card-art img { transform: scale(1.05); }
.music-card .card-art .play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.3);
  opacity: 0; transition: opacity .2s;
}
.music-card:hover .card-art .play-overlay { opacity: 1; }
/* Keep overlay visible + show pause when this card is actively playing */
.music-card .card-art.is-playing .play-overlay { opacity: 1; }
.play-overlay .play-circle {
  width: 44px; height: 44px;
  background: rgba(255,255,255,.9);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--tx-1);
}
/* Swap ▶ to ⏸ when playing */
.card-art.is-playing .play-circle { font-size: 0; }
.card-art.is-playing .play-circle::before { content: '⏸'; font-size: 18px; color: var(--tx-1); }
.music-card .card-title {
  margin-top: 8px;
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}
.music-card .card-title:hover { text-decoration: underline; }
.music-card .card-artist {
  font-size: 12px; color: var(--tx-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}
.music-card .card-artist:hover { text-decoration: underline; }

/* ============================================
   CHARTS / POPULAR LIST
   ============================================ */
.chart-list { margin-top: 8px; }
.chart-row {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--bg-2);
  transition: background .15s;
  cursor: pointer;
}
.chart-row:hover { background: var(--bg-2); }
.chart-rank {
  font-family: var(--font-heading);
  font-size: 16px; font-weight: 700;
  color: var(--acc);
  width: 32px; text-align: center; flex-shrink: 0;
}
.chart-play {
  width: 32px; height: 32px;
  background: var(--acc); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; flex-shrink: 0;
  transition: opacity .15s;
}
.chart-play:hover { opacity: .8; }
.chart-play.is-playing { font-size: 0; }
.chart-play.is-playing::before { content: '⏸'; font-size: 14px; }
.chart-art {
  width: 48px; height: 48px;
  border-radius: 4px; object-fit: cover;
  background: var(--bg-2); flex-shrink: 0;
}
.chart-info { flex: 1; min-width: 0; }
.chart-info .chart-artist {
  font-size: 13px; color: var(--tx-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chart-info .chart-title {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chart-actions {
  display: flex; gap: 12px; flex-shrink: 0;
}
.chart-actions button {
  color: var(--tx-3); font-size: 16px;
  transition: color .15s;
}
.chart-actions button:hover { color: var(--tx-2); }

/* ============================================
   NEW MUSIC PAGE — Grid
   ============================================ */
.music-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 24px;
}
.music-grid .music-card { flex: none; width: auto; }
.music-grid .music-card .card-art { width: 100%; height: 0; padding-bottom: 100%; }
.music-grid .music-card .card-art img {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.music-grid .music-card .card-art .play-overlay { position: absolute; }
.music-grid .card-date { font-size: 11px; color: var(--tx-3); margin-top: 4px; }

/* ============================================
   SEARCH PAGE
   ============================================ */
.search-container { max-width: 700px; }
.search-input-wrap {
  position: relative; margin-bottom: 32px;
}
.search-input-wrap input {
  width: 100%; padding: 14px 20px 14px 48px;
  font-size: 16px; font-family: var(--font-body);
  border: 2px solid var(--bd); border-radius: 8px;
  outline: none; transition: border-color .15s;
  background: var(--bg);
}
.search-input-wrap input:focus { border-color: var(--acc); }
.search-input-wrap .search-icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  font-size: 20px; color: var(--tx-3);
}
.search-results { display: flex; flex-direction: column; gap: 12px; }
.search-result {
  display: flex; align-items: center; gap: 16px;
  padding: 12px; border-radius: 8px;
  transition: background .15s; cursor: pointer;
}
.search-result:hover { background: var(--bg-2); }
.search-result img {
  width: 56px; height: 56px; border-radius: 4px; object-fit: cover;
  background: var(--bg-2); flex-shrink: 0;
}
.search-result .result-info { flex: 1; min-width: 0; }
.search-result .result-artist {
  font-size: 13px; color: var(--tx-3);
}
.search-result .result-title {
  font-size: 15px; font-weight: 600;
}
.search-result .result-date {
  font-size: 11px; color: var(--tx-3);
}

/* ============================================
   POST DETAIL
   ============================================ */
.post-hero {
  position: relative;
  margin: -32px -40px 0;
  padding: 40px;
  display: flex; gap: 32px;
  background: var(--bg-2);
  overflow: hidden;
}
.post-hero-bg {
  position: absolute; inset: -20px;
  background-size: cover; background-position: center;
  filter: blur(30px) brightness(.7);
  opacity: .4;
}
.post-art-wrap {
  position: relative; z-index: 1;
  flex-shrink: 0;
  width: 280px; height: 280px;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  overflow: hidden;
  cursor: pointer;
}
.post-art-wrap:hover .post-art-overlay { opacity: 1; }
.post-art-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .2s ease;
  border-radius: 8px;
}
.post-art-overlay .art-play-circle {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  color: #000;
  padding-left: 4px; /* optical center for ▶ */
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  transition: transform .15s ease;
}
.post-art-wrap:hover .art-play-circle { transform: scale(1.08); }
.post-hero-art {
  width: 280px; height: 280px;
  border-radius: 8px; object-fit: cover;
  display: block;
}
.post-hero-meta {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; justify-content: center;
  gap: 8px;
}
.post-hero-meta .post-artist {
  font-size: 16px; color: var(--tx-3); font-weight: 500;
}
.post-hero-meta .post-title {
  font-family: var(--font-heading);
  font-size: 36px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
}
.post-hero-meta .post-date {
  font-size: 13px; color: var(--tx-3);
}
.post-hero-meta .post-country {
  font-size: 24px;
}
.post-hero-meta .post-socials {
  display: flex; gap: 12px; margin-top: 8px;
}
.post-hero-meta .post-socials a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 4px;
  background: var(--bg); font-size: 12px; font-weight: 500;
  transition: background .15s;
}
.post-hero-meta .post-socials a:hover { background: var(--bd); }
.post-hero-meta .post-tags {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px;
}
.post-hero-meta .post-tags span {
  padding: 4px 10px; border-radius: 4px;
  background: var(--bg); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .5px;
}

.post-body-wrap {
  display: flex; gap: 40px; margin-top: 32px;
}
.post-body {
  flex: 1; min-width: 0;
  font-size: 16px; line-height: 1.75; color: var(--tx-2);
}
.post-body p { margin-bottom: 16px; }

/* Spotify embed blocks inside post write-ups */
.btd-tracks {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.btd-track-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.btd-track-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.btd-track-embed iframe {
  display: block;
  border-radius: 8px;
}

.post-tracklist { margin-top: 32px; }
.post-tracklist h3 {
  font-family: var(--font-heading);
  font-size: 18px; font-weight: 700;
  text-transform: uppercase; margin-bottom: 12px;
}
.track-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--bd);
  cursor: pointer; transition: background .15s;
}
.track-row:hover { background: var(--bg-2); }
.track-row .track-play {
  width: 28px; height: 28px;
  border: 2px solid var(--tx-3); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--tx-3);
  flex-shrink: 0; transition: border-color .15s, color .15s;
}
.track-row:hover .track-play { border-color: var(--acc); color: var(--acc); }
.track-row .track-name { font-size: 14px; font-weight: 500; flex: 1; }
.track-row .track-artist-name { font-size: 12px; color: var(--tx-3); }
.track-embed { padding: 6px 0; border-bottom: 1px solid var(--bd); }
.track-embed iframe { border-radius: 6px; display: block; }

.post-sidebar {
  width: 220px; flex-shrink: 0;
}
.post-sidebar section { margin-bottom: 28px; }
.post-sidebar h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--tx-3); margin-bottom: 12px;
}
.post-sidebar .written-by {
  display: flex; align-items: center; gap: 12px;
}
.post-sidebar .written-by .author-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-2); display: flex; align-items: center;
  justify-content: center; font-size: 18px; font-weight: 600;
}
.post-sidebar .written-by .author-name { font-size: 14px; font-weight: 600; }
.post-sidebar .written-by .author-location { font-size: 12px; color: var(--tx-3); }
.post-sidebar .next-post, .post-sidebar .related-item {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px; cursor: pointer;
}
.post-sidebar .next-post img, .post-sidebar .related-item img {
  width: 48px; height: 48px; border-radius: 4px; object-fit: cover;
  background: var(--bg-2); flex-shrink: 0;
}
.post-sidebar .related-item .rel-title { font-size: 13px; font-weight: 600; }
.post-sidebar .related-item .rel-artist { font-size: 12px; color: var(--tx-3); }

/* ============================================
   EMPTY / LOADING STATES
   ============================================ */
.loading-msg {
  text-align: center; padding: 60px 0;
  color: var(--tx-3); font-size: 14px;
}

/* ============================================
   MOBILE (<768px)
   ============================================ */
@media (max-width: 767px) {
  #sidebar {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0;
    width: 100%; height: 60px;
    flex-direction: row; padding: 0;
    border-right: none; border-top: 1px solid var(--bd);
    overflow: visible;
  }
  #sidebar .sidebar-brand,
  #sidebar .sidebar-user,
  #sidebar .sidebar-footer { display: none; }
  #sidebar nav {
    display: flex; width: 100%;
    align-items: center; justify-content: space-around;
  }
  #sidebar nav a {
    flex-direction: column; gap: 2px;
    padding: 8px 0; font-size: 10px;
    border-left: none; border-top: 2px solid transparent;
    text-align: center;
  }
  #sidebar nav a.active { border-left-color: transparent; border-top-color: var(--acc); }
  #sidebar nav a .nav-icon { font-size: 20px; }

  #main {
    margin-left: 0;
    padding: 24px 16px 80px;
  }

  .post-hero { flex-direction: column; padding: 24px 16px; margin: -24px -16px 0; }
  .post-art-wrap { width: 100%; height: auto; aspect-ratio: 1; max-width: 300px; align-self: center; }
  .post-hero-art { width: 100%; height: 100%; }
  .post-hero-meta .post-title { font-size: 26px; }

  .post-body-wrap { flex-direction: column; }
  .post-sidebar { width: 100%; }

  .music-card { flex: 0 0 140px; }
  .music-card .card-art { width: 140px; height: 140px; }

  #player-bar .player-right .volume-slider { display: none; }
  #player-bar .player-info .player-source { display: none; }
}

/* ============================================
   UTILITIES
   ============================================ */
.mt-40 { margin-top: 40px; }
.hidden { display: none !important; }

/* ============================================
   YOUTUBE PLAYER MODAL
   ============================================ */
#yt-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .25s ease;
  pointer-events: none;
}
#yt-modal.open { opacity: 1; pointer-events: all; }
.yt-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
}
.yt-panel {
  position: relative; z-index: 1;
  background: var(--tx-1);
  border-radius: 12px;
  overflow: hidden;
  width: min(600px, 95vw);
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  transform: translateY(20px);
  transition: transform .25s ease;
}
#yt-modal.open .yt-panel { transform: translateY(0); }
.yt-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
}
.yt-title { font-family: var(--font-heading); font-size: 18px; font-weight: 700; color: #fff; letter-spacing: .03em; }
.yt-artist { font-size: 12px; color: rgba(255,255,255,.6); margin-top: 2px; }
.yt-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; cursor: pointer; flex-shrink: 0;
  transition: background .15s;
}
.yt-close:hover { background: rgba(255,255,255,.3); }
.yt-embed { position: relative; padding-bottom: 56.25%; height: 0; }
.yt-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }

/* Explicit badge */
.explicit {
  display: inline-block;
  font-size: 9px; font-weight: 700;
  background: var(--tx-3); color: #fff;
  padding: 1px 4px; border-radius: 3px;
  vertical-align: middle; margin-left: 4px;
}

/* ============================================
   POST PAGE — STREAM LINKS + SOCIAL PILLS
   ============================================ */
.post-stream-links {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin: 14px 0 10px;
}
.post-play-btn {
  background: rgba(255,255,255,0.95); color: #111;
  border: none; border-radius: 20px;
  padding: 8px 18px; font-size: 13px; font-weight: 700;
  cursor: pointer; letter-spacing: .03em;
  transition: all .15s; white-space: nowrap;
}
.post-play-btn:hover { background: #fff; transform: scale(1.03); }
.stream-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 16px; border-radius: 20px; font-size: 12px;
  font-weight: 700; letter-spacing: .04em; text-decoration: none;
  transition: opacity .15s; white-space: nowrap;
}
.stream-pill:hover { opacity: .85; }
.spotify-pill { background: #1DB954; color: #fff; }
.apple-pill { background: #fff; color: #000; }
.post-socials { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.social-pill {
  display: inline-block; padding: 5px 14px; border-radius: 16px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-decoration: none; background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.9); border: 1px solid rgba(255,255,255,.25);
  transition: background .15s;
}
.social-pill:hover { background: rgba(255,255,255,.28); }
