/* Сетка галереи */
.cigg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.cigg-grid-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease;
    height: 200px; /* Фиксированная высота */
    background: #ffffff; /* Белый фон вместо серого */
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0; /* Легкая граница для красоты */
}

.cigg-grid-item:hover {
    transform: scale(1.05);
}

.cigg-grid-item img {
    width: auto;
    height: 100%;
    object-fit: contain; /* Масштабирование с сохранением пропорций */
    display: block;
    max-width: 100%;
}

/* Лайтбокс */
.cigg-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.cigg-lightbox.active {
    display: block;
}

.cigg-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.cigg-lightbox-content {
    position: relative;
    z-index: 10000;
    width: 90%;
    height: 90%;
    max-width: 1200px;
    margin: 2% auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cigg-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 10001;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cigg-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    font-size: 24px;
    padding: 15px 10px;
    cursor: pointer;
    z-index: 10001;
    transition: background 0.3s ease;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cigg-lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.8);
}

.cigg-lightbox-prev {
    left: 20px;
}

.cigg-lightbox-next {
    right: 20px;
}

.cigg-lightbox-image-container {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff; /* Белый фон в лайтбоксе */
    border-radius: 8px;
    padding: 10px;
}

.cigg-lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

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

.cigg-lightbox-caption p {
    margin: 0;
    font-size: 16px;
    line-height: 1.4;
}

/* Адаптивность */
@media (max-width: 768px) {
    .cigg-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .cigg-grid-item {
        height: 150px;
    }
    
    .cigg-lightbox-nav {
        padding: 10px 5px;
        font-size: 18px;
        width: 50px;
        height: 50px;
    }
    
    .cigg-lightbox-close {
        font-size: 30px;
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
}