/* Шапка и заголовки */
.steps-header {
    text-align: center;
    margin-bottom: 80px;
}


.steps-section {
    margin-bottom: 100px;
}

.steps-main-title {
    font-size: 64px;
    line-height: 64px;
    font-weight: 500;
    color: #1C1C1C;
    margin-bottom: 16px;
}

.steps-main-title span {
    color: #B40555;
}

.steps-subtitle {
    font-size: 20px;
    color: #1C1C1C99;
    max-width: 1084px;
    margin: 0 auto;
    line-height: 26px;
}


.steps-grid {
    display: flex;
    border-top: 2px solid #EDEDED;
    border-bottom: 2px solid #EDEDED;
    width: 100%;
}

.step-item {
    flex: 1;
    padding: 40px 20px;
    border-left: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    height: 450px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: flex 0.5s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
}

.step-item:last-child {
    border-right: 1px solid #f0f0f0;
}


.step-icon {
    color: #ccc;
    margin-bottom: 20px;
}


.step-title,
.step-text {
    display: block;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin: 0;
    transform: translateY(20px); 
    transition: 
        max-height 0.7s cubic-bezier(0.4, 0, 0.2, 1), 
        opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
        transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
        margin 0.5s ease;
}


.step-item.active .step-title {
    max-height: 100px;
    opacity: 1;
    margin-bottom: 16px;
    transform: translateY(0); /* Возвращаем в нормальное положение */
    /* Небольшая задержка, чтобы колонка успела начать расширяться */
    transition-delay: 0.1s; 
}

.step-item.active .step-text {
    max-height: 300px;
    opacity: 1;
    margin-bottom: 64px;
    transform: translateY(0); /* Возвращаем в нормальное положение */
    /* Задержка чуть больше, чем у заголовка, для эффекта очереди */
    transition-delay: 0.2s; 
}

/* Убираем старую анимацию fadeIn, она больше не нужна и может мешать */
.step-item.active .step-title,
.step-item.active .step-text {
    animation: none; 
}

/* Номера в обычном состоянии */
.step-number {
    margin-top: auto;
    font-size: 60px;
    font-weight: 800;
    color: #f2f2f2;
}

.step-item .step-number svg {
    fill: #EDEDED;
}

/* --- АКТИВНЫЙ ЭТАП --- */

.step-item.active {
    flex: 2; /* Увеличение ширины */
    background-color: #fff;
}

/* Иконки в активном состоянии — СТРОГО ПО ТВОЕМУ КОДУ */
.step-item.active .step-icon {
    color: #b01a4e;
}

.step-item.active .step-icon svg path {
    stroke: #FD1F2D;
}

/* Раскрытие текста и заголовка */
.step-item.active .step-title {
    max-height: 100px;
    opacity: 1;
    margin-bottom: 16px;
    font-size: 20px;
    line-height: 24px;
    font-weight: 500;
    color: #1C1C1C;
}

.step-item.active .step-text {
    max-height: 300px;
    opacity: 1;
    margin-bottom: 64px;
    font-size: 18px;
    color: #1C1C1C99;
    line-height: 24px;
}

/* Номер в активном состоянии — СТРОГО ПО ТВОЕМУ КОДУ */
.step-item.active .step-number {
    color: #b01a4e;
    opacity: 1;
}

.step-item.active .step-number svg path {
    fill: #FD1F2D;
    opacity: 1;
}

/* Плавная анимация контента */
.step-item.active .step-title,
.step-item.active .step-text {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Адаптивность */
/* --- ПОЛНЫЙ АДАПТИВ ДЛЯ ЭТАПОВ РАБОТЫ --- */

/* 1. Ноутбуки и мониторы (1200px - 1440px) */
@media (max-width: 1440px) {
    .steps-main-title {
        font-size: 56px;
        line-height: 56px;
    }
}

@media (max-width: 1200px) {
    .steps-header {
        margin-bottom: 50px;
    }
    .steps-main-title {
        font-size: 48px;
        line-height: 52px;
    }
    .step-item {
        height: 400px; /* Немного уменьшаем высоту */
        padding: 30px 15px;
    }
    .step-number {
        font-size: 50px;
    }
}

/* 2. Планшеты (до 1024px) */
@media (max-width: 1024px) {
    .steps-grid {
        flex-wrap: wrap;
        border-right: 1px solid #f0f0f0; /* Закрываем сетку справа */
    }
    
    .step-item {
        flex: none !important;
        width: 50% !important; /* По 2 этапа в ряд */
        height: auto; /* Высота теперь зависит от контента */
        min-height: 250px;
        border-right: 1px solid #f0f0f0;
        border-bottom: 1px solid #f0f0f0;
    }

    /* Включаем видимость контента на планшетах, 
       так как ховер/актив на тач-скринах работает плохо */
    .step-item .step-title,
    .step-item .step-text {
        opacity: 1;
        transform: none;
        margin-bottom: 15px;
    }

    .step-item.active {
        background-color: #fff;
    }
}

/* 3. Малые планшеты (до 768px) */
@media (max-width: 768px) {
    .steps-main-title {
        font-size: 36px;
        line-height: 40px;
    }
    .steps-subtitle {
        font-size: 16px;
        line-height: 19px;
    }
    .step-item {
        width: 100% !important; /* В одну колонку */
        border-left: none;
        align-items: center;
        border-right: none;
    }
    .step-item.active .step-text {
        text-align: center;
    }
    .steps-section {
        margin-bottom: 60px;
    }

    /* .step-number {
        font-size: 40px;
        margin-top: 10px;
        position: absolute;
        top: 20px;
        right: 20px;
    } */
}

/* 4. Смартфоны (до 480px) */
@media (max-width: 580px) {
    .step-icon {
        width: 44px;
        height: 44px;
    }

    .step-icon {
        color: #ccc;
        margin-bottom: 20px;
        /* Добавляем скрытие */
        display: block;
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        transform: translateY(20px); 
        transition: 
            max-height 0.7s cubic-bezier(0.4, 0, 0.2, 1), 
            opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
            transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
            margin 0.5s ease;
    }
    
    .step-number {
        display: block;
        /* Убираем автоматический отступ, ставим небольшой фиксированный, 
        чтобы номер был близко к иконке */
        margin-top: 10px !important; 
        
        max-height: none !important;
        opacity: 1 !important;
        transform: none !important;
        transition: margin-top 0.5s cubic-bezier(0.4, 0, 0.2, 1); /* Плавный переход */
    }

    /* --- АКТИВНОЕ СОСТОЯНИЕ (.active) --- */
    .step-item.active .step-number {
        /* Теперь включаем auto, и номер "улетает" вниз */
        margin-top: auto !important; 
    }
    .step-item {
        min-height: 110px;
    }

    .step-item.active .step-icon {
        max-height: 100px; /* Достаточно для иконки */
        opacity: 1;
        margin-bottom: 20px;
        transform: translateY(0);
        transition-delay: 0s; /* Иконка появляется первой */
    }
    .step-item.active .step-title {
        font-size: 16px;
        line-height: 18px;
    }
    .steps-block {
        padding: 40px 0;
    }
    .steps-header {
        margin-bottom: 30px;
    }
    .steps-main-title {
        font-size: 28px;
        line-height: 32px;
    }
    .step-item {
        padding: 10px 20px;
    }
    .step-icon {
        margin-bottom: 15px;
    }
    .step-item.active .step-text {
        margin-bottom: 20px; /* Убираем гигантский отступ в 64px */
        
    }
    
    /* Делаем иконку номера менее яркой фоновой деталью */
    .step-number {
        font-size: 32px;
        opacity: 0.2;
    }
}

/* 5. Маленькие телефоны (до 360px) */
@media (max-width: 360px) {
    .steps-main-title {
        font-size: 24px;
    }
}