/* Container */
.besdgalerie {
  position: relative;
  width: 100%;
  gap: var(--besd-gap);
  margin: 5px 0 2px 0;
}

/* ---------- Fallback--------- */
.besdgalerie:not(.is-mosaic) {
  display: grid;
  gap: var(--besd-gap);
  grid-template-columns: repeat(2, minmax(0, 1fr)); /* min. 2 */
}
@media (min-width: 700px) {
  .besdgalerie:not(.is-mosaic) {
    grid-template-columns: repeat(3, minmax(0, 1fr)); /* 3 zwischen 700–1199 */
  }
}
@media (min-width: 1200px) {
  .besdgalerie:not(.is-mosaic) {
    grid-template-columns: repeat(4, minmax(0, 1fr)); /* max. 4 bei voller Breite */
  }
}
.besdgalerie:not(.is-mosaic) .besdgalerie__item {
  aspect-ratio: 1/1;
  display: block;
}

/* ---------- Kacheln ---------- */
.besdgalerie__item {
  position: relative;
  overflow: hidden;
  display: inline-block;
  vertical-align: top;
  border-radius: var(--besd-radius);
      box-shadow:   box-shadow: var(--bildshadow); 
  background: #f3f4f6;
  text-decoration: none;
  color: inherit;
}

.besdgalerie__item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform: scale(1.001);
  transition: transform .25s ease;
}
.besdgalerie__item:hover img { transform: scale(1.03); }

/* Tastaturfokus */
.besdgalerie__item:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Markerklasse */
.besdgalerie.is-mosaic {
  font-size: 0;
  line-height: 0;
}

/* ---------- Thumbnail-Untertitel (Overlay) ---------- */
.besdgalerie__cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 10px 10px 9px 10px;
 
  line-height: 1.2;
  color: #fff;
 
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.70) 100%);
	text-shadow: 1px 1px 3px #000;
    font-size: 17px;
    font-family: 'Roboto Condensed';
}

/* ---------- Lightbox ---------- */
.besd-lb {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--besd-lb-bg);
  padding: clamp(12px, 3vw, 32px);

  /* wichtig für Swipe */
  touch-action: none;
}
.besd-lb.is-open { display: flex; }

.besd-lb__img {
  max-width: 100%;
  max-height: calc(100vh - 140px);
  object-fit: contain;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

.besd-lb__caption {
  position: absolute;
  left: 0; right: 0;
  bottom: clamp(8px, 2.5vw, 24px);
  text-align: center;
  color: #e5e7eb;
  font-size: 14px;
  line-height: 1.4;
  padding: 0 16px;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
  z-index: 3; /* über Bild */
}

.besd-lb__close {
  position: absolute;
  top: 10px; right: 10px;
  width: var(--besd-lb-nav-size);
  height: var(--besd-lb-nav-size);
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  opacity: .9;

  /* X über Pfeil-Klickflächen */
  z-index: 5;
}
.besd-lb__close:hover,
.besd-lb__close:focus { opacity: 1; outline: 2px solid #fff; outline-offset: 2px; }

.besd-lb__nav {
  position: absolute;
  top: 0; bottom: 0;
  width: 20%;
  max-width: 160px;
  min-width: 72px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 48px;
  cursor: pointer;
  opacity: .75;

  /* unter X */
  z-index: 2;
}
.besd-lb__prev { left: 0; text-align: left; }
.besd-lb__next { right: 0; text-align: right; }
.besd-lb__nav:hover,
.besd-lb__nav:focus { opacity: 1; outline: none; }

html.besd-lb-open { overflow: hidden; }

/* Innerer Schatten für jede Kachel */
.besdgalerie__item {
  position: relative;
}
.besdgalerie__item::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 44px rgba(0,0,0,0.5);
  z-index: 2; /* über Bild, unter Caption */
}