.ae-gallery {
  display: grid;
  gap: 3px;
  margin: 0 0 1.35rem;
  border-radius: 12px;
  overflow: hidden;
  background: #101612;
}

.ae-gallery--1 {
  display: block;
  background: transparent;
}

.ae-gallery--2 {
  grid-template-columns: 1fr 1fr;
  height: 280px;
}

.ae-gallery--3 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1.45fr 1fr;
  height: 460px;
}

.ae-gallery--3 .ae-gallery__tile:first-of-type {
  grid-column: 1 / -1;
  grid-row: 1;
}

.ae-gallery--3 .ae-gallery__tile:nth-of-type(2) {
  grid-column: 1;
  grid-row: 2;
}

.ae-gallery--3 .ae-gallery__tile:nth-of-type(3) {
  grid-column: 2;
  grid-row: 2;
}

.ae-gallery--4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  height: 420px;
}

.ae-gallery__tile {
  position: relative;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: #1b2420;
  cursor: pointer;
  min-width: 0;
  min-height: 0;
}

.ae-gallery--1 .ae-gallery__tile {
  cursor: default;
  background: transparent;
}

.ae-gallery__tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ae-gallery--1 .ae-gallery__tile img {
  height: auto;
  object-fit: contain;
  background: #f4f7f5;
}

.ae-gallery__count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 18, 14, 0.55);
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  pointer-events: none;
}

.ae-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 64px 76px 72px;
  background: rgba(10, 16, 12, 0.92);
}

.ae-gallery-lightbox.is-open {
  display: flex;
}

.ae-gallery-lightbox__figure {
  margin: 0;
  max-width: min(920px, 100%);
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ae-gallery-lightbox__figure img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 140px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.ae-gallery-lightbox__close,
.ae-gallery-lightbox__nav {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
}

button.ae-gallery-lightbox__close {
  top: 18px;
  right: 18px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  background: #fff;
  color: #1b2420;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

button.ae-gallery-lightbox__close svg {
  display: block;
  width: 18px;
  height: 18px;
}

button.ae-gallery-lightbox__close:hover,
button.ae-gallery-lightbox__close:focus-visible {
  background: #f4f7f5;
  color: #1b2420;
}

.ae-gallery-lightbox__nav {
  top: 50%;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  border-radius: 999px;
  font-size: 1.8rem;
  line-height: 1;
}

.ae-gallery-lightbox__nav--prev { left: 16px; }
.ae-gallery-lightbox__nav--next { right: 16px; }

.ae-gallery-lightbox__count {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  text-align: center;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
}

@media (max-width: 700px) {
  .ae-gallery--2,
  .ae-gallery--4 {
    height: 240px;
  }

  .ae-gallery--3 {
    height: 320px;
  }

  .ae-gallery-lightbox {
    padding: 60px 52px 56px;
  }

  .ae-gallery-lightbox__figure img {
    max-height: calc(100vh - 124px);
  }

  .ae-gallery__count {
    font-size: 1.5rem;
  }
}
