/* ==========================================================================
   Music page — full-screen particle field with centered "square" cover area.
   Cursor displacement works across the whole viewport. Cursor-following
   play / pause buttons sit on the pointer. Bottom-left song title fills green
   left→right as the track plays. Top navbar + sticky footer chrome.
   ========================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #202020;
  color: #f6f6f6;
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden;
}

.music-page {
  position: fixed;
  inset: 0;
}

/* ---------- Full-screen particle canvas ---------- */

.cover-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 1;
  cursor: pointer;
  background: transparent;
}

/* ---------- Static cover (mobile only) ---------- */

.cover-static {
  display: none;
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(72vw, 360px);
  height: min(72vw, 360px);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 2;
  transform: translateY(-6%);
}

.cover-static img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

/* ---------- Cursor-following play / pause ---------- */

.cursor-player {
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  gap: 10px;
  z-index: 60;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  will-change: transform, opacity;
}

.cursor-player.is-visible { opacity: 1; }

.cp-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border: none;
  font: 500 11px/1 'JetBrains Mono', monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  pointer-events: none;        /* enabled only while the label is visible */
  transition: background 0.2s ease;
}
.cursor-player.is-visible .cp-btn { pointer-events: auto; }
.cp-btn:hover { background: rgba(0, 0, 0, 0.7); }

.cp-pause { display: none; }
.cursor-player.is-playing .cp-play { display: none; }
.cursor-player.is-playing .cp-pause { display: inline-flex; }

/* Edge zones: the cursor label becomes PREVIOUS (top band) / NEXT (bottom band)
   and a click there changes track. Middle keeps play/pause. */
.cp-prev, .cp-next { display: none; }
.cursor-player.zone-prev .cp-play,
.cursor-player.zone-prev .cp-pause,
.cursor-player.zone-prev .cp-next { display: none; }
.cursor-player.zone-prev .cp-prev { display: inline-flex; }
.cursor-player.zone-next .cp-play,
.cursor-player.zone-next .cp-pause,
.cursor-player.zone-next .cp-prev { display: none; }
.cursor-player.zone-next .cp-next { display: inline-flex; }

@media (max-width: 768px) {
  .cursor-player { display: none; }
}

/* ---------- Prev / Next track arrows ----------
   Desktop: a full-width fixed band, vertically centred, with the arrows pushed
   to the left/right edges so they flank the cover. Mobile: regrouped into a
   left-aligned row that sits just above the now-playing title. */

.track-nav {
  position: fixed;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 48px;
  z-index: 55;
  pointer-events: none;       /* clicks only land on the buttons */
}

.track-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0.85;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.track-nav-btn:hover { opacity: 1; }
.track-nav-prev:hover { transform: translateX(-3px); }
.track-nav-next:hover { transform: translateX(3px); }
.track-nav-btn svg { width: 32px; height: 32px; display: block; }

/* ---------- Now-playing info (bottom-left) ---------- */

.now-playing {
  position: fixed;
  left: 32px;
  bottom: 88px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 50;
  pointer-events: none;
}

.np-artist {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.65);
  text-transform: uppercase;
  font-weight: 500;
}

.np-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

.np-title-wrap {
  position: relative;
  display: inline-block;
  line-height: 1;
}

.np-title {
  display: block;
  font-family: 'Archivo Narrow', 'JetBrains Mono', sans-serif;
  font-weight: 600;
  font-size: clamp(56px, 9vw, 100px);
  line-height: 100%;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.np-title-empty {
  color: rgba(255, 255, 255, 0.18);
}

.np-title-filled {
  position: absolute;
  inset: 0;
  color: #00FF66;            /* high-vibrancy green when playing */
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.1s linear;
  text-shadow: 0 0 28px rgba(0, 255, 102, 0.35);
}

.np-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 400;
  padding-bottom: 12px;
  white-space: nowrap;
}

.np-current { text-align: right; min-width: 36px; }
.np-duration { text-align: left; min-width: 36px; }

/* ---------- Mobile ---------- */

@media (max-width: 768px) {
  /* Particle field stays on mobile — touch drag drives displacement.
     Keep static cover hidden as a fallback element only. */
  .cover-static { display: none; }

  /* Cover + arrow positions are measured & published by music.js
     (layoutMobileCover) so the cover, arrows, text and explore footer never
     overlap on any screen height. --cover-shift lifts the particle field;
     --arrow-top is the measured arrow row position. */
  .cover-canvas { transform: translateY(calc(-1 * var(--cover-shift, 40px))); }

  /* Arrows sit in the measured gap below the cover. Horizontally they respect
     the same 24px page gutter as the now-playing text so every object lines up. */
  .track-nav {
    top: var(--arrow-top, 62%);
    bottom: auto;
    left: 0;
    right: 0;
    width: auto;
    padding: 0 24px;
    justify-content: space-between;
    transform: none;
  }
  .track-nav-btn { width: 40px; height: 40px; }
  .track-nav-btn svg { width: 36px; height: 36px; }
  .track-nav-prev:hover { transform: none; }
  .track-nav-next:hover { transform: none; }

  /* Now-playing sits just above the explore footer (~50px reserved) and never
     overlaps it; the arrows above clear it via the reserved cover sizing. */
  .now-playing {
    left: 24px;
    right: 24px;
    bottom: calc(52px + env(safe-area-inset-bottom, 0px));
    gap: 2px;
  }
  .np-artist {
    font-size: 10px;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.5);
  }
  .np-row {
    gap: 10px;
    align-items: baseline;
    justify-content: space-between;
  }
  /* Single line always: shrink with the viewport and never wrap. */
  .np-title {
    font-size: clamp(34px, 11.5vw, 56px);
    white-space: nowrap;
  }
  .np-current { display: none; }
  .np-time {
    font-size: 10px;
    padding-bottom: 6px;
    color: rgba(255, 255, 255, 0.4);
  }
  .np-duration { padding-bottom: 6px; min-width: 30px; }
}

@media (max-width: 420px) {
  .np-title { font-size: clamp(30px, 11vw, 48px); }
}

/* ==========================================================================
   Config panel
   ========================================================================== */

.cfg-panel {
  position: fixed;
  top: 80px;
  right: 20px;
  width: 260px;
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: var(--z-player);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #fff;
}

.cfg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: move;
  user-select: none;
}

.cfg-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cfg-toggle {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

/* Info toggle — shows/hides the per-control descriptions. */
.cfg-info-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: none;
  color: rgba(255, 255, 255, 0.6);
  font: 600 11px/1 'JetBrains Mono', monospace;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cfg-info-btn:hover { color: #fff; border-color: rgba(255, 255, 255, 0.6); }
.cfg-info-btn.active {
  background: #00FF66;
  border-color: #00FF66;
  color: #000;
}

.cfg-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.cfg-body.collapsed { display: none; }

.cfg-row { display: flex; flex-direction: column; gap: 4px; }
.cfg-row label {
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  text-transform: uppercase;
}
.cfg-row label span { color: #00FF66; font-weight: 500; }

.cfg-desc {
  display: none;             /* hidden until the info toggle is enabled */
  margin: 2px 0 0;
  font-size: 9px;
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.38);
  text-transform: none;
}
.cfg-body.show-desc .cfg-desc { display: block; }

.cfg-row input[type="range"] {
  width: 100%;
  height: 3px;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}
.cfg-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: #00FF66;
  border-radius: 50%;
  cursor: pointer;
}

.cfg-row select {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  color: #00FF66;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font: 500 10px/1.4 'JetBrains Mono', monospace;
  padding: 5px 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.cfg-row select:focus { outline: 1px solid #00FF66; }

.cfg-copy {
  background: #00FF66;
  border: none;
  color: #000;
  padding: 8px 12px;
  font: 600 10px/1 'JetBrains Mono', monospace;
  cursor: pointer;
  margin-top: 4px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.cfg-copy:hover { background: #00cc52; }

.cfg-output {
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 10px;
  font-size: 9px;
  color: #00FF66;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  max-height: 130px;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .cfg-panel { display: none; }
}

/* ==========================================================================
   Nav layering: keep the navigation (top + footer) on top of the modal so
   Exit / Explore the Museum stay reachable. Scoped to the music page.
   ========================================================================== */

.top-navbar { z-index: var(--z-navbar) !important; }
.sticky-footer,
.mobile-explore-footer,
.mobile-drawer-overlay { z-index: var(--z-drawer-overlay) !important; }
.mobile-drawer { z-index: var(--z-drawer) !important; }
