/* Stage: now-playing card, transport, Gates of Aqualon plug, dialogs, tooltip. */

.stage {
    justify-items: end;
    align-content: center;
    gap: clamp(1rem, 3vh, 2rem);
}

.now-playing {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-rows: auto 1fr;
    width: min(100%, 40rem);
    min-height: 15rem;
    border-radius: 6px;
    color: var(--kp-text);

    /* The card's backdrop: a vertical dark-grey-to-black gradient whose opacity is
       controlled by a second, horizontal gradient used as a mask. The mask fades
       the left third out to transparent; the card's content sits above it. */
    &::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        border: 1px solid rgb(255 255 255 / 0.3);
        border-radius: inherit;
        background: linear-gradient(to bottom, #2b2b2b, #000);
        mask-image: linear-gradient(to right, transparent, #000 33.333%);
    }
}

.now-playing__header {
    justify-self: end;
    width: 75%;
    padding: 0.2rem 1rem 0.4rem;
    overflow: hidden;
    border-bottom: 2px ridge #b8b8b8;
    border-left: 2px ridge #b8b8b8;
    border-radius: 0 0 0 25px;
    background: rgb(19 145 0 / 0.3);
    text-align: center;
}

.now-playing__title {
    margin: 0;
    overflow: hidden;
    color: var(--kp-mint);
    font-size: 1.5em;
    white-space: nowrap;
}

.now-playing__body {
    display: grid;
    grid-template-columns: 4rem 3.5rem 1fr auto;
    grid-template-areas: "modes volume facts cover";
    gap: 0.75rem;
    align-items: stretch;
    padding: 0.75rem 0.5rem 0.25rem;
}

.now-playing__facts {
    grid-area: facts;
    min-width: 0;
    margin: 0;
    padding-left: 0.75rem;
    border-left: 2px ridge #000;

    & dt {
        color: var(--kp-orange);
        font-family: var(--kp-font-display);
        font-style: italic;
        font-weight: 700;
    }

    & dd {
        margin: 0 0 0.35rem 1rem;
        overflow: hidden;
        color: #a8a8a8;
        white-space: nowrap;
    }

    & .now-playing__minor {
        font-size: 0.75em;
    }
}

.now-playing__side {
    grid-area: cover;
    display: grid;
    align-content: space-between;
    gap: 0.5rem;
}

.now-playing__cover {
    align-self: start;
    width: 5.5rem;
    padding: 0;
    border: 2px ridge #000;
    background: #000;

    & img {
        width: 100%;
        aspect-ratio: 1;
        object-fit: cover;
    }
}

.marquee {
    display: inline-block;

    &.is-scrolling {
        animation: marquee 9s linear infinite alternate;

        &:hover {
            animation-play-state: paused;
        }
    }
}

@keyframes marquee {
    0%, 15% { translate: 0; }
    85%, 100% { translate: var(--marquee-distance, 0); }
}

/* Gates of Aqualon plug: bottom right of the stage, with a title tab like the album cards. */
.goa-plug {
    position: absolute;
    right: var(--kp-gap);
    bottom: var(--kp-gap);
    z-index: 2;
    display: grid;
    width: clamp(11rem, 15vw, 15.6rem);
    color: var(--kp-orange);
    font-family: var(--kp-font-display);
    text-decoration: none;
    box-shadow: 0 0 5px 5px rgb(255 255 255 / 0.25);
    opacity: 0.8;
    transition: box-shadow 250ms ease-out, opacity 250ms ease-out;

    &:hover,
    &:focus-visible {
        box-shadow: 0 0 8px 8px rgb(255 255 255 / 0.55);
        opacity: 1;
    }

    & img {
        width: 100%;
        height: auto;
    }
}

.goa-plug__title {
    padding: 0.25rem 0.5rem;
    border: 1px solid rgb(255 255 255 / 0.18);
    border-bottom: 0;
    background: #121412;
    font-size: 0.75em;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.cover-dialog {
    max-width: min(92vw, 80vh);
    padding: 0;
    border: 2px ridge #000;
    background: #000;

    & img {
        width: 100%;
        height: auto;
    }

    &::backdrop {
        background: rgb(0 0 0 / 0.7);
    }
}

.dialog-close {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
    border: 2px ridge #000;
    color: #fff;
    background: rgb(0 0 0 / 0.75);
}

.tooltip {
    position: fixed;
    top: var(--tooltip-y, 0);
    left: var(--tooltip-x, 0);
    z-index: 80;
    max-width: min(22rem, 90vw);
    padding: 0.5rem 0.75rem;
    border: 2px ridge #000;
    background: url("../../images/player/binding_dark.png");
    color: var(--kp-burlywood);
    font-family: var(--kp-font-ui);
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 -1px 17px 3px rgb(255 255 255 / 0.4);
    pointer-events: none;
}

@media (orientation: portrait), (max-width: 56rem) {
    .stage {
        justify-items: center;
        gap: 0.75rem;
        background: none;
    }

    .now-playing {
        min-height: 0;
    }

    .now-playing__header {
        width: 100%;
        border-radius: 0 0 0 18px;
    }

    .now-playing__title {
        font-size: 1.25em;
    }

    .now-playing__cover {
        width: 4.5rem;
    }

    .now-playing__body {
        grid-template-columns: 3.5rem 1fr auto;
        grid-template-areas:
            "volume facts cover"
            "modes modes modes";
    }

    /* Phones: small, in the top bar opposite the Library button. */
    .goa-plug {
        position: static;
        grid-area: library;
        justify-self: end;
        align-self: center;
        width: 7.5rem;
        margin: var(--kp-gap) var(--kp-gap) 0;
        box-shadow: 0 0 3px 3px rgb(255 255 255 / 0.25);
    }

    .goa-plug__title {
        padding: 0.1rem 0.3rem;
        font-size: 0.6rem;
    }
}
