/* =========================================================
   La Grande Récré — Player styles (v2, full-bleed immersive)
   ========================================================= */

:root {
  --ink: #060608;
  --white: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.62);
  --text-faint: rgba(255, 255, 255, 0.42);
  --pill-bg: rgba(18, 18, 22, 0.55);
  --pill-border: rgba(255, 255, 255, 0.12);
  --halo: rgba(255, 255, 255, 0.35);

  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-brand: "Permanent Marker", cursive;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--white);
  background: var(--ink);
  overflow: hidden;
  position: relative;
}

/* ---------------- Background ---------------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.bg-layer {
  position: absolute;
  inset: -5%;
  background-image: url("../img/fallback-art.svg");
  background-size: cover;
  background-position: center;
  filter: blur(52px) saturate(1.15) brightness(0.6);
  transform: scale(1.15);
  transition: opacity 1.4s ease;
}

.bg-layer--a { opacity: 1; z-index: 1; }
.bg-layer--b { opacity: 0; z-index: 2; }
.bg-layer.is-front { z-index: 2; }

.bg-vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    radial-gradient(circle at 50% 38%, rgba(0,0,0,0) 0%, rgba(0,0,0,0.35) 62%, rgba(0,0,0,0.65) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.05) 22%, rgba(0,0,0,0.05) 70%, rgba(0,0,0,0.55) 100%);
}

/* ---------------- Brand (top) ---------------- */

.brand {
  position: fixed;
  top: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  opacity: 0.92;
}

.brand__logo {
  width: 132px;
  height: auto;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.5));
}

/* ---------------- Now playing (center) ---------------- */

.now-playing {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 0 24px;
}

.cover {
  position: relative;
  flex: 0 0 auto;
  width: 190px;
  height: 190px;
}

.cover__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  box-shadow:
    0 20px 50px -15px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(255,255,255,0.06);
  transition: opacity 0.5s ease;
  display: block;
}

.cover__img.is-swapping { opacity: 0; }

.cover__halo {
  position: absolute;
  inset: 50%;
  width: 76px;
  height: 76px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1.5px dashed var(--halo);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.cover:hover .cover__halo,
.play-btn:focus-visible ~ .cover__halo {
  opacity: 0.6;
}

.play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: rgba(15, 15, 18, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.6);
  transition: transform 0.15s ease, background 0.15s ease;
}

.play-btn:hover { transform: translate(-50%, -50%) scale(1.06); background: rgba(15,15,18,0.6); }
.play-btn:active { transform: translate(-50%, -50%) scale(0.95); }
.play-btn:focus-visible { outline: 2px solid rgba(255,255,255,0.8); outline-offset: 3px; }

.play-btn .icon { width: 24px; height: 24px; fill: currentColor; }
.play-btn .icon-pause,
.play-btn .icon-loading { display: none; }
.play-btn .icon-loading {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-dasharray: 38 16;
  animation: rotate-loader 0.9s linear infinite;
}
@keyframes rotate-loader { to { transform: rotate(360deg); } }

body.is-playing .play-btn .icon-play { display: none; }
body.is-playing .play-btn .icon-pause { display: block; }
body.is-loading .play-btn .icon-play,
body.is-loading .play-btn .icon-pause { display: none; }
body.is-loading .play-btn .icon-loading { display: block; }

/* ---------------- Track meta ---------------- */

.meta {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(46vw, 480px);
}

.meta__primary {
  margin: 0 0 4px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-shadow: 0 2px 18px rgba(0,0,0,0.45);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.meta__secondary {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  color: var(--text-muted);
  text-shadow: 0 2px 14px rgba(0,0,0,0.4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------- Bottom control bar ---------------- */

.control-bar {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 999px;
  color: var(--white);
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}

.pill--icon {
  width: 44px;
  padding: 0;
}

.pill:hover { background: rgba(255,255,255,0.14); }
.pill:active { transform: scale(0.96); }
.pill:focus-visible { outline: 2px solid rgba(255,255,255,0.8); outline-offset: 2px; }

.pill--icon svg { width: 18px; height: 18px; fill: currentColor; transition: transform 0.15s ease; }
.pill--icon i { font-size: 17px; line-height: 1; color: currentColor; transition: transform 0.15s ease; }

/* Branded hover states for the "find this track on..." links */
.pill--spotify:hover {
  background: rgba(29, 185, 84, 0.18);
  border-color: rgba(29, 185, 84, 0.45);
  color: #1db954;
}
.pill--deezer:hover {
  background: rgba(162, 56, 255, 0.18);
  border-color: rgba(162, 56, 255, 0.45);
  color: #a238ff;
}
.pill--ytmusic:hover {
  background: rgba(255, 35, 35, 0.18);
  border-color: rgba(255, 35, 35, 0.45);
  color: #ff2323;
}
.pill--spotify:hover svg,
.pill--deezer:hover svg,
.pill--ytmusic:hover svg,
.pill--spotify:hover i,
.pill--deezer:hover i,
.pill--ytmusic:hover i {
  transform: scale(1.12);
}

/* volume pill expands to reveal a slider on hover / focus */
.volume-pill {
  width: 44px;
  padding: 0 0 0 13px;
  justify-content: flex-start;
  overflow: hidden;
  transition: width 0.25s ease, background 0.15s ease;
}

.volume-pill:hover,
.volume-pill:focus-within {
  width: 150px;
}

.vol-btn {
  flex: 0 0 auto;
  width: 18px;
  height: 44px;
  border: none;
  background: none;
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.vol-btn .icon { width: 18px; height: 18px; fill: currentColor; }
.vol-btn .icon-vol-off { display: none; }
.vol-btn.is-muted .icon-vol-on { display: none; }
.vol-btn.is-muted .icon-vol-off { display: block; }

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  margin: 0 16px 0 10px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  outline: none;
  flex: 0 0 auto;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--white);
  cursor: pointer;
}
.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--white);
  cursor: pointer;
}

/* ---------------- Quality badge ---------------- */

.quality-wrap {
  position: fixed;
  right: 24px;
  bottom: 28px;
  z-index: 5;
}

.quality-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 999px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease;
}

.quality-badge:hover { background: rgba(255,255,255,0.14); }
.quality-badge:focus-visible { outline: 2px solid rgba(255,255,255,0.8); outline-offset: 2px; }

.icon-signal { width: 15px; height: 15px; fill: var(--text-muted); flex: 0 0 auto; }
.icon-chevron { width: 13px; height: 13px; flex: 0 0 auto; transition: transform 0.2s ease; }
.quality-wrap.is-open .icon-chevron { transform: rotate(180deg); }

.quality-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  margin: 0;
  padding: 6px;
  list-style: none;
  min-width: 100%;
  background: rgba(18, 18, 22, 0.85);
  border: 1px solid var(--pill-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 14px;
  box-shadow: 0 16px 32px -12px rgba(0,0,0,0.6);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.quality-wrap.is-open .quality-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.quality-menu li {
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
}

.quality-menu li:hover { background: rgba(255,255,255,0.1); color: var(--white); }
.quality-menu li[aria-selected="true"] { color: var(--white); font-weight: 600; }

/* ---------------- Progress bar ---------------- */

.progress-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  z-index: 6;
  background: rgba(255, 255, 255, 0.12);
  opacity: 1;
  transition: opacity 0.3s ease;
}

.progress-bar.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.progress-bar__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.95));
  transition: width 0.25s linear;
}

/* ---------------- Status line ---------------- */

.status-line {
  position: fixed;
  left: 50%;
  bottom: 94px;
  transform: translateX(-50%);
  z-index: 5;
  margin: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: #ffb199;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
  text-align: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
}

.status-line.is-visible { opacity: 1; }

/* ---------------- Responsive ---------------- */

@media (max-width: 640px) {
  .now-playing {
    flex-direction: column;
    gap: 18px;
    text-align: center;
  }
  .cover { width: 150px; height: 150px; }
  .meta { flex-basis: auto; max-width: 320px; }
  .meta__primary { font-size: 24px; -webkit-line-clamp: 2; }
  .meta__secondary { white-space: normal; }
  .quality-wrap { right: 50%; transform: translateX(50%); bottom: 98px; }
  .quality-wrap .quality-menu { right: 50%; transform: translateX(50%) translateY(6px); }
  .quality-wrap.is-open .quality-menu { transform: translateX(50%) translateY(0); }
  .control-bar { bottom: 36px; }
  .status-line { bottom: 150px; }
  .brand { top: 26px; }
}

/* ---------------- Reduced motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  .bg-layer,
  .play-btn .icon-loading,
  .cover__halo,
  .volume-pill {
    transition: none !important;
    animation: none !important;
  }
}
