/* Decorative motion stops when the handoff completes. */
@keyframes ring-clockwise {
    to {
        transform: rotate(360deg);
    }
}

@keyframes ring-counterclockwise {
    to {
        transform: rotate(-360deg);
    }
}

@keyframes aura-breathe {
    0%, 100% {
        opacity: .5;
        transform: scale(.96);
    }
    50% {
        opacity: 1;
        transform: scale(1.04);
    }
}

@keyframes signal-pulse {
    0%, 100% {
        opacity: .4;
    }
    50% {
        opacity: 1;
    }
}

@keyframes bar-pulse {
    0%, 100% {
        transform: scaleY(.45);
    }
    50% {
        transform: scaleY(1);
    }
}

@keyframes cursor-blink {
    0%, 44% {
        opacity: 1;
    }
    45%, 100% {
        opacity: 0;
    }
}

@keyframes scan-track {
    0% {
        transform: translateY(-40px);
        opacity: 0;
    }
    15%, 80% {
        opacity: .8;
    }
    100% {
        transform: translateY(300px);
        opacity: 0;
    }
}

@keyframes progress-sweep {
    to {
        transform: translateX(160%);
    }
}

@keyframes entry-reveal {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes title-glitch {
    0%, 80%, 100% {
        clip-path: inset(0);
        transform: translateX(0);
        opacity: 0;
    }
    81% {
        clip-path: inset(12% 0 68%);
        transform: translateX(-4px);
        opacity: .8;
    }
    83% {
        clip-path: inset(64% 0 12%);
        transform: translateX(5px);
        opacity: .6;
    }
    85% {
        clip-path: inset(37% 0 42%);
        transform: translateX(-3px);
        opacity: .9;
    }
    87% {
        clip-path: inset(0);
        opacity: 0;
    }
}

.ring-outer {
    animation: ring-clockwise 28s linear infinite;
}

.ring-inner {
    animation: ring-counterclockwise 19s linear infinite;
}

.lock-aura {
    animation: aura-breathe 3.8s ease-in-out infinite;
}

.connection-status i, .console-dots i {
    animation: signal-pulse 2.4s ease-in-out infinite;
}

.console-dots i:nth-child(2) {
    animation-delay: .35s;
}

.console-dots i:nth-child(3) {
    animation-delay: .7s;
}

.signal-blocks i {
    animation: signal-pulse 2.6s ease-in-out infinite;
}

.signal-blocks i:nth-child(2) {
    animation-delay: .3s;
}

.signal-blocks i:nth-child(3) {
    animation-delay: .6s;
}

.signal-blocks i:nth-child(4) {
    animation-delay: .9s;
}

.telemetry-bars i {
    transform-origin: bottom;
    animation: bar-pulse 1.7s ease-in-out infinite;
}

.telemetry-bars i:nth-child(2) {
    animation-delay: .3s;
}

.telemetry-bars i:nth-child(3) {
    animation-delay: .7s;
}

.telemetry-bars i:nth-child(4) {
    animation-delay: .15s;
}

.frame-track::before, .frame-track::after {
    animation: scan-track 4s ease-in-out infinite;
}

.frame-track::after {
    animation-delay: 1.8s;
}

.hero-title {
    animation: entry-reveal .7s .1s both;
}

.access-strip {
    animation: entry-reveal .6s .2s both;
}

.console {
    animation: entry-reveal .6s .3s both;
}

.status-grid {
    animation: entry-reveal .6s .4s both;
}

.glitch-title::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    color: #d1ffdc;
    text-shadow: -2px 0 #00ff80;
    opacity: 0;
    pointer-events: none;
    animation: title-glitch 3.6s .1s linear 2;
}

.console-lines li {
    transition: opacity .35s ease, transform .35s ease;
}

.console-lines li.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.console-lines li.is-done .line-check {
    opacity: .7;
}

.console-lines li.is-done .line-tail {
    visibility: hidden;
}

.console-lines li.is-current .terminal-cursor {
    animation: cursor-blink .8s step-end infinite;
}

.progress-shine {
    animation: progress-sweep 2.4s ease-in-out infinite;
}

.status-tile {
    transition: border-color .4s, background-color .4s;
}

.lock-shackle {
    transition: transform .65s cubic-bezier(.2, .8, .2, 1);
}

.lock-keyhole, .lock-check {
    transition: opacity .3s;
}

.lock-body {
    transition: filter .6s;
}

html[data-stage="complete"] .lock-aura {
    background: #52ff6f1c;
    box-shadow: 0 0 80px 25px #4bff6020;
}

html[data-stage="unlocking"] .lock-shackle, html[data-stage="unlocked"] .lock-shackle {
    transform: translateY(-11px) rotate(-28deg);
}

html[data-stage="unlocking"] .lock-keyhole, html[data-stage="unlocked"] .lock-keyhole {
    opacity: 0;
}

html[data-stage="unlocking"] .lock-check, html[data-stage="unlocked"] .lock-check {
    opacity: 1;
    transition-delay: .25s;
}

html[data-stage="unlocking"] .lock-body, html[data-stage="unlocked"] .lock-body {
    filter: drop-shadow(0 0 22px #7bff9599);
}

html[data-stage="unlocked"] .progress-track {
    box-shadow: 0 0 15px #69ff7926, inset 0 0 12px #000;
}

html[data-finished="true"] .portal *, html[data-finished="true"] .portal *::before, html[data-finished="true"] .portal *::after {
    animation-play-state: paused !important;
}

html[data-finished="true"] .glitch-title::after {
    animation: none !important;
    opacity: 0;
}

html[data-resumed="true"] .hero-title,
html[data-resumed="true"] .access-strip,
html[data-resumed="true"] .status-grid {
    animation: none;
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }

    .code-rain {
        display: none;
    }

    .glitch-title::after {
        display: none;
    }

    .hero-title, .access-strip, .console, .status-grid {
        opacity: 1;
        transform: none;
    }

    .terminal-cursor {
        opacity: 1;
    }
}
