/* Konzept: Silent Elegance / Minimalist 
   Status: Optimierte Gallery-Navigation & Header
*/

:root {
  --color-black: #000000;
  --color-white: #ffffff;
  --color-grey-light: #f9f9f9;
  --color-border: #e0e0e0;
  --text-main: #1a1a1a;
  --text-muted: #666666;
  --font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --header-height: 180px; 
}

/* --- RESET & BASIS --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-white);
  color: var(--text-main);
  line-height: 1.7;
  padding-top: var(--header-height);
  -webkit-font-smoothing: antialiased;
}

/* --- HEADER --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background-color: var(--color-white);
  z-index: 1000;
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.header-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 120px; 
  display: flex;
  gap: 5px;
  overflow: hidden;
  padding: 5px;
}

.header-bg img {
  height: 100%;
  width: auto;
  object-fit: cover;
  flex: 1; 
}

.header-bg img:nth-child(1) { object-position: center 25%; }
.header-bg img:nth-child(2) { object-position: center 20%; }
.header-bg img:nth-child(3) { object-position: center 10%; }
.header-bg img:nth-child(4) { object-position: center 20%; }
.header-bg img:nth-child(5) { object-position: center 5%; }
.header-bg img:nth-child(6) { object-position: center 25%; }

.header h1 {
  position: relative;
  font-size: clamp(0.95rem, 2.5vw, 1.2rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0;
  padding: 15px 55px 15px var(--space-md);
  background: var(--color-white); 
  z-index: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- NAVIGATION / TOGGLE --- */
.menu-toggle {
  position: fixed; 
  top: calc(var(--header-height) - 45px); 
  right: var(--space-md);
  width: 30px;
  height: 20px;
  cursor: pointer;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.menu-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--color-black);
  transition: all 0.3s ease-in-out;
  transform-origin: left center;
}

.menu-toggle.active span:nth-child(1) { transform: rotate(45deg); margin-left: 5px; }
.menu-toggle.active span:nth-child(2) { width: 0%; opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: rotate(-45deg); margin-left: 5px; }

.menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  height: 100vh;
  background: rgba(255, 255, 255, 0.98);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end; 
  padding-right: 10%; 
  transition: right 0.5s cubic-bezier(0.77, 0, 0.175, 1);
  z-index: 2000;
}

.menu.active { right: 0; }
.menu a { font-size: 1.5rem; font-weight: 500; color: var(--color-black); text-decoration: none; margin-bottom: var(--space-sm); }

/* --- CONTENT SEKTIONEN SCROLL-FIX --- */
.main, .events, .gallery, section, div[id] {
  scroll-margin-top: var(--header-height);
}

/* --- MAIN BEREICH --- */
.main {
  max-width: 1000px;
  margin: var(--space-xs) var(--space-md) var(--space-xs) var(--space-xs)
}

#aktuelles {
  margin-top: 0;
}

.news img {
  width: 100%;
  max-width: 400px;
  height: auto;
  margin: var(--space-xs) 0;
  display: block;
  border: 1px solid var(--color-border);
}

/* --- EVENTS & CARDS --- */
.events {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-sm);
  margin: var(--space-sm) 0 0 0;
}

.event, .card {
  background: var(--color-grey-light);
  padding: var(--space-xs);
  border: 1px solid var(--color-border);
  min-height: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* --- GALLERY VORSCHAU --- */
.gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--space-xs);
  padding: 10px 0;
}

.gallery img {
  width: 230px;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
}

/* Gallery-Bilder Justierung */
.gallery img:nth-child(1) { object-position: center 5%; }
.gallery img:nth-child(2) { object-position: center 5%; }
.gallery img:nth-child(3) { object-position: center 25%; }
.gallery img:nth-child(4) { object-position: center 15%; }
.gallery img:nth-child(5) { object-position: center 20%; }
.gallery img:nth-child(6) { object-position: center 25%; }
.gallery img:nth-child(7) { object-position: center 30%; }
.gallery img:nth-child(8) { object-position: center 10%; }

/* --- POPUPS & LIGHTBOX --- */
#popup {
  display: none; 
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--color-white);
  padding: var(--space-md);
  border: 1px solid var(--color-black);
  box-shadow: 0 30px 60px rgba(0,0,0,0.15);
  z-index: 5000; 
  min-width: 320px;
}

.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.98);
  z-index: 4000;
  justify-content: center;
  align-items: center;
}

.lightbox .close {
  position: absolute;
  top: 25px;
  right: 35px;
  font-size: 50px;
  color: var(--color-black);
  cursor: pointer;
  z-index: 4100;
}

/* Navigations-Pfeile weit nach außen schieben */
.lightbox .nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 60px; /* Schön groß */
  color: var(--color-black);
  cursor: pointer;
  padding: 20px;
  z-index: 4050;
  user-select: none;
  transition: opacity 0.3s ease;
}

.lightbox .nav:hover {
  opacity: 0.4;
}

.prev { 
  left: 30px; /* Abstand zum linken Rand */
}

.next { 
  right: 30px; /* Abstand zum rechten Rand */
}

#lightbox-img {
  max-width: 80%; /* Begrenzt, damit Platz für die Pfeile am Rand bleibt */
  max-height: 80vh;
  object-fit: contain;
}

/* --- MOBILE --- */
@media (max-width: 600px) {
  :root { --header-height: 140px; }
  .header-bg { height: 80px; }
  
  .header h1 {
    padding: 10px 50px 10px 15px;
  }

  .main { margin-top: var(--space-md); }
  .main img { width: 100%; }
  .gallery img { width: 140px; height: 100px; }
  .menu-toggle { top: calc(var(--header-height) - 40px); }

  /* Mobile Lightbox Anpassung */
  .lightbox .nav { font-size: 40px; padding: 10px; }
  .prev { left: 5px; }
  .next { right: 5px; }
  #lightbox-img { max-width: 95%; }
}