.rw-home-cyber-glitch {
    --rw-home-glitch-duration: 240ms;
    --rw-home-glitch-scan-top: 50%;
    position: fixed;
    inset: -8vh -8vw;
    z-index: 2147483000;
    overflow: hidden;
    pointer-events: none;
    user-select: none;
    visibility: hidden;
    opacity: 0;
    isolation: isolate;
    contain: strict;
}

html.rw-home-glitching--ltr,
html.rw-home-glitching--rtl {
    overflow-x: hidden;
}

html.rw-home-glitching--ltr body > *:not(.rw-home-cyber-glitch):not(.redaiass-assistant):not(script):not(style):not(link),
html.rw-home-glitching--rtl body > *:not(.rw-home-cyber-glitch):not(.redaiass-assistant):not(script):not(style):not(link) {
    transform-origin: 50% 50%;
    will-change: transform;
}

html.rw-home-glitching--ltr body > *:not(.rw-home-cyber-glitch):not(.redaiass-assistant):not(script):not(style):not(link) {
    animation: rw-home-page-shift-ltr var(--rw-home-glitch-duration) steps(2, end) both;
}

html.rw-home-glitching--rtl body > *:not(.rw-home-cyber-glitch):not(.redaiass-assistant):not(script):not(style):not(link) {
    animation: rw-home-page-shift-rtl var(--rw-home-glitch-duration) steps(2, end) both;
}

.rw-home-cyber-glitch::before,
.rw-home-cyber-glitch::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

html.rw-home-glitching--ltr #redaiass-image,
html.rw-home-glitching--rtl #redaiass-image {
    visibility: hidden !important;
    opacity: 0 !important;
}

.rw-home-cyber-glitch::before {
    inset: 0;
    background-color: rgba(143, 45, 255, 0.34);
    box-shadow:
        inset 0 0 0 3px rgba(143, 45, 255, 0.82),
        inset 0 0 90px rgba(143, 45, 255, 0.6);
    opacity: 0;
    mix-blend-mode: color;
    -webkit-backdrop-filter: grayscale(0.85) contrast(1.7);
    backdrop-filter: grayscale(0.85) contrast(1.7);
}

.rw-home-cyber-glitch::after {
    top: var(--rw-home-glitch-scan-top);
    right: 0;
    left: 0;
    height: 4px;
    background-color: rgba(143, 45, 255, 0.96);
    box-shadow:
        0 -14vh 0 1px rgba(143, 45, 255, 0.76),
        0 18vh 0 2px rgba(143, 45, 255, 0.68),
        0 32vh 0 rgba(143, 45, 255, 0.5);
    opacity: 0;
}

.rw-home-cyber-glitch.is-active {
    visibility: visible;
    animation: rw-home-glitch-frame var(--rw-home-glitch-duration) steps(2, end) both;
}

.rw-home-cyber-glitch.is-active::before {
    animation: rw-home-glitch-wash var(--rw-home-glitch-duration) steps(2, end) both;
}

.rw-home-cyber-glitch.is-active::after {
    animation: rw-home-glitch-scan var(--rw-home-glitch-duration) steps(3, end) both;
}

.rw-home-cyber-glitch__noise {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    opacity: 0.82;
    image-rendering: pixelated;
    mix-blend-mode: screen;
}

.rw-home-cyber-glitch__slice {
    position: absolute;
    z-index: 3;
    top: var(--rw-home-glitch-top, 50%);
    left: var(--rw-home-glitch-left, -4vw);
    width: var(--rw-home-glitch-width, 108vw);
    height: var(--rw-home-glitch-height, 5px);
    background-color: var(--rw-home-glitch-color, rgba(143, 45, 255, 0.58));
    box-shadow: 0 0 24px var(--rw-home-glitch-color, rgba(143, 45, 255, 0.58));
    opacity: 0;
    transform: translate3d(var(--rw-home-glitch-shift, 0), 0, 0);
    will-change: transform, opacity;
}

.rw-home-cyber-glitch.is-active .rw-home-cyber-glitch__slice {
    animation: rw-home-glitch-slice var(--rw-home-glitch-duration) steps(3, end) both;
}

@keyframes rw-home-page-shift-ltr {
    0%, 100% { transform: translate3d(0, 0, 0); }
    12% { transform: translate3d(-18px, 0, 0); }
    27% { transform: translate3d(10px, 0, 0); }
    43% { transform: translate3d(-7px, 0, 0); }
    58% { transform: translate3d(32px, 0, 0); }
    73% { transform: translate3d(13px, 0, 0); }
    86% { transform: translate3d(25px, 0, 0); }
}

@keyframes rw-home-page-shift-rtl {
    0%, 100% { transform: translate3d(0, 0, 0); }
    12% { transform: translate3d(18px, 0, 0); }
    27% { transform: translate3d(-10px, 0, 0); }
    43% { transform: translate3d(7px, 0, 0); }
    58% { transform: translate3d(-32px, 0, 0); }
    73% { transform: translate3d(-13px, 0, 0); }
    86% { transform: translate3d(-25px, 0, 0); }
}

@keyframes rw-home-glitch-frame {
    0% { opacity: 0; background-color: transparent; }
    8% { opacity: 1; background-color: rgba(143, 45, 255, 0.2); }
    20% { opacity: 0.48; background-color: rgba(143, 45, 255, 0.08); }
    34% { opacity: 1; background-color: rgba(143, 45, 255, 0.28); }
    50% { opacity: 0.56; background-color: rgba(143, 45, 255, 0.12); }
    66% { opacity: 1; background-color: rgba(143, 45, 255, 0.24); }
    82% { opacity: 0.46; background-color: rgba(143, 45, 255, 0.1); }
    93% { opacity: 0.88; background-color: rgba(143, 45, 255, 0.2); }
    100% { opacity: 0; background-color: transparent; }
}

@keyframes rw-home-glitch-wash {
    0%, 100% { opacity: 0; }
    10% { opacity: 0.86; }
    24% { opacity: 0.32; }
    40% { opacity: 0.92; }
    56% { opacity: 0.38; }
    72% { opacity: 0.82; }
    88% { opacity: 0.3; }
}

@keyframes rw-home-glitch-scan {
    0%, 100% { opacity: 0; transform: translate3d(-5vw, -8px, 0); }
    14% { opacity: 0.9; transform: translate3d(6vw, 2px, 0); }
    35% { opacity: 0.22; transform: translate3d(-3vw, 14px, 0); }
    58% { opacity: 0.78; transform: translate3d(5vw, -4px, 0); }
    80% { opacity: 0.3; transform: translate3d(-6vw, 10px, 0); }
}

@keyframes rw-home-glitch-slice {
    0%, 100% { opacity: 0; transform: translate3d(var(--rw-home-glitch-shift), 0, 0); }
    10% { opacity: var(--rw-home-glitch-opacity, 0.65); transform: translate3d(var(--rw-home-glitch-shift-reverse), 0, 0); }
    28% { opacity: 0.18; transform: translate3d(var(--rw-home-glitch-shift-soft), 1px, 0); }
    44% { opacity: var(--rw-home-glitch-opacity, 0.65); transform: translate3d(var(--rw-home-glitch-shift-wide), -1px, 0); }
    62% { opacity: 0.24; transform: translate3d(var(--rw-home-glitch-shift-soft-reverse), 0, 0); }
    82% { opacity: var(--rw-home-glitch-opacity-soft, 0.46); transform: translate3d(var(--rw-home-glitch-shift-close), 1px, 0); }
}

@media (prefers-reduced-motion: reduce) {
    html.rw-home-glitching--ltr body > *:not(.rw-home-cyber-glitch):not(.redaiass-assistant):not(script):not(style):not(link) {
        animation: rw-home-page-shift-reduced-ltr var(--rw-home-glitch-duration) linear both;
    }

    html.rw-home-glitching--rtl body > *:not(.rw-home-cyber-glitch):not(.redaiass-assistant):not(script):not(style):not(link) {
        animation: rw-home-page-shift-reduced-rtl var(--rw-home-glitch-duration) linear both;
    }

    .rw-home-cyber-glitch.is-active,
    .rw-home-cyber-glitch.is-active::before {
        animation-timing-function: linear;
    }
}

@keyframes rw-home-page-shift-reduced-ltr {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(6px, 0, 0); }
}

@keyframes rw-home-page-shift-reduced-rtl {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(-6px, 0, 0); }
}
