/* =========================================================
   Radio Bury now playing
   ========================================================= */

.rb-now-playing {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.14);
}


/* =========================================================
   Current track
   ========================================================= */

.rb-track {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 0.8rem;
    align-items: center;
    min-width: 0;
    padding: 0.7rem 1rem;
}

.rb-track__artwork-link {
    position: relative;
    display: block;
    width: 48px;
    height: 48px;
    overflow: hidden;
    border-radius: 12px;
    background:
        linear-gradient(
            135deg,
            rgba(78, 193, 186, 0.22),
            rgba(96, 191, 125, 0.28)
        );
    color: #fff;
    text-decoration: none;
}

.rb-track__artwork-link:hover,
.rb-track__artwork-link:focus {
    color: #fff;
    text-decoration: none;
}

.rb-track__artwork {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 220ms ease;
}

.rb-track__artwork.is-loaded {
    opacity: 1;
}

.rb-track__fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.82);
    font-size: 1rem;
}

.rb-track__artwork.is-loaded
+ .rb-track__fallback {
    display: none;
}

.rb-track__content {
    min-width: 0;
}

.rb-track__label {
    margin-bottom: 0.12rem;
    color: var(--rb-teal, #4EC1BA);
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.rb-track__lower {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.rb-track__details {
    min-width: 0;
    overflow: hidden;
    flex: 1 1 auto;
    color: #fff;
    font-size: 0.88rem;
    line-height: 1.3;
    white-space: nowrap;
}

.rb-track__details-inner {
    display: inline-block;
    white-space: nowrap;
    will-change: transform;
}

.rb-track__details[hidden],
.rb-track__status[hidden] {
    display: none !important;
}

.rb-track__title {
    font-weight: 800;
}

.rb-track__separator {
    margin: 0 0.25rem;
    color: rgba(255, 255, 255, 0.45);
}

.rb-track__artist {
    color: rgba(255, 255, 255, 0.7);
}

.rb-track__status {
    min-width: 0;
    overflow: hidden;
    flex: 1 1 auto;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.82rem;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* =========================================================
   Recently played control
   ========================================================= */

.rb-recently-played {
    flex: 0 0 auto;
    margin-left: auto;
}

.rb-recently-played[hidden] {
    display: none !important;
}

.rb-recently-played__summary {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0;
    border: 0;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.7rem;
    font-weight: 750;
    line-height: 1.3;
    cursor: pointer;
    list-style: none;
    user-select: none;
    white-space: nowrap;
}

.rb-recently-played__summary::-webkit-details-marker {
    display: none;
}

.rb-recently-played__summary::marker {
    display: none;
    content: "";
}

.rb-recently-played__summary:hover,
.rb-recently-played__summary:focus-visible {
    color: #fff;
}

.rb-recently-played__chevron {
        font-size: 0.82rem;
        color: rgba(255, 255, 255, 0.42);
        line-height: 1;
    }

    .rb-recently-played__summary:hover
    .rb-recently-played__chevron,
    .rb-recently-played__summary:focus-visible
    .rb-recently-played__chevron {
        color: rgba(255, 255, 255, 0.75);
    }

.rb-recently-played[open]
.rb-recently-played__chevron {
    transform: rotate(90deg);
}


/* =========================================================
   Recently played drawer
   ========================================================= */

.rb-recently-played__drawer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.rb-recently-played__drawer[hidden] {
    display: none !important;
}

.rb-recently-played__list {
    padding: 0.45rem 1rem 0.7rem;
}

.rb-recently-played__item {
    display: grid;
    grid-template-columns: 3rem minmax(0, 1fr);
    gap: 0.65rem;
    align-items: baseline;
    padding: 0.38rem 0;
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.78rem;
    line-height: 1.35;
    text-decoration: none;
}

.rb-recently-played__item
+ .rb-recently-played__item {
    border-top:
        1px solid
        rgba(255, 255, 255, 0.06);
}

a.rb-recently-played__item:hover,
a.rb-recently-played__item:focus-visible {
    color: #fff;
    text-decoration: none;
}

.rb-recently-played__time {
    color: var(--rb-teal, #4EC1BA);
    font-size: 0.7rem;
    font-weight: 800;
}

.rb-recently-played__track {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rb-recently-played__title {
    color: #fff;
    font-weight: 750;
}

.rb-recently-played__artist {
    color: rgba(255, 255, 255, 0.58);
}


/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 575.98px) {

    .rb-track {
        grid-template-columns:
            46px
            minmax(0, 1fr);

        padding:
            0.65rem
            0.8rem;
    }

    .rb-track__artwork-link {
        width: 42px;
        height: 42px;
    }

    .rb-track__lower {
        gap: 0.6rem;
    }

    /*
     * Only animate when JS has confirmed that the
     * title / artist is wider than the available space.
     */
    .rb-track__details.is-overflowing
    .rb-track__details-inner {
        animation:
            rb-track-scroll
            var(--rb-track-scroll-duration, 9s)
            ease-in-out
            infinite;
    }

    .rb-recently-played__summary {
        font-size: 0.66rem;
    }

    .rb-recently-played__summary-text {
        display: none;
    }

    .rb-recently-played__chevron {
        font-size: 1.15rem;
    }

    .rb-recently-played__list {
        padding:
            0.45rem
            0.8rem
            0.65rem;
    }

    .rb-recently-played__item {
        grid-template-columns:
            2.8rem
            minmax(0, 1fr);
    }
}


/* =========================================================
   Track scrolling animation
   ========================================================= */

@keyframes rb-track-scroll {

    /* Pause at the beginning */
    0%,
    15% {
        transform: translateX(0);
    }

    /* Scroll across */
    60% {
        transform:
            translateX(
                var(--rb-track-scroll-distance, 0)
            );
    }

    /* Hold at the end */
    99.99% {
        transform:
            translateX(
                var(--rb-track-scroll-distance, 0)
            );
    }

    /* Instant jump back to the start */
    100% {
        transform: translateX(0);
    }
}


/* =========================================================
   Reduced motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .rb-track__artwork,
    .rb-recently-played__chevron {
        transition: none;
    }

    .rb-track__details-inner {
        animation: none !important;
        transform: none !important;
    }
}
