/* Базовая сетка */
.piwigo-gallery {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  padding: 12px 0;
}

@media (max-width: 1200px) {
  .piwigo-gallery {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 1024px) {
  .piwigo-gallery {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 600px) {
  .piwigo-gallery {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
}

/* Карточка изображения */
.piwigo-gallery .gallery-card {
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  overflow: hidden;
  background: #f0f0f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  animation: piwigoFadeIn 0.3s ease;
}

.piwigo-gallery .gallery-card a {
  display: block;
  width: 100%;
  height: 100%;
}

.piwigo-gallery .gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.piwigo-gallery .gallery-card:hover img {
  transform: scale(1.03);
}

/* Блок статуса и спиннер */
.piwigo-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 0 48px;
  min-height: 48px;
}

.piwigo-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0, 0, 0, 0.08);
  border-top-color: #222;
  border-radius: 50%;
  animation: piwigoSpin 0.75s linear infinite;
}

.piwigo-spinner.hidden {
  display: none;
}

.piwigo-message {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  color: #888;
  letter-spacing: 0.2px;
}

/* Плавающая кнопка "Наверх" */
.piwigo-scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  outline: none;
  cursor: pointer;
  background: rgba(30, 30, 30, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease;
}

.piwigo-scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.piwigo-scroll-top:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translateY(-2px);
}

.piwigo-scroll-top:active {
  transform: translateY(0);
}

@keyframes piwigoSpin {
  to { transform: rotate(360deg); }
}

@keyframes piwigoFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}