/* Gallerij — publiek & beheer */

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.gallery-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(26, 34, 48, 0.88);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
}

.gallery-filter:hover {
  border-color: var(--accent);
  color: var(--text);
  text-decoration: none;
}

.gallery-filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.gallery-count {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.gallery-filter.active .gallery-count {
  background: rgba(255, 255, 255, 0.25);
}

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

.gallery-item {
  background: rgba(26, 34, 48, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, border-color 0.2s;
}

@media (min-width: 640px) {
  .gallery-item.gallery-size-full {
    grid-column: 1 / -1;
  }

  .gallery-item.gallery-size-large {
    grid-column: span 2;
  }
}

.gallery-item.gallery-size-small {
  max-width: 220px;
}

.gallery-item.gallery-align-left {
  justify-self: start;
}

.gallery-item.gallery-align-center {
  justify-self: center;
}

.gallery-item.gallery-align-right {
  justify-self: end;
}

.gallery-item.gallery-size-full.gallery-align-left,
.gallery-item.gallery-size-full.gallery-align-right {
  max-width: none;
}

.gallery-item.gallery-size-full.gallery-align-left .gallery-thumb,
.gallery-item.gallery-size-full.gallery-align-left .gallery-media-wrap,
.gallery-item.gallery-size-full.gallery-align-left .gallery-audio-wrap {
  max-width: 75%;
  margin-right: auto;
}

.gallery-item.gallery-size-full.gallery-align-right .gallery-thumb,
.gallery-item.gallery-size-full.gallery-align-right .gallery-media-wrap,
.gallery-item.gallery-size-full.gallery-align-right .gallery-audio-wrap {
  max-width: 75%;
  margin-left: auto;
}

.gallery-item.gallery-size-full.gallery-align-center .gallery-thumb,
.gallery-item.gallery-size-full.gallery-align-center .gallery-media-wrap,
.gallery-item.gallery-size-full.gallery-align-center .gallery-audio-wrap {
  max-width: 75%;
  margin-left: auto;
  margin-right: auto;
}

.gallery-item:hover {
  transform: translateY(-3px);
  border-color: rgba(196, 30, 58, 0.45);
}

.gallery-thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: #000;
  cursor: zoom-in;
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.gallery-thumb:hover img {
  transform: scale(1.05);
}

.gallery-zoom {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.gallery-thumb:hover .gallery-zoom {
  opacity: 1;
}

.gallery-media-wrap video {
  width: 100%;
  display: block;
  max-height: 280px;
  background: #000;
}

.gallery-audio-wrap {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  min-height: 140px;
  justify-content: center;
}

.gallery-audio-icon {
  font-size: 2rem;
  color: var(--gold);
}

.gallery-audio-wrap audio {
  width: 100%;
}

.gallery-caption {
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  line-height: 1.4;
  border-top: 1px solid var(--border);
}

.gallery-caption strong {
  display: block;
  margin-bottom: 0.2rem;
}

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

.gallery-empty {
  text-align: center;
  padding: 2.5rem;
}

.gallery-extra {
  margin-top: 1rem;
}

/* Lightbox */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.gallery-lightbox[hidden] {
  display: none !important;
}

.gallery-lightbox-inner {
  max-width: min(92vw, 1100px);
  max-height: 85vh;
  text-align: center;
}

.gallery-lightbox-inner img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.gallery-lightbox-meta {
  margin-top: 1rem;
  color: var(--text);
  font-size: 0.95rem;
}

.gallery-lightbox-meta strong {
  display: block;
  color: var(--gold);
  margin-bottom: 0.25rem;
}

.gallery-lightbox-close,
.gallery-lightbox-prev,
.gallery-lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.75rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1;
}

.gallery-lightbox-close:hover,
.gallery-lightbox-prev:hover,
.gallery-lightbox-next:hover {
  background: var(--accent);
}

.gallery-lightbox-close {
  top: 1.5rem;
  right: 1.5rem;
}

.gallery-lightbox-prev {
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}

.gallery-lightbox-next {
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}

/* Admin */
.gallery-upload-panel h2,
.gallery-upload-panel h2 + * {
  margin-bottom: 0;
}

.gallery-upload-tabs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.gallery-upload-box {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  background: rgba(12, 15, 20, 0.4);
}

.gallery-upload-box[open] {
  border-color: rgba(196, 30, 58, 0.4);
}

.gallery-upload-box summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--gold);
  padding: 0.35rem 0;
  list-style: none;
}

.gallery-upload-box summary::-webkit-details-marker {
  display: none;
}

.gallery-upload-form {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
  max-width: 480px;
}

.gallery-upload-form label span {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.gallery-upload-form input[type="text"],
.gallery-upload-form input[type="file"] {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
}

.gallery-file-label input[type="file"] {
  padding: 0.5rem;
}

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

.gallery-admin-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(12, 15, 20, 0.5);
}

.gallery-admin-preview {
  position: relative;
  background: #000;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-admin-preview img,
.gallery-admin-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-admin-preview audio {
  width: 90%;
}

.gallery-type-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.gallery-admin-meta {
  padding: 1rem;
  display: grid;
  gap: 0.5rem;
}

.gallery-admin-meta label span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.gallery-admin-meta input {
  width: 100%;
  padding: 0.45rem 0.65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
}

.gallery-admin-meta .form-actions {
  margin-top: 0.25rem;
}

.gallery-admin-delete {
  padding: 0 1rem 1rem;
}

@media (max-width: 600px) {
  .gallery-masonry {
    grid-template-columns: 1fr;
  }
  .gallery-lightbox-prev,
  .gallery-lightbox-next {
    display: none;
  }
}
