/* KornSW RemoteArticles - galleries of embedded posts (justified rows). */

.kornsw-ra-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 1em 0;
}

/* Keeps the items of the last row from stretching over the full width. */
.kornsw-ra-gallery::after {
  content: '';
  flex-grow: 999999;
}

.kornsw-ra-gallery-loading {
  min-height: var(--kornsw-ra-gallery-height, 300px);
  align-items: center;
  justify-content: center;
  gap: 0.75em;
  border-radius: 4px;
  background: rgba(127, 127, 127, 0.08);
}

/* Loading indicator: a spinning ring (pure CSS, no image file) next to the label. */
.kornsw-ra-gallery-loading::before {
  content: '';
  width: 28px;
  height: 28px;
  border: 3px solid rgba(127, 127, 127, 0.3);
  border-top-color: rgba(127, 127, 127, 0.9);
  border-radius: 50%;
  animation: kornsw-ra-spin 0.9s linear infinite;
}

.kornsw-ra-gallery-loading::after {
  display: none;
}

.kornsw-ra-gallery-loading-label {
  font-size: 0.875em;
  opacity: 0.75;
}

@keyframes kornsw-ra-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .kornsw-ra-gallery-loading::before {
    animation-duration: 3s;
  }
}

.kornsw-ra-gallery-item {
  position: relative;
  display: block;
  overflow: hidden;
  height: var(--kornsw-ra-gallery-height, 300px);
  border-radius: 4px;
  background: rgba(127, 127, 127, 0.12);
}

.kornsw-ra-gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

.kornsw-ra-gallery-video::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 18px 0 18px 30px;
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.9);
  transform: translate(-40%, -50%);
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.6));
}

@media (max-width: 600px) {
  .kornsw-ra-gallery-item {
    height: calc(var(--kornsw-ra-gallery-height, 300px) * 0.5);
  }
}
