/* Modernes, responsives Galerie- und Lightbox-Design mit Dark/Light-Mode-Unterstützung */
:root {
  --gallery-bg: #f8f9fa;
  --gallery-txt: #222;
  --gallery-border: #e0e0e0;
  --gallery-thumb-bg: #fff;
  --gallery-thumb-shadow: 0 2px 8px rgba(0,0,0,0.08);
  --gallery-thumb-radius: 12px;
  --gallery-thumb-hover: #e3e8f0;
  --gallery-lightbox-bg: rgba(0,0,0,0.96);
  --gallery-lightbox-txt: #fff;
  --gallery-lightbox-btn: #fff;
  --gallery-lightbox-btn-bg: rgba(0,0,0,0.4);
  --gallery-lightbox-btn-hover: #0a84ff;
  --gallery-chip-bg: #eef2f7;
  --gallery-chip-txt: #334155;
  --gallery-chip-active-bg: #0a84ff;
  --gallery-chip-active-txt: #fff;
  --gallery-watermark: rgba(255,255,255,0.8);
  --gallery-watermark-dark: rgba(0,0,0,0.6);
  --gallery-thumb-title-bg: rgba(0,0,0,0.6);
  --gallery-thumb-title-txt: #fff;
  --gallery-grid-cols: repeat(auto-fit, minmax(240px, 1fr));
  --gallery-animation-duration: 0.5s;
  --gallery-animation-timing: cubic-bezier(0.25, 1, 0.5, 1);
  --gallery-thumb-opacity: 1;
  --gallery-outline-color: #0a84ff;
  --gallery-favorite-color: #ff3860;
  --gallery-toolbar-bg: rgba(0,0,0,0.75);
}
[data-theme="dark"] {
  --gallery-bg: #121212;
  --gallery-txt: #f3f3f3;
  --gallery-border: #2a2a2a;
  --gallery-thumb-bg: #1e1e1e;
  --gallery-thumb-shadow: 0 2px 12px rgba(0,0,0,0.35);
  --gallery-thumb-hover: #252525;
  --gallery-lightbox-bg: rgba(10,10,10,0.98);
  --gallery-lightbox-txt: #fff;
  --gallery-lightbox-btn: #fff;
  --gallery-lightbox-btn-bg: rgba(30,30,30,0.7);
  --gallery-lightbox-btn-hover: #0a84ff;
  --gallery-chip-bg: #2a2a2a;
  --gallery-chip-txt: #cbd5e1;
  --gallery-chip-active-bg: #0a84ff;
  --gallery-chip-active-txt: #fff;
  --gallery-thumb-title-bg: rgba(0,0,0,0.7);
  --gallery-thumb-title-txt: #f3f3f3;
  --gallery-thumb-opacity: 0.95;
  --gallery-outline-color: #3291ff;
  --gallery-toolbar-bg: rgba(10,10,10,0.85);
}
/* Tag-Filter Bar */
.gallery-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  justify-content: center;
  margin: 0 1rem 1.5rem;
  max-width: 1200px;
  padding: 0 1rem;
  margin-left: auto;
  margin-right: auto;
}
.gallery-tag-btn {
  background: var(--gallery-chip-bg);
  color: var(--gallery-chip-txt);
  border: 1px solid var(--gallery-border);
  padding: .5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: .9rem;
  transition: all 0.3s var(--gallery-animation-timing);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  position: relative;
  overflow: hidden;
}
.gallery-tag-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gallery-chip-active-bg);
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s var(--gallery-animation-timing);
  z-index: -1;
  border-radius: inherit;
}
.gallery-tag-btn:hover { 
  box-shadow: 0 2px 6px rgba(10,132,255,0.15);
  transform: translateY(-1px);
}
.gallery-tag-btn.active {
  background: var(--gallery-chip-active-bg);
  color: var(--gallery-chip-active-txt);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(10,132,255,0.25);
}
.gallery-tag-btn.active::before {
  opacity: 1;
  transform: scale(1);
}
.gallery-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.25);
  color: inherit;
  border-radius: 999px;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  margin-left: 0.4rem;
  min-width: 18px;
  line-height: 1.2;
}
/* Tags auf Thumbnails */
.gallery-thumb-tags {
  position: absolute;
  left: .6rem; top: .6rem;
  display: flex; gap: .3rem; flex-wrap: wrap;
  z-index: 3;
}
.gallery-tag {
  background: rgba(0,0,0,.7);
  color: #fff;
  font-size: .7rem;
  padding: .2rem .5rem;
  border-radius: 6px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s var(--gallery-animation-timing);
}
.gallery-tag:hover {
  transform: translateY(-1px);
}
/* Wasserzeichen */
.gallery-watermark {
  position: absolute;
  right: .6rem; bottom: .6rem;
  font-size: .8rem;
  color: var(--gallery-watermark);
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
  pointer-events: none;
  z-index: 3;
  font-weight: 600;
  padding: 0.2rem 0.4rem;
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
[data-theme="dark"] .gallery-watermark { color: var(--gallery-watermark-dark); }
/* No-Save Schutz Overlay */
.no-save-shield {
  position: absolute; inset: 0;
  background: transparent;
  z-index: 2;
  cursor: zoom-in;
}
.gallery-thumb picture, .gallery-thumb img, .gallery-lightbox-img {
  -webkit-user-drag: none; 
  user-select: none; 
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: none;
}
/* Download-Schutz - erweitert */
.copy-protection-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: transparent;
  pointer-events: none;
}
/* Galerie-Sektion */
.gallery-section {
  background: var(--gallery-bg);
  color: var(--gallery-txt);
  padding: 2.5rem 0 4rem 0;
  transition: background 0.3s, color 0.3s;
  min-height: 60vh;
}
.gallery-title {
  text-align: center;
  font-size: 2.4rem;
  margin-bottom: 1.8rem;
  font-weight: 700;
  color: var(--gallery-txt);
  transition: color 0.3s;
  position: relative;
  display: inline-block;
  left: 50%;
  transform: translateX(-50%);
}
.gallery-title::after {
  content: '';
  position: absolute;
  left: 25%;
  right: 25%;
  bottom: -8px;
  height: 3px;
  background: var(--gallery-chip-active-bg);
  border-radius: 3px;
}
.gallery-description {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 2rem;
  padding: 0 1.5rem;
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--gallery-txt);
  opacity: 0.8;
}
.gallery-grid {
  display: grid;
  grid-template-columns: var(--gallery-grid-cols);
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  opacity: var(--gallery-thumb-opacity);
}
.gallery-empty {
  text-align: center;
  padding: 3rem 1rem;
  font-size: 1.1rem;
  color: var(--gallery-txt);
  opacity: 0.6;
  grid-column: 1 / -1;
}
.gallery-thumb {
  background: var(--gallery-thumb-bg);
  border-radius: var(--gallery-thumb-radius);
  box-shadow: var(--gallery-thumb-shadow);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.3s var(--gallery-animation-timing), 
              transform 0.3s var(--gallery-animation-timing),
              background 0.3s;
  border: 1px solid var(--gallery-border);
  position: relative;
  aspect-ratio: 1 / 1;
  animation: thumbFadeIn 0.5s var(--gallery-animation-timing) backwards;
}
@keyframes thumbFadeIn {
  from { 
    opacity: 0; 
    transform: translateY(15px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}
.gallery-thumb:hover {
  box-shadow: 0 6px 30px rgba(10,132,255,0.15);
  transform: translateY(-6px) scale(1.02);
  background: var(--gallery-thumb-hover);
  z-index: 1;
}
.gallery-thumb:focus-within {
  outline: 2px solid var(--gallery-outline-color);
  outline-offset: 3px;
}
.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: var(--gallery-thumb-radius);
  transition: transform 0.5s var(--gallery-animation-timing);
}
.gallery-thumb:hover img {
  transform: scale(1.05);
}
.gallery-thumb .gallery-thumb-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(0deg,rgba(0,0,0,0.7) 0%,rgba(0,0,0,0.4) 70%,rgba(0,0,0,0.0) 100%);
  color: #fff;
  font-size: 1rem;
  padding: 1.5rem 1rem 0.8rem 1rem;
  opacity: 0.98;
  pointer-events: none;
  border-radius: 0 0 var(--gallery-thumb-radius) var(--gallery-thumb-radius);
  transition: opacity 0.3s, transform 0.3s var(--gallery-animation-timing);
  transform: translateY(0);
}
.gallery-thumb:hover .gallery-thumb-caption {
  transform: translateY(-3px);
}
.gallery-like-btn {
  position: absolute;
  left: .6rem;
  bottom: .6rem;
  background: var(--gallery-lightbox-btn-bg);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: .35rem .65rem;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  transition: all 0.2s var(--gallery-animation-timing);
  z-index: 3;
  font-size: 1rem;
}
.gallery-like-btn:hover {
  background: rgba(0,0,0,.6);
  transform: scale(1.1);
}
.gallery-like-btn.active {
  color: var(--gallery-favorite-color);
}
.gallery-loading {
  text-align: center;
  padding: 2rem 0;
  grid-column: 1 / -1;
}
/* Lightbox */
.gallery-lightbox {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0; top: 0; width: 100vw; height: 100vh;
  background: var(--gallery-lightbox-bg);
  align-items: center;
  justify-content: center;
  transition: background 0.4s;
  flex-direction: column;
  overflow: hidden;
}
.gallery-lightbox.active {
  display: flex;
  animation: lightboxFadeIn 0.3s forwards;
}
@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.gallery-lightbox-toolbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: var(--gallery-toolbar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 10001;
  transition: opacity 0.3s;
}
.gallery-lightbox.controls-hidden .gallery-lightbox-toolbar {
  opacity: 0;
  pointer-events: none;
}
.glb-left, .glb-center, .glb-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.glb-center {
  flex: 1;
  justify-content: center;
}
.gallery-lightbox-title {
  font-weight: 700;
  font-size: 1.1rem;
  opacity: 0.95;
  color: var(--gallery-lightbox-txt);
  max-width: 50vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-like-toggle, .gallery-lightbox-zoom, .gallery-lightbox-fullscreen,
.gallery-lightbox-download, .gallery-lightbox-close {
  background: var(--gallery-lightbox-btn-bg);
  color: var(--gallery-lightbox-btn);
  border: none;
  border-radius: 50%;
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s var(--gallery-animation-timing);
}
.gallery-like-toggle:hover, .gallery-lightbox-zoom:hover, 
.gallery-lightbox-fullscreen:hover, .gallery-lightbox-download:hover,
.gallery-lightbox-close:hover {
  background: var(--gallery-lightbox-btn-hover);
  color: #fff;
  transform: scale(1.1);
}
.gallery-like-toggle.active {
  color: var(--gallery-favorite-color);
}
.gallery-lightbox-download {
  font-size: 1rem;
}
.gallery-lightbox-media { 
  position: relative; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  max-width: 95vw; 
  max-height: 80vh;
  flex: 1;
  width: 100%;
}
.gallery-lightbox-img {
  max-width: 90vw;
  max-height: 75vh;
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  background: #111;
  object-fit: contain;
  transition: transform 0.3s var(--gallery-animation-timing), 
              filter 0.4s var(--gallery-animation-timing);
  will-change: transform;
}
.gallery-lightbox-img.landscape { 
  max-height: 75vh; 
}
.gallery-lightbox-img.portrait { 
  max-height: 75vh; 
}
.gallery-lightbox-img.zoomed {
  cursor: zoom-out !important;
  transform: scale(2);
}
.gallery-lightbox-loader {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 48px; height: 48px;
  border: 3px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  border-top-color: var(--gallery-chip-active-bg);
  animation: spin 1s linear infinite;
  z-index: 10002;
  display: none;
}
@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
.gallery-lightbox-caption {
  color: var(--gallery-lightbox-txt);
  font-size: 1.2rem;
  margin-top: 1.2rem;
  text-align: center;
  max-width: 80vw;
  padding: 0 1rem;
  opacity: 0.9;
}
.gallery-lightbox-prev, .gallery-lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--gallery-lightbox-btn-bg);
  color: var(--gallery-lightbox-btn);
  border: none;
  border-radius: 50%;
  width: 50px; height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s var(--gallery-animation-timing);
  z-index: 10001;
  opacity: 0.8;
}
.gallery-lightbox-prev {
  left: 1.5rem;
}
.gallery-lightbox-next {
  right: 1.5rem;
}
.gallery-lightbox-prev:hover, .gallery-lightbox-next:hover {
  background: var(--gallery-lightbox-btn-hover);
  color: #fff;
  transform: translateY(-50%) scale(1.1);
  opacity: 1;
}
.gallery-lightbox.controls-hidden .gallery-lightbox-prev,
.gallery-lightbox.controls-hidden .gallery-lightbox-next {
  opacity: 0;
  pointer-events: none;
}
/* Index Anzeige */
.gallery-lightbox-index { 
  color: var(--gallery-lightbox-txt); 
  text-align: center; 
  margin-top: 0.5rem; 
  opacity: 0.75;
  font-size: 0.9rem;
  position: absolute;
  bottom: 1rem;
  left: 0;
  right: 0;
  transition: opacity 0.3s;
}
.gallery-lightbox.controls-hidden .gallery-lightbox-index {
  opacity: 0;
}
/* Shields auch in Lightbox */
.gallery-lightbox .no-save-shield { 
  position: absolute; 
  inset: 0; 
  z-index: 10000; 
  cursor: default;
}
.gallery-lightbox.no-controls .no-save-shield {
  cursor: zoom-in;
}
/* Lightbox Tags */
.gallery-lightbox-tags {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  position: absolute;
  bottom: 3rem;
  left: 0;
  right: 0;
  padding: 0 2rem;
  transition: opacity 0.3s;
}
.gallery-lightbox.controls-hidden .gallery-lightbox-tags {
  opacity: 0;
}
.gallery-lightbox-tags .gallery-tag {
  font-size: 0.8rem;
  cursor: pointer;
}
.gallery-lightbox-tags .gallery-tag:hover {
  background: var(--gallery-chip-active-bg);
}
/* Lightbox Thumbnails */
.gallery-lightbox-thumbs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.5);
  padding: 0.5rem;
  overflow-x: auto;
  max-width: 100vw;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
  transition: opacity 0.3s, transform 0.3s;
}
.gallery-lightbox.controls-hidden .gallery-lightbox-thumbs {
  opacity: 0;
  transform: translateY(100%);
}
.gallery-thumb-mini {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  opacity: 0.6;
  cursor: pointer;
  transition: all 0.2s var(--gallery-animation-timing);
  border: 2px solid transparent;
}
.gallery-thumb-mini:hover {
  opacity: 0.9;
}
.gallery-thumb-mini.active {
  opacity: 1;
  border-color: var(--gallery-chip-active-bg);
}
/* Ken-Burns Animation */
.kenburns {
  animation: kenburnsAnim 8s ease forwards;
}
@keyframes kenburnsAnim {
  0% { transform: scale(1); filter: blur(5px); }
  5% { filter: blur(0); }
  100% { transform: scale(1.05); }
}
/* Mobile */
@media (max-width: 768px) {
  .gallery-tags { 
    gap: .5rem; 
    margin-bottom: 1.2rem; 
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .gallery-tags::-webkit-scrollbar {
    display: none;
  }
  .gallery-tag-btn { 
    padding: .4rem .8rem; 
    font-size: .85rem;
    white-space: nowrap;
  }
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    padding: 0 0.8rem;
  }
  .gallery-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
  }
  .gallery-description {
    font-size: 1rem;
    padding: 0 1rem;
    margin-bottom: 1.5rem;
  }
  .gallery-lightbox-img {
    max-width: 95vw;
    max-height: 70vh;
  }
  .gallery-lightbox-toolbar {
    height: 50px;
  }
  .gallery-lightbox-close, .gallery-lightbox-prev, .gallery-lightbox-next,
  .gallery-like-toggle, .gallery-lightbox-zoom, .gallery-lightbox-fullscreen,
  .gallery-lightbox-download {
    width: 36px; height: 36px;
    font-size: 1rem;
  }
  .gallery-lightbox-title {
    font-size: 0.9rem;
    max-width: 40vw;
  }
  .gallery-lightbox-caption {
    font-size: 1rem;
    margin-top: 1rem;
  }
  .gallery-lightbox-prev {
    left: 0.8rem;
  }
  .gallery-lightbox-next {
    right: 0.8rem;
  }
  .gallery-lightbox-tags {
    bottom: 2.5rem;
    padding: 0 1rem;
  }
  .gallery-lightbox-tags .gallery-tag {
    font-size: 0.7rem;
  }
  .gallery-lightbox-thumbs .gallery-thumb-mini {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.8rem;
  }
  .gallery-thumb img {
    height: 120px;
  }
  .gallery-thumb .gallery-thumb-caption {
    font-size: 0.9rem;
    padding: 1.2rem 0.7rem 0.6rem 0.7rem;
  }
  .gallery-lightbox-img {
    max-width: 98vw;
    max-height: 60vh;
  }
  .gallery-lightbox-toolbar {
    padding: 0 0.5rem;
  }
  .glb-left, .glb-right {
    gap: 0.5rem;
  }
  .gallery-lightbox-title {
    font-size: 0.85rem;
    max-width: 35vw;
  }
  .gallery-lightbox-close, .gallery-lightbox-prev, .gallery-lightbox-next,
  .gallery-like-toggle, .gallery-lightbox-zoom, .gallery-lightbox-fullscreen,
  .gallery-lightbox-download {
    width: 32px; height: 32px;
    font-size: 0.9rem;
  }
}

/* Animationen & Transitionen */
.gallery-fade-in {
  animation: fadeIn 0.4s var(--gallery-animation-timing) forwards;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gallery-slide-in {
  animation: slideIn 0.4s var(--gallery-animation-timing) forwards;
}
@keyframes slideIn {
  from { 
    opacity: 0;
    transform: translateY(20px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

/* Prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .gallery-thumb:hover {
    transform: none;
  }
  .gallery-thumb:hover img {
    transform: none;
  }
  .gallery-thumb:hover .gallery-thumb-caption {
    transform: none;
  }
  .gallery-lightbox-prev:hover, .gallery-lightbox-next:hover {
    transform: translateY(-50%);
  }
  .kenburns {
    animation: none !important;
  }
}
