/* Galerie foto — structură ca federatiaambulanta (grid + paginare + lightbox) */

#event-gallery h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  color: var(--teal-deep);
  text-align: center;
}

.gallery-summary {
  text-align: center;
  color: var(--muted);
  margin: 0 0 1rem;
}

.gallery-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 20px;
  max-width: 1100px;
  margin: 0 auto 1rem;
}

.gallery-count {
  color: var(--muted);
  font-size: 0.95rem;
}

.article-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  max-width: 920px;
  margin: 0 auto 1.5rem;
}

.article-gallery-event {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

.article-gallery-event .article-gallery-item {
  width: calc((100% - 40px) / 5);
  max-width: 208px;
  flex: 0 0 calc((100% - 40px) / 5);
}

.gallery-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 1100px;
  margin: 0 auto 1.5rem;
}

.gallery-page-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.gallery-page-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--white);
  color: var(--teal-deep);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.gallery-page-btn:hover:not(:disabled) {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.gallery-page-btn.active {
  background: var(--teal-deep);
  color: #fff;
  border-color: var(--teal-deep);
  font-weight: 600;
}

.gallery-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.gallery-page-nav {
  min-width: auto;
  padding: 0 14px;
}

.gallery-page-gap {
  min-width: 20px;
  text-align: center;
  color: var(--muted);
}

.article-gallery-item {
  display: block;
  overflow: hidden;
  background: var(--paper);
  aspect-ratio: 4 / 3;
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 0;
  padding: 0;
  cursor: pointer;
  width: 100%;
}

.article-gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(6, 40, 42, 0.16);
}

.article-gallery-item picture {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
}

.article-gallery-item img {
  width: 100%;
  height: 100%;
  min-height: 120px;
  object-fit: cover;
  display: block;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
}

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

.gallery-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 40, 42, 0.9);
}

.gallery-lightbox-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 56px 72px;
}

.gallery-lightbox-figure {
  margin: 0;
  max-width: min(1100px, calc(100vw - 144px));
  max-height: calc(100vh - 112px);
  text-align: center;
}

.gallery-lightbox-figure img {
  max-width: 100%;
  max-height: calc(100vh - 160px);
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 0.75rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.gallery-lightbox-caption {
  margin-top: 0.85rem;
  color: #fff;
  font-size: 0.95rem;
}

.gallery-lightbox-close,
.gallery-lightbox-nav {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  line-height: 1;
  transition: background 0.2s ease;
}

.gallery-lightbox-close:hover,
.gallery-lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.28);
}

.gallery-lightbox-close {
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  font-size: 1.8rem;
}

.gallery-lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 999px;
  font-size: 2rem;
}

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

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

@media (max-width: 900px) {
  .article-gallery-event .article-gallery-item {
    width: calc((100% - 12px) / 2);
    max-width: none;
    flex: 0 0 calc((100% - 12px) / 2);
  }
}

@media (max-width: 560px) {
  .article-gallery-event .article-gallery-item {
    width: 100%;
    flex: 0 0 100%;
  }

  .gallery-lightbox-dialog { padding: 48px 12px; }
  .gallery-lightbox-figure { max-width: calc(100vw - 24px); }
  .gallery-lightbox-nav {
    width: 40px;
    height: 40px;
    font-size: 1.6rem;
  }
  .gallery-lightbox-prev { left: 8px; }
  .gallery-lightbox-next { right: 8px; }
}
