/* Galerie-Shortcode [Galerie-slug] – einheitliche Karten + Lightbox */
.cmsp-gallery-module {
    margin: 2rem 0;
}

.cmsp-gallery-title {
    font-size: 1.75rem;
    margin: 0 0 1.25rem;
    text-align: center;
    font-weight: 700;
}

.cmsp-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.cmsp-gallery-item {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.cmsp-gallery-item:focus-visible {
    outline: none;
}

.cmsp-gallery-item:focus-visible .cmsp-gallery-item__card {
    outline: 3px solid rgba(150, 188, 77, 0.85);
    outline-offset: 2px;
}

.cmsp-gallery-item__card {
    height: 100%;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.cmsp-gallery-item:hover .cmsp-gallery-item__card {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.cmsp-gallery-item__media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f3f4f6;
}

.cmsp-gallery-item__thumb {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform-origin: center center;
    transition: transform 0.35s ease;
}

.cmsp-gallery-item:hover .cmsp-gallery-item__thumb.is-rot-0 {
    transform: scale(1.05);
}

.cmsp-gallery-item__thumb.is-rot-90 {
    transform: rotate(90deg) scale(1.34);
}

.cmsp-gallery-item__thumb.is-rot-180 {
    transform: rotate(180deg);
}

.cmsp-gallery-item__thumb.is-rot-270 {
    transform: rotate(270deg) scale(1.34);
}

.cmsp-gallery-item:hover .cmsp-gallery-item__thumb.is-rot-90 {
    transform: rotate(90deg) scale(1.42);
}

.cmsp-gallery-item:hover .cmsp-gallery-item__thumb.is-rot-180 {
    transform: rotate(180deg) scale(1.05);
}

.cmsp-gallery-item:hover .cmsp-gallery-item__thumb.is-rot-270 {
    transform: rotate(270deg) scale(1.42);
}

.cmsp-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.92);
}

.cmsp-gallery-lightbox.is-open {
    display: flex;
}

.cmsp-gallery-lightbox__dialog {
    position: relative;
    max-width: min(1200px, 96vw);
    max-height: 92vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cmsp-gallery-lightbox__image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 82vh;
}

.cmsp-gallery-lightbox__image {
    max-width: 100%;
    max-height: 82vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    transform-origin: center center;
}

.cmsp-gallery-lightbox__image.is-rot-90 {
    transform: rotate(90deg);
}

.cmsp-gallery-lightbox__image.is-rot-180 {
    transform: rotate(180deg);
}

.cmsp-gallery-lightbox__image.is-rot-270 {
    transform: rotate(270deg);
}

.cmsp-gallery-lightbox__caption {
    margin: 0.75rem 0 0;
    color: #fff;
    font-size: 0.95rem;
    text-align: center;
}

.cmsp-gallery-lightbox__counter {
    margin-top: 0.35rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
}

.cmsp-gallery-lightbox__close,
.cmsp-gallery-lightbox__nav {
    position: absolute;
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.cmsp-gallery-lightbox__close:hover,
.cmsp-gallery-lightbox__close:focus-visible,
.cmsp-gallery-lightbox__nav:hover,
.cmsp-gallery-lightbox__nav:focus-visible {
    background: rgba(255, 255, 255, 0.24);
}

.cmsp-gallery-lightbox__close {
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    font-size: 1.75rem;
    line-height: 1;
}

.cmsp-gallery-lightbox__nav {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    line-height: 1;
}

.cmsp-gallery-lightbox__nav--prev {
    left: 16px;
}

.cmsp-gallery-lightbox__nav--next {
    right: 16px;
}

@media (max-width: 767.98px) {
    .cmsp-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    .cmsp-gallery-lightbox__nav {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 575.98px) {
    .cmsp-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
