/* Gallery page (/galeria): full-width photo grid + lightbox. */

.photo-gallery {
  /* The "Akceptujemy płatności kartą" label below the page is pulled 17px up onto
     its box's border (pages.css .payment-wrap .payment), so leave room for it plus
     the same ~26px gap other pages have. */
  padding: 16px 0 43px;
}

/* Same look as the other page headings (#content h1 in pages.css). */
.photo-gallery h1 {
  font: normal 25px/27px 'museo300', Arial, Helvetica, sans-serif;
  color: #ef2c42;
  border-bottom: 1px solid #e4e4e4;
  margin: 0 0 21px;
  padding: 0 0 16px 3px;
}

/* ---- grid ---- */

.photo-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  /* 3 columns: the 27 photos fill exactly 9 rows, on every screen size. */
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.photo-grid li {
  margin: 0;
  padding: 0;
  background: none;
}

.photo-grid__link {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 6px;
  background: #f3f0f7;
  box-shadow: 0 1px 3px rgba(78, 47, 138, 0.15);
}

.photo-grid__link img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover; /* crop to a square, keeping the centre */
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.photo-grid__link:hover img,
.photo-grid__link:focus-visible img {
  transform: scale(1.05);
  opacity: 0.92;
}

.photo-grid__link:focus-visible {
  outline: 3px solid #ef2c42;
  outline-offset: 2px;
}

@media only screen and (max-width: 767px) {
  .photo-grid {
    gap: 6px;
  }
}

/* ---- lightbox ---- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 12, 35, 0.92);
}

.lightbox[hidden] {
  display: none;
}

/* Stop the page behind from scrolling while the lightbox is open. */
html.lightbox-open {
  overflow: hidden;
}

.lightbox__figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100vw;
  max-height: 100vh;
}

/* One centred row: [<] photo [>]. The arrows sit right next to the photo's edges,
   so they follow narrower (portrait) photos too. */
.lightbox__stage {
  display: flex;
  align-items: center;
  gap: 14px;
}

.lightbox__image {
  display: block;
  /* Never larger than the photo itself (most are 530x352) or the screen;
     leave room for the two 56px arrows + gaps beside it. */
  max-width: calc(100vw - 180px);
  max-height: calc(100vh - 90px);
  border-radius: 4px;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
  background: #222;
  cursor: pointer; /* clicking the photo goes to the next one */
  user-select: none;
}

.lightbox__counter {
  margin-top: 12px;
  color: #ddd;
  font: 14px/1 Arial, Helvetica, sans-serif;
  letter-spacing: 0.05em;
}

.lightbox__nav,
.lightbox__close {
  border: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.2s ease;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1;
}

.lightbox__nav:hover,
.lightbox__close:hover,
.lightbox__nav:focus-visible,
.lightbox__close:focus-visible {
  background: #ef2c42;
  outline: none;
}

.lightbox__nav {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 40px;
  padding-bottom: 4px;
}

.lightbox__close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 30px;
}

/* Phones: no room beside the photo, so the arrows overlay its left/right edges. */
@media only screen and (max-width: 767px) {
  .lightbox__stage {
    position: relative;
    gap: 0;
  }
  .lightbox__image {
    max-width: 100vw;
  }
  .lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    font-size: 30px;
    background: rgba(0, 0, 0, 0.35);
  }
  .lightbox__nav--prev { left: 6px; }
  .lightbox__nav--next { right: 6px; }
}
