/* ============================================================
   animations.css — Keyframes и классы анимаций
   Команда InIProject | Code & Games
   ============================================================ */

/* ---------- ГЛИТЧ-ЭФФЕКТ (сдвиг каналов) ---------- */
@keyframes glitch-skew {
    0% {
        transform: skew(0deg);
    }
    20% {
        transform: skew(-2deg);
    }
    40% {
        transform: skew(2deg);
    }
    60% {
        transform: skew(-1deg);
    }
    80% {
        transform: skew(1deg);
    }
    100% {
        transform: skew(0deg);
    }
}

@keyframes glitch-clip-1 {
    0%, 100% {
        clip-path: inset(20% 0 60% 0);
    }
    20% {
        clip-path: inset(60% 0 20% 0);
    }
    40% {
        clip-path: inset(30% 0 50% 0);
    }
    60% {
        clip-path: inset(70% 0 10% 0);
    }
    80% {
        clip-path: inset(10% 0 70% 0);
    }
}

@keyframes glitch-clip-2 {
    0%, 100% {
        clip-path: inset(50% 0 30% 0);
    }
    20% {
        clip-path: inset(10% 0 70% 0);
    }
    40% {
        clip-path: inset(70% 0 10% 0);
    }
    60% {
        clip-path: inset(40% 0 40% 0);
    }
    80% {
        clip-path: inset(20% 0 60% 0);
    }
}

/* Готовый класс для глитч-текста */
.glitch-text {
    position: relative;
    display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-text::before {
    left: 2px;
    text-shadow: -2px 0 var(--accent);
    animation: glitch-clip-1 3s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: 2px 0 #00FFFF;
    animation: glitch-clip-2 2s infinite linear alternate-reverse;
}

/* ---------- ЭФФЕКТ ПЕЧАТИ ТЕКСТА ---------- */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink-caret {
    0%, 100% {
        border-right-color: var(--accent);
    }
    50% {
        border-right-color: transparent;
    }
}

.typing-effect {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--accent);
    animation: 
        typing 3s steps(30, end) forwards,
        blink-caret 0.75s step-end infinite;
    width: 0;
}

/* Модификаторы скорости печати */
.typing-fast {
    animation-duration: 1.5s, 0.5s;
}

.typing-slow {
    animation-duration: 5s, 1s;
}

/* ---------- ПУЛЬСАЦИЯ (неоновое дыхание) ---------- */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--accent-glow),
                    0 0 10px var(--accent-glow),
                    0 0 15px var(--accent-glow);
    }
    50% {
        box-shadow: 0 0 10px var(--accent-glow-strong),
                    0 0 20px var(--accent-glow-strong),
                    0 0 30px var(--accent-glow-strong);
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

.pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* ---------- ПАРЕНИЕ (вверх-вниз) ---------- */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

@keyframes float-subtle {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

.float {
    animation: float 4s ease-in-out infinite;
}

.float-subtle {
    animation: float-subtle 3s ease-in-out infinite;
}

/* ---------- ВРАЩЕНИЕ ---------- */
@keyframes rotate-slow {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes rotate-reverse-slow {
    from {
        transform: rotate(360deg);
    }
    to {
        transform: rotate(0deg);
    }
}

.rotate-slow {
    animation: rotate-slow 20s linear infinite;
}

.rotate-reverse-slow {
    animation: rotate-reverse-slow 25s linear infinite;
}

/* ---------- МЕРЦАНИЕ (как неоновая лампа) ---------- */
@keyframes flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        opacity: 1;
    }
    20%, 24%, 55% {
        opacity: 0.4;
    }
}

.flicker {
    animation: flicker 3s linear infinite;
}

/* ---------- ПОЯВЛЕНИЕ ИЗ-ЗА КРАЯ ---------- */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- МАСШТАБИРОВАНИЕ ---------- */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scalePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.scale-in {
    animation: scaleIn 0.4s ease forwards;
}

.scale-pulse {
    animation: scalePulse 2s ease-in-out infinite;
}

/* ---------- ДРОЖАНИЕ (как от помех) ---------- */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-2px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(2px);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* ---------- ЛИНИЯ СКАНИРОВАНИЯ ---------- */
@keyframes scan-line {
    0% {
        top: -100%;
    }
    100% {
        top: 100%;
    }
}

.scan-line-container {
    position: relative;
    overflow: hidden;
}

.scan-line-container::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow-strong);
    animation: scan-line 3s linear infinite;
    pointer-events: none;
}

/* ---------- ЗАТУХАНИЕ (fade) ---------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

/* ---------- ЗАДЕРЖКИ АНИМАЦИЙ ---------- */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* ---------- ДЛИТЕЛЬНОСТИ ---------- */
.duration-fast { animation-duration: 0.3s; }
.duration-normal { animation-duration: 0.5s; }
.duration-slow { animation-duration: 1s; }
.duration-very-slow { animation-duration: 2s; }

/* ---------- ОТКЛЮЧЕНИЕ АНИМАЦИЙ ДЛЯ ПОЛЬЗОВАТЕЛЕЙ ---------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}