/* ============================================
 * GALERIM (F2) — Saved carousel grid + detail
 * ============================================
 *
 * Theme-agnostic: tuned to the site's CSS variables (--bg-primary,
 * --bg-card, --border, --accent). No hard-coded colors. Picks up dark/light.
 */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.gallery-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.gallery-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.gallery-card-thumb {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--bg-secondary);
  overflow: hidden;
}
.gallery-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-card-noimg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--bg-secondary);
}

.gallery-card-frame-count {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 7px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 6px;
  font-size: 10px;
  color: #fff;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.gallery-card-meta {
  padding: 10px 12px;
}
.gallery-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Skeleton */
.gallery-card-skeleton .gallery-card-thumb,
.gallery-shim {
  background: linear-gradient(110deg, var(--bg-card) 30%, var(--bg-card-hover) 50%, var(--bg-card) 70%);
  background-size: 200% 100%;
  animation: gallery-shimmer 1.6s infinite;
}
.gallery-shim {
  height: 12px;
  border-radius: 6px;
  margin-bottom: 6px;
}
@keyframes gallery-shimmer {
  to { background-position: -200% 0; }
}

/* Empty state */
.gallery-empty {
  text-align: center;
  padding: 48px 20px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--text-secondary);
}

/* ── Detail dialog ─────────────────────────────────────────────
 * Reuses .igs-modal / .igs-modal-body markup so the dialog is
 * visually identical to the existing carousel-studio modals.
 * Only the frame-grid and the danger button need bespoke styles. */

.gallery-detail-frames {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 20px;
  overflow-y: auto;
}
@media (min-width: 720px) {
  .gallery-detail-frames { grid-template-columns: repeat(4, 1fr); }
}

.gallery-detail-frame {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.gallery-detail-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gallery-detail-frame-noimg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--bg-secondary);
}
.gallery-detail-frame-label {
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  padding: 3px 7px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.03em;
  border-radius: 6px;
  text-align: center;
}

.gallery-detail-actions {
  display: flex;
  gap: 8px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.gallery-detail-danger-btn {
  color: var(--danger);
  border-color: var(--border);
}
.gallery-detail-danger-btn:hover {
  border-color: var(--danger);
  background: var(--danger-subtle);
}
