*, *::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" 
  ; 
}

.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;
}

.portfoliotitel 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;
    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;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-item {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.2s ease;
}

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

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

.gallery-item img {
    width: 100%;
    height: auto;
    object-fit: cover;
    background-color: #333;
}

.gallery-item figcaption {
    font: bold clamp(0.5rem, 0.3333rem + 1.6667vw, 1.0rem) sans-serif;
    font-family: "Arial";
    color: #000;
    text-align: center;
    padding-top: 10px;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  
  display: flex;
  justify-content: center;
  align-items: center;
  
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;

  cursor: zoom-out;
}

.overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.overlay img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.active-transition {
  view-transition-name: flying-image;
}

::view-transition-group(flying-image) {
  animation-duration: 0.4s;
}

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" 
    ;
  }
}

@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-item {
    cursor: default;
  }
  
  .menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .main-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #666666;
    z-index: 1000;
  }

  .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;
  }

  .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;
  }

  .menu-checkbox:checked ~ .nav-links {
      display: flex;
  }

 .menu-checkbox:checked ~ .menu-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .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);
  }
}
