.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.gallery-item {
  display: block;
  padding: 0;
  border: none;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  cursor: zoom-in;
  overflow: hidden;
  aspect-ratio: 3 / 4;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.gallery-item:hover img { transform: scale(1.02); opacity: 0.92; }

.lightbox {
  border: none;
  background: var(--gallery-bg);
  color: var(--on-dark);
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
}
/* Eigenes display:flex überschreibt sonst unconditional die native
   "dialog:not([open]) { display:none }"-Regel des Browsers (Autor-Styles
   schlagen immer User-Agent-Styles, unabhängig von der Spezifität) –
   deshalb explizit an [open] koppeln, sonst bleiben die Lightbox-Buttons
   auch im geschlossenen Zustand sichtbar. */
.lightbox[open] { display: flex; }
.lightbox::backdrop { background: var(--gallery-bg); }

.lightbox-image {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
}

.lightbox-close, .lightbox-prev, .lightbox-next {
  position: fixed;
  background: var(--gallery-ctl);
  border: none;
  border-radius: 50%;
  color: var(--on-dark);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  width: 3rem;
  height: 3rem;
  padding: 0;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { background: var(--gallery-ctl-hover); }
.lightbox :focus-visible { outline-color: var(--on-dark); }

.lightbox-close { top: 1rem; right: 1rem; }
.lightbox-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1rem; top: 50%; transform: translateY(-50%); }

@media (max-width: 600px) {
  .lightbox-prev, .lightbox-next { font-size: 1.5rem; width: 2.5rem; height: 2.5rem; }
}
