/* Site-wide mini player (templates/partials/player.html). Kept small and quiet on purpose. */

.ps-player {
    --pp-yellow: #FBD518;
    --pp-text: #F6F4EA;
    --pp-dim: rgba(246, 244, 234, 0.55);
    position: fixed;
    left: 14px;
    bottom: calc(14px + var(--ps-player-lift, 0px) + env(safe-area-inset-bottom));
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    max-width: calc(100vw - 28px);
    padding: 4px 6px 4px 4px;
    border-radius: 999px;
    background: rgba(14, 14, 14, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--pp-text);
    font: 700 11px/1 'Space Mono', ui-monospace, Menlo, monospace;
    opacity: 0.72;
    transition: opacity .2s ease, max-width .3s ease, height .3s ease;
    -webkit-user-select: none;
    user-select: none;
}
.ps-player:hover,
.ps-player:focus-within,
.ps-player.is-playing,
.ps-player[data-state="expanded"] { opacity: 1; }

.ps-player button {
    appearance: none;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 0;
}
.ps-player svg { width: 14px; height: 14px; fill: currentColor; display: block; }

.psp-play {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--pp-yellow) !important;
    color: #0B0B0B !important;
    display: grid;
    place-items: center;
}
.psp-play .i-pause, .ps-player.is-playing .psp-play .i-play { display: none; }
.ps-player.is-playing .psp-play .i-pause { display: block; }

.psp-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    height: 32px;
    padding: 0 4px !important;
}

.psp-eq { display: flex; align-items: flex-end; gap: 2px; height: 12px; flex: 0 0 auto; }
.psp-eq i { width: 3px; height: 3px; border-radius: 1px; background: var(--pp-yellow); }
.ps-player.is-playing .psp-eq i { animation: psp-eq .9s ease-in-out infinite alternate; }
.ps-player.is-playing .psp-eq i:nth-child(2) { animation-delay: -.3s; animation-duration: .7s; }
.ps-player.is-playing .psp-eq i:nth-child(3) { animation-delay: -.6s; animation-duration: 1.1s; }
@keyframes psp-eq { from { height: 3px; } to { height: 12px; } }

.psp-title {
    display: block;
    max-width: 150px;
    overflow: hidden;
    white-space: nowrap;
    mask-image: linear-gradient(90deg, #000 85%, transparent);
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
}
.psp-title-inner { display: inline-block; padding-right: 24px; }
.ps-player.is-playing .psp-title-inner.scrolls { animation: psp-marquee 12s linear infinite; }
@keyframes psp-marquee { 0%, 15% { transform: translateX(0); } 85%, 100% { transform: translateX(var(--psp-shift, 0)); } }

/* expanded controls */
.psp-more {
    display: none;
    align-items: center;
    gap: 8px;
    padding-left: 2px;
}
.ps-player[data-state="expanded"] .psp-more { display: flex; }
.psp-skip { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: var(--pp-dim) !important; }
.psp-skip:hover { color: var(--pp-text) !important; }
.psp-next { flex: 0 0 auto; color: var(--pp-text) !important; }
.psp-next:hover { color: var(--pp-yellow) !important; }
.psp-time { color: var(--pp-dim); min-width: 32px; }

.ps-player input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--pp-yellow) var(--fill, 0%), rgba(255, 255, 255, 0.18) var(--fill, 0%));
    outline: none;
    cursor: pointer;
}
.psp-seek { width: 120px; }
.psp-vol { width: 56px; }
.ps-player input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 10px; border-radius: 50%; background: var(--pp-text); }
.ps-player input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 0; border-radius: 50%; background: var(--pp-text); }

.psp-min {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    color: var(--pp-dim) !important;
    font-size: 14px !important;
    display: none !important;
}
.ps-player[data-state="expanded"] .psp-min { display: grid !important; place-items: center; }

/* minimised: just the play dot */
.ps-player[data-state="mini"] { padding: 4px; gap: 0; }
.ps-player[data-state="mini"] .psp-info,
.ps-player[data-state="mini"] .psp-next,
.ps-player[data-state="mini"] .psp-more,
.ps-player[data-state="mini"] .psp-min { display: none !important; }
.ps-player[data-state="mini"] .psp-play { box-shadow: 0 0 0 3px rgba(251, 213, 24, 0.25); }

.ps-player.needs-tap .psp-play { animation: psp-nudge 1.6s ease-in-out infinite; }
@keyframes psp-nudge { 50% { box-shadow: 0 0 0 6px rgba(251, 213, 24, 0.25); } }

@media (max-width: 560px) {
    .ps-player { left: 10px; bottom: calc(10px + var(--ps-player-lift, 0px) + env(safe-area-inset-bottom)); }
    .psp-title { max-width: 110px; }
    .psp-seek { width: 70px; }
    .psp-vol { display: none; }       /* phones use the hardware volume buttons */
}

@media print { .ps-player { display: none; } }

@media (prefers-reduced-motion: reduce) {
    .ps-player *, .ps-player { animation: none !important; transition: none !important; }
}
