/* RESET */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: #000; color: #fff;
  font-family: 'Jost', 'Futura PT', 'Futura', 'Trebuchet MS', sans-serif;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* Hide the play-icon & track-number while .loading is active */
.loading .play-icon,
.loading .track-number { display: none !important; }

/* Force 100% opacity (no hover fade) during loading */
.loading .song-block,
.loading .song-block:hover { opacity: 1 !important; }

/* CENTERED LOGO (FIXED) — z above scanlines (9999) so they don't paint over it */
.center-logo {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  max-width: 260px;
  width: 30vw;
  z-index: 10005;
}

/* GRID */
.grid-container {
  display: grid; gap: 1rem; grid-template-columns: repeat(3, 1fr);
  max-width: 1200px; margin: 0 auto 6rem; padding: 1rem;
}
@media (max-width: 1000px) { .grid-container { grid-template-columns: 1fr; } }

/* SONG BLOCKS — image edge-to-edge, rounded corners as the "housing".
 * Active indicator uses inset box-shadow so it follows border-radius and
 * paints above the canvas overlays. */
.song-block {
  position: relative; overflow: hidden;
  background: url("../img/tv-static.gif") center center / cover no-repeat #111;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.15s;
  cursor: pointer;
}
.song-block:hover { opacity: 1; transform: scale(1.012); }
.song-block.active { opacity: 1; }
/* Active indicator — drawn on ::after above all canvases + scanlines.
 * Inherits the parent's border-radius so the white frame is rounded. */
.song-block.active::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 10020;
  border: 2px solid #fff;
  border-radius: inherit;
}

/* Canvases injected by ScreenEffect (vcr + snow) */
.song-block > canvas {
  position: absolute; left: 0; top: 0;
  width: 100%; height: 100%;
  z-index: 9998;
  pointer-events: none;
}
.song-block > canvas.vcr  { opacity: 0.3; }
.song-block > canvas.snow { /* no bg-color — let the noise show against the image */ }

/* MEDIA LAYER (holds either <img> or <video>) */
.media-layer {
  position: absolute; inset: 0;
  overflow: hidden;
}
.media-layer > .media {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  opacity: 0;
  transition: opacity 350ms ease;
  will-change: opacity;
}
.media-layer > .media.show { opacity: 1; }
/* When a new cue is replacing me, fade out at the same duration */
.media-layer > .media.media--out { opacity: 0; }

/* ============================================
   CRT / VHS overlay stack (matches Mobius1 pen)
     z 9998 : canvases (vcr + snow)
     z 9999 : ::before  = scanlines (horizontal + RGB mask)
     z 10000: ::after   = vignette PNG (rounded TV-tube housing)
   ============================================ */
.song-block::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 9999;
  /* Pen's exact .scanlines pattern (SCSS resolved):
     - 100% 2px horizontal: 1px transparent, 1px rgba(0,0,0,0.25)
     - 3px 100% RGB shadow-mask vertical stripe */
  background:
    linear-gradient(rgba(18,16,16,0) 50%, rgba(0,0,0,0.25) 50%),
    linear-gradient(90deg,
      rgba(255, 0, 0, 0.06),
      rgba(0, 255, 0, 0.02),
      rgba(0, 0, 255, 0.06));
  background-size: 100% 2px, 3px 100%;
}
/* (vignette PNG removed — border-radius + inset shadow on .song-block handle the housing now) */

/* Active block: tiny saturation lift for that "tuned-in" pop */
.song-block.active {
  filter: saturate(1.06) contrast(1.04);
}

/* ============================================
   Glitch animation (verbatim from pen, scoped to .media-layer)
   Wobble removed per Anthony's request — was too distracting.
   ============================================ */
/* Glitch — scoped to .media-layer so the canvas noise overlays stay stable
   while the image skews. */
.song-block.has-glitch .media-layer { animation: tvGlitch 5s ease infinite; }
.song-block.has-glitch.active .media-layer { animation: none; }
@keyframes tvGlitch {
  0%, 40% { transform: skew(0, 0); opacity: 1; }
  41%     { transform: skew(18deg, 0); opacity: 0.85; }
  42%     { transform: skew(-10deg, 0); opacity: 0.85; }
  43%, 100% { transform: skew(0, 0); opacity: 1; }
}

/* PLAY ICON (bottom-right corner) — above vignette */
.play-icon {
  position: absolute; bottom: 10px; right: 10px;
  font-size: 32px; color: #fff;
  display: none; opacity: 0.95;
  z-index: 10010;
  text-shadow: 0 0 8px rgba(0,0,0,0.8);
}
.song-block:hover .play-icon { display: block; }

/* TRACK NUMBER/TITLE — Supreme red box, italic confidence */
.track-number {
  position: absolute; top: 12px; left: 12px;
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: #fff;
  background: #000;
  padding: 4px 9px 3px;
  display: none;
  line-height: 1.15;
  max-width: 85%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  z-index: 10010;
  box-shadow: 0 1px 0 rgba(0,0,0,0.4);
}
.song-block:hover .track-number,
.song-block.active .track-number { display: inline-block; }

/* BOTTOM BAR — 2 rows: scrubber top, song-info/controls/social bottom */
.bottom-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: auto auto;
  row-gap: 0.5rem;
  align-items: center;
  padding: 0.75rem 1rem 0.85rem;
  background: #0a0a0a;
  position: fixed; bottom: 0; left: 0; right: 0;
  border-top: 1px solid #222;
  font-family: 'Jost', sans-serif;
  z-index: 100;
}
.song-info     { justify-self: start;  display: flex; align-items: center; gap: 0.6rem; }
.controls      { justify-self: center; }
.social-links  { justify-self: end;    display: flex; align-items: center; gap: 0.4rem; }

/* Scrubber row — spans all 3 columns at the top */
.progress-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.time-current,
.time-total {
  font-family: 'Jost', sans-serif;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.6);
  min-width: 2.5rem;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
.time-total { text-align: right; }

.progress-bar {
  flex: 1 1 auto;
  position: relative;
  height: 36px;                /* generous hit area; visible bar stays 3px */
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;          /* prevent scroll/zoom interfering with scrub */
}
.progress-bar::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  transition: height 0.15s, margin-top 0.15s;
}
.progress-bar:hover::before,
.progress-bar:focus::before { height: 6px; margin-top: -3px; }
.progress-bar:focus { outline: none; }

.progress-fill {
  position: absolute;
  left: 0;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  width: 0%;
  background: #fff;
  border-radius: 2px;
  transition: height 0.15s, margin-top 0.15s, width 0.05s linear;
  pointer-events: none;
}
.progress-bar:hover .progress-fill,
.progress-bar:focus .progress-fill { height: 6px; margin-top: -3px; }

/* SOCIAL ICONS + CREDITS TRIGGER */
.social-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: transparent;
  color: rgba(255,255,255,0.78);
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  font: inherit;
  padding: 0;
}
.social-link:hover { color: #fff; border-color: #2a2a2a; background: #1a1a1a; }
.social-link svg { width: 20px; height: 20px; display: block; }
.social-link .material-icons { font-size: 22px; line-height: 1; }

/* Mobile bottom bar — progress row on top, controls + info side-by-side below */
@media (max-width: 640px) {
  .bottom-bar {
    display: grid;
    grid-template-columns: auto auto;
    grid-template-rows: auto auto;
    justify-content: center;
    column-gap: 0.4rem;
    row-gap: 0.4rem;
    padding: 0.55rem 1rem 0.7rem;
  }
  .song-info { display: none; }
  .progress-row {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
  }
  .controls     { grid-column: 1; grid-row: 2; justify-self: end; }
  .social-links { grid-column: 2; grid-row: 2; justify-self: start; }
}
.song-info #currentSong {
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}

/* REC dot — blinks only when audio is playing */
.rec-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #444;
  flex: 0 0 auto;
  transition: background 0.2s;
}
body.is-playing .rec-dot {
  background: #e2261b;
  box-shadow: 0 0 8px rgba(226,38,27,0.7);
  animation: recBlink 1.2s ease-in-out infinite;
}
@keyframes recBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* LOADING SPINNER */
.spinner {
  width: 18px; height: 18px; border: 2px solid #ccc; border-top: 2px solid #fff;
  border-radius: 50%; animation: spin 1s linear infinite; display: inline-block;
}
.spinner.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* CONTROLS */
.controls button {
  background: #1a1a1a; color: #fff; border: 1px solid #2a2a2a;
  margin: 0 0.25rem;
  padding: 0.4rem 0.9rem; cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  font-size: 0;
  border-radius: 2px;
}
.controls button:hover { background: #2a2a2a; border-color: #444; }
.material-icons { font-size: 28px; }

/* CREDITS OVERLAY */
.credits-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 100000;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.credits-overlay.is-open { opacity: 1; pointer-events: auto; }

.credits-close {
  position: absolute; top: 1.25rem; right: 1.25rem;
  width: 44px; height: 44px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 2px;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.credits-close:hover { border-color: #fff; background: rgba(255,255,255,0.06); }

.credits-panel {
  max-width: 640px;
  width: 100%;
  color: #fff;
  font-family: 'Jost', sans-serif;
  text-align: center;
  line-height: 1.55;
  max-height: 80vh;
  overflow-y: auto;
}
.credits-title {
  font-size: 2.5rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  margin: 0 0 0.5rem;
}
.credits-tagline {
  font-style: italic; opacity: 0.7;
  margin: 0 0 2.5rem;
}
.credits-section { margin-bottom: 1.75rem; }
.credits-section h3 {
  font-size: 0.85rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  opacity: 0.6;
  margin: 0 0 0.5rem;
}
.credits-section p {
  margin: 0.15rem 0;
  font-size: 0.95rem;
}
.credits-section a {
  color: #fcc144;
  text-decoration: none;
  border-bottom: 1px solid rgba(252, 193, 68, 0.35);
  transition: border-color 0.15s;
}
.credits-section a:hover { border-bottom-color: #fcc144; }

/* Lead paragraph above the band list */
.credits-section .credits-lead {
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 0.5rem;
  opacity: 0.85;
}

/* Band roles list — one person per line, generous line-height */
.credits-roles {
  list-style: none;
  padding: 0;
  margin: 0;
  line-height: 1.75;
}
.credits-roles li { font-size: 0.95rem; }
.credits-instrument { opacity: 0.78; }
.credits-tracks {
  opacity: 0.45;
  font-variant-numeric: tabular-nums;
  font-size: 0.85em;
}

/* Small footnote under sections (e.g. "Numbers refer to track positions") */
.credits-note {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.45;
  margin-top: 1rem;
}

/* Thank-You paragraphs — centered text and centered block.
 * Specificity bumped (.credits-section .credits-thanks) so it beats the
 * generic ".credits-section p { margin: 0.15rem 0 }" rule above, which
 * was zeroing out the `margin: 0 auto` and pinning the block to the left
 * edge of the panel. */
.credits-section .credits-thanks {
  font-size: 0.95rem;
  line-height: 1.7;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  max-width: 32rem;
}
.credits-section .credits-thanks + .credits-thanks { margin-top: 1.75rem; }

/* "A Personal Note" — slightly italic, more whitespace */
.credits-section--message { margin-top: 2.5rem; }
.credits-message {
  font-style: italic;
  opacity: 0.85;
  margin: 0.3rem 0;
}
.credits-dedication {
  margin-top: 1.5rem;
  font-size: 1.1rem;
  font-style: italic;
  letter-spacing: 0.02em;
  opacity: 1;
}

/* Mobile tightening */
@media (max-width: 640px) {
  .credits-roles li { font-size: 0.9rem; }
  .credits-thanks { max-width: 100%; font-size: 0.9rem; }
}
.credits-foot {
  margin-top: 2rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.5;
}
