/* Front end and editor: tightly packed, centered, square images. */
.csg-grid {
    display: grid;
    gap: 2px;
    width: 100%;
    max-width: 1002px; /* 2 × 500px images + 1 × 2px gap */
    margin: 1em auto;
    padding: 0;
    box-sizing: border-box;
    align-items: start;
    justify-content: center;
}

.csg-grid.csg-columns-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 1002px;
}

.csg-grid.csg-columns-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 1504px; /* 3 × 500px images + 2 × 2px gaps */
}

.csg-grid > .csg-tile {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    margin: 0 !important;
    padding: 0;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
    border: 0;
    border-radius: 0;
}

.csg-grid > .csg-tile > img,
.csg-grid > .csg-tile > picture > img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-width: 0;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0;
    object-fit: cover;
    object-position: center;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

/* Images are deliberately not links. Keep normal image context menus. */
.csg-grid > .csg-tile img {
    cursor: default !important;
    pointer-events: auto; /* needed for right-click → Open image in new tab */
}
