.media-gallery {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  margin: 1.45rem 0;
}

.media-gallery-item {
  display: block;
  line-height: 0;
  min-width: 0;
  position: relative;
}

.media-gallery-item img {
  display: block;
  height: auto;
  max-width: 100%;
  width: 100%;
}

.media-gallery-item:hover {
  opacity: 0.96;
}

[data-live-photo] {
  position: relative;
}

.live-photo-lightbox-link {
  display: block;
  line-height: 0;
  position: relative;
}

.live-photo-badge {
  background: rgba(24, 24, 24, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 0.36rem 0.52rem;
  pointer-events: none;
  position: absolute;
  left: 0.65rem;
  top: 0.65rem;
}

.media-live-lightbox-badge {
  left: 1rem;
  top: 1rem;
  z-index: 2;
}

.media-live-lightbox {
  align-items: center;
  background: rgba(0, 0, 0, 0.9);
  bottom: 0;
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  justify-content: center;
  left: 0;
  padding: 1rem;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 10000;
}

.media-live-lightbox.is-open {
  display: flex;
}

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

.media-live-lightbox-stage {
  align-items: center;
  cursor: zoom-out;
  display: grid;
  justify-content: center;
  max-height: calc(100vh - 7rem);
  max-width: min(100%, 1200px);
  outline: none;
  position: relative;
  touch-action: pan-y pinch-zoom;
  user-select: none;
}

.media-live-lightbox-stage.is-live {
  cursor: pointer;
}

.media-live-lightbox-stage img,
.media-live-lightbox-stage video {
  display: block;
  grid-area: 1 / 1;
  max-height: calc(100vh - 7rem);
  max-width: 100%;
  object-fit: contain;
}

.media-live-lightbox-stage > [hidden] {
  display: none !important;
}

.media-live-lightbox-caption {
  color: #f4f4f4;
  font-size: 0.95em;
  line-height: 1.5;
  max-width: min(100%, 900px);
  text-align: center;
}

.media-live-lightbox-close,
.media-live-lightbox-prev,
.media-live-lightbox-next {
  background: transparent;
  border: 0;
  color: #fff;
  font: inherit;
  line-height: 1;
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.45rem;
  position: fixed;
  z-index: 4;
}

.media-live-lightbox-close {
  font-size: 2rem;
  right: 1rem;
  top: 0.7rem;
}

.media-live-lightbox-prev,
.media-live-lightbox-next {
  font-size: 2.4rem;
  top: 50%;
  transform: translateY(-50%);
}

.media-live-lightbox-prev { left: 0.6rem; }
.media-live-lightbox-next { right: 0.6rem; }

.media-live-lightbox-close:hover,
.media-live-lightbox-prev:hover,
.media-live-lightbox-next:hover {
  opacity: 0.8;
  text-decoration: none;
}

@media (max-width: 760px) {
  .media-gallery {
    gap: 0.55rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .live-photo-badge {
    font-size: 0.62rem;
    left: 0.45rem;
    padding: 0.3rem 0.42rem;
    top: 0.45rem;
  }
}
