/* ==========================================================================
   Installation gallery

   Loaded only on the pages that carry a gallery, not site-wide.

   The photos are a mix of portrait, landscape and square. The brief for this
   site is that every photo shows in full, so the tile is a fixed box and the
   image is contained inside it — never cropped to fill. That leaves margins
   around the odd-shaped ones, which is the intended trade.
   ========================================================================== */

.gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-4);
}

.gallery-item {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

.gallery-item:hover,
.gallery-item:focus-visible {
    border-color: var(--brand-orange);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

/* Fixed box: the height never depends on the photo, so nothing reflows as the
   images load and the rows stay level whatever shape the photo is. */
.gallery-item__media {
    position: relative;
    display: block;

    /* Square, like the gallery this replaces. The photos are a mix of portrait,
       landscape and square, and a square box wastes the least room across all
       three once they are contained rather than cropped. */
    aspect-ratio: 1 / 1;

    /* The card is a flex column, so this is a flex item — and a flex item's
       min-height:auto is its CONTENT height, not zero. Without this the tall
       photos push the box past its aspect ratio and the ratio is ignored. */
    min-height: 0;
    flex: 0 0 auto;

    background: var(--surface-alt);
}

.gallery-item__media img {
    width: 100%;
    height: 100%;
    object-fit: contain;      /* show the whole photo — never crop */
    display: block;
}

/* Magnifier badge, so it reads as "opens larger" rather than a dead image. */
.gallery-item__media::after {
    content: "";
    position: absolute;
    right: var(--sp-2);
    bottom: var(--sp-2);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(20, 26, 32, .72) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='8.5' cy='8.5' r='5.5'/%3E%3Cline x1='13' y1='13' x2='17' y2='17'/%3E%3Cline x1='6' y1='8.5' x2='11' y2='8.5'/%3E%3Cline x1='8.5' y1='6' x2='8.5' y2='11'/%3E%3C/svg%3E") center / 18px 18px no-repeat;
    opacity: 0;
    transition: opacity .18s ease;
}

.gallery-item:hover .gallery-item__media::after,
.gallery-item:focus-visible .gallery-item__media::after {
    opacity: 1;
}

/* Touch devices have no hover, so show it rather than hide a hint they can
   never reveal. */
@media (hover: none) {
    .gallery-item__media::after { opacity: 1; }
}

.gallery-item__caption {
    display: block;
    padding: var(--sp-3);
    border-top: 1px solid var(--line);
}

.gallery-item__title {
    display: block;
    font-weight: 600;
    font-size: var(--fs-sm);
    line-height: 1.35;
    color: var(--ink);
}

.gallery-item__place {
    display: block;
    margin-top: 2px;
    font-size: var(--fs-xs);
    color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   Tablet
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
    .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --------------------------------------------------------------------------
   Desktop
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
    .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

/* --------------------------------------------------------------------------
   Lightbox overrides — the library's own chrome, nudged to match the site.
   -------------------------------------------------------------------------- */
.lg-backdrop { background-color: rgba(12, 16, 20, .94); }

.lg-sub-html {
    font-family: inherit;
    font-size: .95rem;
}

.lg-toolbar .lg-icon,
.lg-actions .lg-next,
.lg-actions .lg-prev {
    /* The library ships 44px controls at desktop but shrinks some on mobile;
       keep every control at the 44px tap target this site holds to. */
    min-width: 44px;
    min-height: 44px;
}

@media (prefers-reduced-motion: reduce) {
    .gallery-item,
    .gallery-item__media::after {
        transition: none;
    }

    .gallery-item:hover,
    .gallery-item:focus-visible {
        transform: none;
    }
}
