/* ============================================
   АНИМАЦИИ И ПАРАЛЛАКС - animations.css
   ============================================
*/

/* ===== БАЗОВЫЕ АНИМАЦИИ ===== */

/* Плавное появление элементов при скролле */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Классы для анимаций при скролле */
.fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

.fade-in-left {
    animation: fadeInLeft 0.8s ease-out;
}

.fade-in-right {
    animation: fadeInRight 0.8s ease-out;
}

.fade-in {
    animation: fadeIn 0.8s ease-out;
}

/* ===== ПАРАЛЛАКС ЭФФЕКТЫ ===== */

/* Инициальное состояние для элементов с параллаксом */
.parallax-element {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.parallax-element.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Эффект масштабирования при скролле */
.scale-on-scroll {
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.6s ease-out;
}

.scale-on-scroll.visible {
    transform: scale(1);
    opacity: 1;
}

/* ===== ДВИЖУЩИЙСЯ ФОН (частицы) ===== */

.particles-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float linear infinite;
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* ===== ПУЛЬСАЦИЯ ДЛЯ КНОПОК ===== */

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(220, 38, 38, 0);
    }
}

.btn-primary:hover {
    animation: pulse 1.5s infinite;
}

/* ===== ВРАЩЕНИЕ ИКОНОК ПРИ HOVER ===== */

.service-card:hover .service-icon {
    animation: rotate360 0.6s ease-in-out;
}

@keyframes rotate360 {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ===== ЭФФЕКТ СВЕЧЕНИЯ ===== */

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(220, 38, 38, 0.5),
                    0 0 10px rgba(220, 38, 38, 0.3),
                    0 0 15px rgba(220, 38, 38, 0.2);
    }
    50% {
        box-shadow: 0 0 10px rgba(220, 38, 38, 0.8),
                    0 0 20px rgba(220, 38, 38, 0.5),
                    0 0 30px rgba(220, 38, 38, 0.3);
    }
}

.service-card:hover {
    animation: glow 2s ease-in-out infinite;
}

/* ===== ВОЛНОВОЙ ЭФФЕКТ ДЛЯ ТЕКСТА ===== */

.wave-text span {
    display: inline-block;
    animation: wave 1.5s ease-in-out infinite;
}

.wave-text span:nth-child(1) { animation-delay: 0s; }
.wave-text span:nth-child(2) { animation-delay: 0.1s; }
.wave-text span:nth-child(3) { animation-delay: 0.2s; }
.wave-text span:nth-child(4) { animation-delay: 0.3s; }
.wave-text span:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ===== ГРАДИЕНТНАЯ АНИМАЦИЯ ===== */

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.animated-gradient {
    background: linear-gradient(
        270deg,
        var(--color-primary),
        var(--color-primary-dark),
        var(--color-accent)
    );
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
}

/* ===== ПАРАЛЛАКС ДЛЯ КАРТОЧЕК ===== */

.portfolio-card,
.service-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
}

.portfolio-card:hover,
.service-card:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}

/* ===== ЭФФЕКТ ПОЯВЛЕНИЯ СЧЁТЧИКОВ ===== */

.stat-number {
    transition: transform 0.3s ease;
}

.stat-number:hover {
    transform: scale(1.1);
    color: var(--color-primary);
}

/* ===== ЛЕНТОЧНЫЙ ЭФФЕКТ ДЛЯ РАЗДЕЛИТЕЛЕЙ ===== */

@keyframes slideIn {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.section-divider {
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--color-primary) 50%,
        transparent 100%
    );
    margin: 2rem 0;
    animation: slideIn 1.5s ease-out;
}

/* ===== ЭФФЕКТ НАБОРА ТЕКСТА ===== */

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

.typing-effect {
    overflow: hidden;
    border-right: 3px solid var(--color-primary);
    white-space: nowrap;
    animation: 
        typing 3.5s steps(40, end),
        blink 0.75s step-end infinite;
}

/* ===== ПРОГРЕСС БАР СКРОЛЛА ===== */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 4px;
    background: linear-gradient(
        90deg,
        var(--color-primary),
        var(--color-accent)
    );
    z-index: 9999;
    transition: width 0.1s linear;
    box-shadow: 0 2px 10px rgba(220, 38, 38, 0.5);
}

/* ===== ЛОАДЕР (для админки) ===== */

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loader {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

/* ===== ОТКЛЮЧЕНИЕ АНИМАЦИЙ ДЛЯ МЕДЛЕННЫХ УСТРОЙСТВ ===== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== АДАПТИВ ДЛЯ МОБИЛЬНЫХ ===== */

@media (max-width: 768px) {
    .portfolio-card:hover,
    .service-card:hover {
        transform: translateY(-10px) scale(1.01);
    }
    
    .parallax-element {
        transform: translateY(30px);
    }
}

