/* shared/assets/gallery.css — CmsGallery
 * Layout + theming for the .cmsgallery image grid + .cmsgallery-modal
 * lightbox emitted by gallery.js. Scoped via .cmsgallery prefix so it
 * stacks safely alongside any host theme.
 */

.cmsgallery {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 8px;
  margin: 0 0 24px;
}

.cmsgallery-hero {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}
.cmsgallery-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  transition: transform .35s ease;
}
.cmsgallery-hero:hover img {
  transform: scale(1.02);
}

.cmsgallery-thumbs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 8px;
}
.cmsgallery-thumb {
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 4 / 3;
}
.cmsgallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s ease;
}
.cmsgallery-thumb:hover img {
  transform: scale(1.04);
}

.cmsgallery-more {
  position: relative;
}
.cmsgallery-more::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .58);
  transition: background .2s ease;
}
.cmsgallery-more:hover::before {
  background: rgba(0, 0, 0, .68);
}
.cmsgallery-more-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: .02em;
  pointer-events: none;
}

@media (max-width: 720px) {
  .cmsgallery {
    grid-template-columns: 1fr;
  }
  .cmsgallery-thumbs {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Modal lightbox ─────────────────────────────────────────────────── */
.cmsgallery-modal-open {
  /* lock body scroll while the modal is open */
  overflow: hidden;
}

.cmsgallery-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8, 12, 20, .96);
  display: flex;
  flex-direction: column;
  color: #fff;
}
.cmsgallery-modal[hidden] {
  display: none;
}

.cmsgallery-modal-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 80px 16px;
  overflow: hidden;
  position: relative;
}
.cmsgallery-modal-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.cmsgallery-modal-counter {
  position: absolute;
  top: 16px;
  right: 24px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, .8);
}

.cmsgallery-modal-close,
.cmsgallery-modal-prev,
.cmsgallery-modal-next {
  position: absolute;
  z-index: 2;
  border: 0;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 24px;
  line-height: 1;
  border-radius: 50%;
  transition: background .15s ease, transform .12s ease;
}
.cmsgallery-modal-close:hover,
.cmsgallery-modal-prev:hover,
.cmsgallery-modal-next:hover {
  background: rgba(255, 255, 255, .18);
}
.cmsgallery-modal-close:active,
.cmsgallery-modal-prev:active,
.cmsgallery-modal-next:active {
  transform: scale(.94);
}

.cmsgallery-modal-close {
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  font-size: 28px;
}
.cmsgallery-modal-prev {
  left: 24px;
  top: 50%;
  width: 48px;
  height: 48px;
  transform: translateY(-50%);
  font-size: 28px;
}
.cmsgallery-modal-next {
  right: 24px;
  top: 50%;
  width: 48px;
  height: 48px;
  transform: translateY(-50%);
  font-size: 28px;
}
.cmsgallery-modal-prev:active { transform: translateY(-50%) scale(.94); }
.cmsgallery-modal-next:active { transform: translateY(-50%) scale(.94); }

.cmsgallery-modal-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px 16px;
  max-height: 28vh;
  overflow-y: auto;
  scroll-behavior: smooth;
  border-top: 1px solid rgba(255, 255, 255, .08);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .25) transparent;
}
.cmsgallery-modal-strip::-webkit-scrollbar {
  width: 6px;
}
.cmsgallery-modal-strip::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .25);
  border-radius: 3px;
}

.cmsgallery-modal-stripthumb {
  flex: 0 0 auto;
  width: 90px;
  height: 60px;
  padding: 0;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
  border-radius: 4px;
  overflow: hidden;
  opacity: .55;
  transition: opacity .15s ease, border-color .15s ease, transform .12s ease;
}
.cmsgallery-modal-stripthumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cmsgallery-modal-stripthumb:hover {
  opacity: .85;
}
.cmsgallery-modal-stripthumb.is-active {
  opacity: 1;
  border-color: #fff;
}

@media (max-width: 720px) {
  .cmsgallery-modal-stage {
    padding: 56px 16px 8px;
  }
  .cmsgallery-modal-prev,
  .cmsgallery-modal-next {
    width: 40px;
    height: 40px;
    font-size: 22px;
  }
  .cmsgallery-modal-prev { left: 8px; }
  .cmsgallery-modal-next { right: 8px; }
  .cmsgallery-modal-stripthumb {
    width: 64px;
    height: 44px;
  }
}
