body { padding: 20px; }

/* constrain overall gallery width on laptops and center it, use less horizontal gap */
.gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 820px;
    margin: 0 auto;
    align-items: start;
}

@media (max-width: 640px) {
    .gallery { grid-template-columns: 1fr; max-width: 100%; padding: 0 12px; }
}
@media (min-width: 700px) {
    /* move gallery slightly left on laptops/desktops while keeping mobile centered */
    .gallery {
    margin-left: 24px;
    margin-right: 0;
    justify-items: start;
    }
}

/* shrink the grey "panel" to wrap only the thumbnail */
figure {
    margin: 0;
    padding: 0;
    text-align: center;
    background: transparent;
}

/* background, padding and rounded corners only around the image link */
figure > a {
    display: inline-block;
    padding: 4px;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

figure img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 380px;
    max-height: 280px;
    border-radius: 4px;
}

figcaption {
    margin-top: 6px;
    font-size: 0.9rem;
    color: #333;
}

.meta { color: #666; font-size: 0.85rem; }
