.gallery-container { max-width: 1200px; margin: 40px auto; }
.gallery-title { text-align: center; margin-bottom: 30px; color: #333; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.gallery-card {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    background: #fff;
    transition: transform 0.3s ease;
}
.gallery-card:hover { transform: scale(1.03); }

.gallery-thumb img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    display: block;
}

.gallery-caption {
    /*padding: 10px 10px 12px;*/
    margin-block-start: 20px;
    margin-left: 10px;
    margin-right: 10px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #333;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 8;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal; /* ОБОВ’ЯЗКОВО */
    text-align: center;
}
.comment-gallery {
    margin-top: 10px;
}


.pagination {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    gap: 10px;
}
.pagination a {
    padding: 8px 16px;
    border: 1px solid #ccc;
    text-decoration: none;
    color: #333;
    border-radius: 4px;
}
.pagination a.active {
    background-color: #020e42;
    color: white;
    border-color: #020e42;
}

.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
}
.lightbox-content-wrapper {
    position: relative;
    width: 92%;
    height: 92%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 4%;
    pointer-events: none;
}
.lightbox img {
    max-width: 100%;
    max-height: calc(100% - 70px);
    object-fit: contain;
    pointer-events: auto;
}
.lightbox-caption {
    margin-top: 14px;
    max-width: 1100px;
    width: 100%;
    color: #fff;
    font-size: 16px;
    line-height: 1.4;
    text-align: center;
    pointer-events: auto;
    padding: 0 10px;
}
.close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
}
.prev-btn, .next-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    color: white;
    border: none;
    padding: 16px;
    cursor: pointer;
    font-size: 24px;
    z-index: 10001;
}
.prev-btn { left: 10px; }
.next-btn { right: 10px; }

@media (max-width: 992px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .gallery-grid { grid-template-columns: 1fr; } }