/* Shimmer that invites a click: once on Upload (shine-once), every 30 s on the settings cog and on the Text switch
   in the difference view (shine-infinite). The element clips the moving highlight.
   The highlight is white, which only shows on dark or coloured surfaces; on the white light theme it is the primary
   colour instead (MainLayout puts .theme-light on the layout).
   It moves with transform, not left, so the browser animates it without layout or repaint of the page. */
:root {
    --shine-edge: rgba(255, 255, 255, 0.1);
    --shine-peak: rgba(255, 255, 255, 0.4);
}

.theme-light {
    --shine-edge: rgba(var(--mud-palette-primary-rgb), 0.05);
    --shine-peak: rgba(var(--mud-palette-primary-rgb), 0.3);
}

.shine-infinite,
.shine-once {
    position: relative;
    overflow: hidden;
}

.shine-infinite::before,
.shine-once::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(
        120deg,
        var(--shine-edge) 0%,
        var(--shine-peak) 50%,
        var(--shine-edge) 100%
    );
    pointer-events: none;
}

/* Translations are in the highlight's own width: from -75% to 100% (shine) or 125% (shine-once) of the element. */
.shine-infinite::before {
    width: 50%;
    transform: translateX(-150%) skewX(-20deg);
    animation: shine 30s infinite;
}

.shine-once::before {
    width: 40%;
    transform: translateX(-187.5%) skewX(-20deg);
    animation: shine-once 2s ease-in-out 3s 3 forwards;
}

@keyframes shine {
    0% {
        transform: translateX(-150%) skewX(-20deg);
    }
    8%, 100% {
        transform: translateX(200%) skewX(-20deg);
    }
}

@keyframes shine-once {
    0% {
        transform: translateX(-187.5%) skewX(-20deg);
        opacity: 0;
        visibility: visible;
    }
    10%, 95% {
        opacity: 1;
    }
    100% {
        transform: translateX(312.5%) skewX(-20deg);
        opacity: 0;
        visibility: hidden;
    }
}

@media (prefers-reduced-motion: reduce) {
    .shine-infinite::before,
    .shine-once::before {
        animation: none;
        display: none;
    }
}
