/* RESET I BAZA */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --img-base-width: 320px;
  --single-scale: 0.3;
}

body {
  background: #ffffff;
  font-family: system-ui, Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

/* KONTENER GŁÓWNY (WYŚRODKOWANIE) */
.wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 40px 20px;
  text-align: center;
}

/* POJEDYNCZY ELEMENT MENU */
.item {
  width: var(--img-base-width);
  max-width: 90%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* KONTENER OBRAZKÓW (KLUCZ DO NAKŁADANIA) */
.img-wrap {
  position: relative; /* Pozwala obrazkowi .hover nałożyć się idealnie na .normal */
  display: inline-block;
  width: 100%;
  text-decoration: none;
  overflow: hidden;
  border-radius: 6px;
}

/* PIERWSZY OBRAZEK (STATYCZNY) */
.img-wrap img.single-img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 1 !important;
}

/* OBRAZEK PODSTAWOWY (DLA LINKÓW Z HOVEREM) */
.img-wrap img.normal {
  display: block;
  width: 100%;
  height: auto;
  opacity: 1;
  transition: opacity 0.25s ease-in-out;
}

/* OBRAZEK PO NAJECHANIU (NAŁOŻONY NA WIERZCH) */
.img-wrap img.hover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
  pointer-events: none;
}

/* Klasa no-cover dla elementu 5 */
.img-wrap img.hover.no-cover {
  object-fit: contain;
  background: #ffffff;
}

/* ZMIANA PO NAJECHANIU (HOVER) LUB FOKUSIE */
.img-wrap:hover img.normal,
.item:focus-within img.normal {
  opacity: 0;
}

.img-wrap:hover img.hover,
.item:focus-within img.hover {
  opacity: 1;
}

/* SKALOWANIE POSZCZEGÓLNYCH ELEMENTÓW */
.single-link.tiny {
  width: calc(var(--img-base-width) * var(--single-scale));
}

.item.scale-150 {
  width: calc(var(--img-base-width) * 1.5);
}

.item.scale-130 {
  width: calc(var(--img-base-width) * 1.3);
}

/* POWIADOMIENIE "SKOPIOWANO" */
.copied-msg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10;
  white-space: nowrap;
}

.copied-msg.show {
  opacity: 1;
}

/* STATYCZNY TEKST */
.static-text {
  color: #111;
  font-size: 18px;
}

@media (max-width: 480px) {
  :root {
    --img-base-width: 260px;
  }
}

/* ==========================================
   SIATKA GALERII ZDJĘĆ
   ========================================== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 zdjęcia w rzędzie na komputera */
  gap: 16px; /* Niewielkie odstępy na ekranach komputera */
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.gallery-item {
  overflow: hidden;
  border-radius: 4px;
  cursor: pointer;
  background: #f5f5f5;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.03); /* Delikatne powiększenie po najechaniu */
}

/* MODYFIKACJA MOBILNA: Obrazki dochodzące do krawędzi */
@media (max-width: 768px) {
  .wrap {
    padding-left: 0;
    padding-right: 0;
  }

  .gallery-grid {
    grid-template-columns: repeat(3, 1fr); /* Zachowanie 3 w rzędzie lub zmiana na 1/2 zależnie od preferencji */
    gap: 2px; /* Zminimalizowane odstępy lub 0 dla pełnego przylegania do krawędzi */
    width: 100vw;
  }

  .gallery-item {
    border-radius: 0; /* Brak zaokrągleń przy krawędziach mobilnych */
  }
}

/* ==========================================
   LIGHTBOX (POWIĘKSZENIE ZDJĘĆ)
   ========================================== */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9); /* Przyciemnione tło */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 9999;
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-content {
  max-width: 85%;
  max-height: 85%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* Przycisk zamknięcia */
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 36px;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.lightbox-close:hover {
  color: #ccc;
}

/* Strzałki nawigacyjne */
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  font-size: 28px;
  padding: 16px 12px;
  cursor: pointer;
  user-select: none;
  border-radius: 4px;
  transition: background 0.2s;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

@media (max-width: 480px) {
  .lightbox-prev { left: 5px; }
  .lightbox-next { right: 5px; }
  .lightbox-close { top: 10px; right: 15px; }
}
