.cms-gallery {
  scroll-margin-top: 110px;
}

.cms-gallery-filters {
  scrollbar-width: thin;
}

.cms-gallery-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 30px 0 8px;
}

.cms-gallery-pagination[hidden],
.cms-gallery-item[hidden] {
  display: none !important;
}

.cms-gallery-page-button {
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid #d9e0e9;
  border-radius: 12px;
  background: #fff;
  color: #132036;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
}

.cms-gallery-page-button:hover:not(:disabled) {
  border-color: #ef1370;
  background: #fff5f9;
}

.cms-gallery-page-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.cms-gallery-page-status {
  min-width: 155px;
  text-align: center;
  color: #657189;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.cms-gallery-item:focus-visible,
.cms-gallery-page-button:focus-visible,
.lightbox button:focus-visible {
  outline: 3px solid #ff7cae;
  outline-offset: 3px;
}

.lightbox {
  box-sizing: border-box;
  width: min(95vw, 1140px);
  max-width: none;
  max-height: min(92dvh, 900px);
  padding: 52px 64px 16px;
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  background: #090d17;
  color: #fff;
  box-shadow: 0 30px 100px rgba(0, 0, 0, .45);
}

.lightbox::backdrop {
  background: rgba(3, 7, 16, .88);
  backdrop-filter: blur(8px);
}

.lightbox > img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(92dvh - 140px);
  margin-inline: auto;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  z-index: 3;
  top: 9px;
  right: 12px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  background: #e90061;
}

.lightbox-arrow {
  position: absolute;
  z-index: 2;
  top: 50%;
  display: grid;
  place-items: center;
  width: 45px;
  height: 56px;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 12px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 40px;
  line-height: 1;
  cursor: pointer;
  transition: background-color .2s ease;
}

.lightbox-arrow:hover:not(:disabled) {
  background: #e90061;
}

.lightbox-arrow:disabled {
  opacity: .3;
  cursor: not-allowed;
}

.lightbox-arrow--prev { left: 10px; }
.lightbox-arrow--next { right: 10px; }

.lightbox-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: 34px;
  padding-top: 12px;
  font-size: 13px;
}

.lightbox-caption {
  overflow: hidden;
  color: #e2e6ee;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-counter {
  flex-shrink: 0;
  color: #ffc6df;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .cms-gallery-pagination { gap: 8px; }
  .cms-gallery-page-button { padding: 10px 12px; font-size: 13px; }
  .cms-gallery-page-status { min-width: auto; font-size: 12px; }

  .lightbox {
    width: 98vw;
    max-height: 90dvh;
    padding: 56px 8px 18px;
    border-radius: 13px;
  }

  .lightbox > img {
    max-height: calc(90dvh - 138px);
  }

  .lightbox-arrow {
    top: 53%;
    width: 42px;
    height: 48px;
    background: rgba(9, 13, 23, .72);
  }

  .lightbox-arrow--prev { left: 8px; }
  .lightbox-arrow--next { right: 8px; }
  .lightbox-meta { padding-inline: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .cms-gallery-page-button,
  .lightbox-arrow {
    transition: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .lightbox[open] {
    animation: elizabeth-gallery-open .2s ease-out both;
  }

  @keyframes elizabeth-gallery-open {
    from { opacity: 0; transform: translateY(7px) scale(.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
}
