.custom-image-gallery-wrapper {
    width: 100%;
    margin-bottom: 10px;
}

.custom-image-gallery-container {
    position: relative;
}

.custom-image-gallery-slider {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 5px 0;
    transition: transform 0.3s ease;
    flex-wrap: nowrap;
}

.custom-image-gallery-slider::-webkit-scrollbar {
    display: none;
}

.custom-image-gallery-item {
    flex: 0 0 auto;
    min-width: 200px;
    scroll-snap-align: start;
}

@media (min-width: 481px) {
    .custom-image-gallery-slider {
        overflow-x: visible;
    }
    
    .custom-image-gallery-item {
        flex: 1;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .custom-image-gallery-item {
        min-width: calc(40% - 6px);
    }
}

.custom-image-gallery-inner {
    width: 100%;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.custom-image-gallery-inner:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.custom-image-gallery-link {
    display: block;
    text-decoration: none;
}

.custom-image-gallery-image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.custom-image-gallery-image-wrapper::before {
    padding-top: 75%;
    content: '';
    display: block;
}

[data-title-position="outside"] .custom-image-gallery-image-wrapper::before {
    padding-top: 60%;
}

.custom-image-gallery-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.custom-image-gallery-inner:hover .custom-image-gallery-image {
    transform: scale(1.05);
}

.custom-image-gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 15px 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
    transition: opacity 0.3s ease;
    text-align: center;
}

.custom-image-gallery-caption {
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.custom-image-gallery-title-outside {
    padding: 12px 15px;
    text-align: center;
}

.custom-image-gallery-title-outside a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.custom-image-gallery-title-outside a:hover {
    color: var(--theme-color);
}

.custom-image-gallery-title-outside span {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
