.gallery-container {
    max-width: 1200px;
    margin: 0 auto;
}
.mosaic-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    grid-auto-rows: 220px;
    grid-gap: 20px;
    grid-auto-flow: dense;
}
figure.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    margin: 0; 
    padding: 0;
}
figure.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
}
figure.gallery-item:hover img {
    transform: scale(1.04);
}
figure.gallery-item:hover figcaption.item-overlay {
    opacity: 0.9;
}
figure.gallery-item:hover figcaption.item-overlay .image-title {
    transform: translateY(0);
}
.gallery-more-btn-container {
    display: none;
    justify-content: center;
    margin-top: 30px;
}
.gallery-more-btn {
    color: rgba(61,61,63,1);
    border: 1px solid rgba(61,61,63,0.8);
    background-color: #fff;
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.gallery-more-btn:hover {
    color: #fff;
    border-color: #428e6b;
    background-color: #428e6b;
}
.wide { grid-column: span 2; }
.tall { grid-row: span 2; }
.big { grid-column: span 2; grid-row: span 2; }
figcaption.item-overlay {
    position: absolute;
    text-align: left;
    font-style: normal;   
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-sizing: border-box;
}
figcaption.item-overlay .image-title {
    font-size: 0.9rem;
    color: #ffffff;
    margin: 0;
    transform: translateY(10px);
    transition: transform 0.3s ease;
    line-clamp: 2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;  
    overflow: hidden;
    text-overflow: ellipsis;
}
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4); 
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    touch-action: pan-y;
}
.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}
.lightbox-wrapper {
    background: #ffffff; 
    padding: 40px;       
    border-radius: 12px; 
    position: relative;  
    width: 1034px;               
    max-width: 90%;      
    max-height: 85vh; 
    display: flex;
    flex-direction: column; 
    align-items: center;
    justify-content: center;
    gap: 0;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); 
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.lightbox.active .lightbox-wrapper {
    transform: scale(1) translateY(0);
}
.lightbox-img-bridge {
    display: block;
    width: max-content;      
    max-width: 100%;
    height: 52vh;            
    max-height: 52vh;
    margin-top: 15px; 
    border-radius: 8px;  
    overflow: hidden;   
}
.lightbox-content {
    display: block;
    width: auto;             
    max-width: 100%;         
    height: 100%;            
    object-fit: contain;
    line-height: 0;     
}
.lightbox-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #777; 
    font-size: 32px;         
    line-height: 1;          
    font-weight: normal;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    z-index: 1020;           
}
.lightbox-close:hover {
    color: #428e6b;
    transform: scale(1.1);
}
.lightbox-meta-bar {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    width: 954px;
    max-width: 100%;
    margin-top: 25px;
    padding: 0 5px;
    box-sizing: border-box;
}
.lightbox-text-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex-grow: 1;
    text-align: center;
    color: #333335;
    padding: 0 20px;
}
.lightbox-text-container .image-title {
    font-size: 0.95rem;
    margin: 0;
    font-weight: 500;
    display: block;
    overflow: visible;
    line-clamp: none;
    -webkit-line-clamp: none;
}
.lightbox-text-container .image-counter {
    font-size: 0.85rem;
    color: #777; 
    white-space: nowrap;
    margin: 2px 0 0 0;
}
.lightbox-nav {
    color: #444; 
    font-size: 16px;
    width: 35px;
    height: 35px;
    background-color: #f9f9f9; 
    border: 1px solid #777;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.25s ease;
    flex-shrink: 0; 
}
.lightbox-nav:hover {
    color: #fff;
    background-color: #428e6b;
    border-color: #428e6b;
    opacity: 1;
    transform: scale(1.05);
}
@media (max-width: 600px) {
    .wide, .tall, .big {
        grid-column: span 1;
        grid-row: span 1;
    }
    .mosaic-gallery {
        grid-auto-rows: 260px;
    }
    .mosaic-gallery .gallery-item:nth-child(n+7) {
        display: none;
    }
    .lightbox-wrapper {
        padding: 15px;
        width: 100%; 
        max-width: 95%;
        max-height: 90vh;
        gap: 10px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .lightbox-close {
        position: relative !important;
        top: 0 !important;
        right: 0 !important;
        align-self: flex-end;
        font-size: 28px;
        line-height: 1;
        margin-bottom: 5px;
    }
    .lightbox-img-bridge {
         height: auto !important;
        max-height: 50vh !important;
        margin-top: 0 !important;
        border-radius: 8px !important;
        overflow: hidden;
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .lightbox-content {
        max-height: 50vh;
        max-width: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
        border-radius: 8px !important;
        overflow: hidden;
    }
    .lightbox-nav {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    .lightbox-meta-bar {
        max-width: 100%;
        margin-top: 15px;
    }
    .gallery-more-btn-container {
        display: flex;
    }
    .mosaic-gallery .gallery-item:nth-child(n+7) {
        display: none;
    }
    .mosaic-gallery.show-all .gallery-item:nth-child(n+7) {
        display: block;
    }
}
@media (min-width: 601px) and (max-width: 992px), (min-width: 1201px) {
    .mosaic-gallery {
        grid-template-columns: repeat(4, 1fr) !important;
        grid-auto-rows: 240px !important; 
    }
}
@media (min-width: 601px) and (max-width: 992px) {
    .lightbox-img-bridge {
        height: auto !important;
        max-height: 52vh !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        border-radius: 8px !important;
        overflow: hidden !important;
    }
    .lightbox-content {
        max-height: 52vh !important;
        border-radius: 8px !important;
        overflow: hidden !important;
        object-fit: contain !important;
    }
}
/* ohne Beschriftung Querformat*/
@media (max-width: 900px) and (orientation: landscape) {
    .lightbox-text-container {
        display: none !important;
    }
    .lightbox-wrapper {
        padding: 10px 15px !important;
        max-height: 96vh !important;
        position: relative !important;
    }
    .lightbox-img-bridge {
        max-height: 78vh !important;
        height: auto !important;
    }
    .lightbox-content {
        max-height: 78vh !important;
    }
    .lightbox-meta-bar {
        margin-top: 5px !important;
        display: contents !important;
    }
    .lightbox-nav {
        position: absolute !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        z-index: 1010 !important;
    }
    .lightbox-nav-prev {
        left: 10px !important;
        right: auto !important;
    }
    .lightbox-nav-next {
        right: 10px !important;
        left: auto !important;
    }
}
/* Lupe */
@media (max-width: 559px) {
    figure.gallery-item:first-of-type {
        position: relative;
    }
    figure.gallery-item:first-of-type::after {
        content: "";
        position: absolute;
        top: 12px;
        right: 12px;
        width: 34px;
        height: 34px;
        background-color: rgba(255, 255, 255, 0.7);
        border-radius: 3px;
        pointer-events: none;
        z-index: 5;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http:%2F%2Fwww.w3.org%2F2000%2Fsvg' width='21' height='21' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3Cline x1='11' y1='8' x2='11' y2='14'/%3E%3Cline x1='8' y1='11' x2='14' y2='11'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
  }
}