/* Shared article gallery presentation for Masli and profile article pages. */
.article-content .article-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.article-content .article-gallery > * {
  min-width: 0;
  max-width: 100%;
  margin: 0 !important;
}

.article-content .article-gallery img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 12px;
  margin: 0;
  cursor: zoom-in;
}

.article-content .article-gallery.article-gallery--slideshow {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 28px 0;
}

.article-gallery--slideshow .ag-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: min(62vh, 560px);
  background: #111;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 16px;
  overflow: hidden;
  outline: none;
}

.article-gallery--slideshow .ag-slides {
  position: absolute;
  inset: 0;
}

.article-gallery--slideshow .ag-stage img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  object-fit: cover;
  border-radius: 0;
  margin: 0 !important;
  opacity: 0;
  transform: none;
  transition: opacity .45s ease;
  cursor: zoom-in;
  pointer-events: none;
}

.article-gallery--slideshow .ag-stage img.is-active {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

.article-gallery--slideshow .ag-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(10, 12, 18, .55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.article-gallery--slideshow .ag-prev { left: 10px; }
.article-gallery--slideshow .ag-next { right: 10px; }

.article-gallery--slideshow .ag-count {
  position: absolute;
  right: 12px;
  bottom: 10px;
  z-index: 3;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(10, 12, 18, .55);
  border-radius: 999px;
  padding: 4px 10px;
}

.article-gallery--slideshow .ag-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.article-gallery--slideshow .ag-thumb {
  flex: 0 0 auto;
  width: 72px;
  height: 52px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: #1a1a1a;
  cursor: pointer;
  opacity: .62;
}

.article-gallery--slideshow .ag-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  margin: 0;
  cursor: pointer;
}

.article-gallery--slideshow .ag-thumb.is-active {
  opacity: 1;
  border-color: #2A7A70;
  box-shadow: 0 0 0 1px #2A7A70;
}

@media (max-width: 640px) {
  .article-gallery--slideshow .ag-stage {
    aspect-ratio: 4 / 3;
    max-height: 52vh;
    border-radius: 12px;
  }

  .article-gallery--slideshow .ag-thumb {
    width: 60px;
    height: 44px;
  }

  .article-gallery--slideshow .ag-nav {
    width: 34px;
    height: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .article-gallery--slideshow .ag-stage img,
  .article-gallery--slideshow .ag-stage img.is-active {
    transition: none;
    animation: none !important;
  }
}

@media print {
  .article-gallery--slideshow .ag-nav,
  .article-gallery--slideshow .ag-count,
  .article-gallery--slideshow .ag-thumbs {
    display: none !important;
  }

  .article-gallery--slideshow .ag-stage {
    height: auto;
    max-height: none;
    aspect-ratio: auto;
  }

  .article-gallery--slideshow .ag-stage img {
    position: static;
    opacity: 1 !important;
    height: auto;
  }
}
