/* ===== Page Transitions ===== */
/* Плавное появление и исчезновение страниц */

/* ===== Базовое состояние ===== */
body {
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ===== При загрузке — плавное появление ===== */
body.page-enter {
    opacity: 0;
    transform: translateY(8px);
}

body.page-enter-active {
    opacity: 1;
    transform: translateY(0);
}

/* ===== При уходе — плавное исчезновение ===== */
body.page-leave {
    opacity: 0;
    transform: translateY(6px);
}

/* ===== Анимация для контента ===== */
main {
    animation: fadeInContent 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
    animation-delay: 0.1s;
}

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

/* ===== Для хедера ===== */
header {
    animation: fadeInHeader 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

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

/* ===== Для футера ===== */
footer {
    animation: fadeInFooter 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
    animation-delay: 0.15s;
}

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

/* ===== Для героя ===== */
.hero {
    animation: fadeInHero 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
    animation-delay: 0.05s;
}

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

/* ===== Для категорий ===== */
.categories {
    animation: fadeInCategories 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
    animation-delay: 0.1s;
}

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

/* ===== Для карточек инструментов ===== */
.tool-card {
    animation: fadeInCards 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

.tool-card:nth-child(1) { animation-delay: 0.05s; }
.tool-card:nth-child(2) { animation-delay: 0.08s; }
.tool-card:nth-child(3) { animation-delay: 0.11s; }
.tool-card:nth-child(4) { animation-delay: 0.14s; }
.tool-card:nth-child(5) { animation-delay: 0.17s; }
.tool-card:nth-child(6) { animation-delay: 0.2s; }

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

/* ===== Для калькулятора ===== */
.calculator-wrapper {
    animation: fadeInCalc 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
    animation-delay: 0.1s;
}

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

/* ===== Для навигации инструмента ===== */
.tool-nav {
    animation: fadeInNav 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

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

/* ===== Для результатов калькулятора ===== */
.calc-results > * {
    animation: fadeInResults 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

.calc-results > *:nth-child(1) { animation-delay: 0.1s; }
.calc-results > *:nth-child(2) { animation-delay: 0.15s; }
.calc-results > *:nth-child(3) { animation-delay: 0.2s; }
.calc-results > *:nth-child(4) { animation-delay: 0.25s; }

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

/* ===== Для модальных окон ===== */
.modal {
    animation: fadeInModal 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

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

/* ===== Для оверлея ===== */
.overlay {
    animation: fadeInOverlay 0.25s ease forwards;
    opacity: 0;
}

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

/* ===== Для пользователей с чувствительностью к анимации ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    body {
        transition: none !important;
    }
}

/* ===== Для мобильных устройств ===== */
@media (max-width: 768px) {
    main {
        animation-duration: 0.3s;
    }
    
    .tool-card {
        animation-duration: 0.3s;
    }
}