/* Grundlegende Stile */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


/* Galerie */
.gallery {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    padding: 0px;
    justify-items: left;

}

.gallery-item {
    width: 130px;
    height: 130px;
    overflow: hidden;
    position: relative;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.gallery-item img:hover {
    transform: scale(1.05);
}

/* Modal */
.modal {
    display: none;  /* Modal standardmäßig ausgeblendet */
    position: fixed;
    z-index: 9999; /* Modal im Vordergrund */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8); /* Abdunkelter Hintergrund */
    display: flex; /* Flexbox für zentrierte Ausrichtung */
    justify-content: center;
    align-items: center;
    visibility: hidden; /* Modal ist unsichtbar, wenn nicht aktiviert */
    opacity: 0; /* Modal ist transparent */
    transition: opacity 0.3s ease, visibility 0s 0.3s; /* Sanfte Übergänge */
}

.modal.show {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s ease, visibility 0s; /* Fade-In-Effekt */
}

/* Modal-Inhalt (das Bild) */
.modal-content {
    margin: auto;
    display: block;
    width: 100%; /* Volle Breite des Modals */
    max-width: 80vw; /* Maximal 90% der Fensterbreite */
    max-height: 80vh; /* Maximal 90% der Fensterhöhe */
    object-fit: contain; /* Bild wird vollständig sichtbar und proportional angepasst */
}

/* Close-Button */
.close {
    color: #fff;
    font-size: 36px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 25px;
    transition: 0.3s;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #f1f1f1;
    text-decoration: none;
    cursor: pointer;
}

/* Buttons für vorheriges und nächstes Bild */
.prev, .next {
    position: absolute;
    top: 50%;
    font-size: 40px;
    color: white;
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 16px;
    transition: 0.3s;
}

.prev {
    left: 10px;
}

.next {
    right: 10px;
}

@media (max-width: 770px) {
    .gallery {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 600px) {
    .gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 500px) {
    .gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 400px) {
    .gallery {
        grid-template-columns: 1fr;
    }
}

/* Galerie: Bei kleinen Bildschirmen */
@media (max-width: 770px) {
    /* Galerie: Die Bilder direkt untereinander anzeigen */
    .gallery {
        grid-template-columns: 1fr; /* 1 Bild pro Zeile */
        padding: 0 0px; /* Abstand von 21px links und rechts */
    }

    .gallery-item {
        width: 100%; /* Bilder nehmen die volle Breite ein */
        height: auto; /* Höhe passt sich an */
    }

    .gallery-item img {
        width: 100%; /* Bild soll die komplette Breite des Containers einnehmen */
        height: auto; /* Höhe wird automatisch skaliert */
        object-fit: contain; /* Das Bild wird vollständig gezeigt, ohne abgeschnitten zu werden */
    }

    /* Modal: Die Bilder im Modal sollen auch bei kleineren Bildschirmen volle Breite einnehmen */
    .modal-content {
        max-width: 100vw; /* Bild im Modal soll die volle Breite des Bildschirms einnehmen */
        max-height: 100vh; /* Bild im Modal soll die volle Höhe des Bildschirms einnehmen */
        object-fit: contain; /* Das Bild wird vollständig und proportional angezeigt */
    }
}

/* Für größere Bildschirme */
@media (min-width: 771px) {
    .gallery {
        grid-template-columns: repeat(5, 1fr); /* 5 Bilder pro Zeile auf großen Bildschirmen */
    }

    .gallery-item img {
        width: 100%;
        height: 100%;
        object-fit: cover; /* Bilder decken die gesamte Fläche ab */
    }
}

/* Play-Button über Video-Thumbnail */
.gallery-item .play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    color: white;
    pointer-events: none;
    text-shadow: 0 0 10px black;
}

.gallery-item[data-type="image"] .play-button {
    display: none;
}

