.gallery {
  padding: var(--space-6) 0;
  background: var(--color-bg);
}
.gallery--full {
  padding-top: var(--space-4);
}

.gallery__inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

.gallery__inner h2 {
  font-size: var(--fs-h2);
  margin-bottom: var(--space-5);
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

.gallery__item {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius-m);
}
.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-medium);
}
.gallery__item:hover img {
  transform: scale(1.06);
}

.gallery__number {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(10, 9, 10, 0.72);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
}

.gallery__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--space-3);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.75));
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-align: left;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.gallery__item:hover .gallery__caption,
.gallery__item:focus-visible .gallery__caption {
  opacity: 1;
  transform: translateY(0);
}
.gallery__title {
  font-family: var(--font-display);
  font-weight: 600;
  color: #fff;
}
.gallery__category {
  font-size: 0.8rem;
  color: var(--color-accent-tint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (min-width: 640px) {
  .gallery__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 1000px) {
  .gallery__grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .gallery:not(.gallery--full) .gallery__item:nth-child(5n+1) {
    grid-row: span 2;
    aspect-ratio: 1 / 2.06;
  }
}

/* Startseiten-Teaser: Bild- und Video-Karte im Stil der Service-Cards */
.gallery-teaser {
  padding: var(--space-6) 0;
  background: var(--color-bg);
}
.gallery-teaser__inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--space-3);
}
.gallery-teaser__inner h2 {
  font-size: var(--fs-h2);
  margin-bottom: var(--space-2);
}
.gallery-teaser__text {
  max-width: 60ch;
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}
.gallery-teaser__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}
.gallery-teaser__card p {
  margin-bottom: 0;
  font-size: 0.98rem;
  max-width: 40ch;
}
.gallery-teaser__card .btn {
  margin-top: var(--space-3);
}
.gallery-teaser__grid .icon-badge {
  width: 88px;
  height: 88px;
}
.gallery-teaser__grid .icon-badge .icon {
  width: 44px;
  height: 44px;
}

@media (min-width: 700px) {
  .gallery-teaser__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 9, 10, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
}
.lightbox[hidden] {
  display: none;
}
.lightbox__image {
  max-width: min(90vw, 1100px);
  max-height: 80vh;
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 320ms ease, transform 320ms ease;
}
.lightbox__image.is-loaded {
  opacity: 1;
  transform: scale(1);
}
.lightbox__video {
  max-width: min(90vw, 1100px);
  max-height: 80vh;
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 320ms ease, transform 320ms ease;
}
.lightbox__video.is-loaded {
  opacity: 1;
  transform: scale(1);
}
.lightbox__video[hidden] {
  display: none;
}
.lightbox__caption {
  position: absolute;
  bottom: var(--space-4);
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  font-family: var(--font-display);
}
.lightbox__close,
.lightbox__prev,
.lightbox__next {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-text);
  line-height: 1;
  transition: background var(--transition-fast), transform var(--transition-fast);
  z-index: 1;
}
.lightbox__close {
  font-size: 1.7rem;
}
.lightbox__prev svg,
.lightbox__next svg {
  width: 24px;
  height: 24px;
}
.lightbox__close:hover,
.lightbox__prev:hover,
.lightbox__next:hover {
  background: var(--color-accent-hover);
  transform: scale(1.08);
}
.lightbox__prev:hover,
.lightbox__next:hover {
  transform: translateY(-50%) scale(1.08);
}
.lightbox__close {
  top: var(--space-3);
  right: var(--space-3);
}
.lightbox__prev {
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
}
.lightbox__next {
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
}
.lightbox__prev[hidden],
.lightbox__next[hidden] {
  display: none;
}
@media (max-width: 600px) {
  .lightbox__close,
  .lightbox__prev,
  .lightbox__next {
    width: 40px;
    height: 40px;
  }
  .lightbox__close {
    font-size: 1.4rem;
  }
  .lightbox__prev svg,
  .lightbox__next svg {
    width: 20px;
    height: 20px;
  }
  .lightbox__prev {
    left: var(--space-1);
  }
  .lightbox__next {
    right: var(--space-1);
  }
}
