.mw-referenzen {
    width: 100%;
}

.mw-referenzen__grid {
    display: grid;
    grid-template-columns: repeat(var(--mw-ref-cols-l, 5), minmax(0, 1fr));
    gap: var(--mw-ref-gap, 0px);
}

.mw-referenzen__item {
    position: relative;
    margin: 0;
    overflow: hidden;
    background: #111;
}

.mw-referenzen__trigger {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: inherit;
    background: transparent;
    cursor: pointer;
    text-align: left;
    appearance: none;
}

.mw-referenzen__media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.mw-referenzen__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1);
    transition: transform .35s ease, filter .35s ease;
}

.mw-referenzen__trigger:hover .mw-referenzen__image,
.mw-referenzen__trigger:focus-visible .mw-referenzen__image {
    transform: scale(1.045);
    filter: brightness(.82);
}

.mw-referenzen__caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 18px 20px;
    color: #fff;
    font-size: clamp(14px, 1.15vw, 20px);
    line-height: 1.2;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0,0,0,.9);
    background: linear-gradient(to top, rgba(0,0,0,.68), rgba(0,0,0,0));
    pointer-events: none;
}

.mw-ref-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.92);
}

.mw-ref-lightbox.is-open {
    display: flex;
}

.mw-ref-lightbox__stage {
    position: relative;
    width: min(94vw, 1600px);
    height: 88vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mw-ref-lightbox__image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 18px 70px rgba(0,0,0,.6);
}

.mw-ref-lightbox__caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -42px;
    color: #fff;
    text-align: center;
    font-size: 16px;
    line-height: 1.35;
    text-shadow: 0 2px 10px rgba(0,0,0,.8);
}

.mw-ref-lightbox__close,
.mw-ref-lightbox__prev,
.mw-ref-lightbox__next {
    position: absolute;
    z-index: 4;
    border: 0;
    color: #fff;
    background: rgba(0,0,0,.35);
    cursor: pointer;
    appearance: none;
    transition: background .2s ease;
}

.mw-ref-lightbox__close:hover,
.mw-ref-lightbox__prev:hover,
.mw-ref-lightbox__next:hover,
.mw-ref-lightbox__close:focus-visible,
.mw-ref-lightbox__prev:focus-visible,
.mw-ref-lightbox__next:focus-visible {
    background: rgba(255,255,255,.18);
}

.mw-ref-lightbox__close {
    top: 18px;
    right: 18px;
    width: 48px;
    height: 48px;
    font-size: 34px;
    line-height: 1;
}

.mw-ref-lightbox__prev,
.mw-ref-lightbox__next {
    top: 50%;
    width: 58px;
    height: 74px;
    margin-top: -37px;
    font-size: 58px;
    line-height: 1;
}

.mw-ref-lightbox__prev { left: 18px; }
.mw-ref-lightbox__next { right: 18px; }

.mw-ref-lightbox__project-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: #fff;
    background: rgba(0,0,0,.5);
    font-size: clamp(32px, 6vw, 92px);
    line-height: 1.05;
    font-weight: 800;
    text-align: center;
    text-shadow: 0 6px 22px rgba(0,0,0,.8);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

.mw-ref-lightbox__project-overlay.is-visible {
    opacity: 1;
}

body.mw-ref-lightbox-open {
    overflow: hidden;
}

@media (max-width: 1024px) {
    .mw-referenzen__grid {
        grid-template-columns: repeat(var(--mw-ref-cols-m, 3), minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .mw-referenzen__grid {
        grid-template-columns: repeat(var(--mw-ref-cols-s, 1), minmax(0, 1fr));
    }
    .mw-ref-lightbox__prev,
    .mw-ref-lightbox__next {
        width: 46px;
        height: 60px;
        font-size: 44px;
    }
    .mw-ref-lightbox__caption {
        bottom: -52px;
        font-size: 14px;
    }
}
