/* ============ ПЛЕЄР ============ */
.player {
  --w: min(78vw, calc((100dvh - 130px) * var(--ratio)), 1180px);      /* ширина обкладинки; панель керування лежить поверх неї */
  position: fixed; inset: 0; z-index: 10;
  display: grid; grid-template-rows: minmax(0, 1fr);
  background: var(--tint);
  -webkit-backdrop-filter: blur(0px); backdrop-filter: blur(0px);
  opacity: 0; visibility: hidden;
  transition: opacity .45s var(--ease), backdrop-filter .6s var(--ease),
              -webkit-backdrop-filter .6s var(--ease), visibility 0s .6s;
}
/* плавний перехід розмиття внизу: стрічка прев'ю під плеєром поступово «тане» в рівний тон, без різкого краю */
.player::before {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 34vh; z-index: 0; pointer-events: none;
  background: linear-gradient(to bottom,
    rgba(232, 242, 251, 0) 0%, rgba(232, 242, 251, .35) 28%, rgba(232, 242, 251, .72) 60%, rgba(232, 242, 251, .92) 100%);
}
.player.is-open {
  opacity: 1; visibility: visible;
  -webkit-backdrop-filter: blur(26px) saturate(1.15); backdrop-filter: blur(26px) saturate(1.15);
  transition-delay: 0s;
}

.player__close {
  position: absolute; top: max(14px, env(safe-area-inset-top)); right: var(--gutter); z-index: 3;
  width: 44px; height: 44px; display: grid; place-items: center;
}
.player__close svg, .nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.player__close:hover, .nav:hover:not(:disabled) { opacity: .6; }

.player__stage { position: relative; display: grid; align-items: center; min-height: 0; }

.slides {
  position: relative;
  display: flex; gap: clamp(14px, 2.4vw, 36px);
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  /* великі вертикальні поля (з компенсацією негативним margin): тінь обкладинки не обрізається краєм прокручуваного контейнера → немає різкої лінії внизу */
  padding: 100px calc((100% - var(--w)) / 2);
  margin-block: -76px;
  scrollbar-width: none; outline: none;
  overscroll-behavior-x: contain;
}
.slides::-webkit-scrollbar { display: none; }

.slide {
  flex: 0 0 var(--w);
  aspect-ratio: var(--ratio);
  scroll-snap-align: center; scroll-snap-stop: always;
  position: relative; overflow: hidden;
  background: #dcebf7 center / cover no-repeat;
  box-shadow: 0 30px 80px -30px rgba(20, 86, 143, .45), 0 2px 10px rgba(20, 86, 143, .12);
  opacity: .38; transform: scale(.92);
  transition: opacity .5s var(--ease), transform .6s var(--ease);
  cursor: pointer;
}
.slide.is-active { opacity: 1; transform: scale(1); cursor: default; }
.slide img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  user-select: none; -webkit-user-drag: none;
  transform: scale(calc(1 + var(--bass, 0) * .02));
  will-change: transform;
}
.slide__soon {
  position: absolute; right: 14px; top: 14px;
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  background: rgba(255,255,255,.88); padding: 5px 9px;
}
.slide--noimg { display: grid; place-items: center; font-size: clamp(48px, 10vw, 120px); font-weight: 700; color: var(--ink-soft); }

.nav {
  position: absolute; top: 50%; translate: 0 -50%; z-index: 2;
  width: 52px; height: 52px; display: grid; place-items: center;
}
.nav--prev { left: max(8px, calc(var(--gutter) - 10px)); }
.nav--next { right: max(8px, calc(var(--gutter) - 10px)); }
.nav:disabled { opacity: .18; cursor: default; }

/* ---------- нижня панель ---------- */
.player__bar {
  /* десктоп: елементи керування лежать у стрічці обкладинок, на нижньому краї активної обкладинки, без підкладки */
  position: absolute; z-index: 2; left: 50%; translate: -50% 0;
  bottom: 90px;   /* 14px від низу обкладинки + 76px компенсації полів .slides */
  width: calc(var(--w) - 28px);
  transition: opacity .35s var(--ease);
  display: grid; gap: 8px;
  padding: 12px 18px 6px;
}
.now { display: flex; gap: 14px; align-items: baseline; font-size: 13px; letter-spacing: .04em; min-width: 0; }
.now__n { font-weight: 700; letter-spacing: .1em; flex: none; }
/* на десктопі ім'я й назва вже є на обкладинці — тут лише номер; текст лишається для скрінрідерів */
.now__t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.transport { display: flex; align-items: center; gap: 14px; }
.play {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  border: 1.5px solid currentColor; display: grid; place-items: center;
  transition: background .25s, color .25s, opacity .25s;
}
.play svg { width: 20px; height: 20px; fill: currentColor; grid-area: 1 / 1; }
.play .i-pause { display: none; }
.player.is-playing .play .i-play { display: none; }
.player.is-playing .play .i-pause { display: block; }
.play:hover:not(:disabled) { background: var(--ink); color: #fff; }
.play:disabled { opacity: .3; cursor: default; }
.time { font-size: 12px; font-variant-numeric: tabular-nums; min-width: 3ch; opacity: .8; }

.seek {
  --p: 0%;
  flex: 1; min-width: 0; height: 22px; margin: 0; background: transparent; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.seek:disabled { opacity: .3; cursor: default; }
.seek::-webkit-slider-runnable-track {
  height: 2px; background: linear-gradient(to right, var(--ink) var(--p), var(--line) var(--p));
}
.seek::-moz-range-track { height: 2px; background: var(--line); }
.seek::-moz-range-progress { height: 2px; background: var(--ink); }
.seek::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--ink); margin-top: -5px; border: 0;
}
.seek::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 0; }

/* десктоп: лінії повзунків на обкладинці мають читатися без підкладки */
@media (min-width: 701px), (orientation: landscape) and (max-height: 500px) {
  .player__bar { --line: rgba(255, 255, 255, .85); }
  /* кнопка паузи — у лівому нижньому куті обкладинки з однаковим відступом (18px) від лівого й нижнього країв,
     так само 18px праворуч у гучності/часу; повзунок аудіо лишається на місці, номер і гучність — нижче */
  .player__bar { padding: 12px 4px 16px; gap: 2px; }   /* повзунок, номер і гучність — на ~10px (≈2,5 мм) нижче; кнопка play лишається на місці (позиціонується окремо) */
  .player__bar .transport { order: 1; padding-left: 54px; }
  .player__bar .bar-top { order: 2; display: flex; align-items: center; justify-content: space-between; padding-left: 54px; }
  .player__bar .play { position: absolute; left: 4px; bottom: 28px; width: 44px; height: 44px; }
  .player__bar .play svg { width: 18px; height: 18px; }
  .player__bar .vol__range { width: clamp(90px, 10vw, 140px); }
  .player__bar .seek, .player__bar .vol__range, .player__bar .play, .player__bar .vol__btn, .player__bar .time, .player__bar .now__n {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, .55));
  }
}

/* ---------- гучність (над часом кінця треку) ---------- */
.bar-top { display: flex; align-items: center; gap: 18px; min-width: 0; }
.bar-top .now { flex: 1; min-width: 0; }
.vol { display: flex; align-items: center; gap: 6px; flex: none; }
.vol[hidden] { display: none; }
.vol__btn { width: 28px; height: 28px; display: grid; place-items: center; }
.vol__btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.vol__btn .x { display: none; }
.vol__btn.is-muted .x { display: block; }
.vol__btn.is-muted .wave { display: none; }
.vol__btn:hover { opacity: .6; }
.vol__range {
  --p: 100%;
  width: clamp(80px, 9vw, 120px); height: 22px; margin: 0; background: transparent; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.vol__range::-webkit-slider-runnable-track {
  height: 2px; background: linear-gradient(to right, var(--ink) var(--p), var(--line) var(--p));
}
.vol__range::-moz-range-track { height: 2px; background: var(--line); }
.vol__range::-moz-range-progress { height: 2px; background: var(--ink); }
.vol__range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 10px; height: 10px; border-radius: 50%;
  background: var(--ink); margin-top: -4px; border: 0;
}
.vol__range::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); border: 0; }

/* ---------- мобільний плеєр ---------- */
@media (max-width: 700px) and (min-height: 501px), (max-width: 700px) and (orientation: portrait) {
  /* великі зони дотику для повзунків (на пальці 12-піксельний повзунок майже не влучити) */
  .seek, .vol__range { height: 40px; -webkit-tap-highlight-color: transparent; }
  .seek::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -9px; }
  .seek::-moz-range-thumb { width: 20px; height: 20px; }
  .vol__range::-webkit-slider-thumb { width: 18px; height: 18px; margin-top: -8px; }
  .vol__range::-moz-range-thumb { width: 18px; height: 18px; }

  .slides { --w: min(86vw, calc((100dvh - 210px) * var(--ratio))); }
  .nav { display: none; }
}
