/* =========================================
   ZDRAVÉ SLOVENSKO 2026 – STABILNÝ MASONRY
========================================= */

.gallery-head {
  margin: 0;
  background: #fff !important;
}

.gallery-head .newsletter-wrapper {
  background: #fff !important;
}

.gallery-head .newsletter-text {
  color: var(--color-primary) !important;
  font-weight: 700;
  margin-top: 40px;
}

/* PAGE */

.gallery-page {
  padding: 20px 0 80px;
  background: #fff;
}

.gallery-page-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 35px;
}

.gallery-page-intro {
  margin: 0;
  color: var(--color-text);
  font-family: var(--font-main-inter);
  font-size: var(--font-size-text);
  line-height: 1.4;
}

.gallery-back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  color: var(--color-primary);
  font-family: var(--font-main-compact);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}

/* =========================================
   MASONRY
========================================= */

.gallery-masonry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.gallery-column {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.gallery-item {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: 6px;
  background: #f1f2f6;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

/*
   aspect-ratio príde inline z PHP/JS.
   Preto má dlaždica správnu výšku ešte PRED stiahnutím JPG.
*/
.gallery-item img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;

  /*
       Žiadny fade/transition.
       Po načítaní sa fotografia iba zobrazí v už existujúcom priestore.
    */
  opacity: 1;
}

.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

@media (hover: hover) {
  .gallery-item:hover::after {
    opacity: 0.08;
  }
}

.gallery-sentinel {
  width: 100%;
  height: 1px;
}

.gallery-empty {
  margin: 30px 0;
  color: var(--color-text);
  font-family: var(--font-main-inter);
}

/* =========================================
   LIGHTBOX
========================================= */

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

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 55px 90px 45px;

  background: rgba(7, 9, 22, 0.96);

  opacity: 0;
  visibility: hidden;

  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

.gallery-lightbox.open {
  opacity: 1;
  visibility: visible;
}

.gallery-lightbox-content {
  position: relative;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: 100%;
}

.gallery-lightbox-content img {
  display: block;

  max-width: 100%;
  max-height: calc(100vh - 125px);

  width: auto;
  height: auto;

  object-fit: contain;

  box-shadow: 0 15px 60px rgba(0, 0, 0, 0.35);
}

.gallery-lightbox-counter {
  position: absolute;

  left: 50%;
  bottom: -28px;

  transform: translateX(-50%);

  color: rgba(255, 255, 255, 0.75);

  font-family: var(--font-main-inter);
  font-size: 14px;

  white-space: nowrap;
}

.gallery-lightbox-actions {
  position: absolute;

  top: 20px;
  right: 25px;

  z-index: 20003;
}

.gallery-lightbox-close {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 42px;
  height: 42px;

  padding: 0;
  border: 0;

  background: transparent;
  color: #fff;

  font-family: Arial, sans-serif;
  font-size: 42px;
  font-weight: 200;
  line-height: 1;

  cursor: pointer;

  opacity: 0.85;
}

.gallery-lightbox-prev,
.gallery-lightbox-next {
  position: fixed;

  top: 50%;

  z-index: 20002;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 55px;
  height: 80px;

  padding: 0;

  transform: translateY(-50%);

  border: 0;

  background: rgba(0, 0, 0, 0.25);
  color: #fff;

  font-family: Arial, sans-serif;
  font-size: 58px;
  font-weight: 200;
  line-height: 1;

  cursor: pointer;

  opacity: 0.85;
}

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

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

body.gallery-open {
  overflow: hidden;
}

/* =========================================
   FOOTER
========================================= */

.gallery-footer {
  padding: 30px 0;

  background: var(--color-primary);
  color: #fff;
}

.gallery-footer-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 30px;

  font-family: var(--font-main-inter);
  font-size: 15px;
}

.gallery-footer-wrapper img {
  display: block;

  width: 105px;
  height: auto;
}

/* =========================================
   MOBILE
========================================= */

@media (max-width: 768px) {
  .gallery-head .newsletter-text {
    color: var(--color-primary) !important;
    font-weight: 700;
    margin-top: 20px;
  }
  .gallery-page {
    padding: 0px 0 55px;
  }

  .gallery-page-top {
    display: block;
    margin-bottom: 25px;
  }

  .gallery-page-intro {
    margin-bottom: 18px;
  }

  .gallery-back {
    font-size: 16px;
  }

  .gallery-masonry {
    gap: 6px;
  }

  .gallery-column {
    gap: 6px;
  }

  /*
       Mobil = iba dva stĺpce.
       Tretí JS vôbec nepoužije a CSS ho schová.
    */
  .gallery-column-third {
    display: none;
  }

  .gallery-item {
    border-radius: 4px;
  }

  .gallery-lightbox {
    padding: 55px 10px 45px;
  }

  .gallery-lightbox-content img {
    max-width: 100%;
    max-height: calc(100vh - 110px);
  }

  .gallery-lightbox-actions {
    top: 10px;
    right: 10px;
  }

  .gallery-lightbox-prev,
  .gallery-lightbox-next {
    width: 42px;
    height: 65px;

    font-size: 48px;
  }

  .gallery-lightbox-prev {
    left: 0;
  }

  .gallery-lightbox-next {
    right: 0;
  }

  .gallery-footer-wrapper {
    flex-direction: column;
    justify-content: center;

    text-align: center;
  }
}
