/* Оберточный контейнер */
.cards-wrapper {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
}

/* Основной контейнер карточек */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, 250px);
    gap: 15px;
    justify-content: center;
    width: 100%;
    max-width: calc(250px * 4 + 30px * 3);
    row-gap: 30px;
}

/* Стили карточки */
.service-card {
    width: 234px;
    height: 338px;
    padding: 23px;
    background-color: #5F4E4E;
    border-radius: 10px;
    box-sizing: border-box;
    position: relative;
    transition: all 0.3s ease;
}

.service-card:hover {
    background-color: #ffcc00;
}

.card-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.card-border {
    width: 100%;
    height: 100%;
    background-color: #FFFFFF;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.image-wrapper {
    padding: 20px 20px 0 20px;
    max-height: 173px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
}

.card-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    vertical-align: top;
}

.card-title {
    margin: 0;
    padding: 30px 20px;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    color: #333;
    position: absolute;
    bottom: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 2;
}

.str3{
    padding-bottom: 10px; /* Только снизу */
}

.text_long{
    font-size: 22px;
}

.card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s;
    position: relative;
    z-index: 3;
}

.card-title a:hover {
    color: #5F4E4E;
}

/* Адаптация для мобильных (2 карточки с уменьшенными отступами) */
@media (max-width: 600px) {
    .cards-wrapper {
        padding: 0px; /* Уменьшаем отступы */
    }
    
    .cards-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        row-gap: 10px;
        max-width: 100%;
        padding: 0 10px; /* Добавляем небольшие боковые отступы */
        box-sizing: border-box;
    }
    
    .service-card {
        width: 100%; /* Занимаем всю доступную ширину ячейки */
        height: auto; /* Автоматическая высота */
        aspect-ratio: 0.7; /* Сохраняем пропорции карточки */
        padding: 14px;
        border-radius: 8px;
    }
    
    .image-wrapper {
        padding: 10px 10px 0 10px;
        max-height: 60%; /* Изменяем пропорции внутренних элементов */
    }
    
    .card-title {
        padding: 10px;
        font-size: 18px;
        font-weight: 700;
        text-align: center;
        margin: 0;
        margin-top: auto; /* Прижимаем к низу */
        flex-shrink: 0;
    }
    
    .card-border {
        height: 100%;
        display: flex;
        flex-direction: column;
    }
}

