.references-gallery {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
    padding: 30px 0;
}

.references-gallery__item { margin: 0; min-width: 0; }

.references-gallery__link {
    background: #222;
    display: block;
    overflow: hidden;
    position: relative;
}

.references-gallery__link img {
    display: block;
    height: auto;
    transition: opacity .2s ease, transform .2s ease;
    width: 100%;
}

.references-gallery__link:hover img,
.references-gallery__link:focus-visible img {
    opacity: .72;
    transform: scale(1.04);
}

.references-gallery__link:focus-visible {
    outline: 3px solid #ff5d00;
    outline-offset: 3px;
}

.references-gallery__zoom {
    background: rgba(0, 0, 0, .72);
    bottom: 0;
    color: #fff;
    font-size: 12px;
    left: 0;
    opacity: 0;
    padding: 8px 10px;
    position: absolute;
    right: 0;
    text-align: center;
    transition: opacity .2s ease;
}

.references-gallery__link:hover .references-gallery__zoom,
.references-gallery__link:focus-visible .references-gallery__zoom { opacity: 1; }

.references-gallery__item figcaption {
    color: #ff5d00;
    font-size: 16px;
    line-height: 1.3;
    padding-top: 8px;
    text-align: center;
}

.references-lightbox {
    align-items: center;
    background: rgba(0, 0, 0, .92);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 24px 76px;
    position: fixed;
    z-index: 100000;
}

.references-lightbox[hidden] { display: none; }

.references-lightbox__backdrop {
    inset: 0;
    position: fixed;
    z-index: 0;
}

.references-lightbox__image {
    display: block;
    max-height: calc(100vh - 120px);
    max-width: min(100%, 1400px);
    object-fit: contain;
    position: relative;
    z-index: 1;
}

.references-lightbox__caption {
    bottom: 20px;
    color: #fff;
    font-size: 18px;
    left: 76px;
    margin: 0;
    position: fixed;
    right: 76px;
    text-align: center;
    z-index: 1;
}

.references-lightbox__button {
    background: rgba(0, 0, 0, .45);
    border: 1px solid rgba(255, 255, 255, .7);
    color: #fff;
    cursor: pointer;
    font-size: 32px;
    height: 52px;
    line-height: 1;
    padding: 0;
    position: fixed !important;
    top: 50vh !important;
    transform: translateY(-50%) !important;
    width: 52px;
    z-index: 2;
}

.references-lightbox__button:hover,
.references-lightbox__button:focus-visible {
    background: #ff5d00;
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.references-lightbox__previous { left: 20px !important; }
.references-lightbox__next { right: 20px !important; }

@media (max-width: 991px) {
    .references-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
    .references-gallery {
        gap: 10px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 20px 0;
    }

    .references-gallery__item figcaption { font-size: 14px; }
    .references-lightbox { padding: 20px 58px; }
    .references-lightbox__caption {
        bottom: 14px;
        font-size: 15px;
        left: 58px;
        right: 58px;
    }
    .references-lightbox__button { height: 42px; width: 42px; }
    .references-lightbox__previous { left: 8px !important; }
    .references-lightbox__next { right: 8px !important; }
}

@media (prefers-reduced-motion: reduce) {
    .references-gallery__link img,
    .references-gallery__zoom { transition: none; }
}
