/* Профессиональные анимации для портфолио */

/* Анимация появления при прокрутке */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.slide-in {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-in.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Анимация для заголовков в шапке */
.site-title {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.site-subtitle {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.15s forwards;
    opacity: 0;
}

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

/* Анимация для кнопок фильтра */
.filter-btn {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

.filter-btn:nth-child(1) { animation-delay: 0.1s; }
.filter-btn:nth-child(2) { animation-delay: 0.15s; }
.filter-btn:nth-child(3) { animation-delay: 0.2s; }
.filter-btn:nth-child(4) { animation-delay: 0.25s; }
.filter-btn:nth-child(5) { animation-delay: 0.3s; }

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Анимация для модального окна */
.modal-overlay {
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active .modal-overlay {
    opacity: 1;
}

.modal-container {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active .modal-container {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Анимация для изображений в галерее */
.modal-image {
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-image.loaded {
    opacity: 1;
}

/* Индикатор загрузки для модального окна */
.modal-image-container {
    position: relative;
}

.modal-image-container::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid var(--accent-light, rgba(59, 130, 246, 0.2));
    border-top-color: var(--accent-color, #3b82f6);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 5;
}

.modal-image-container.loading::before {
    opacity: 1;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Анимация для карточек проектов при загрузке */
.project-card {
    animation: cardAppear 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Задержка анимации для карточек */
.projects-grid .project-card:nth-child(1) { animation-delay: 0.05s; }
.projects-grid .project-card:nth-child(2) { animation-delay: 0.1s; }
.projects-grid .project-card:nth-child(3) { animation-delay: 0.15s; }
.projects-grid .project-card:nth-child(4) { animation-delay: 0.2s; }
.projects-grid .project-card:nth-child(5) { animation-delay: 0.25s; }
.projects-grid .project-card:nth-child(6) { animation-delay: 0.3s; }
.projects-grid .project-card:nth-child(7) { animation-delay: 0.35s; }
.projects-grid .project-card:nth-child(8) { animation-delay: 0.4s; }
.projects-grid .project-card:nth-child(9) { animation-delay: 0.45s; }
.projects-grid .project-card:nth-child(10) { animation-delay: 0.5s; }
.projects-grid .project-card:nth-child(11) { animation-delay: 0.55s; }
.projects-grid .project-card:nth-child(12) { animation-delay: 0.6s; }

/* Анимация для тегов в модальном окне */
.modal-tag {
    animation: tagAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
}

@keyframes tagAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Задержка для тегов */
.tags-container .modal-tag:nth-child(1) { animation-delay: 0.05s; }
.tags-container .modal-tag:nth-child(2) { animation-delay: 0.1s; }
.tags-container .modal-tag:nth-child(3) { animation-delay: 0.15s; }
.tags-container .modal-tag:nth-child(4) { animation-delay: 0.2s; }
.tags-container .modal-tag:nth-child(5) { animation-delay: 0.25s; }
.tags-container .modal-tag:nth-child(6) { animation-delay: 0.3s; }

/* Анимация появления основного контента */
.site-main {
    animation: mainFadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

/* Плавное появление placeholder изображений */
.placeholder-image {
    opacity: 0;
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
}

/* Анимация для социальных ссылок в футере */
.social-links a {
    animation: socialAppear 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

.social-links a:nth-child(1) { animation-delay: 0.1s; }
.social-links a:nth-child(2) { animation-delay: 0.15s; }
.social-links a:nth-child(3) { animation-delay: 0.2s; }
.social-links a:nth-child(4) { animation-delay: 0.25s; }

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

/* Анимация для кнопок в модальном окне */
.modal-actions .btn {
    animation: btnAppear 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

.modal-actions .btn:nth-child(1) { animation-delay: 0.2s; }
.modal-actions .btn:nth-child(2) { animation-delay: 0.3s; }

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

/* Hover-эффект свечения для кнопок */
.primary-btn {
    position: relative;
}

.primary-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
    pointer-events: none;
}

.primary-btn:hover::after {
    opacity: 1;
}

/* Переход темы - плавное изменение */
body {
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Анимация точек галереи */
.gallery-dot {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-dot.active {
    animation: dotPulse 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dotPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Анимация навигационных кнопок галереи */
.gallery-nav {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-nav:active {
    transform: translateY(-50%) scale(0.95);
}

/* Предпочтения пользователя по уменьшению движения */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
