/* Galerija – gusta mreža + lightbox */
.container--wide {
  max-width: min(1400px, calc(100% - 2rem));
}

.section-gallery {
  padding-top: 1.5rem !important;
}

.sa-gallery-albums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.sa-gallery-album-card {
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--color-border, #e2e8f0);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sa-gallery-album-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1);
}

.sa-gallery-album-card__media {
  display: block;
  aspect-ratio: 4 / 3;
  background: #eef2f7;
  overflow: hidden;
}

.sa-gallery-album-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.sa-gallery-album-card:hover .sa-gallery-album-card__media img {
  transform: scale(1.04);
}

.sa-gallery-album-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 1rem 1rem;
}

.sa-gallery-album-card__title {
  font-weight: 700;
  font-size: 1.05rem;
}

.sa-gallery-album-card__meta {
  font-size: 0.85rem;
  color: var(--color-text-muted, #64748b);
}

.sa-gallery__title {
  margin: 0 0 1rem;
  font-size: 1.35rem;
}

.sa-gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 4px;
}

@media (min-width: 768px) {
  .sa-gallery__grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 5px;
  }
}

@media (min-width: 1100px) {
  .sa-gallery__grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }
}

.sa-gallery__item {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: zoom-in;
  background: #e8eef3;
  aspect-ratio: 1;
  overflow: hidden;
  display: block;
  position: relative;
}

.sa-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.sa-gallery__item:hover img,
.sa-gallery__item:focus-visible img {
  transform: scale(1.05);
  filter: brightness(1.05);
}

.sa-gallery__item:focus-visible {
  outline: 2px solid var(--color-primary, #2f9fb5);
  outline-offset: 2px;
  z-index: 1;
}

.sa-gallery-empty {
  color: var(--color-text-muted, #64748b);
}

/* Lightbox – fullscreen */
.sa-lightbox[hidden] {
  display: none !important;
}

.sa-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.92);
  color: #fff;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.32s ease;
  -webkit-tap-highlight-color: transparent;
}

.sa-lightbox.is-open {
  opacity: 1;
}

.sa-lightbox.is-closing {
  opacity: 0;
}

.sa-lightbox__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  flex-shrink: 0;
  position: relative;
  z-index: 3;
}

.sa-lightbox__counter {
  font-size: 0.95rem;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.sa-lightbox__tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sa-lightbox__btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 999px;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.85rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sa-lightbox__btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.sa-lightbox__stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem 1rem;
  position: relative;
  z-index: 1;
  touch-action: pan-y;
}

.sa-lightbox__nav {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
  z-index: 2;
}

.sa-lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sa-lightbox__figure {
  margin: 0;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: default;
}

.sa-lightbox__figure img {
  display: block;
  max-width: 92vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 2px;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform, opacity;
}

.sa-lightbox__figure img.is-open-zoom {
  animation: saLbOpenZoom 0.32s ease both;
}

.sa-lightbox__figure img.is-slide-next {
  animation: saLbSlideNext 0.32s ease both;
}

.sa-lightbox__figure img.is-slide-prev {
  animation: saLbSlidePrev 0.32s ease both;
}

.sa-lightbox__figure img.is-fade {
  animation: saLbFade 0.2s ease both;
}

.sa-lightbox__caption {
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 0.95rem;
  opacity: 0.9;
  max-width: min(40rem, 92vw);
}

@keyframes saLbOpenZoom {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes saLbSlideNext {
  from {
    opacity: 0;
    transform: translateX(36px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes saLbSlidePrev {
  from {
    opacity: 0;
    transform: translateX(-36px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes saLbFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

body.sa-lightbox-open {
  overflow: hidden;
  touch-action: none;
}

@media (prefers-reduced-motion: reduce) {
  .sa-lightbox {
    transition: none;
  }
  .sa-lightbox__figure img.is-open-zoom,
  .sa-lightbox__figure img.is-slide-next,
  .sa-lightbox__figure img.is-slide-prev,
  .sa-lightbox__figure img.is-fade {
    animation: none;
  }
}

@media (max-width: 640px) {
  .sa-gallery__grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 3px;
  }
  .sa-lightbox__stage {
    grid-template-columns: 1fr;
    position: relative;
  }
  .sa-lightbox__nav {
    position: absolute;
    bottom: 1rem;
    z-index: 2;
  }
  .sa-lightbox__nav--prev { left: 0.75rem; }
  .sa-lightbox__nav--next { right: 0.75rem; }
  .sa-lightbox__figure img {
    max-width: 92vw;
    max-height: 78vh;
  }
}
