/* ==========================================================================
   GALERIE GRUNDSTYLING & HEADER
   ========================================================================== */

.galerie-container {
  padding: 60px 40px 20px 40px;
  color: #2c523e; /* Vereinsgrün */
}

.galerie-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 40px;
  border-bottom: 2px solid rgba(44, 82, 62, 0.2);
  padding-bottom: 15px;
}

.galerie-header h1 {
  font-family: 'Garamond', serif;
  font-size: 3rem;
  margin: 0;
}

/* Dropdown Auswahlbereich */
.select-wrapper {
  font-family: 'Garamond', serif;
  font-size: 1.2rem;
  font-weight: bold;
}

.select-wrapper select {
  padding: 8px 15px;
  font-size: 1.05rem;
  border: 2px solid #2c523e;
  background-color: #FEFBF3;
  color: #2c523e;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  outline: none;
  margin-left: 10px;
}

/* Tages-Überschriften (z.B. Sa. 21.05.2019) */
.tag-section {
  margin-bottom: 50px;
}

.tag-section h3 {
  font-family: 'Garamond', serif;
  font-size: 1.6rem;
  border-left: 4px solid #c9a054; /* Edles Gold */
  padding-left: 12px;
  margin-bottom: 20px;
}

/* ==========================================================================
   MODERNES FLEX-LAYOUT (Mittig zentriert, ohne Nummerierung)
   ========================================================================== */

.bilder-grid {
  display: flex;
  flex-wrap: wrap;           /* Erlaubt das Umbrechen in die nächste Zeile */
  justify-content: center;   /* Zentriert die Bilderreihen perfekt in der Mitte */
  gap: 15px;                 /* Gleichmäßiger Abstand zwischen den Kacheln */
  width: 100%;
}

.bild-kachel {
  display: block;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  background-color: #FEFBF3;
  
  /* Flex-Verhalten für die Vorschau */
  height: 200px;             /* Feste Höhe für die Reihe am PC */
  flex-grow: 0;              /* Verhindert künstliches Strecken */
  flex-shrink: 1;            /* Erlaubt Verkleinerung, falls der Bildschirm zu klein wird */
}

/* WICHTIG: Diese CSS-Regel gilt NUR für die Bilder INNERHALB der Vorschau-Kacheln */
.bild-kachel > img {
  height: 100% !important;   /* Nutzt exakt die Höhe der Kachel */
  width: auto !important;    /* Berechnet die Breite proportional */
  display: block;
  border-radius: 8px;
  object-fit: cover;
}

/* Hover-Effekt für die Vorschaubilder */
.bild-kachel:hover {
  transform: scale(1.04);    /* Minimales, edles Vergrößern */
  box-shadow: 0 10px 20px rgba(44, 82, 62, 0.25);
  z-index: 5;
}

/* ==========================================================================
   LIGHTBOX MODAL (Großansicht beim Anklicken) - Fixiert für Flex-Layout
   ========================================================================== */

.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(30, 30, 30, 0.95); /* <-- HIER IN ZEILE 104: Schönes, edles Dunkelgrau */
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lightbox.aktiv {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-content-wrapper {
  max-width: 85%;
  max-height: 85%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* WICHTIG: Hier wird sichergestellt, dass das Lightbox-Bild NICHT die Kachel-Höhe erbt */
.lightbox img {
  max-width: 100% !important;
  max-height: 90vh !important; /* Verhindert das Übersteuern bei Hochkant-Bildern */
  width: auto !important;
  height: auto !important;
  object-fit: contain !important; /* Garantiert vollständige Sichtbarkeit ohne Verzerrung */
  border: 3px solid #e2d1b5;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* Schließen-Button (X) */
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #FEFBF3;
  font-size: 3rem;
  cursor: pointer;
  transition: color 0.2s;
  z-index: 2100;
}

.lightbox-close:hover { 
  color: #c9a054; 
}

/* Pfeiltasten zur Navigation (Vor / Zurück) */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #FEFBF3;
  padding: 18px 22px;
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s;
  z-index: 2100;
}

.lightbox-nav:hover {
  background: #c9a054;
  color: #2c523e;
}

.lightbox-nav.prev { left: 30px; }
.lightbox-nav.next { right: 30px; }

/* ==========================================================================
   RESPONSIVE ANPASSUNGEN (Für Tablets und Mobilgeräte)
   ========================================================================== */

@media screen and (max-width: 900px) {
  .galerie-container { 
    padding: 30px 20px 10px 20px; 
  }
  .galerie-header h1 { 
    font-size: 2.2rem; 
    margin-bottom: 15px; 
  }
  /* Hier eingefügt: h3 wird auf Tablets von 1.6rem auf 1.4rem verkleinert */
  .tag-section h3 {
    font-size: 1.4rem;
  }
  .galerie-header { 
    flex-direction: column; 
    align-items: flex-start; 
  }
  .bild-kachel {
    height: 150px;           /* Auf Tablets etwas kleinere Vorschaubilder */
  }
  .lightbox-nav { 
    padding: 12px 16px; 
    font-size: 1.2rem; 
  }
  .lightbox-nav.prev { left: 10px; }
  .lightbox-nav.next { right: 10px; }
}

@media screen and (max-width: 600px) {
  .galerie-header h1 { 
    font-size: 1.8rem; 
  }
  /* Hier eingefügt: h3 wird auf Smartphones noch etwas kleiner (1.2rem) */
  .tag-section h3 {
    font-size: 1.2rem;
    margin-bottom: 15px; /* Optional: Auch den Abstand nach unten leicht verringert */
  }
  .select-wrapper {
    font-size: 1rem;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .select-wrapper select {
    margin-left: 0;
    flex-grow: 1;
    max-width: 60%;
    margin-left: 17px;
    
  }
  .bilder-grid {
    gap: 8px;                /* Schmaler Abstand auf Handys */
  }
  .bild-kachel {
    height: auto;            /* Hebt die feste Pixelhöhe auf, damit das Breitenlimit greifen kann */
    max-width: calc(50% - 4px); /* Absolutes Limit: Maximal 50% der Breite minus halber Gap-Abstand */
    flex-grow: 1;            /* Lässt die Bilder den Platz links und rechts gleichmäßig aufteilen */
  }
  .bild-kachel > img {
    width: 100% !important;  /* Das Bild füllt die Kachel komplett aus */
    height: auto !important; /* Die Höhe passt sich automatisch an, damit nichts verzerrt */
    max-height: 140px;       /* Verhindert, dass Hochkantbilder auf dem Handy zu riesig werden */
    object-fit: cover;       /* Schneidet überstehende Ränder sauber ab */
  }
}