/* Секция */
.happy-clients-section {
    padding: 60px 20px;
    background-color:#f5f5f5;
    position: relative;
}

.section-title {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2.2rem;
    color: #333;
}

/* Сетка */
.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Карточка клиента */
.client-card {
    position: relative;
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.client-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.15);
}

.client-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.client-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    cursor: pointer;
}

.client-card:hover .client-image {
    transform: scale(1.05);
}

.client-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 20px;
    color: white;
    opacity: 0.95;
}

.client-name {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: white;
}

.client-text {
    font-size: 0.9rem;
    margin-bottom: 15px;
    color: #eee;
}

.client-button {
    background: transparent;
    color: white;
    border: 2px solid white;
    transition: all 0.3s ease;
}

.client-button:hover {
    background: white;
    color: #333;
}

/* Лайтбокс */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-image {
    max-width: 80%;
    max-height: 80%;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.lightbox-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    text-align: center;
    color: white;
}

.lightbox-name {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: white;
}

.lightbox-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #ddd;
    max-width: 800px;
    margin: 0 auto;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    transition: color 0.3s ease;
}

.lightbox-close:hover {
    color: #ccc;
}

/* Адаптивность */
@media (max-width: 768px) {
    .clients-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .client-card {
        height: 250px;
    }
    
    .lightbox-image {
        max-width: 95%;
        max-height: 70%;
    }
    
    .lightbox-name {
        font-size: 1.4rem;
    }
    
    .lightbox-text {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .clients-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); /* Уменьшаем минимальную ширину */
        gap: 15px; /* Сужаем отступы */
    }

    .client-card {
        height: 220px; /* Уменьшаем высоту */
    }

    .client-name {
        font-size: 1rem; /* Меньший заголовок */
    }

    .client-text {
        font-size: 0.8rem; /* Компактный текст */
    }

    .client-button {
        font-size: 0.75rem; /* Меньшая кнопка */
        padding: 6px 12px;
    }
}

@media (max-width: 768px) {
    .lightbox-image {
        max-width: 90%; /* Больше места под текст */
        max-height: 60%; /* Не занимает весь экран */
    }

    .lightbox-caption {
        padding: 15px;
    }

    .lightbox-name {
        font-size: 1.2rem; /* Уменьшаем заголовок */
    }

    .lightbox-text {
        font-size: 0.95rem; /* Компактный текст */
        padding: 0 10px;
    }

    .lightbox-close {
        font-size: 30px; /* Удобный размер для нажатия */
        top: 10px;
        right: 20px;
    }

    /* Добавляем прокрутку для длинного текста */
    .lightbox-caption {
        overflow-y: auto;
        max-height: 30vh;
    }
}

/* Предотвращаем горизонтальный скролл */
body {
    overflow-x: hidden;
    padding: 0 10px; /* Добавляем отступы */
}

/* Увеличиваем зону клика для кнопок */
.client-button {
    touch-action: manipulation; /* Ускоряет реакцию на тап */
}

/* Лучшая адаптация изображений */
.client-image {
    object-position: center; /* Центрируем изображение */
}

/* Фиксируем положение крестика при скролле */
.lightbox-close {
    position: fixed;
}

@media (max-width: 480px) {
    .section-title {
        font-size: 1.8rem; /* Меньший заголовок */
    }

    .clients-grid {
        grid-template-columns: 1fr; /* Вертикальная колонка */
        gap: 10px;
    }

    .client-card {
        height: 200px; /* Еще меньше */
    }

    .lightbox-image {
        max-width: 95%;
        max-height: 50%;
    }

    .lightbox-caption {
        max-height: 25vh;
    }
}