/* VH Galerie – Raster, Slideshow und Lightbox. Farben über Variablen, das Template kann sie überschreiben. */
.vhg {
  --vhg-accent: var(--vh-orange, #f08a1c);
  --vhg-surface: var(--vh-surface, #1e1230);
  --vhg-line: var(--vh-line, rgba(127, 127, 127, .25));
  --vhg-fg: inherit;
  --vhg-radius: 10px;
  --vhg-gap: 10px;
  margin: 1.5rem 0 2rem;
  padding: 0;
}

.vhg__title {
  font-family: var(--vh-font-display, "Barlow Condensed", "Arial Narrow", Arial, sans-serif);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: .03em;
  text-transform: uppercase;
  margin: 0 0 .75rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.vhg__title::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--vhg-line);
}

.vhg__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--vhg-thumb, 180px), 100%), 1fr));
  gap: var(--vhg-gap);
}

.vhg__item {
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.vhg__link {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: var(--vhg-radius);
  background: var(--vhg-surface);
  aspect-ratio: 4 / 3;
}

.vhg__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease, opacity .3s ease;
}

.vhg__link:hover .vhg__img,
.vhg__link:focus-visible .vhg__img {
  transform: scale(1.05);
}

.vhg__link:focus-visible {
  outline: 3px solid var(--vhg-accent);
  outline-offset: 2px;
}

.vhg__caption {
  font-size: .85rem;
  line-height: 1.3;
  opacity: .8;
}

/* Slideshow: horizontal scrollen mit Einrasten */
.vhg--slideshow {
  position: relative;
}

.vhg--slideshow .vhg__list {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  gap: var(--vhg-gap);
  scrollbar-width: thin;
}

.vhg--slideshow .vhg__item {
  flex: 0 0 min(100%, 720px);
  scroll-snap-align: start;
}

.vhg--slideshow .vhg__link {
  aspect-ratio: 16 / 10;
}

.vhg__nav {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: .5rem;
}

.vhg__btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--vhg-line);
  background: var(--vhg-surface);
  color: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.vhg__btn:hover {
  border-color: var(--vhg-accent);
  color: var(--vhg-accent);
}

/* Lightbox */
.vhg-lightbox {
  border: 0;
  padding: 0;
  margin: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  background: rgba(10, 4, 20, .94);
  color: #fff;
}

.vhg-lightbox::backdrop {
  background: rgba(10, 4, 20, .94);
}

.vhg-lightbox__stage {
  position: absolute;
  inset: 56px 64px 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vhg-lightbox__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
  user-select: none;
}

.vhg-lightbox__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 64px;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: .95rem;
}

.vhg-lightbox__counter {
  font-variant-numeric: tabular-nums;
  color: #f08a1c;
  font-weight: 600;
  white-space: nowrap;
}

.vhg-lightbox__btn {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.vhg-lightbox__btn:hover,
.vhg-lightbox__btn:focus-visible {
  background: #f08a1c;
  color: #1d1526;
  outline: none;
}

.vhg-lightbox__close {
  top: calc(8px + env(safe-area-inset-top, 0px));
  right: max(8px, env(safe-area-inset-right, 0px));
}

.vhg-lightbox__prev {
  left: max(8px, env(safe-area-inset-left, 0px));
  top: 50%;
  transform: translateY(-50%);
}

.vhg-lightbox__next {
  right: max(8px, env(safe-area-inset-right, 0px));
  top: 50%;
  transform: translateY(-50%);
}

@media (max-width: 640px) {
  .vhg-lightbox__stage {
    inset: 56px 8px 72px;
  }

  .vhg-lightbox__prev,
  .vhg-lightbox__next {
    top: auto;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vhg__img,
  .vhg--slideshow .vhg__list {
    transition: none;
    scroll-behavior: auto;
  }
}
