/* ---------- песня, которая разбирается: плашка над сеткой на главной (pending.js) ---------- */

.pend-list { display: grid; gap: 12px; margin: 4px 0 40px; }
.pend-list:empty { display: none; }

/* цвета песни (--c1, --c2) приходят из coverStyle: ими светится обложка и заливается плашка */
.pend {
  --pad: 18px;
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; grid-template-areas: "cover name num" "cover now num" "bar bar bar" "foot foot foot";
  column-gap: 16px; align-items: center; padding: var(--pad) var(--pad) 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  transition: border-color .2s ease, opacity .25s ease, transform .25s ease;
}
.pend:hover { border-color: var(--border-2); }
/* свет от обложки: дышит, пока идёт работа */
.pend::before {
  content: ""; position: absolute; z-index: -2; left: -60px; top: -80px; width: 380px; height: 260px; pointer-events: none;
  background:
    radial-gradient(closest-side at 35% 50%, color-mix(in srgb, var(--c1) 55%, transparent), transparent),
    radial-gradient(closest-side at 70% 60%, color-mix(in srgb, var(--c2) 45%, transparent), transparent);
  filter: blur(36px); opacity: .5;
}
/* плашка заливается цветами песни: край заливки идёт ровно над головой полосы */
.pend-fill {
  position: absolute; z-index: -1; inset: 0 auto 0 0; pointer-events: none;
  width: calc(var(--pad) + (100% - 2 * var(--pad)) * var(--p, 0));
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--c1) 7%, transparent) 60%, color-mix(in srgb, var(--c2) 15%, transparent));
  box-shadow: inset -1px 0 0 color-mix(in srgb, var(--c2) 30%, transparent);
  transition: width .4s ease;
}
.pend-fill::after { content: ""; position: absolute; inset: 0; background: var(--grain); opacity: .22; mix-blend-mode: overlay; }
/* вся плашка ведёт на страницу песни, кнопки лежат поверх ссылки */
.pend-open { position: absolute; z-index: 0; inset: 0; border-radius: inherit; }
.pend-open:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pend > :not(.pend-open, .pend-fill) { position: relative; z-index: 1; pointer-events: none; }
.pend-act { pointer-events: auto; }

/* обложка «слушает» запись: столбики эквалайзера */
.pend-cover { grid-area: cover; width: 64px; border-radius: 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); }
.pend-eq {
  position: absolute; z-index: 1; inset: 0; display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding-bottom: 16px;
  transition: opacity .25s ease;
}
.pend-eq i {
  width: 4px; height: 28px; border-radius: 2px; background: rgba(255, 255, 255, .9);
  transform-origin: 50% 100%; transform: scaleY(.3);
}
/* у каждого столбика свой темп, чтобы они не прыгали хором */
.pend-eq i:nth-child(2) { --d: .7s; --dl: -.3s; }
.pend-eq i:nth-child(3) { --d: 1.1s; --dl: -.6s; }
.pend-eq i:nth-child(4) { --d: .8s; --dl: -.2s; }
.pend-eq i:nth-child(5) { --d: 1s; --dl: -.5s; }
.pend-check {
  position: absolute; z-index: 1; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .28);
  opacity: 0; transform: scale(.6); transition: opacity .25s ease, transform .35s cubic-bezier(.3, 1.6, .5, 1);
}
.pend-check .ic-check { width: 30px; height: 30px; margin: 0; color: #ffffff; }

.pend-name { grid-area: name; align-self: end; min-width: 0; display: flex; align-items: baseline; gap: 4px 10px; white-space: nowrap; }
.pend-name b { overflow: hidden; text-overflow: ellipsis; font-size: 17px; font-weight: 500; letter-spacing: -.01em; }
.pend-name span { overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 14px; }
.pend:hover .pend-name b { text-decoration: underline; text-underline-offset: 3px; }
.pend-now { grid-area: now; align-self: start; min-width: 0; display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 14px; color: var(--muted); }
.pend-now .busy-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pend-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--aura); }

.pend-num { grid-area: num; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.pend-num b { font-size: 28px; line-height: 1; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.pend-num span { font-size: 12px; color: var(--muted); white-space: nowrap; }

.progress.pend-bar { grid-area: bar; margin-top: 16px; }
.pend-bar > div { position: relative; box-shadow: 0 0 12px color-mix(in srgb, #f0516a 55%, transparent); }
/* по залитой части бежит блик */
.pend-bar > div::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, .55) 50%, transparent 100%) 0 0 / 40% 100% no-repeat;
  opacity: 0;
}

.pend-foot { grid-area: foot; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 12px; min-height: 32px; }
.pend-steps { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--faint); }
.pend-steps li { display: flex; align-items: center; gap: 7px; }
.pend-steps i {
  position: relative; flex: none; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--surface-3);
}
.pend-steps .ic-check { width: 11px; height: 11px; margin: 0; color: var(--ink); }
.pend-steps li.done { color: var(--muted); }
.pend-steps li.done i { background: var(--ok); box-shadow: none; }
.pend-steps li.now { color: var(--text); font-weight: 500; }
.pend-steps li.now i { background: var(--aura); box-shadow: none; }
.pend-steps li.now i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--aura); opacity: 0; }

.pend-act { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.pend-minus:empty { display: none; }
.pend-dl { animation: pend-in .35s ease-out; }

/* в очереди: работа ещё не началась */
.pend.queued .pend-eq i { transform: scaleY(.18); opacity: .6; }
.pend.queued .pend-dot { background: var(--faint); }

/* готово: галочка на обложке, полоса зелёная, по плашке проходит свет */
.pend.done .pend-eq { opacity: 0; }
.pend.done .pend-check { opacity: 1; transform: none; }
.pend.done .pend-dot { background: var(--ok); }
.pend.done .pend-bar > div { background: var(--ok); box-shadow: 0 0 14px color-mix(in srgb, var(--ok) 60%, transparent); transition: width .4s ease, background-color .3s ease; }
.pend.done .pend-now { color: var(--text); }
.pend.leaving { opacity: 0; transform: translateY(-6px) scale(.98); }

@keyframes pend-in { from { opacity: 0; transform: translateY(3px); } }

@media (prefers-reduced-motion: no-preference) {
  .pend::before { animation: pend-breathe 5s ease-in-out infinite alternate; }
  .pend:not(.queued, .done) .pend-eq i { animation: pend-eq var(--d, .9s) ease-in-out var(--dl, 0s) infinite alternate; }
  .pend:not(.queued, .done) .pend-bar > div::after { animation: pend-shine 2.2s ease-in-out infinite; }
  .pend-steps li.now i::after { animation: pend-ping 1.6s ease-out infinite; }
  .pend:not(.queued, .done) .pend-dot { animation: pend-pulse 1.6s ease-in-out infinite; }
  .pend.done::after {
    content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none;
    background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .09) 50%, transparent 70%);
    animation: pend-sweep .9s ease-out both;
  }
}
@keyframes pend-breathe { from { opacity: .35; transform: translateX(-12px) scale(.95); } to { opacity: .65; transform: translateX(12px) scale(1.06); } }
@keyframes pend-eq { from { transform: scaleY(.22); } to { transform: scaleY(1); } }
@keyframes pend-shine { 0% { opacity: 1; background-position: -60% 0; } 70%, 100% { opacity: 1; background-position: 160% 0; } }
@keyframes pend-ping { from { opacity: .7; transform: scale(1); } to { opacity: 0; transform: scale(2.2); } }
@keyframes pend-pulse { 50% { opacity: .35; } }
@keyframes pend-sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

@media (max-width: 700px) {
  .pend { --pad: 14px; grid-template-columns: 52px minmax(0, 1fr) auto; column-gap: 12px; border-radius: 18px; }
  .pend-cover { width: 52px; border-radius: 10px; }
  .pend-eq { gap: 2px; padding-bottom: 12px; }
  .pend-eq i { width: 3px; height: 22px; }
  .pend-name { flex-direction: column; align-items: flex-start; gap: 0; }
  .pend-name b { max-width: 100%; font-size: 16px; }
  .pend-name span { max-width: 100%; }
  .pend-num b { font-size: 22px; }
  /* на телефоне фраза этапа идёт отдельной строкой над полосой, а из этапов виден только текущий */
  .pend { grid-template-areas: "cover name num" "now now now" "bar bar bar" "foot foot foot"; }
  .pend-name { align-self: center; }
  .pend-now { margin-top: 12px; font-size: 13px; }
  .progress.pend-bar { margin-top: 10px; }
  .pend-steps li:not(.now) { display: none; }
}
