*, *::before, *::after {
  box-sizing: border-box;
}

body {
    margin:0;
}

.container { 
  display: grid;
  height:100vh; 
  grid-template-rows: 15vh 5vh 75vh 5vh;
  grid-template-columns: 100%; 
  grid-template-areas:  
    "header" 
    "nav" 
    "main" 
    "footer" 
  ; 
}

/* Desktop-Anordnung der Links nebeneinander */
.nav-links {
  display: flex;
  justify-content: center;
  gap: 15px;
  padding-top: 1vh;
  width: 100%;
  font-size: clamp(0.75rem, 0.525rem + 0.6vi, 1.125rem);
  font-family: "Arial", sans-serif;
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: 15px;
  padding-top: 1vh;
  width: 100%;
  font-size: clamp(0.75rem, 0.525rem + 0.6vi, 1.125rem);
  font-family: "Arial", sans-serif;
}

.nav-links a {
    color: white;
} 

.nav-item {
  position: relative;
}

.sub-nav {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  background-color: rgba(66, 66, 66, 0.8); 
  box-shadow: 0px 4px 10px rgba(0,0,0,0.1);
  padding: 10px;
  list-style: none;
  min-width: 120px;
  z-index: 100;
}

.sub-nav li {
  display: block;
  white-space: nowrap;
  padding: 5px 10px;
}

.nav-item:hover .sub-nav {
  display: block;
}

.burger-button, .menu-checkbox {
  display: none;
}

.texttitel1 h1 {
    font: italic small-caps bold clamp(1rem, 0.4167rem + 2.3333vw, 2.75rem) cursive;
    font-family: "Arial", sans-serif;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-block-end: 0px;
    margin-block-start: -10px;
}

.texttitel2 h2 {
    font: italic small-caps clamp(0.6rem, 0.3333rem + 1.6667vw, 2rem) cursive;
    font-family: "Arial", sans-serif;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-block-end: 20px;
    margin-block-start: -1px;
}
.pagetitle h3 {
    font: bold clamp(0.5rem, 0.3333rem + 1.6667vw, 1.4rem) sans-serif;
    font-family: "Arial";
    color: black;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-block-start: 10px;
}

header {
    display: grid;
    background-color: #444444; 
    grid-area: header; 
    place-items: center;
    padding-top: 2cqh;
    box-sizing: border-box;
}

main {
    grid-area: main;
    width: 100%;
    height: 100%;
    overflow-y: auto; /* Erlaubt Scrollen, falls viele Bilder vorhanden sind */
    padding: 20px;
}

nav {
    background: #666666;
    grid-area: nav;
}

.main-nav {
    grid-area: nav;
    position: relative;
}

footer {
    background: #666666;
    grid-area: footer; 
    align-items: center;
}

.footer-text {
  display: flex;
  justify-content: center;
  padding-top: 1.5vh;
  width: 100%;
  font: italic clamp() cursive;
  font-family: "Arial", sans-serif;
  color: white;
}

.gallery-grid {
    display: grid;
    /* Erzwingt eine feste Spaltenanzahl: 1 Spalte mobil, 2 auf Tablet, 4 auf Desktop */
    grid-template-columns: repeat(4, 1fr); 
    gap: 25px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Styling für Möglichkeit 1 (Umschließender Link) */
.gallery-item {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.2s ease;
}

.gallery-item:hover {
    transform: scale(1.02); /* Kleiner Hover-Effekt für Interaktivität */
}


.gallery-item figure {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Der Container erzwingt das quadratische Seitenverhältnis (1:1) */
.gallery-item .img-container {
    width: 100%;
    aspect-ratio: 1 / 1; /* Macht das Element perfekt quadratisch */
    overflow: hidden;    /* Schneidet überstehende Bildteile sauber ab */
    border-radius: 12px; /* Abgerundete Ecken (Wert nach Wunsch anpassen) */
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;   /* Füllt das Quadrat aus, ohne das Bild zu verzerren */
    display: block;
}

.gallery-item figcaption {
    font-family: "Arial", sans-serif;
    color: #333;
    text-align: center;
    padding-top: 10px;
    font-size: 0.9rem;
    font-weight: bold;  /* Macht den Titel der Galerie deutlicher sichtbar */
}

tcopy { font-size: clamp(12px, 1vw, 16px); }

@media screen and (max-width: 60.001em) {
  .container {
    grid-template-rows: 10vh 5vh 80vh 5vh;
    grid-template-columns: 100%; 
    grid-template-areas:  
      "header"
      "nav"
      "main" 
      "footer" 
    ;
  }
  .gallery-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 Spalten auf Tablets */
  }
}

@media screen and (max-width: 40.001em) {
  .container {
    grid-template-rows: 10vh 7vh 78vh 5vh;
    grid-template-columns: 100%; 
    grid-template-areas:  
      "header"
      "nav"
      "main" 
      "footer" 
    ;
  }

.gallery-grid {
        grid-template-columns: 1fr; /* 1 Spalte auf Handys */
    }
  
/* Das Abdunklungs-Overlay im Grundzustand (unsichtbar) */
  .menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5); /* Schwarz mit 50% Transparenz */
    z-index: 900;                         /* Unter den Links (999), aber über den Fotos */
    opacity: 0;
    pointer-events: none;                 /* Klicks gehen im geschlossenen Zustand durch */
    transition: opacity 0.3s ease;        /* Sanftes Einblenden */
  }

  /* Zentriert das Burger-Icon mathematisch in der Nav-Row */
  .main-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #666666;
    z-index: 1000;
  }

  /* Burger-Button einblenden */
  .burger-button {
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 5px; 
  }
  
  .burger-button span {
    width: 30px;
    height: 3px;
    background-color: white;
    transition: 0.3s;
  }

  /* Checkbox bleibt unsichtbar im Hintergrund */
  .menu-checkbox {
    display: none;
  }

  .nav-links {
    flex-direction: column;
    display: none;
    position: absolute;
    top: 100%;
    left: 25%;
    width: 50%;
    padding: 0;
    gap: 0;
    background-color: rgba(33, 33, 33, 0.8); 
    z-index: 1001;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1); 
  }

  .nav-item {
    position: relative; 
    width: 100%;
    border-bottom: 2px solid black;
    box-sizing: border-box;
  }

  .nav-item:last-child {
    border-bottom: none; 
  }

  .nav-links a {
    display: block;
    padding-bottom: 5px;
    padding-top: 5px;
    text-align: center;
    width: 100%;
    text-decoration: none;
    font-size: 1.0rem;
    line-height: 1.2;  
    box-sizing: border-box; 

  }

  .sub-nav {
    position: absolute; /* Für Mausgeräte */
    top: 0;            
    left: 100%;        
    width: 80%;        
    display: none;     
    background-color: rgba(66, 66, 66, 0.66); 
    box-shadow: 10px 10px 15px rgba(0, 0, 0, 0.1);
    padding: 0;
    list-style: none; 
/*      position: static; /* Mobil touch: Bleibt im Textfluss und schiebt Inhalt nach unten */
/*  display: none;
  background-color: rgba(0, 0, 0, 0.2);
  padding: 0;
  list-style: none; */
  }
  
  .nav-item:hover .sub-nav {
    display: block;
  }
  
  .sub-nav a {
    font-size: 0.9rem;  
    text-align: center;
    width: 100%;
    text-decoration: none;
    line-height: 0.6;  
    box-sizing: border-box;
  }

  .sub-nav li {
    padding-left: 20px;
  }

  .sub-nav.is-open {
    display: block;
  }


  /* ========================================== */
  /* 3. INTERAKTIONS-LOGIK (NUR MOBIL)          */
  /* ========================================== */
  
/* Schaltet das Overlay auf sichtbar, sobald gecheckt */
  .menu-checkbox:checked ~ .nav-links {
      display: flex;
  }

 .menu-checkbox:checked ~ .menu-backdrop {
    opacity: 1;
    pointer-events: auto;                 /* Blockiert Klicks auf den Content dahinter */
  }

  /* Burger-Icon Animation zum "X" */
  .menu-checkbox:checked ~ .burger-button span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .menu-checkbox:checked ~ .burger-button span:nth-child(2) {
    opacity: 0;
  }
  .menu-checkbox:checked ~ .burger-button span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
  }
}
