/* Стилі для галереї */
.gallery-carousel {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    padding: 1rem 0;
    gap: 10px;
    scroll-behavior: smooth;
    max-height: 800px;
    overflow-x: auto;
    justify-content: center;
}


.gallery-item {
    flex: 0 0 auto;
    width: calc(16% - 10px); /* Ширина кожного елемента, щоб вмістити два на рядок */
    margin-bottom: 10px; /* Відступи між рядками */
}

.gallery-item img {
    width: 100%;
    height: auto;
    border-radius: 5px;
    cursor: pointer;
}

.gallery-item img:hover {
    opacity: 0.9;
}

.gallery-item p {
    margin: 0.5rem 0 0;
    text-align: center;
    color: #333;
}

/* Стилі для прокручування */
.gallery-carousel::-webkit-scrollbar {
    height: 8px;
}

.gallery-carousel::-webkit-scrollbar-thumb {
    background-color: #9a1915;
    border-radius: 10px;
    border: 2px solid #f4f4f4;
}

.gallery-carousel::-webkit-scrollbar-track {
    background-color: #f4f4f4;
    border-radius: 10px;
}

.gallery-carousel {
    scrollbar-width: thin;
    scrollbar-color: #9a1915 #f4f4f4;
}

/* Стилізація оверлею */
.gallery-item-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.gallery-item-overlay img {
    max-width: 90%;
    max-height: 80%;
    border-radius: 5px;
}

.gallery-item-overlay p {
    margin-top: 1rem;
    color: #fff;
    text-align: center;
}

.gallery-item-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Адаптивність для галереї */
@media (max-width: 768px) {
    .gallery-item {
        width: calc(50% - 5px); /* Менша ширина елементів для планшетів */
    }

    .gallery-item img {
        border-radius: 3px;
    }
}

@media (max-width: 480px) {
    .gallery-item {
        width: 100%; /* Один елемент на рядок для мобільних пристроїв */
    }

    .gallery-item img {
        border-radius: 2px;
    }
}


/* Stage 2 gallery refinement */
.gallery-carousel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    max-height: none;
    overflow: visible;
}

.gallery-item {
    width: auto;
    border: 1px solid var(--pv-line, #d8d8d8);
    background: #fff;
    padding: 0.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item:hover {
    border-color: var(--pv-red, #9a1915);
    box-shadow: 0 8px 24px rgba(154, 25, 21, 0.12);
}

.gallery-item img,
.gallery-item-overlay img {
    border-radius: 0 !important;
}

.gallery-item figcaption,
.gallery-item p {
    font-size: 0.95rem;
    line-height: 1.35;
}

@media (max-width: 430px) {
    .gallery-carousel {
        grid-template-columns: 1fr;
    }
}
