/* ===== Referenciák galéria (izolált osztályok) ===== */
.refs-section {
  width: min(1100px, 92vw);
  margin: 20px auto;
}

.refs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.refs-tile {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #e8e2da;
  cursor: zoom-in;
  /* egységes csempearány; állítható igény szerint */
  aspect-ratio: 4 / 3;
  display: block;
}

.refs-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.refs-tile:focus-visible img,
.refs-tile:hover img {
  transform: scale(1.03);
  filter: saturate(1.05);
}

/* ===== Lightbox ===== */
.refs-lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
}

.refs-lightbox.open {
  display: block;
}

.refs-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

/* módosított figure: nem nő túl a viewporton */
.refs-figure {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  width: min(92vw, 1200px);
  max-width: min(92vw, 1200px);
  max-height: 86vh;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  overflow: visible;
  z-index: 1;
}

/* kép mindig a figure-n belül marad, arányosan zsugorodik */
.refs-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  background: #111;
}

.refs-figure figcaption {
  text-align: center;
  color: #fff;
  font-size: 0.95rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* ===== Navigáció gombok ===== */
.refs-nav,
.refs-close {
  position: absolute;
  border: none;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(2px);
  z-index: 3; /* mindig a kép fölött */
}

.refs-nav:hover,
.refs-close:hover {
  background: rgba(0, 0, 0, 0.55);
}

.refs-prev {
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
}

.refs-next {
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
}

.refs-close {
  right: 14px;
  top: 14px;
  font-size: 28px;
  line-height: 1;
}

/* extra tér a nyilaknak nagyobb képernyőkön */
@media (min-width: 681px) {
  .refs-figure {
    padding-inline: 56px;
  }
}

/* ===== Kisebb kijelzők ===== */
@media (max-width: 680px) {
  .refs-grid {
    gap: 10px;
  }

  .refs-tile {
    aspect-ratio: 16 / 10;
  }

  .refs-prev,
  .refs-next {
    width: 40px;
    height: 40px;
  }
}
