/* Afostodata Audio Player — shortcode-embedded brand-styled player.
 * Scoped to .afd-ap so it never collides with the host theme. */

.afd-ap {
    --afd-ap-bg-from: #0c1d2e;
    --afd-ap-bg-to:   #08131f;
    --afd-ap-ink:     #fffcf3;
    --afd-ap-mute:    rgba(255, 252, 243, 0.6);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--afd-ap-ink);
    margin: 24px 0;
    box-sizing: border-box;
}
.afd-ap *, .afd-ap *::before, .afd-ap *::after { box-sizing: border-box; }

.afd-ap--sticky {
    position: fixed;
    left: 16px; right: 16px; bottom: 16px;
    z-index: 9999;
    margin: 0;
}

.afd-ap__bar {
    display: grid;
    /* single track: play | meta(auto, capped) | progress(grows) | speed */
    grid-template-columns: auto minmax(0, 200px) minmax(180px, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--afd-ap-bg-from) 0%, var(--afd-ap-bg-to) 100%);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 30px 60px -25px rgba(0,0,0,0.45);
    position: relative;
    overflow: visible;
}
/* playlist: prev | play | next | meta | progress | speed | queue */
.afd-ap--playlist .afd-ap__bar { grid-template-columns: auto auto auto minmax(0, 200px) minmax(180px, 1fr) auto auto; }

/* Audio element lives off-screen so it never claims a grid slot. */
.afd-ap__audio { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.afd-ap__btn {
    appearance: none;
    border: 0;
    background: rgba(255, 255, 255, 0.10);
    color: var(--afd-ap-ink);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}
.afd-ap__btn:hover { background: rgba(255, 255, 255, 0.20); }
.afd-ap__btn svg { width: 20px; height: 20px; }
.afd-ap__btn--play {
    background: var(--afd-ap-color, #bc1823);
    color: #ffffff;
    width: 48px;
    height: 48px;
    box-shadow: 0 10px 25px -8px color-mix(in srgb, var(--afd-ap-color, #bc1823) 80%, transparent);
}
.afd-ap__btn--play:hover { background: color-mix(in srgb, var(--afd-ap-color, #bc1823) 85%, #fff); transform: scale(1.04); }
.afd-ap__btn--play svg { width: 22px; height: 22px; }

.afd-ap__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    margin-left: 4px;
}
.afd-ap__sub {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--afd-ap-mute);
}
.afd-ap__title {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--afd-ap-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.afd-ap__progress {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.afd-ap__time {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--afd-ap-mute);
    font-variant-numeric: tabular-nums;
    min-width: 36px;
    text-align: center;
}
.afd-ap__scrub {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.12);
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    min-width: 80px;
}
.afd-ap__scrub-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    background: var(--afd-ap-color, #bc1823);
    border-radius: 999px;
    transition: width 0.1s linear;
}
.afd-ap__scrub-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    transition: left 0.1s linear, transform 0.15s ease;
    opacity: 0;
    pointer-events: none;
}
.afd-ap__scrub:hover .afd-ap__scrub-thumb,
.afd-ap__scrub:focus-visible .afd-ap__scrub-thumb { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
.afd-ap__scrub:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(255, 210, 48, 0.6); }

/* Speed */
.afd-ap__speed { position: relative; }
.afd-ap__btn--speed {
    width: auto;
    min-width: 50px;
    padding: 0 12px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.82rem;
    background: rgba(255,255,255,0.10);
}
.afd-ap__btn--speed:hover { background: rgba(255,255,255,0.20); }
.afd-ap__btn--speed[aria-expanded="true"] {
    background: #fff;
    color: #0c1d2e;
    box-shadow: 0 0 0 2px #ffd230 inset;
}
.afd-ap__speed-label { line-height: 1; }
.afd-ap__speed-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #fffcf3;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 24px 50px -20px rgba(0,0,0,0.45);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 110px;
    z-index: 20;
}
.afd-ap__speed-menu[hidden] { display: none; }
.afd-ap__speed-menu button {
    appearance: none;
    background: transparent;
    border: 0;
    color: #0f1419;
    text-align: center;
    padding: 9px 14px;
    border-radius: 9px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.afd-ap__speed-menu button:hover { background: #fff8e0; color: var(--afd-ap-color, #bc1823); }
.afd-ap__speed-menu button.is-active { background: var(--afd-ap-color, #bc1823); color: #fff; }

/* Queue button + dropdown */
.afd-ap__btn--queue[aria-expanded="true"] {
    background: #fff;
    color: var(--afd-ap-color, #bc1823);
}
.afd-ap__queue {
    margin-top: -8px;
    background: linear-gradient(180deg, var(--afd-ap-bg-from) 0%, var(--afd-ap-bg-to) 100%);
    border-radius: 0 0 16px 16px;
    padding: 12px 16px 16px;
    box-shadow: 0 30px 60px -25px rgba(0,0,0,0.45);
    max-height: 320px;
    overflow-y: auto;
}
.afd-ap__queue[hidden] { display: none; }
.afd-ap__queue-list {
    list-style: none;
    margin: 0; padding: 0;
    display: flex; flex-direction: column;
    gap: 2px;
}
.afd-ap__queue-list button {
    width: 100%;
    appearance: none;
    background: transparent;
    border: 0;
    color: var(--afd-ap-ink);
    text-align: left;
    padding: 10px 12px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.afd-ap__queue-list button:hover { background: rgba(255,255,255,0.08); }
.afd-ap__queue-list button.is-active {
    background: rgba(255,255,255,0.08);
    color: var(--afd-ap-color, #bc1823);
    font-weight: 800;
}
.afd-ap__queue-num {
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 800;
    color: rgba(255, 252, 243, 0.45);
    font-size: 0.95rem;
    min-width: 22px;
    flex-shrink: 0;
}
.afd-ap__queue-list button.is-active .afd-ap__queue-num { color: var(--afd-ap-color, #bc1823); }
.afd-ap__queue-title { flex: 1; line-height: 1.3; }

.afd-ap--empty {
    padding: 14px 18px;
    background: #fff3e0;
    border: 1px dashed #ff8210;
    color: #78131b;
    border-radius: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (max-width: 760px) {
    .afd-ap__bar {
        grid-template-columns: auto 1fr auto !important;
        gap: 10px;
        padding: 12px 14px;
    }
    .afd-ap--playlist .afd-ap__bar {
        grid-template-columns: auto auto auto 1fr auto auto !important;
    }
    .afd-ap__meta { min-width: 0; }
    .afd-ap__progress { grid-column: 1 / -1; }
    .afd-ap__btn--speed { font-size: 0.78rem; min-width: 44px; padding: 0 10px; }
}
