.md-img-row {
  display: grid;
  grid-template-columns: repeat(var(--imgrow-cols, 2), minmax(0, 1fr));
  gap: var(--imgrow-gap, 14px);
  margin: 1rem 0 1.25rem;
  align-items: start;
}

.md-img-row .md-img-col {
  margin: 0;
}

.md-img-row .md-img-col img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  cursor: zoom-in;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.md-img-row .md-img-col img:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(18, 45, 67, 0.14);
}

.md-img-row .md-img-col figcaption {
  margin-top: 0.45rem;
  font-size: 0.88rem;
  line-height: 1.35;
  color: #6c7480;
  text-align: center;
}

.imgrow-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(7, 18, 28, 0.82);
  backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  cursor: zoom-out;
}

.imgrow-lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.imgrow-lightbox[aria-hidden="true"] {
  visibility: hidden;
}

.imgrow-lightbox[aria-hidden="false"] {
  visibility: visible;
}

.imgrow-lightbox__figure {
  margin: 0;
  max-width: min(94vw, 1400px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.imgrow-lightbox__viewport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  max-width: 100%;
  cursor: default;
}

.imgrow-lightbox__image {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 52px);
  width: auto;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.34);
  background: #fff;
  cursor: default;
}

.imgrow-lightbox__meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 1.5rem;
  max-width: min(92vw, 960px);
}

.imgrow-lightbox__counter {
  color: rgba(245, 250, 255, 0.76);
  font-size: 0.82rem;
  line-height: 1.3;
}

.imgrow-lightbox__caption {
  color: rgba(245, 250, 255, 0.92);
  font-size: 0.94rem;
  line-height: 1.4;
  text-align: center;
}

.imgrow-lightbox__nav {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  color: #f8fbff;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 180ms ease, transform 180ms ease, opacity 180ms ease;
}

.imgrow-lightbox__nav:hover,
.imgrow-lightbox__nav:focus-visible {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.04);
}

.imgrow-lightbox__nav:disabled {
  opacity: 0.3;
  cursor: default;
  transform: none;
}

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

@media (max-width: 900px) {
  .md-img-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .md-img-row {
    grid-template-columns: 1fr;
  }

  .imgrow-lightbox {
    padding: 18px;
  }

  .imgrow-lightbox__viewport {
    gap: 10px;
  }

  .imgrow-lightbox__nav {
    width: 40px;
    height: 40px;
    font-size: 1.45rem;
  }

  .imgrow-lightbox__image {
    max-height: calc(90vh - 48px);
    border-radius: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .md-img-row .md-img-col img,
  .imgrow-lightbox {
    transition: none;
  }
}
