.zapex-gallery {
  position: relative;
  overflow: hidden;
  padding: clamp(72px, 8vw, 120px) 20px;
  color: var(--blue-grey-50);
  background: var(--bg-primary-gradient);
  margin: 1.5rem;
  border-radius: 24px;
}

.zapex-gallery::before {
  content: "";
  position: absolute;
  inset: auto auto -180px -120px;
  width: 430px;
  height: 430px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  pointer-events: none;
}

.zapex-gallery__inner {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.zapex-gallery__header {
  max-width: 720px;
  margin: 0 auto clamp(32px, 5vw, 56px);
  text-align: center;
}

.zapex-gallery__eyebrow {
  margin: 0 0 12px;
  color: #3b9cff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.zapex-gallery__title {
  margin: 0;
  color: var(--blue-grey-50);
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.zapex-gallery__text {
  max-width: 620px;
  margin: 18px auto 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 16px;
  line-height: 1.75;
}

.zapex-gallery__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(160px, 1fr));
  gap: 12px;
  min-height: clamp(360px, 42vw, 520px);
}

.zapex-gallery__item {
  position: relative;
  display: block;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
}

.zapex-gallery__item::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    180deg,
    transparent 55%,
    rgba(0, 0, 0, 0.26) 100%
  );
  opacity: 0.72;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.zapex-gallery__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.001);
  transition:
    transform 0.35s ease,
    filter 0.35s ease;
}

.zapex-gallery__item:hover .zapex-gallery__image,
.zapex-gallery__item:focus-visible .zapex-gallery__image {
  transform: scale(1.045);
  filter: brightness(1.05);
}

.zapex-gallery__item:hover::after,
.zapex-gallery__item:focus-visible::after {
  opacity: 0.35;
}

.zapex-gallery__item:focus-visible {
  outline: 2px solid #3b9cff;
  outline-offset: 4px;
}

.zapex-gallery__item--1 {
  grid-column: 1 / 3;
  grid-row: 1 / 2;
}

.zapex-gallery__item--2 {
  grid-column: 3 / 5;
  grid-row: 1 / 2;
}

.zapex-gallery__item--3 {
  grid-column: 5 / 9;
  grid-row: 1 / 3;
}

.zapex-gallery__item--4 {
  grid-column: 9 / 11;
  grid-row: 1 / 2;
}

.zapex-gallery__item--5 {
  grid-column: 11 / 13;
  grid-row: 1 / 2;
}

.zapex-gallery__item--6 {
  grid-column: 1 / 3;
  grid-row: 2 / 3;
}

.zapex-gallery__item--7 {
  grid-column: 3 / 5;
  grid-row: 2 / 3;
}

.zapex-gallery__item--8 {
  grid-column: 9 / 11;
  grid-row: 2 / 3;
}

.zapex-gallery__item--9 {
  grid-column: 11 / 13;
  grid-row: 2 / 3;
}

.zapex-gallery__footer {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

.zapex-gallery__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: var(--blue-grey-50);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.zapex-gallery__button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.zapex-gallery__button:hover,
.zapex-gallery__button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(59, 156, 255, 0.75);
  background: rgba(59, 156, 255, 0.12);
}

@media (max-width: 980px) {
  .zapex-gallery__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: none;
    min-height: 0;
  }

  .zapex-gallery__item {
    grid-column: auto !important;
    grid-row: auto !important;
    aspect-ratio: 4 / 3;
  }

  .zapex-gallery__item--3 {
    grid-column: span 2 !important;
    grid-row: span 2 !important;
    aspect-ratio: auto;
  }
}

@media (max-width: 640px) {
  .zapex-gallery {
    padding: 64px 16px;
  }

  .zapex-gallery__header {
    margin-bottom: 28px;
    text-align: left;
  }

  .zapex-gallery__text {
    margin-left: 0;
    margin-right: 0;
  }

  .zapex-gallery__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .zapex-gallery__item {
    border-radius: 10px;
    aspect-ratio: 1 / 1;
  }

  .zapex-gallery__item--3 {
    grid-column: 1 / -1 !important;
    aspect-ratio: 16 / 10;
  }

  .zapex-gallery__footer {
    justify-content: flex-start;
  }
}
