.custom-gallery-grid {
    display: grid;
    /* grid-template-columns, gap, and grid-auto-rows are handled by Elementor controls */
}

.custom-gallery-item {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 8px; /* Default, overridden by control */
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    height: 100%;
    width: 100%;
}

.custom-gallery-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* Dark Overlay on Hover */
.custom-gallery-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.2); /* Can be overridden by Elementor control */
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

/* Icon Overlay */
.custom-gallery-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    color: #ffffff;
    font-size: 2rem;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 2;
    pointer-events: none;
}

/* Hover Effects */
.custom-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.custom-gallery-item:hover .custom-gallery-image {
    transform: scale(1.1);
}

.custom-gallery-item:hover::after {
    opacity: 1;
}

.custom-gallery-item:hover .custom-gallery-overlay {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
