.galerie-container {
  --gallery-navy: #003f6b;
  --gallery-blue: #005691;
  --gallery-red: #dc3545;
  --gallery-ink: #1a2530;
  --gallery-muted: #4a5568;
  --gallery-line: #dfe7ef;
  --gallery-surface: #ffffff;
  --gallery-soft: #f5f8fb;
  width: min(1200px, calc(100% - 30px));
  margin: 0 auto;
  padding: 20px 0 56px;
  box-sizing: border-box;
  color: var(--gallery-ink);
  font-family: var(--font-body, 'Inter', Arial, sans-serif);
  line-height: 1.6;
}

.oesbv-scope { background: #fff; }

/* Einheitlicher ÖSBV-Subseiten-Hero */
.gallery-page-hero {
  position: relative;
  left: 50%;
  right: 50%;
  display: flex;
  align-items: center;
  width: 100vw;
  min-height: clamp(360px, 46vw, 510px);
  margin-right: -50vw;
  margin-bottom: 40px;
  margin-left: -50vw;
  overflow: hidden;
  border-bottom: 1px solid #e2e8f0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.97) 0%, rgba(255, 255, 255, 0.88) 30%, rgba(255, 255, 255, 0.42) 52%, rgba(255, 255, 255, 0.08) 76%),
    url('/bilder/css/header_hero_1200.webp') center center / cover no-repeat;
}

.gallery-page-hero-inner {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(54px, 7vw, 88px) 20px;
}

.gallery-page-hero-kicker {
  display: block;
  margin-bottom: 12px;
  color: #dc3545;
  font-family: var(--font-display, 'Oswald', Arial, sans-serif);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gallery-page-hero h1 {
  margin: 0 0 18px;
  color: #005691;
  font-family: var(--font-display, 'Oswald', Arial, sans-serif);
  font-size: clamp(2.4rem, 5.6vw, 4.8rem);
  text-transform: uppercase;
}

.gallery-page-hero-divider {
  width: 78px;
  height: 5px;
  margin: 0 0 20px;
  border-radius: 999px;
  background: #dc3545;
}

.gallery-page-hero p {
  max-width: 650px;
  color: #1a2530;
  font-weight: 700;
  line-height: 1.65;
}

.gallery-eyebrow {
  display: block;
  margin-bottom: 10px;
  color: var(--gallery-red);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.gallery-filter-panel {
  margin-bottom: 34px;
  border: 1px solid var(--gallery-line);
  border-radius: 14px;
  background: var(--gallery-surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
}

.gallery-filter-panel summary {
  position: relative;
  list-style: none;
  padding: 18px 22px;
  color: var(--gallery-navy);
  font-weight: 800;
  cursor: pointer;
}

.gallery-filter-panel summary::-webkit-details-marker { display: none; }

.gallery-filter-panel summary::after {
  position: absolute;
  top: 50%;
  right: 22px;
  width: 10px;
  height: 10px;
  content: "";
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.18s ease;
}

.gallery-filter-panel[open] summary::after {
  transform: translateY(-25%) rotate(225deg);
}

.gallery-filter-panel[open] summary {
  border-bottom: 1px solid var(--gallery-line);
}

.gallery-filter-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(145px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 16px 20px 18px;
}

.gallery-filter-field {
  display: grid;
  gap: 7px;
}

.gallery-filter-field label {
  color: var(--gallery-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gallery-filter-field select {
  width: 100%;
  min-height: 46px;
  padding: 0 38px 0 12px;
  border: 1px solid #b9c7d3;
  border-radius: 10px;
  background: #fff;
  color: var(--gallery-ink);
  font: inherit;
}

.gallery-filter-submit,
.gallery-empty a,
.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 10px;
  background: var(--gallery-blue);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    background 0.18s ease;
}

.gallery-filter-submit:hover,
.gallery-empty a:hover,
.back-link:hover {
  background: var(--gallery-navy);
  color: #fff;
  transform: translateY(-1px);
}

.gallery-section-heading,
.album-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 24px;
}

.gallery-section-heading h2,
.album-header h2 {
  margin: 0;
  color: var(--gallery-blue);
  font-family: var(--font-display, "Oswald", sans-serif);
  font-size: clamp(1.85rem, 4vw, 3rem);
  line-height: 1.08;
}

.gallery-section-heading > p,
.album-header > p {
  margin: 0;
  color: var(--gallery-muted);
  font-weight: 700;
}

.album-header {
  display: block;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--gallery-line);
  border-radius: 14px;
  background: linear-gradient(145deg, #fff, var(--gallery-soft));
}

.album-header .back-link {
  min-height: 40px;
  margin-bottom: 24px;
  padding: 0 15px;
  background: #e8eff5;
  color: var(--gallery-navy);
  font-size: 0.9rem;
}

.album-header p {
  max-width: 820px;
  margin: 12px 0 0;
  color: var(--gallery-muted);
  line-height: 1.65;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.album-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--gallery-line);
  border-radius: 14px;
  background: var(--gallery-surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.album-card:hover {
  transform: translateY(-4px);
  border-color: #b7cad9;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
}

.gallery-album-link {
  display: flex;
  height: 100%;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
}

.album-cover-wrapper {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: #dfe8ef;
}

.album-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.album-card:hover .album-cover {
  transform: scale(1.035);
}

.album-cover-placeholder {
  display: flex;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(145deg, #e9f0f5, #cfdee9);
  color: var(--gallery-navy);
  font-weight: 800;
}

.album-cover-placeholder svg {
  width: 38px;
  height: 38px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.album-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 20px;
}

.album-info h3 {
  margin: 0;
  color: var(--gallery-navy);
  font-family: var(--font-display, "Oswald", sans-serif);
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  line-height: 1.16;
}

.album-meta {
  margin: 9px 0 0;
  color: var(--gallery-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.album-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
  color: var(--gallery-muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.album-open {
  color: var(--gallery-red);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.photo-grid-single {
  grid-template-columns: minmax(0, 1fr);
  margin-inline: auto;
}

.photo-grid-single .photo-item { aspect-ratio: auto; }

.photo-grid-single .photo-item img {
  height: auto;
  max-height: none;
  object-fit: contain;
}

.photo-item {
  position: relative;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 12px;
  aspect-ratio: 4 / 3;
  background: #dfe8ef;
  cursor: zoom-in;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

.photo-item::after {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  content: "+";
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(10, 36, 59, 0.78);
  color: #fff;
  font-size: 1.25rem;
  opacity: 0;
  transform: translateY(6px);
  transition: 0.18s ease;
}

.photo-item:hover::after,
.photo-item:focus-visible::after {
  opacity: 1;
  transform: none;
}

.photo-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition:
    transform 0.35s ease,
    filter 0.35s ease;
}

.photo-item:hover img {
  transform: scale(1.035);
  filter: saturate(1.05);
}

.gallery-empty {
  display: grid;
  min-height: 280px;
  place-items: center;
  align-content: center;
  padding: 36px;
  border: 1px dashed #b8c8d4;
  border-radius: 18px;
  background: var(--gallery-soft);
  text-align: center;
}

.gallery-empty-icon {
  width: 48px;
  height: 48px;
  fill: none;
  stroke: var(--gallery-blue);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gallery-empty h2 {
  margin: 10px 0 4px;
  color: var(--gallery-navy);
}

.gallery-empty p {
  margin: 0 0 18px;
  color: var(--gallery-muted);
}

.gallery-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 30px;
}

.gallery-pagination a,
.gallery-pagination span {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  padding: 0 15px;
  border-radius: 9px;
  font-weight: 800;
}

.gallery-pagination a {
  background: var(--gallery-navy);
  color: #fff;
  text-decoration: none;
}

.gallery-pagination span {
  color: var(--gallery-muted);
}

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 60px minmax(0, 1fr);
  align-items: center;
  padding: max(8px, env(safe-area-inset-top)) 20px max(12px, env(safe-area-inset-bottom));
  background: rgba(3, 13, 23, 0.96);
  backdrop-filter: blur(10px);
}

.lightbox-top {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  font-weight: 800;
}

.lightbox button {
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
}

.lightbox button[hidden] { display: none; }

.gallery-lightbox-open { overflow: hidden; }

.lightbox-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
}

.lightbox-prev,
.lightbox-next {
  position: fixed;
  z-index: 2;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 64px;
  border-radius: 12px;
  font-size: 2.6rem;
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox figure {
  display: flex;
  grid-column: 1;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  width: calc(100dvw - 40px);
  height: 100%;
  justify-self: center;
  align-items: center;
  margin: 0;
  text-align: center;
}

.lightbox img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(calc(100dvw - 140px), 1800px);
  max-height: calc(100dvh - 138px);
  margin: 0 auto;
  border-radius: 8px;
  object-fit: contain;
  transition: opacity 0.16s ease;
  touch-action: pinch-zoom;
}

.lightbox img.is-loading { opacity: 0.35; }

.lightbox figcaption {
  overflow: hidden;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Ruhigere, hochwertige Bildbühne */
.lightbox {
  background:
    radial-gradient(circle at 50% 42%, rgba(30, 62, 88, 0.34), transparent 48%),
    rgba(2, 10, 18, 0.975);
}
.lightbox-top {
  padding: 0 6px;
}
#lightboxCounter {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.88rem;
  letter-spacing: 0.04em;
}
.lightbox figure {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.lightbox img {
  border-radius: 10px;
}
.lightbox figcaption {
  margin: 0;
  padding: 8px 72px 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  font-weight: 650;
}
.lightbox-prev,
.lightbox-next,
.lightbox-close {
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  background: rgba(255, 255, 255, 0.09) !important;
  transition:
    background 0.18s ease,
    transform 0.18s ease;
}
.lightbox-prev:hover,
.lightbox-next:hover,
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.18) !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.gallery-filter-field select:focus-visible,
.gallery-filter-submit:focus-visible,
.gallery-album-link:focus-visible,
.photo-item:focus-visible,
.back-link:focus-visible,
.lightbox button:focus-visible {
  outline: 3px solid rgba(0, 86, 145, 0.32);
  outline-offset: 3px;
}

.gallery-filter-panel summary:focus-visible {
  outline: 3px solid rgba(0, 86, 145, 0.32);
  outline-offset: -3px;
}

.lightbox button:focus-visible {
  outline-color: #fff;
}

@media (max-width: 1280px) {
  .album-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  .gallery-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-filter-submit {
    grid-column: 1/-1;
  }

  .album-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .galerie-container {
    width: min(100% - 24px, 1380px);
    padding-top: 12px;
  }

  .gallery-filter-panel summary {
    padding: 16px;
  }

  .gallery-filter-form {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .gallery-filter-submit {
    grid-column: auto;
    width: 100%;
  }

  .gallery-section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .album-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .album-card {
    border-radius: 15px;
  }

  .album-cover-wrapper {
    aspect-ratio: 16 / 9;
  }

  .album-info {
    padding: 16px;
  }

  .album-header {
    padding: 22px 18px;
    border-radius: 16px;
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .photo-grid-single {
    grid-template-columns: 1fr;
  }

  .photo-item {
    border-radius: 8px;
  }

  .photo-item::after {
    display: none;
  }

  .lightbox {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 54px minmax(0, 1fr);
    padding: max(6px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  }

  .gallery-pagination {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .gallery-pagination span {
    grid-column: 1/-1;
    grid-row: 1;
    justify-content: center;
  }

  .gallery-pagination a {
    justify-content: center;
  }

  .lightbox-prev,
  .lightbox-next {
    width: 42px;
    height: 54px;
    font-size: 2.1rem;
  }

  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }

  .lightbox img {
    max-width: calc(100dvw - 16px);
    max-height: calc(100dvh - 150px);
  }

  .lightbox figure {
    width: calc(100dvw - 16px);
    height: 100%;
  }

  .lightbox figcaption {
    max-width: 100%;
    padding: 10px 52px 0;
    font-size: 0.86rem;
    line-height: 1.35;
  }
}

@media (max-width: 768px) {
  .gallery-page-hero {
    align-items: flex-end;
    min-height: clamp(300px, 72vw, 420px);
    margin-bottom: 30px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0.92) 62%, rgba(255, 255, 255, 0.98) 100%),
      url('/bilder/css/header_hero_1200.webp') center center / cover no-repeat;
  }

  .gallery-page-hero-inner {
    padding: 76px 18px 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .album-card,
  .album-cover,
  .photo-item img,
  .photo-item::after,
  .gallery-filter-submit,
  .back-link {
    transition: none !important;
  }

  .gallery-filter-panel summary::after { transition: none !important; }
}

@media print {
  .gallery-page-hero { display: none !important; }
}
