/* Axis Reporters — article gallery (public) */

.cp-article-gallery {
  margin: 1.75rem 0 2rem;
  padding-top: 0.25rem;
}

.cp-article-gallery__title {
  margin: 0 0 1rem;
  font-family: var(--cp-font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--cp-ink);
  letter-spacing: -0.02em;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--cp-line);
}

.cp-article-gallery__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.cp-article-gallery__item {
  margin: 0;
  background: #fff;
  border: 1px solid #D9D3C9;
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cp-article-gallery__item a.cp-gallery-lightbox__trigger {
  display: block;
  line-height: 0;
  background: #F7F5F1;
  cursor: zoom-in;
}

.cp-article-gallery__item img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: min(72vh, 520px);
  object-fit: contain;
  object-position: center top;
  background: #F7F5F1;
  transition: transform 0.2s ease;
}

.cp-gallery-lightbox__trigger:hover img,
.cp-gallery-lightbox__trigger:focus-visible img {
  transform: scale(1.01);
}

.cp-gallery-lightbox__trigger:focus-visible {
  outline: 2px solid #0B1F33;
  outline-offset: 2px;
}

.cp-article-gallery__item figcaption {
  padding: 0.7rem 0.85rem 0.85rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #5B6570;
}

@media (min-width: 640px) {
  .cp-article-gallery__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 980px) {
  .cp-article-gallery__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.15rem;
  }

  .cp-article-gallery__item:only-child,
  .cp-article-gallery__grid[data-count="1"] .cp-article-gallery__item {
    grid-column: 1 / -1;
    max-width: 920px;
    margin-inline: auto;
    width: 100%;
  }

  .cp-article-gallery__grid[data-count="2"] .cp-article-gallery__item {
    grid-column: span 1;
  }
}

/* Lightbox (gallery.js) */
body.cp-gallery-lightbox-open {
  overflow: hidden;
}

.cp-gallery-lightbox[hidden] {
  display: none !important;
}

.cp-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 12000;
}

.cp-gallery-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 31, 51, 0.88);
}

.cp-gallery-lightbox__dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  height: 100%;
  padding: 1rem;
  box-sizing: border-box;
}

.cp-gallery-lightbox__figure {
  margin: 0;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.cp-gallery-lightbox__image {
  display: block;
  max-width: min(96vw, 1200px);
  max-height: calc(100vh - 6rem);
  width: auto;
  height: auto;
  object-fit: contain;
  background: #0B1F33;
}

.cp-gallery-lightbox__caption {
  margin-top: 0.75rem;
  max-width: min(96vw, 720px);
  color: #F7F5F1;
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
}

.cp-gallery-lightbox__close,
.cp-gallery-lightbox__nav {
  border: 0;
  background: rgba(247, 245, 241, 0.12);
  color: #F7F5F1;
  cursor: pointer;
  border-radius: 999px;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.5rem;
  line-height: 1;
}

.cp-gallery-lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
}

.cp-gallery-lightbox__close:hover,
.cp-gallery-lightbox__close:focus-visible,
.cp-gallery-lightbox__nav:hover,
.cp-gallery-lightbox__nav:focus-visible {
  background: rgba(247, 245, 241, 0.22);
}

@media (max-width: 639px) {
  .cp-gallery-lightbox__dialog {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto auto;
    padding-top: 3.25rem;
  }

  .cp-gallery-lightbox__nav {
    justify-self: center;
  }

  .cp-gallery-lightbox__nav--prev,
  .cp-gallery-lightbox__nav--next {
    grid-row: 3;
  }

  .cp-gallery-lightbox__figure {
    grid-row: 1;
  }
}

/* Admin gallery UI */
.cp-admin-gallery {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 16px;
  background: #f8fafc;
  margin-bottom: 20px;
}

.cp-admin-gallery h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.cp-admin-gallery > p {
  margin: 0 0 14px;
  color: #64748b;
  font-size: 13px;
}

.cp-admin-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.cp-admin-gallery-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
}

.cp-admin-gallery-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  margin-bottom: 8px;
}

.cp-admin-gallery-card label {
  font-size: 12px;
  font-weight: 600;
}

.cp-admin-gallery-card input[type="text"] {
  width: 100%;
  margin-top: 4px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
}

.cp-admin-gallery-card .delete-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #b91c1c;
}

.cp-gallery-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.cp-gallery-preview figure {
  margin: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.cp-gallery-preview img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
}

.cp-gallery-preview figcaption {
  padding: 6px 8px;
  font-size: 11px;
  color: #64748b;
}
