/* Портрет как вход в галерею, сетка фотографий и полноэкранный просмотр.
   Общее для страницы и полноэкранного просмотра. */

/* --- портрет-кнопка -------------------------------------------------------- */

.photo--button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  font: inherit;
  color: inherit;
  cursor: zoom-in;
}

.photo--button .photo__img { transition: transform .35s ease; }

.photo--button:hover .photo__img,
.photo--button:focus-visible .photo__img { transform: scale(1.04); }

.photo__badge {
  position: absolute;
  left: .55rem;
  bottom: .55rem;
  padding: .28rem .65rem;
  border-radius: 999px;
  background: rgba(10, 10, 20, .62);
  color: #fff;
  font-size: .74rem;
  letter-spacing: .02em;
  pointer-events: none;
}

/* --- сетка (сейчас не выводится, см. README) -------------------------------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: .6rem;
}

.gallery__item {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: zoom-in;
}

.gallery__img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  transition: transform .25s ease, filter .25s ease;
}

.gallery__item:hover .gallery__img,
.gallery__item:focus-visible .gallery__img {
  transform: scale(1.02);
  filter: brightness(1.05);
}

.gallery__caption {
  display: block;
  margin-top: .3rem;
  font-size: .78rem;
  color: var(--muted-fg);
}

/* --- полноэкранный просмотр ------------------------------------------------ */

body.has-lightbox { overflow: hidden; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(8, 8, 16, .93);
  color: #f2f2f5;
}

.lightbox[hidden] { display: none; }

.lightbox__figure {
  margin: 0;
  display: grid;
  justify-items: center;
  gap: .75rem;
}

.lightbox__img {
  max-width: min(100%, 68rem);
  max-height: 78vh;
  object-fit: contain;
  border-radius: 6px;
}

.lightbox__caption {
  margin: 0;
  font-size: .9rem;
  color: #c9cbd8;
}

.lightbox__close,
.lightbox__nav {
  position: absolute;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.lightbox__close {
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.1rem;
}

.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  font-size: 2rem;
}

.lightbox__nav--prev { left: 1rem; }
.lightbox__nav--next { right: 1rem; }

.lightbox__close:hover,
.lightbox__nav:hover { background: rgba(255, 255, 255, .22); }

@media (max-width: 40rem) {
  .lightbox__nav {
    top: auto;
    bottom: 1rem;
    transform: none;
  }
}

/* На печати фото-галерея в CV не нужна. */
@media print {
  .section--gallery,
  .photo__badge,
  .lightbox { display: none !important; }
}
