/* ── Gallery page header ──────────────────────────────────── */
.gallery-header {
  background:
    linear-gradient(
      180deg,
      rgba(4, 13, 26, 0.55) 0%,
      rgba(7, 21, 38, 0.75) 100%
    ),
    url("../multimedia/Gallery/header.webp") center center / cover no-repeat;
}

/* ── Gallery filters ──────────────────────────────────────── */
.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 28px 0 32px;
}

.gallery-filter-btn {
  padding: 9px 20px;
  border: 1px solid rgba(10, 30, 60, 0.14);
  border-radius: 999px;
  background: var(--white);
  color: var(--blue);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.12s;
}

.gallery-filter-btn:hover {
  border-color: var(--sky);
  color: var(--sky);
}

.gallery-filter-btn:active {
  transform: translateY(1px);
}

.gallery-filter-btn.is-active {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}

.gallery-filter-btn:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
}

/* ── Gallery grid ─────────────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 220px;
  gap: 16px;
}

.gallery-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
}

.gallery-item:nth-child(1),
.gallery-item:nth-child(5),
.gallery-item:nth-child(9) {
  grid-row: span 2;
}

.gallery-item.is-hidden {
  display: none;
}

/* Real images instead of placeholders */
.gallery-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  inset: 0;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-item:hover .gallery-photo {
  transform: scale(1.05);
}

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 20px 18px;
  background: linear-gradient(0deg, rgba(4, 13, 26, 0.88) 0%, transparent 100%);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
  opacity: 0;
  transition: opacity 0.3s;
}

.gallery-item:hover .gallery-caption {
  opacity: 1;
}

/* ── Lightbox ─────────────────────────────────────────────── */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s;
}

.gallery-lightbox.is-open {
  opacity: 1;
  pointer-events: all;
}

.gallery-lightbox-bg {
  position: absolute;
  inset: 0;
  background: rgba(4, 13, 26, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.gallery-lightbox-figure {
  position: relative;
  z-index: 1;
  max-width: min(1100px, 90vw);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(0.96);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-lightbox.is-open .gallery-lightbox-figure {
  transform: scale(1);
}

.gallery-lightbox-figure img {
  max-width: 100%;
  max-height: 74vh;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  object-fit: contain;
}

.gallery-lightbox-figure figcaption {
  margin-top: 16px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
}

.gallery-lightbox-x,
.gallery-lightbox-nav {
  position: absolute;
  z-index: 2;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
}

.gallery-lightbox-x:hover,
.gallery-lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
}

.gallery-lightbox-x {
  top: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
}

.gallery-lightbox-x svg {
  width: 18px;
  height: 18px;
}

.gallery-lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
}

.gallery-lightbox-nav svg {
  width: 20px;
  height: 20px;
}

.gallery-lightbox-prev {
  left: 24px;
}

.gallery-lightbox-next {
  right: 24px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 960px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .gallery-item:nth-child(9) {
    grid-row: span 1;
  }
}

@media (max-width: 768px) {
  .gallery-grid {
    grid-auto-rows: 180px;
  }
  .gallery-item:nth-child(1),
  .gallery-item:nth-child(5) {
    grid-row: span 1;
  }
}

@media (max-width: 640px) {
  /* Filteri: centrirano i kompaktnije da se uredno prelome */
  .gallery-filters {
    justify-content: center;
    gap: 8px;
    margin: 24px 0 28px;
  }
  .gallery-filter-btn {
    padding: 8px 15px;
    font-size: 13px;
  }

  .gallery-lightbox-nav {
    width: 38px;
    height: 38px;
  }
  .gallery-lightbox-prev {
    left: 8px;
  }
  .gallery-lightbox-next {
    right: 8px;
  }
  .gallery-lightbox-x {
    top: 12px;
    right: 12px;
  }
}

@media (max-width: 520px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 200px;
  }
}
