.gallery-grid {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    padding: 1rem;
    margin: 0;
    width: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    /* Hide scrollbar for cleaner look but keep functionality */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.gallery-grid::-webkit-scrollbar {
    display: none;
}

.gallery-item {
    margin: 0 10px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    flex: 0 0 300px;
    max-height: 200px;
    background-color: #fff;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease-in-out;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translate3d(0,0,0);
    transform: translate3d(0,0,0);
    scroll-snap-align: start;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease-in-out;
    display: block;
}

/* Add scroll buttons for better UX */
.gallery-container {
    position: relative;
    width: 100%;
    padding: 0 40px;
    margin: 0 auto;
    max-width: 1400px;
}

.gallery-scroll-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
}

.gallery-scroll-button:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.gallery-scroll-button i {
    font-size: 20px;
    color: #333;
}

.gallery-scroll-left {
    left: 0;
}

.gallery-scroll-right {
    right: 0;
}

/* RTL support */
[dir="rtl"] .gallery-scroll-left {
    left: auto;
    right: 0;
}

[dir="rtl"] .gallery-scroll-right {
    right: auto;
    left: 0;
}

.gallery-item:hover img {    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.gallery-item::before {
    content: '';
    display: block;
    padding-bottom: 75%;
}

.gallery-info {
    opacity: 1;
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.4) 50%, rgba(0, 0, 0, 0) 100%);
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    transition: all 0.3s ease-in-out;
    z-index: 2;
}

.gallery-info h4 {
    font-size: 20px;
    color: #fff;
    font-weight: 600;
    text-align: center;
    margin-bottom: 10px;
    transform: translateY(10px);
    opacity: 0.7;
    transition: all 0.3s ease-in-out;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.gallery-info p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    text-align: center;
    margin-bottom: 0;
    transform: translateY(10px);
    opacity: 0.7;
    transition: all 0.3s ease-in-out;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.gallery-info .gallery-lightbox {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    margin-top: 15px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transition: all 0.3s ease-in-out;
    opacity: 0;
    transform: translateY(20px);
}

.gallery-info .gallery-lightbox:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.gallery-item:hover .gallery-info,
.gallery-item:focus-within .gallery-info {
    transform: translateY(0);
    opacity: 1;
}

.gallery-item:hover .gallery-info h4,
.gallery-item:hover .gallery-info p,
.gallery-item:hover .gallery-info .gallery-lightbox {
    transform: translateY(0);
    opacity: 1;
}

.gallery-item a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
    outline: none;
}

.gallery-item a:focus-visible {
    outline: 3px solid #007bff;
    outline-offset: -3px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}
