/* NOTE!: You can change the height of the image by overriding this: */
.awcf_custom_acf_gallery .gallery-featured {
    /* NOTE!: Choose a height: */
    height: 655px;
}
.awcf_custom_acf_gallery .gallery-item {
    /* NOTE!: Make the gallery items 50% (minus 5px) of the height of the featured image like this: */
    height: 325px;
}

.awcf_custom_acf_gallery {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    height: auto;
}

.awcf_custom_acf_gallery .gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    width: 100%;
}

.awcf_custom_acf_gallery .gallery-featured {
    grid-column: span 2;
    grid-row: span 2;
    width: 100%;
    position: relative;
    margin-top: 0;
    margin-right: 5px;
}

.awcf_custom_acf_gallery .gallery-item {
    position: relative;
    width: 100%;
    margin: 0 5px 0 0;
}

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

.awcf_custom_acf_gallery .gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.awcf_custom_acf_gallery .gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: black;
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1;
    transition: opacity 0.6s;
}

.awcf_custom_acf_gallery .gallery-overlay:hover {
    opacity: 0.5;
}

.awcf_custom_acf_gallery .gallery-icon {
    display: block;
    position: relative;
    height: 36px;
    width: 36px;
    font-size: 2rem;
    color: white;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="40px" viewBox="0 -960 960 960" width="40px" fill="%23FFFFFF"><path d="M792-120.67 532.67-380q-30 25.33-69.64 39.67Q423.39-326 378.67-326q-108.44 0-183.56-75.17Q120-476.33 120-583.33t75.17-182.17q75.16-75.17 182.5-75.17 107.33 0 182.16 75.17 74.84 75.17 74.84 182.27 0 43.23-14 82.9-14 39.66-40.67 73l260 258.66-48 48Zm-414-272q79.17 0 134.58-55.83Q568-504.33 568-583.33q0-79-55.42-134.84Q457.17-774 378-774q-79.72 0-135.53 55.83-55.8 55.84-55.8 134.84t55.8 134.83q55.81 55.83 135.53 55.83Z"/></svg>');
}

/* Always show the overlay of the last item */
.awcf_custom_acf_gallery .gallery-item:not(.low-count):nth-child(5) .gallery-overlay {
    opacity: 0.5 !important;
}

.awcf_custom_acf_gallery .gallery-item:not(.low-count):nth-child(5) .gallery-overlay .gallery-icon {
    background-image: none;
    width: 110px;
}

.awcf_custom_acf_gallery .hidden,
.awcf_custom_acf_gallery .hidden-images {
    display: none;
}

/* Add an before for .awcf_custom_acf_gallery .gallery-item:nth-child(5) .gallery-overlay .gallery-icon with the data-count attribute */
.awcf_custom_acf_gallery .gallery-item:not(.low-count):nth-child(5) .gallery-overlay .gallery-icon::before {
    content: attr(data-count);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 35px;
    width: 100%;
    text-align: center;
}

.mfp-content button {
    background: none !important;
    background-color: none !important;
    cursor: pointer !important;
}

@media (min-width: 1024px) {
    .awcf_custom_acf_gallery .gallery-item {
        margin-left: 0;
    }

    .awcf_custom_acf_gallery .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
