/* Gallery Styles */
.gallery-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    margin: 2rem 0;
}

.gallery-wrapper {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--secondary-bg);
    padding: 1rem 0;
    gap: 1.5rem;
}

.gallery-wrapper::-webkit-scrollbar {
    height: 8px;
}

.gallery-wrapper::-webkit-scrollbar-track {
    background: var(--secondary-bg);
    border-radius: 4px;
}

.gallery-wrapper::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 4px;
}

.gallery-item {
    flex: 0 0 auto;
    width: 300px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px var(--shadow-color);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.gallery-caption {
    padding: 1rem;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.gallery-caption h4 {
    margin: 0 0 0.5rem;
    color: var(--primary-color);
}

.gallery-caption p {
    margin: 0;
    font-size: 0.9rem;
}

.gallery-controls {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    gap: 1rem;
}

.gallery-control {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.gallery-control:hover {
    background-color: var(--primary-dark);
}

.gallery-control:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
}

.dark-mode .gallery-caption {
    background-color: var(--dark-secondary-bg);
}

.dark-mode .gallery-control:disabled {
    background-color: var(--dark-border-color);
}

/* Full-width gallery for homepage */
.full-width-gallery .gallery-item {
    width: 400px;
    height: 300px;
}

.full-width-gallery .gallery-item img {
    height: 250px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gallery-item {
        width: 250px;
    }
    
    .full-width-gallery .gallery-item {
        width: 300px;
        height: 250px;
    }
    
    .full-width-gallery .gallery-item img {
        height: 200px;
    }
}

@media (max-width: 576px) {
    .gallery-item {
        width: 220px;
    }
    
    .full-width-gallery .gallery-item {
        width: 260px;
        height: 220px;
    }
    
    .full-width-gallery .gallery-item img {
        height: 170px;
    }
}

/* Gallery page specific styles */
.gallery-page .gallery-item {
    width: 350px;
}

.gallery-page .gallery-item img {
    height: 250px;
}

/* Featured gallery with larger first item */
.featured-gallery .gallery-item:first-child {
    width: 450px;
}

.featured-gallery .gallery-item:first-child img {
    height: 300px;
}

/* Gallery modal for fullscreen view */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.gallery-modal-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.gallery-modal-content img {
    max-width: 100%;
    max-height: 80vh;
    display: block;
    border: 2px solid white;
}

.gallery-modal-caption {
    color: white;
    text-align: center;
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.gallery-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
}

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

.gallery-modal-nav button {
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.gallery-modal-nav button:hover {
    background-color: rgba(0, 0, 0, 0.8);
}
