/* Accent glow, the reaction strip under the waveform (above it on phones) and the
   comment ticker. */

.waveform-area {
    --progress: 0;

    grid-area: waveform;
    position: relative;
}

.waveform__accents {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(100, 1fr);
    pointer-events: none;
}

.waveform__accent {
    align-self: end;
    height: 0;
    background: url("../../images/player/flair2.gif") center / cover;
    mix-blend-mode: soft-light;
    transition: height 1s ease-in;

    &.is-lit {
        height: 120%;
        transition: height 3s ease-out;
    }
}

.reaction-strip {
    position: relative;
    height: 2.75rem;
    background: rgb(0 0 0 / 0.35);
}

.reaction-strip__markers {
    position: absolute;
    inset: 0 0 auto;
    height: 1rem;
}

.comment-marker {
    position: absolute;
    left: calc(var(--position, 0) * 100%);
    width: max(1%, 0.75rem);
    min-width: 0.75rem;
    height: 1rem;
    padding: 0;
    border: 0;
    background: url("../../images/commentico.png") center / 100% 100% no-repeat;
    opacity: 0.6;
    transition: opacity 200ms ease;

    &:hover,
    &:focus-visible {
        opacity: 1;
    }
}

/* Sparkle and comment buttons ride along with the needle. */
.reaction-strip__actions {
    position: absolute;
    top: 1rem;
    left: clamp(0rem, calc(var(--progress) * 100% - 2.5rem), calc(100% - 5rem));
    display: flex;
}

/* The two buttons form one pill: sparkle rounded to the left, comment to the right. */
.reaction-btn {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 1.75rem;
    padding: 0;
    border: 1px solid #000;
    background: #000;
    transition: background-color 250ms ease-out;

    & img {
        width: 1.25rem;
        height: 1.25rem;
    }

    &.reaction-btn--accent {
        border-radius: 999px 0 0 999px;
        border-right-color: rgb(255 255 255 / 0.15);
        background: #000 url("../../images/player/sparkle.jpg") bottom / cover no-repeat;

        &:hover {
            background-image: url("../../images/player/sparkle.gif");
        }

        & img {
            rotate: 45deg;
        }
    }

    &.reaction-btn--comment {
        border-left: 0;
        border-radius: 0 999px 999px 0;

        &:hover {
            background-color: var(--kp-green-500);
        }
    }
}

.ticker {
    display: flex;
    flex-direction: column-reverse; /* the first lane sits at the bottom */
    gap: 2px;
    width: 100%;
    pointer-events: none;
}

.ticker__lane {
    height: 3.25rem;
    overflow: hidden;

    &:empty {
        visibility: hidden;
    }
}

.ticker__comment {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: min(100%, 36rem);
    height: 100%;
    margin-inline: auto;
    padding: 0.25rem 0.5rem;
    background: rgb(0 0 0 / 0.6);
    color: #fff;
    font-family: var(--kp-font-ui);
    font-size: 0.85rem;
    line-height: 1.2;
    animation: ticker-roll 6s linear 1 both;

    & .avatar {
        flex: none;
        width: 2.5rem;
        height: 2.5rem;
    }
}

.ticker__nick {
    flex: none;
    color: var(--kp-orange);
    font-weight: 700;
}

.ticker__body {
    overflow-wrap: anywhere;
}

@keyframes ticker-roll {
    0% { opacity: 0; translate: 0 100%; }
    10%, 85% { opacity: 1; translate: 0 0; }
    100% { opacity: 0; translate: 0 -100%; }
}

.avatar {
    border-radius: 50%;
    object-fit: cover;
}

@media (orientation: portrait), (max-width: 56rem) {
    /* Phones: the strip sits above the waveform, mirrored, so the markers
       still touch the waveform and the buttons sit above them. */
    .waveform-area {
        display: flex;
        flex-direction: column-reverse;
        justify-content: flex-end; /* reversed: packed to the top, under the stage */
    }

    .reaction-strip__markers {
        inset: auto 0 0;
    }

    .reaction-strip__actions {
        top: 0;
    }

    .ticker__lane {
        height: 2.75rem;

        &:empty {
            display: none;
        }
    }
}
