.gallery {
  background: var(--cream);
}

.gallery__heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: clamp(3rem, 7vw, 6rem);
}

.gallery__heading .section-index {
  margin-bottom: 1.5rem;
  color: var(--brown);
}

.gallery__heading h2 em {
  color: var(--rust);
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.2rem;
}

.gallery__grid figure {
  position: relative;
  overflow: hidden;
  min-width: 0;
  aspect-ratio: 3 / 4;
  margin: 0;
  border: 2px solid var(--ink);
  border-radius: var(--radius-m);
  background: var(--ink);
  box-shadow: 7px 7px 0 rgba(116, 64, 27, 0.14);
}

.gallery__open {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: zoom-in;
}

.gallery__open:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: -6px;
}

.gallery__open img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms var(--ease), filter 700ms var(--ease);
}

.gallery__grid figure:hover img,
.gallery__open:focus-visible img {
  filter: saturate(1.08);
  transform: scale(1.045);
}

.gallery__grid figcaption {
  display: grid;
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.75rem;
  align-items: center;
  max-width: 430px;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(246, 234, 217, 0.24);
  border-radius: var(--radius-s);
  color: var(--cream);
  background: rgba(12, 27, 42, 0.92);
  pointer-events: none;
  transition: transform 280ms var(--ease);
}

.gallery__grid figure:hover figcaption {
  transform: translateY(-4px);
}

.gallery__grid figcaption > span {
  display: grid;
  grid-row: 1 / 3;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  color: var(--ink);
  background: var(--gold);
  font-family: var(--display);
  font-size: 0.72rem;
}

.gallery__grid figcaption strong {
  font-family: var(--display);
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.gallery__grid figcaption small {
  color: rgba(246, 234, 217, 0.68);
  font-size: 0.75rem;
  line-height: 1.25;
}

.gallery__plus {
  display: grid;
  position: absolute;
  top: 1rem;
  right: 1rem;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  color: var(--ink);
  background: var(--cream);
  font-size: 1.45rem;
  line-height: 1;
  opacity: 0;
  transform: rotate(-18deg) scale(0.8);
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}

.gallery__grid figure:hover .gallery__plus,
.gallery__open:focus-visible .gallery__plus {
  opacity: 1;
  transform: rotate(0) scale(1);
}

@media (min-width: 821px) and (max-width: 1099px) {
  .gallery__grid figcaption {
    right: 0.6rem;
    bottom: 0.6rem;
    left: 0.6rem;
    padding: 0.55rem 0.65rem;
  }

  .gallery__grid figcaption small {
    display: none;
  }
}

.gallery__caravan img {
  object-position: center 55%;
}

.gallery__action img {
  object-position: center 28%;
}

.gallery__sweet img {
  object-position: center 72%;
}

.lightbox {
  width: min(92vw, 1050px);
  max-width: none;
  max-height: 90vh;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--cream);
  border-radius: var(--radius-l);
  color: var(--cream);
  background: var(--ink);
  box-shadow: 0 30px 90px rgba(4, 12, 19, 0.55);
}

.lightbox[open] {
  animation: lightbox-in 260ms var(--ease);
}

.lightbox::backdrop {
  background: rgba(4, 12, 19, 0.8);
  backdrop-filter: blur(9px);
}

.lightbox img {
  display: block;
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
  background: #05080a;
}

.lightbox p {
  margin: 0;
  padding: 1rem 1.25rem 1.15rem;
  font-size: 0.9rem;
}

.lightbox__close {
  display: grid;
  position: absolute;
  z-index: 2;
  top: 1rem;
  right: 1rem;
  place-items: center;
  width: 2.8rem;
  height: 2.8rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: var(--cream);
  font-size: 1.5rem;
  cursor: pointer;
}

@keyframes lightbox-in {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
