/* === CSS Reset === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  /* Basis für Rems */
}

body {
  font-family: sans-serif;
  line-height: 1.5;
  color: #fff;
  background: #000;
}

/* Links */
a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

/* Bilder responsiv */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Verstecktes Element */
[hidden] {
  display: none !important;
}

/* header */
header {
  display: flex;
  justify-content: flex-start;
  height: 80px;
}

.fotogram_logo {
  margin: 16px;
  padding-top: 2%;
  padding-bottom: 2%;
  height: 64px;
  width: auto;
  max-width: 80%;
}

/* main */
main {
  border-radius: 8px;
  box-shadow: 0 0 16px #fff;
  margin: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;

}

/* section gallery */
.gallery {
  width: min(1200px, 100%);
  padding: 0px 24px 24px;
  text-align: center;
}

.gallery h2 {
  display: inline-block;
  max-width: 70vw;
  /* schrumpft auf Textbreite */
  margin: -16px auto 16px;
  /* und zentriert als Block */
  padding: 0 12px;

  border-radius: 8px;
  box-shadow: 0 0 16px #fff;
  background: rgba(255, 255, 255, 0.9);
  color: #000;
  font-size: 1.5rem;
  text-shadow: 0 0 8px #fff;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

#thumbnail_container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  /*  wiederholt und füllt auf min 160px, max so breit wie es eben zulässt (fractional unit) */
  gap: 12px;
  width: 100%;
}

#thumbnail_container article {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  background-color: #111;
  transition: transform .2s ease;
}

#thumbnail_container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* zuschneiden statt verzerren */
  display: block;
  transition: transform .2s ease;
  /* für hover in 0.2 sec */

}

#thumbnail_container article:hover {
  box-shadow: 0 0 16px #fff;
}

#thumbnail_container img:hover {
  transform: scale(1.1);
  cursor: pointer;
}

#thumbnail_container figure {
  margin: 0;
}

/* thumbnail braucht keine Beschreibung und nicht noch mehr Abstand */
#thumbnail_container figcaption {
  display: none;
}

#lightbox_img {
  grid-area: 1 / 1;
  max-width: 100%;
  max-height: 75vh;
  display: block;
  border-radius: 8px;
  box-shadow: 0 0 16px #fff;
  background: rgba(0, 0, 0, 0.2);
  pointer-events: none;
  margin-top: 8px;
}

#lightbox_caption {
  margin: 16 8px 8px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
  border-radius: 8px;
  box-shadow: 0 0 16px #fff;
  background: rgba(255, 255, 255, 0.9);
  color: #000;
}

.media {
  display: grid;
}

/* Buttons */
#close_btn,
#prev_btn,
#next_btn {
  grid-area: 1 / 1;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  z-index: 2;
  pointer-events: auto;
}

#close_btn {
  margin: 8px;
  justify-self: end;
  align-self: start;
}

#prev_btn {
  margin-left: 8px;
  justify-self: start;
  align-self: center;
}

#next_btn {
  margin-right: 8px;
  justify-self: end;
  align-self: center;
}

#close_btn:focus,
#prev_btn:focus,
#next_btn:focus {
  outline: 2px solid #fff;
  /* weißer Rahmen */
  outline-offset: 2px;
  /* Abstand zum Button-Rand */
}

#close_btn:hover,
#prev_btn:hover,
#next_btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

dialog#lightbox::backdrop {
  background: rgba(0, 0, 0, 0.0);
  transition: background 0.8s ease;
}

dialog#lightbox[open]::backdrop {
  background: rgba(0, 0, 0, 0.8);
}

dialog#lightbox[open] {
  position: fixed;
  inset: 0;
  margin: auto;
  display: grid;
  place-items: center;
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
}

/* Sicherheitsnetz: geschlossener Dialog ist garantiert unsichtbar */
dialog#lightbox:not([open]) {
  display: none !important;
}

dialog#lightbox {
  border: none;
  padding: 0;
  background: transparent;
}

dialog#lightbox figure {
  max-width: min(90vw, 1200px);
  max-height: 85vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}


/* end of dialog */