/*
 * Shared Tilda-like diagonal light sweep.
 *
 * Direction: bottom-left -> top-right.
 * The light band is intentionally wider and moves more slowly than v3.
 * Full cycle: 6 s; visible sweep: ~1.6 s.
 */

.es-callback,
.es-footer__callback,
.es-nav__mobile-callback,
.oge-button--red,
a[class*="ege-"][class*="-button--red"],
button[class*="ege-"][class*="-button--red"],
form button[type="submit"],
form button:not([type]) {
    position: relative !important;
    overflow: hidden !important;
}

/* Wide diagonal band moving from the lower-left corner to the upper-right. */
.es-callback::after,
.es-footer__callback::after,
.es-nav__mobile-callback::after,
.oge-button--red::after,
a[class*="ege-"][class*="-button--red"]::after,
button[class*="ege-"][class*="-button--red"]::after,
form button[type="submit"]::after,
form button:not([type])::after {
    content: "";
    position: absolute;
    z-index: 3;

    /* Coordinates are animated via left/top so the path is truly diagonal. */
    left: -70%;
    top: 140%;

    width: 58%;
    height: 240%;

    pointer-events: none;
    opacity: 0;

    background: linear-gradient(
        90deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,.10) 12%,
        rgba(255,255,255,.42) 32%,
        rgba(255,255,255,.82) 50%,
        rgba(255,255,255,.42) 68%,
        rgba(255,255,255,.10) 88%,
        rgba(255,255,255,0) 100%
    );

    transform: translate(-50%, -50%) rotate(-24deg);
    filter: blur(.6px);

    animation: es-button-light-sweep 6s ease-in-out infinite;
}

@keyframes es-button-light-sweep {
    0% {
        left: -70%;
        top: 140%;
        opacity: 0;
    }

    2% {
        opacity: .85;
    }

    28% {
        left: 170%;
        top: -40%;
        opacity: .85;
    }

    31% {
        left: 170%;
        top: -40%;
        opacity: 0;
    }

    100% {
        left: 170%;
        top: -40%;
        opacity: 0;
    }
}

/*
 * <input type="submit"> does not reliably render pseudo-elements,
 * so use a diagonal moving highlight directly on its background.
 */
form input[type="submit"],
form input[type="button"] {
    background-image: linear-gradient(
        125deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,.08) 22%,
        rgba(255,255,255,.42) 40%,
        rgba(255,255,255,.80) 50%,
        rgba(255,255,255,.42) 60%,
        rgba(255,255,255,.08) 78%,
        rgba(255,255,255,0) 100%
    ) !important;

    background-repeat: no-repeat !important;
    background-size: 72% 250% !important;
    background-position: -90% 155% !important;

    animation: es-submit-input-light-sweep 6s ease-in-out infinite !important;
}

@keyframes es-submit-input-light-sweep {
    0% {
        background-position: -90% 155%;
    }

    28% {
        background-position: 190% -55%;
    }

    100% {
        background-position: 190% -55%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .es-callback::after,
    .es-nav__mobile-callback::after,
    .oge-button--red::after,
    a[class*="ege-"][class*="-button--red"]::after,
    button[class*="ege-"][class*="-button--red"]::after,
    form button[type="submit"]::after,
    form button:not([type])::after {
        animation: none !important;
    }

    form input[type="submit"],
    form input[type="button"] {
        animation: none !important;
        background-image: none !important;
    }
}
