/* ===== СТИЛИ ДЛЯ БЛОКА КАТЕГОРИЙ НА ГЛАВНОЙ ===== */
.main_category__title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--dark-color);
    font-weight: 700;
    position: relative;
    padding-bottom: 15px;
}

.main_category__title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: var(--primary-color);
}

.main_category__text {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 40px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.content-box.wrapper_category_main {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.wrap_cat_main {
    position: relative;
    width: 100%;
    height: 450px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--border-radius);
    text-decoration: none;
}

.wrap_cat_main::after {
    width: 100%;
    height: 100%;
    position: absolute;
    content: "";
    background-color: #000;
    opacity: 0.5;
    border-radius: var(--border-radius);
    transition: opacity 0.3s ease;
}

.wrap_cat_main:hover::after {
    opacity: 0.3;
}

.cat_main {
    color: var(--color-white);
    font-size: 28px;
    text-transform: uppercase;
    text-align: center;
    font-weight: 600;
    z-index: 1;
    padding: 20px;
}

/* ===== АНИМАЦИИ ДЛЯ КАТЕГОРИЙ ===== */
.main_category[data-animate-on-scroll] .wrap_cat_main {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.6s ease;
}

.main_category[data-animate-on-scroll] .wrap_cat_main.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Или если используете animate.css */
.wrap_cat_main.animate__animated {
    opacity: 0;
}

.wrap_cat_main.animate__fadeInUp {
    opacity: 1;
}

/* Принудительное центрирование для неполных рядов */
.wrap_cat_main:nth-child(3n+1):nth-last-child(1),
.wrap_cat_main:nth-child(3n+1):nth-last-child(2),
.wrap_cat_main:nth-child(3n+2):nth-last-child(1) {
    grid-column: 2;
}

/* Адаптивность для планшетов */
@media (max-width: 1024px) {
    .main_category {
        padding: 40px 0;
    }
    
    .main_category__title {
        font-size: 2rem;
    }
    
    .content-box.wrapper_category_main {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .wrap_cat_main {
        height: 350px;
    }
    
    /* Центрирование для планшетов (2 в ряд) */
    .wrap_cat_main:nth-child(2n+1):nth-last-child(1) {
        grid-column: 1 / -1;
        justify-self: center;
        max-width: calc(50% - 5px);
    }
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .main_category__title {
        font-size: 1.8rem;
    }
    
    .main_category__text {
        font-size: 1rem;
        margin-bottom: 30px;
    }
    
    .content-box.wrapper_category_main {
        grid-template-columns: 1fr;
        padding-inline: 15px;
    }
    
    .wrap_cat_main {
        height: 300px;
        max-width: 500px;
        margin: 0 auto;
    }
    
    .cat_main {
        font-size: 24px;
    }
    
    /* Сбрасываем центрирование для мобильных */
    .wrap_cat_main:nth-child(3n+1):nth-last-child(1),
    .wrap_cat_main:nth-child(3n+1):nth-last-child(2),
    .wrap_cat_main:nth-child(3n+2):nth-last-child(1),
    .wrap_cat_main:nth-child(2n+1):nth-last-child(1) {
        grid-column: 1;
        justify-self: stretch;
        max-width: none;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .main_category {
        padding: 30px 0;
    }
    
    .main_category__title {
        font-size: 1.6rem;
    }
    
    .wrap_cat_main {
        height: 250px;
    }
    
    .cat_main {
        font-size: 20px;
        padding: 15px;
    }
}