:root {
    --erste_background_farbe: #3b0202;
    --zweite_background_farbe: #380909;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, var(--erste_background_farbe) 0%, var(--zweite_background_farbe) 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, var(--erste_background_farbe) 0%, var(--zweite_background_farbe) 100%);
    color: white;
    padding: 50px 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.3em;
    margin-bottom: 10px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header p {
    font-size: 1.1em;
    opacity: 0.95;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.content {
    padding: 35px 30px;
}

.intro {
    text-align: center;
    margin-bottom: 30px;
}

.intro h2 {
    font-size: 1.7em;
    color: var(--erste_background_farbe);
    margin-bottom: 12px;
}

.intro p {
    font-size: 1.05em;
    color: var(--erste_background_farbe);
    line-height: 1.7;
}

.buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 30px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 25px;
    text-decoration: none;
    border-radius: 12px;
    font-size: 1.15em;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    border: none;
    width: 100%;
}

.btn-primary {
    background: #f8f9ff;
    color: var(--erste_background_farbe);
    border: 2px solid var(--erste_background_farbe);
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: #eee;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--erste_background_farbe) 0%, var(--zweite_background_farbe) 100%);
    color: white;
    font-weight: bold;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 2, 2, 0.4);
}

.btn-icon {
    font-size: 1.3em;
    margin-right: 10px;
}

input[type="file"]#photoInput {
    display: none;
}

/* Progress Bar */
.progress-container {
    display: none;
    margin-bottom: 25px;
    text-align: center;
}

.progress-bar {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--erste_background_farbe);
    transition: width 0.2s;
}

.status-text {
    font-size: 0.95em;
    color: var(--erste_background_farbe);
    font-weight: 600;
}

/* Gallery Grid */
.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    margin-bottom: 16px;
    border-top: 1px solid #eee;
    padding-top: 25px;
}

.gallery-header h3 {
    color: var(--erste_background_farbe);
    font-size: 1.4em;
}

.badge {
    background: #f3e8e8;
    color: var(--erste_background_farbe);
    font-size: 0.85em;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
}

/* Kachel-Raster für die Bilder */
.gallery-grid {
    display: grid;
    /* Erzeugt automatisch gleich große Spalten (mind. 100px, max. 1fr) */
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    width: 100%;
}

@media (min-width: 500px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 14px;
    }
}

/* Einzelnes Galerie-Quadrat */
.gallery-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    /* Zwingt die Kachel in ein perfektes Quadrat */
    border-radius: 10px;
    overflow: hidden;
    background: #f0f0f0;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* WICHTIG: Begrenzung für das Bild/Video im Quadrat */
.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    /* Schneidet das Bild sauber auf das Quadrat zu */
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.video-icon {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.65);
    color: white;
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: 600;
    pointer-events: none;
}

/* Info Box */
.info-box {
    background: #f8f9ff;
    border-left: 4px solid var(--erste_background_farbe);
    padding: 20px;
    border-radius: 8px;
    margin-top: 35px;
}

.info-box h3 {
    color: var(--erste_background_farbe);
    font-size: 1.2em;
    margin-bottom: 10px;
}

.info-box ul {
    margin-left: 20px;
    color: #555;
}

.info-box li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.footer {
    text-align: center;
    padding: 25px;
    background: #f8f9ff;
    color: #666;
    font-size: 0.95em;
}

/* Lightbox Modal */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 95%;
    max-height: 90vh;
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 2.2rem;
    cursor: pointer;
    background: none;
    border: none;
    line-height: 1;
}

button.lightbox-btn {
    color: white;
    background: black;
    box-sizing: border-box;
    font-size: 3.5rem;
}

@media (max-width: 480px) {
    .header {
        padding: 40px 20px;
    }

    .header h1 {
        font-size: 1.9em;
    }

    .header p {
        font-size: 1em;
    }

    .content {
        padding: 25px 18px;
    }

    .intro h2 {
        font-size: 1.4em;
    }

    .btn {
        font-size: 1.05em;
        padding: 16px 20px;
    }
}


/* Mobile Touch-Optimierungen */
@media (max-width: 600px) {
    .gallery-grid {
        /* 3 gleich große Spalten auf dem Smartphone */
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .lightbox-btn {
        padding: 18px 16px;
        font-size: 3.5rem;
        background: rgba(0, 0, 0, 0.7);
        /* Bessere Sichtbarkeit auf Mobilgeräten */
        color: white;
    }



    .lightbox-prev {
        left: 8px;
    }

    .lightbox-next {
        right: 8px;
    }

    .lightbox-close {
        top: 10px;
        right: 15px;
        font-size: 2.8rem;
    }
}

/* Strikte Fixierung der Lightbox für Mobilgeräte */
.lightbox-content-wrapper img,
.lightbox-content-wrapper video {
    max-width: 85vw;
    max-height: 99dvh;
    /* dvh = dynamic viewport height (berücksichtigt die Handy-Menüleisten) */
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: auto;
}

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    /* Pfeile auf dem Handy deutlich dezentere & kleiner machen */
    .lightbox-btn {
        padding: 8px 12px;
        font-size: 3.5rem;
        background: rgba(0, 0, 0, 0.4);
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        border: none;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    /* Schließen-Button (X) oben rechts anpassen */
    .lightbox-close {
        top: 12px;
        right: 16px;
        font-size: 2.2rem;
    }
}