/* =====================================================================
   SPVOX — Unified Demo Player
   Shared styles for the home page player and all landing page players.
   Loads after site-chrome.css (uses its design tokens).
   ===================================================================== */

/* ---- Card ---- */
/* Animated gradient border */
@property --gangle {
  syntax: '<angle>';
  initial-value: 135deg;
  inherits: false;
}
@keyframes spinGrad {
  from { --gangle: 135deg; }
  to   { --gangle: 495deg; }
}

.spvox-player {
  --accent: var(--pink);
  --gangle: 135deg;
  border: 4px solid transparent;
  background:
    linear-gradient(var(--white), var(--white)) padding-box,
    linear-gradient(var(--gangle), var(--pink), var(--zapote), var(--green), var(--pink)) border-box;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--s-5);
  overflow-x: hidden;
  animation: spinGrad 18s linear infinite;
  transition: transform .25s ease, box-shadow .25s ease;
}
.spvox-player:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(0,0,0,.13);
}
.spvox-player.is-sticky {
  position: sticky;
  top: calc(var(--header-h, 64px) + 18px);
}

/* ---- Performer tabs (folder style) ---- */
.sp-tabs {
  display: flex;
  gap: 2px;
  align-items: stretch;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
}
.sp-tab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  padding: 11px 13px 12px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: var(--ink-40);
  cursor: pointer;
  text-align: left;
  transition: background .18s, color .18s;
}
.sp-tab + .sp-tab::before {
  content: "";
  position: absolute;
  left: 0; top: 22%; bottom: 22%;
  width: 1px;
  background: var(--line);
  transition: opacity .3s;
}
.sp-tab:not(.active):hover { background: var(--canvas); color: var(--charcoal); }
.sp-tab.active {
  background: var(--white);
  color: var(--charcoal);
  border-color: var(--line);
  z-index: 1;
}
.sp-tab.active::before,
.sp-tab.active + .sp-tab::before { opacity: 0; }
.sp-tab.active::after {
  content: "";
  position: absolute;
  left: 13px; right: 13px; top: 0;
  height: 2.5px;
  border-radius: 0 0 3px 3px;
  background: var(--accent-grad, linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 45%, var(--zapote))));
}
.sp-tab-ava {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex: none;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--accent-grad, linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--zapote))));
  color: #fff;
  filter: saturate(.55) opacity(.75);
  transition: filter .2s, box-shadow .2s;
  box-shadow: 0 0 0 1.5px var(--line);
}
.sp-tab.active .sp-tab-ava {
  filter: none;
  box-shadow: 0 0 0 1.5px var(--white), 0 0 0 3px color-mix(in srgb, var(--accent) 38%, transparent);
}
.sp-tab-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-tab-ava .ini { font-family: var(--font-display); font-weight: 700; font-size: 13px; }
.sp-tab-info { min-width: 0; line-height: 1.2; }
.sp-tab-info b {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-tab-info small {
  display: block;
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-40);
}

/* ---- Category pill tabs ---- */
.sp-cats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: var(--s-4) 0 var(--s-3);
}
.sp-cat {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12.5px;
  padding: 5px 14px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--ink-60);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s;
}
.sp-cat:hover { border-color: var(--accent); color: var(--charcoal); }
.sp-cat.active { background: var(--accent-grad, var(--accent)); border-color: var(--accent); color: #fff; }

/* ---- Now playing header ---- */
.sp-np {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: var(--s-4) 0 var(--s-3);
  border-top: 1px solid var(--line);
}
.sp-np-left { min-width: 0; flex: 1; }
.sp-np-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--charcoal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.sp-np-sub {
  display: block;
  font-size: 12.5px;
  color: var(--ink-40);
  margin-top: 3px;
}
.sp-np-dl {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--ink-40);
  border: 1px solid var(--line);
  transition: color .18s, border-color .18s;
  visibility: hidden;
}
.sp-np-dl.has-file { visibility: visible; }
.sp-np-dl:hover { color: var(--green); border-color: var(--green); }
.sp-np-dl svg { width: 16px; height: 16px; }

/* ---- Waveform ---- */
.sp-wave {
  position: relative;
  height: 56px;
  cursor: pointer;
  user-select: none;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: var(--s-2);
}
.sp-wave-bg,
.sp-wave-fg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 1px;
  pointer-events: none;
}
.sp-wave-fg { clip-path: inset(0 100% 0 0); }
.sp-bar {
  flex: 1;
  min-width: 0;
  border-radius: 2px;
  transition: height .18s ease;
}
.sp-wave-bg .sp-bar { background: var(--line); }
.sp-wave-fg .sp-bar { background: var(--accent-bar-grad, var(--accent)); }
.sp-wave-cur {
  position: absolute;
  top: 4px; bottom: 4px;
  width: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: translateX(-50%);
  left: 0%;
  pointer-events: none;
  box-shadow: 0 0 4px color-mix(in srgb, var(--accent) 50%, transparent);
}

/* ---- Time row ---- */
.sp-time {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--ink-40);
  margin-bottom: var(--s-3);
}
.sp-t-cur { color: var(--accent); font-weight: 600; }

/* ---- Waveform markers ---- */
.sp-wave-marker {
  position: absolute;
  top: 5px;
  bottom: 5px;
  width: 2px;
  background: rgba(255, 255, 255, 0.82);
  border-radius: 1px;
  pointer-events: none;
  transform: translateX(-50%);
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.22);
}

/* ---- Chapter cuts ---- */
.sp-cuts {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: var(--s-3);
  scrollbar-width: none;
}
.sp-cuts::-webkit-scrollbar { display: none; }
.sp-cut {
  flex: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--ink-60);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s;
}
.sp-cut.active {
  background: color-mix(in srgb, var(--accent) 10%, var(--white));
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- Transport ---- */
.sp-transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: var(--s-2) 0 var(--s-4);
}
.sp-prev, .sp-next {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--ink-60);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.sp-prev:hover, .sp-next:hover { border-color: var(--accent); color: var(--accent); }
.sp-prev svg, .sp-next svg { width: 15px; height: 15px; }
.sp-play {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent-grad, var(--accent));
  color: #fff;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
  transition: transform .15s, background .15s, box-shadow .15s;
}
.sp-play:hover { transform: scale(1.07); background: var(--accent-grad-hover, color-mix(in srgb, var(--accent), #000 14%)); }
.sp-play:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; transform: none; }
.sp-play svg { width: 22px; height: 22px; }

/* ---- Track list ---- */
.sp-tracks {
  border-top: 1px solid var(--line);
}
.sp-track {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.sp-track:last-child { border-bottom: none; }
.sp-tr-ico {
  width: 30px; height: 30px;
  border-radius: 8px;
  flex: none;
  background: color-mix(in srgb, var(--accent) 10%, var(--white));
  color: var(--accent);
  display: grid;
  place-items: center;
  transition: background .15s, color .15s;
}
.sp-track.active .sp-tr-ico { background: var(--accent-grad, var(--accent)); color: #fff; }
.sp-tr-ico svg { width: 14px; height: 14px; }
.sp-tr-info { min-width: 0; flex: 1; }
.sp-tr-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--charcoal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .15s;
}
.sp-track.active .sp-tr-title { color: var(--accent); }
.sp-tr-var {
  display: block;
  font-size: 12px;
  color: var(--ink-40);
  margin-top: 1px;
}
.sp-tr-len {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--ink-40);
  flex: none;
}
.sp-tr-fav {
  width: 30px; height: 30px;
  border-radius: 7px;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--ink-40);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.sp-tr-fav:hover { color: #D6455B; background: rgba(214,69,91,.09); }
.sp-tr-fav[aria-pressed="true"] { color: #D6455B; }
.sp-tr-fav[aria-pressed="true"] svg { fill: #D6455B; }
.sp-tr-fav svg { width: 16px; height: 16px; fill: none; transition: fill .15s; }
.sp-tr-dl {
  width: 28px; height: 28px;
  border-radius: 7px;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--ink-40);
  transition: color .15s, background .15s;
}
.sp-tr-dl:hover { color: var(--green); background: rgba(21,178,124,.08); }
.sp-tr-dl svg { width: 14px; height: 14px; }

/* ---- Empty state ---- */
.sp-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--ink-40);
  font-size: 13.5px;
  border: 1.5px dashed var(--line);
  border-radius: var(--r-md);
  margin: var(--s-4) 0;
}

/* ---- Footer toolbar ---- */
.sp-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: var(--s-4);
  margin-top: var(--s-4);
  border-top: 1px solid var(--line);
}
.sp-autoplay-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink-60);
  background: none;
  border: none;
  padding: 4px 0;
  cursor: pointer;
  transition: color .2s;
}
.sp-autoplay-btn[aria-checked="true"] { color: var(--charcoal); }
.sp-auto-sw {
  flex: none;
  width: 36px; height: 20px;
  border-radius: 99px;
  background: var(--line);
  position: relative;
  transition: background .22s;
}
.sp-auto-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.28);
  transition: left .22s;
}
.sp-autoplay-btn[aria-checked="true"] .sp-auto-sw { background: var(--accent-grad, var(--accent)); }
.sp-autoplay-btn[aria-checked="true"] .sp-auto-knob { left: 18px; }
/* ---- Download all ---- */
.sp-dl-wrap {
  margin-left: auto;
  position: relative;
}
.sp-dl-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink-60);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--r-pill);
  padding: 5px 12px;
  cursor: pointer;
  transition: color .16s, border-color .16s;
}
.sp-dl-all-btn:hover { border-color: var(--green); color: var(--green); }
.sp-dl-all-btn svg { width: 14px; height: 14px; }
.sp-dl-caret { font-size: 10px; color: var(--ink-40); line-height: 1; }
.sp-dl-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,.13);
  padding: 5px;
  min-width: 200px;
  z-index: 40;
}
.sp-dl-wrap.open .sp-dl-menu { display: block; }
.sp-dl-item {
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--charcoal);
  padding: 9px 13px;
  border-radius: 8px;
  background: none;
  border: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sp-dl-item:hover { background: var(--canvas); color: var(--green); }

.sp-favfilter-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink-60);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--r-pill);
  padding: 5px 12px;
  cursor: pointer;
  transition: color .16s, border-color .16s, background .16s;
}
.sp-favfilter-btn svg { width: 14px; height: 14px; fill: none; transition: fill .15s; }
.sp-favfilter-btn:hover { border-color: color-mix(in srgb, #D6455B 40%, var(--line)); }
.sp-favfilter-btn[aria-pressed="true"] { color: #fff; background: #D6455B; border-color: #D6455B; }
.sp-favfilter-btn[aria-pressed="true"] svg { fill: #fff; }
.sp-fav-ct {
  font-size: 11px;
  background: #D6455B;
  color: #fff;
  border-radius: var(--r-pill);
  padding: 1px 5px;
  display: none;
}
.sp-fav-ct:not(:empty) { display: inline; }
.sp-favfilter-btn[aria-pressed="true"] .sp-fav-ct { background: rgba(255,255,255,.28); }

/* ---- Hint footer ---- */
.sp-hint {
  margin-top: var(--s-4);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
  color: var(--ink-40);
}
.sp-hint a {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 23px;
  color: var(--pink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
  transition: color .2s ease, gap .2s ease;
}
.sp-hint a:hover { color: var(--green); gap: 9px; }

/* ---- Marquee scroll for long titles ---- */
/* margin-left (not transform) so overflow:hidden clips reliably on iOS Safari */
@keyframes sp-marquee {
  0%,  15% { margin-left: 0; }
  85%, 100% { margin-left: var(--sp-scroll-dist, 0px); }
}
.sp-tr-title.sp-scroll,
.sp-np-title.sp-scroll { text-overflow: clip; }
.sp-tr-title.sp-scroll > span,
.sp-np-title.sp-scroll > span {
  display: inline-block;
  white-space: nowrap;
  animation: sp-marquee 5s ease-in-out 0.6s infinite alternate;
}

@media (prefers-reduced-motion: reduce) {
  .spvox-player { animation: none; }
  .sp-tr-title.sp-scroll > span,
  .sp-np-title.sp-scroll > span { animation: none; }
}

/* ---- Responsive ---- */
@media (max-width: 400px) {
  .sp-tab-info small { display: none; }
}
@media (max-width: 520px) {
  /* Prevent footer buttons from overflowing on narrow screens */
  .sp-autoplay-btn > span:last-child { display: none; } /* hide "Autoplay next" label */
  .sp-favfilter-btn > span:not(.sp-fav-ct) { display: none; } /* hide "Favorites" label */
  .sp-dl-all-btn > span:not(.sp-dl-caret) { display: none; } /* hide "Download" label */
  .sp-dl-wrap { margin-left: 0; } /* don't push right; let autoplay take left */
  .sp-dl-menu { right: auto; left: 50%; margin-left: -100px; } /* center over button, stays within player bounds */
}
