/* gallery.css — several images as a grid or a mosaic.
 *
 * Yours: edit it, or delete the file.
 *
 * Two layouts, chosen in the editor. A grid is even columns of equal crops. A
 * mosaic is rows the editor has already balanced, where each image keeps its
 * own aspect ratio — the markup arrives pre-grouped into rows, so this only has
 * to lay those rows out.
 */

.velocity-gallery {
    position: relative;
}

.velocity-gallery-item {
    position: relative;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.velocity-gallery-img {
    display: block;
    cursor: pointer;
}

/* Per-image captions are hidden: at this size they are unreadable, and the
   gallery takes one caption of its own below. */
.velocity-gallery-caption {
    display: none;
}

/* ── Grid ── */
.velocity-gallery-grid {
    display: grid;
    gap: 4px;
}

.velocity-gallery-grid[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.velocity-gallery-grid[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

/* Fixed height and a cover crop, so a portrait and a landscape photo sit in
   the same row without one of them dictating the height. */
.velocity-gallery-grid .velocity-gallery-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

/* ── Mosaic ── */
.velocity-gallery-mosaic {
    display: flex;
    flex-direction: column;
}

.velocity-gallery-mosaic .velocity-gallery-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

.velocity-gallery-mosaic .velocity-gallery-row:not(:first-of-type) {
    margin-top: 4px;
}

.velocity-gallery-mosaic .velocity-gallery-item:not(:first-of-type) {
    margin-left: 4px;
}

.velocity-gallery-mosaic .velocity-gallery-img {
    width: 100%;
    height: 100%;
    margin: 0;
}

.velocity-gallery-main-caption {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-style: italic;
    text-align: center;
    color: var(--ink-faint);
}

@media (max-width: 500px) {
    /* Three columns on a phone is a strip of stamps. */
    .velocity-gallery-grid[data-columns="3"] {
        grid-template-columns: repeat(2, 1fr);
    }

    .velocity-gallery-grid .velocity-gallery-img {
        height: 120px;
    }
}
