.dm-work-detail-gallery-widget {
    background: transparent;
    width: 100%;
}
.dm-work-detail-intro {
    max-width: 800px;
    margin: 0 auto 100px;
    text-align: center;
}
.dm-work-detail-gallery {
    display: flex;
    flex-direction: column;
    width: 100%;
    /* The gap is controlled by Elementor, but here is the fallback */
    gap: 180px; 
}

/* Row wrapper for each image / image pair */
.dm-gallery-row {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    width: 100%;
    gap: 20px; /* Horizontal gap between items in a row (if pair) */
}

/* Image Wrappers */
.dm-work-detail-image-wrap {
    width: 100%;
}

.dm-work-detail-image {
    max-width: 100%;
    height: auto;
    display: block;
    width: 100%;
}

/* Grid Columns Utility Classes */
.dm-col-1-5 { grid-column: 1 / 6; }
.dm-col-2-5 { grid-column: 2 / 6; }
.dm-col-2-6 { grid-column: 2 / 7; }
.dm-col-2-7 { grid-column: 2 / 8; }
.dm-col-2-8 { grid-column: 2 / 9; }
.dm-col-3-8 { grid-column: 3 / 9; }
.dm-col-4-10 { grid-column: 4 / 11; }
.dm-col-6-11 { grid-column: 6 / 12; }
.dm-col-6-12 { grid-column: 6 / 13; }
.dm-col-7-12 { grid-column: 7 / 13; }
.dm-col-8-12 { grid-column: 8 / 13; }
.dm-col-9-12 { grid-column: 9 / 13; }
.dm-col-3-11 { grid-column: 3 / 12; }


/* Responsive Adjustments */
@media (max-width: 1024px) {
    .dm-work-detail-gallery {
        gap: 120px;
    }
    /* Relax the grid constraints slightly for tablet to avoid images being too small */
    .dm-col-1-5 { grid-column: 1 / 7; }
    .dm-col-2-5 { grid-column: 1 / 6; }
    .dm-col-2-6 { grid-column: 1 / 7; }
    .dm-col-2-7 { grid-column: 1 / 8; }
    .dm-col-2-8 { grid-column: 1 / 9; }
    .dm-col-3-8 { grid-column: 2 / 9; }
    .dm-col-4-10 { grid-column: 2 / 12; }
    .dm-col-6-11 { grid-column: 5 / 13; }
    .dm-col-6-12 { grid-column: 6 / 13; }
    .dm-col-7-12 { grid-column: 6 / 13; }
    .dm-col-8-12 { grid-column: 7 / 13; }
    .dm-col-9-12 { grid-column: 8 / 13; }
    .dm-col-3-11 { grid-column: 1 / 13; }
}

@media (max-width: 768px) {
    .dm-work-detail-gallery {
        gap: 64px;
    }
    
    /* Classic Mobile Style (Default) */
    .dm-mobile-style-classic .dm-gallery-row {
        display: flex;
        flex-direction: column;
        gap: 64px; /* Same as row gap to maintain rhythm between paired images */
    }
    .dm-mobile-style-classic .dm-work-detail-image-wrap {
        width: 100% !important;
    }
    
    /* Free Mobile Style */
    .dm-mobile-style-free .dm-gallery-row {
        display: flex;
        flex-direction: column;
        gap: 64px; /* Space between items if it was a pair row */
    }
    
    /* To maintain the free offset look on mobile, we assign alternating or offset max-widths and margins 
       instead of grid layout, because mobile grid can be too constrained.
       We map the original grid classes to mobile-friendly percentage offsets.
    */
    .dm-mobile-style-free .dm-work-detail-image-wrap {
        width: 100% !important; /* Ensure the wrapper takes full flex width */
    }

    .dm-mobile-style-free .dm-work-detail-image {
        width: 100%;
        max-width: 100%;
    }

    /* Map the desktop grid classes to mobile offsets (minimum ~50% width) */
    /* Left aligned blocks (small-ish) */
    .dm-mobile-style-free .dm-col-1-5 .dm-work-detail-image,
    .dm-mobile-style-free .dm-col-2-5 .dm-work-detail-image,
    .dm-mobile-style-free .dm-col-2-6 .dm-work-detail-image {
        width: 60%;
        margin-left: 0;
        margin-right: auto;
    }

    /* Left-ish / medium width */
    .dm-mobile-style-free .dm-col-2-7 .dm-work-detail-image,
    .dm-mobile-style-free .dm-col-2-8 .dm-work-detail-image {
        width: 75%;
        margin-left: 5%;
        margin-right: auto;
    }

    /* Center blocks */
    .dm-mobile-style-free .dm-col-3-8 .dm-work-detail-image,
    .dm-mobile-style-free .dm-col-4-10 .dm-work-detail-image {
        width: 80%;
        margin: 0 auto;
    }

    /* Wide block */
    .dm-mobile-style-free .dm-col-3-11 .dm-work-detail-image {
        width: 90%;
        margin: 0 auto;
    }

    /* Right aligned blocks */
    .dm-mobile-style-free .dm-col-6-11 .dm-work-detail-image,
    .dm-mobile-style-free .dm-col-7-12 .dm-work-detail-image,
    .dm-mobile-style-free .dm-col-8-12 .dm-work-detail-image,
    .dm-mobile-style-free .dm-col-9-12 .dm-work-detail-image {
        width: 65%;
        margin-left: auto;
        margin-right: 5%;
    }
    
    .dm-mobile-style-free .dm-col-6-12 .dm-work-detail-image {
        width: 75%;
        margin-left: auto;
        margin-right: 0;
    }
}