/* ==========================================================================
   Kate Lorén — soundtracks: the list of songs and the player ("deck").
   Used on the site pages and inside the reader, so the colours come from --pl-* variables:
   site.css sets them for the dark pages, reader.css for the reading themes.
     --pl-fg text · --pl-muted quiet text · --pl-line thin lines · --pl-hover row under the pointer
     --pl-accent the colour of the book · --pl-ink what is drawn on the accent · --pl-bg the fixed bar
   ========================================================================== */

/* ---------- the list of songs ---------- */
.ost { list-style: none; margin: 0; padding: 0; }
.ost li { margin: 0; padding: 0; }
.ost-play {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  margin: 0;
  padding: 8px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--pl-fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ost-play:hover { background: var(--pl-hover); }
.ost-n {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--pl-line);
  display: grid;
  place-items: center;
  font-family: var(--font-ui);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--pl-muted);
}
.ost-t { font-family: var(--font-display); font-size: 1.25rem; line-height: 1.15; overflow-wrap: anywhere; }
.ost-by { display: block; margin-top: 3px; font-family: var(--font-ui); font-size: 12.5px; color: var(--pl-muted); }
.ost-d { padding-right: 4px; font-family: var(--font-ui); font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--pl-muted); }
/* a song that is kept on this device (it plays with no connection): a tiny check before its length */
.ost-saved { display: inline-block; width: 11px; height: 11px; margin-right: 6px; vertical-align: -1px; color: var(--pl-accent); opacity: 0.9; }
.ost-saved svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
/* the song that is on: three dancing bars while it plays, a triangle while it waits */
.ost-play.on .ost-t { color: var(--pl-accent); }
.ost-play.on .ost-n { background: var(--pl-accent); border-color: transparent; color: var(--pl-ink); font-size: 0; }
.ost-play.on .ost-n::before {
  content: '';
  width: 13px;
  height: 12px;
  background:
    linear-gradient(currentColor, currentColor) 0 100% / 3px 60% no-repeat,
    linear-gradient(currentColor, currentColor) 50% 100% / 3px 100% no-repeat,
    linear-gradient(currentColor, currentColor) 100% 100% / 3px 40% no-repeat;
  animation: ost-eq 0.85s ease-in-out infinite alternate;
}
@keyframes ost-eq {
  0% { background-size: 3px 60%, 3px 100%, 3px 40%; }
  50% { background-size: 3px 100%, 3px 45%, 3px 85%; }
  100% { background-size: 3px 35%, 3px 80%, 3px 100%; }
}
.ost-play.on.paused .ost-n::before {
  width: 0;
  height: 0;
  margin-left: 3px;
  background: none;
  border: 6px solid transparent;
  border-left: 10px solid currentColor;
  border-right: 0;
  animation: none;
}

/* ---------- the deck ---------- */
.pl { --pl-p: 0%; color: var(--pl-fg); font-family: var(--font-ui); }
.pl-in { max-width: 860px; margin: 0 auto; }
.pl-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px; }
.pl-cover { width: 40px; height: 58px; object-fit: cover; border-radius: 4px; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.7); }
.pl-cover[hidden] { display: none; }
.pl-meta { min-width: 0; }
.pl-title { font-family: var(--font-display); font-size: 1.24rem; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-sub { display: flex; gap: 7px; margin-top: 3px; font-size: 12px; color: var(--pl-muted); white-space: nowrap; overflow: hidden; }
.pl-album { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pl-album:empty { display: none; }
.pl-album:not(:empty)::after { content: '·'; margin-left: 7px; }
.pl.failed .pl-album { white-space: normal; color: var(--pl-fg); }
.pl.failed .pl-album::after, .pl.failed .pl-time { display: none; }
.pl-time { flex: none; font-variant-numeric: tabular-nums; }
.pl-btns { display: flex; align-items: center; gap: 2px; }
.pl-b {
  flex: none;
  width: 40px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--pl-fg);
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pl-b svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pl-b .i-line { fill: none; }
.pl-b:hover { color: var(--pl-accent); }
.pl-play { width: 46px; height: 46px; background: var(--pl-accent); color: var(--pl-ink); }
.pl-play:hover { color: var(--pl-ink); filter: brightness(1.08); }
.pl-play .i-pause { display: none; stroke-width: 3.2; }
.pl.playing .pl-play .i-play { display: none; }
.pl.playing .pl-play .i-pause { display: block; }
.pl.loading .pl-play { animation: pl-wait 0.9s ease-in-out infinite alternate; }
@keyframes pl-wait { to { opacity: 0.5; } }
.pl-close { width: 34px; color: var(--pl-muted); }
.pl-close svg { width: 18px; height: 18px; }
.pl.single .pl-prev, .pl.single .pl-next { display: none; }

/* the bar to wind the song */
.pl-seek {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 24px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.pl-seek:disabled { cursor: default; }
.pl-seek::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--pl-accent) var(--pl-p), var(--pl-line) var(--pl-p)); }
.pl-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5.5px; border: 0; border-radius: 50%; background: var(--pl-accent); }
.pl-seek:disabled::-webkit-slider-thumb { opacity: 0; }
.pl-seek::-moz-range-track { height: 3px; border-radius: 3px; background: var(--pl-line); }
.pl-seek::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--pl-accent); }
.pl-seek::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--pl-accent); }
.pl-seek:focus-visible { outline: none; }
.pl-seek:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--pl-fg); }
.pl-seek:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--pl-fg); }

/* fixed to the bottom of a site page: appears with the first song */
.pl-fixed {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 45;
  padding: 0 max(12px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: var(--pl-bg);
  border-top: 1px solid var(--pl-line);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  transform: translateY(115%);
  visibility: hidden;
  transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.21, 1), visibility 0s 0.45s;
}
.pl-fixed.on { transform: none; visibility: visible; transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.21, 1); }
.pl-fixed .pl-seek { margin: -12px 0 -5px; } /* the line sits right on the upper edge of the bar */
body.has-player { padding-bottom: 84px; }

/* always on the page (the reader's sheet): cover and title, the bar, the buttons */
.pl-inline { margin: 16px 0 6px; padding: 14px 14px 10px; border: 1px solid var(--pl-line); border-radius: 18px; }
.pl-inline .pl-in { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: center; }
.pl-inline .pl-row { display: contents; }
.pl-inline .pl-cover { grid-area: 1 / 1; width: 46px; height: 68px; }
.pl-inline .pl-meta { grid-area: 1 / 2; }
.pl-inline .pl-seek { grid-area: 2 / 1 / 3 / 3; margin: 8px 0 0; }
.pl-inline .pl-btns { grid-area: 3 / 1 / 4 / 3; justify-content: center; gap: 18px; }
.pl-inline .pl-play { width: 54px; height: 54px; }

@media (max-width: 599px) {
  .pl-fixed .pl-album { display: none; }
  .pl-fixed.failed .pl-album { display: block; }
  .pl-fixed .pl-row { gap: 8px; }
  .pl-fixed .pl-title { font-size: 1.1rem; }
  .pl-fixed .pl-b { width: 36px; }
  .pl-fixed .pl-play { width: 44px; height: 44px; }
  .pl-fixed .pl-close { width: 30px; }
}
@media (max-width: 359px) {
  .pl-fixed .pl-cover { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ost-play.on .ost-n::before, .pl.loading .pl-play { animation: none; }
  .pl-fixed, .pl-fixed.on { transition: none; }
}
