/* Стилі для оновленої галереї */

.gallery {
    padding: 100px 0;
    background-color: #000;
    position: relative;
    overflow: hidden;
}

/* Фоновий ефект */
.gallery::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255, 215, 0, 0.1) 0%, rgba(0, 0, 0, 0.9) 70%);
    z-index: 1;
}

/* Анімовані частинки */
.gallery::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('img/bcg.png');
    opacity: 0.2;
    z-index: 1;
    /* Статичний фон без анімації */
}

/* Анімацію видалено, використовуємо статичний фон */

.gallery .container {
    position: relative;
    z-index: 2;
}

.gallery .section-title {
    margin-bottom: 20px;
    text-align: center;
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.gallery .section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, transparent, #FFD700, transparent);
}

.gallery-subtitle {
    text-align: center;
    margin-bottom: 50px;
    opacity: 0.8;
    font-size: 1.2rem;
    color: #ccc;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Сітка галереї */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 60px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.gallery-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform 0.4s ease;
    max-height: 250px;
}

.gallery-item:hover {
    transform: translateY(-8px);
    z-index: 10;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    filter: brightness(0.9) contrast(1.1);
}

.gallery-item:hover img {
    transform: scale(1.03);
    filter: brightness(1.05) contrast(1.15);
}

/* Ефект світіння при наведенні */
.gallery-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 15px rgba(255, 215, 0, 0);
    border-radius: 8px;
    transition: box-shadow 0.4s ease;
}

.gallery-item:hover::after {
    box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.5), 0 0 20px rgba(255, 215, 0, 0.3);
}

/* Підпис до фото */
.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 40px 15px 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    color: #fff;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    text-align: center;
}

.gallery-item:hover .gallery-caption {
    transform: translateY(0);
}

.gallery-caption h4 {
    font-size: 1rem;
    margin-bottom: 3px;
    color: #FFD700;
}

.gallery-caption p {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 0;
}

/* Модальне вікно для перегляду фото */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gallery-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    border: 3px solid rgba(255, 215, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.2);
}

.gallery-modal.active .modal-content {
    transform: scale(1);
}

.modal-content img {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 215, 0, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.modal-close:hover {
    background-color: #FFD700;
    transform: rotate(90deg);
}

.modal-close::before,
.modal-close::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background-color: #000;
}

.modal-close::before {
    transform: rotate(45deg);
}

.modal-close::after {
    transform: rotate(-45deg);
}

.modal-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    color: #fff;
    text-align: center;
}

.modal-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    transform: translateY(-50%);
}

.modal-nav-btn {
    width: 50px;
    height: 50px;
    background-color: rgba(255, 215, 0, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.modal-nav-btn:hover {
    background-color: #FFD700;
    transform: scale(1.1);
}

.modal-nav-btn svg {
    width: 24px;
    height: 24px;
    fill: #000;
}

/* Адаптивність */
@media (max-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .gallery-item {
        max-height: 220px;
    }
}

@media (max-width: 768px) {
    .gallery {
        padding: 40px 0;
    }
    
    .gallery .section-title {
        font-size: 2.2rem;
        margin-bottom: 15px;
    }
    
    .gallery-subtitle {
        font-size: 1.1rem;
        margin-bottom: 30px;
        padding: 0 20px;
        text-align: center;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 0 15px;
        justify-items: center;
        align-items: start;
    }
    
    .gallery-item {
        max-height: 200px;
        border-radius: 6px;
        width: 100%;
        max-width: 180px;
    }
    
    .gallery-caption {
        padding: 30px 12px 12px;
    }
    
    .gallery-caption h4 {
        font-size: 0.9rem;
        margin-bottom: 2px;
    }
    
    .gallery-caption p {
        font-size: 0.75rem;
    }
    
    /* Touch-friendly hover effects */
    .gallery-item:active {
        transform: translateY(-4px);
    }
    
    .gallery-item:active .gallery-caption {
        transform: translateY(0);
    }
}

@media (max-width: 576px) {
    .gallery {
        padding: 30px 0;
    }
    
    .gallery .section-title {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }
    
    .gallery-subtitle {
        font-size: 1rem;
        margin-bottom: 25px;
        padding: 0 15px;
        text-align: center;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0 20px;
        max-width: 400px;
        margin: 0 auto;
        justify-items: center;
    }
    
    .gallery-item {
        max-height: 280px;
        border-radius: 8px;
        width: 100%;
        max-width: 350px;
    }
    
    .gallery-caption {
        padding: 35px 15px 15px;
    }
    
    .gallery-caption h4 {
        font-size: 1rem;
        margin-bottom: 3px;
    }
    
    .gallery-caption p {
        font-size: 0.8rem;
    }
    
    /* Modal improvements for mobile */
    .modal-content {
        max-width: 95%;
        max-height: 85vh;
        margin: 20px;
    }
    
    .modal-content img {
        max-height: 70vh;
    }
    
    .modal-close {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
    }
    
    .modal-nav {
        padding: 0 15px;
    }
    
    .modal-nav-btn {
        width: 45px;
        height: 45px;
        /* Touch-friendly size */
    }
    
    .modal-nav-btn svg {
        width: 22px;
        height: 22px;
    }
    
    .modal-caption {
        padding: 15px;
    }
    
    .modal-caption h4 {
        font-size: 1.1rem;
        margin-bottom: 5px;
    }
    
    .modal-caption p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .gallery .section-title {
        font-size: 1.6rem;
    }
    
    .gallery-grid {
        padding: 0 15px;
        max-width: 320px;
        margin: 0 auto;
    }
    
    .gallery-item {
        max-height: 250px;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .modal-nav-btn {
        width: 40px;
        height: 40px;
    }
    
    .modal-nav-btn svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 360px) {
    .gallery {
        padding: 25px 0;
    }
    
    .gallery .section-title {
        font-size: 1.4rem;
    }
    
    .gallery-subtitle {
        font-size: 0.9rem;
        margin-bottom: 20px;
        text-align: center;
    }
    
    .gallery-grid {
        padding: 0 10px;
        gap: 12px;
        max-width: 280px;
        margin: 0 auto;
        justify-items: center;
    }
    
    .gallery-item {
        max-height: 220px;
        width: 100%;
        max-width: 260px;
        margin: 0 auto;
    }
    
    .modal-content {
        margin: 15px;
    }
    
    .modal-nav-btn {
        width: 35px;
        height: 35px;
    }
    
    .modal-close {
        width: 30px;
        height: 30px;
        top: 10px;
        right: 10px;
    }
}