.sgm-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
}

.sgm-card {
  min-width: 0;
}

.sgm-frame {
  border-radius: 20px;
  overflow: hidden;
  position: relative;
}

.sgm-media,
.sgm-open {
  display: block;
  height: 220px;
  width: 100%;
}

.sgm-open {
  background: transparent;
  border: 0;
  cursor: pointer;
  display: block;
  overflow: hidden;
  padding: 0;
  width: 100%;
}

.sgm-thumb {
  display: block;
  height: 220px;
  max-height: 220px;
  min-height: 220px;
  object-fit: cover;
  object-position: center;
  transition: transform 0.25s ease;
  width: 100%;
}

.sgm-frame:hover .sgm-thumb,
.sgm-frame:focus-within .sgm-thumb {
  transform: scale(1.03);
}

.sgm-overlay {
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.sgm-overlay-button {
  align-items: center;
  background: rgba(209, 31, 58, 0.88);
  border: 0;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 0;
  height: 40px;
  justify-content: center;
  left: 50%;
  opacity: 0;
  pointer-events: auto;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 0.2s ease, transform 0.2s ease;
  width: 40px;
}

.sgm-frame:hover .sgm-overlay-button,
.sgm-frame:focus-within .sgm-overlay-button {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.04);
}

.sgm-overlay-button i {
  color: #fff;
  font-size: 18px;
}

.sgm-gallery-actions {
  margin-top: 18px;
}

.sgm-gallery-view-all {
  background: #d11f3a;
  border: 0;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 26px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sgm-gallery-view-all:hover,
.sgm-gallery-view-all:focus {
  opacity: 0.92;
  transform: translateY(-1px);
}

.sgm-lightbox[hidden] {
  display: none !important;
}

.sgm-lightbox {
  inset: 0;
  position: fixed;
  z-index: 99999;
}

.sgm-lightbox-backdrop {
  background: rgba(0, 0, 0, 0.84);
  inset: 0;
  position: absolute;
}

.sgm-lightbox-dialog {
  align-items: center;
  display: flex;
  gap: 16px;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: relative;
}

.sgm-lightbox-stage {
  max-width: min(92vw, 1200px);
  position: relative;
  text-align: center;
  z-index: 2;
}

.sgm-lightbox-image {
  display: block;
  margin: 0 auto;
  max-height: 82vh;
  max-width: 100%;
}

.sgm-lightbox-caption {
  color: #fff;
  margin-top: 14px;
}

.sgm-lightbox-nav,
.sgm-lightbox-close {
  background: rgba(255, 255, 255, 0.18);
  border: 0;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  z-index: 2;
}

.sgm-lightbox-nav {
  font-size: 32px;
  height: 52px;
  width: 52px;
}

.sgm-lightbox-close {
  font-size: 30px;
  height: 48px;
  position: absolute;
  right: 20px;
  top: 20px;
  width: 48px;
}

body.sgm-lightbox-open {
  overflow: hidden;
}

@media (max-width: 767px) {
  .sgm-grid {
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sgm-media,
  .sgm-open,
  .sgm-thumb {
    height: 160px;
    max-height: 160px;
    min-height: 160px;
  }

  .sgm-lightbox-dialog {
    gap: 8px;
    padding: 14px;
  }

  .sgm-lightbox-nav {
    font-size: 24px;
    height: 40px;
    width: 40px;
  }

  .sgm-lightbox-close {
    right: 10px;
    top: 10px;
  }
}

@media (max-width: 480px) {
  .sgm-grid {
    grid-template-columns: 1fr;
  }
}
