/* ============================================================
   gallery.css — Grid · ThumbnailCard · ThumbHash
   ============================================================ */

/* ── Page Layout ─────────────────────────────────────────── */
.gallery-page {
  padding-top: calc(var(--header-h) + var(--filter-h));
  min-height: 100vh;
}
.gallery-main { padding-bottom: 60px; }

/* ── Image Grid ──────────────────────────────────────────── */
.image-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap-sm);
}
@media (min-width: 640px)  { .image-grid { grid-template-columns: repeat(3, 1fr); gap: var(--gap-md); } }
@media (min-width: 1024px) { .image-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1440px) { .image-grid { grid-template-columns: repeat(5, 1fr); } }

/* ── Thumbnail Card ──────────────────────────────────────── */
.thumb-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-3);
  cursor: pointer;
}
.thumb-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Video play icon overlay */
.thumb-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}

/* ThumbHash Canvas placeholder */
.thumb-placeholder {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: opacity 0.4s ease;
}
.thumb-placeholder.skeleton {
  background: var(--bg-3);
  animation: shimmer 1.5s infinite;
  background-image: linear-gradient(
    90deg,
    var(--bg-3) 0%,
    var(--bg-2) 50%,
    var(--bg-3) 100%
  );
  background-size: 200% 100%;
}
@keyframes shimmer {
  from { background-position: -200% center; }
  to   { background-position:  200% center; }
}

/* Actual image */
.thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.thumb-img.loaded { opacity: 1; }

/* Hover overlay */
.thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  pointer-events: none;
}
.thumb-card:hover .thumb-overlay,
.thumb-card:focus-visible .thumb-overlay { opacity: 1; }

.thumb-title {
  font-size: 13px;
  font-weight: 400;
  color: #fff;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thumb-tags {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  overflow: hidden;
}
.thumb-tag {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.12);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

/* Error state */
.thumb-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
}
.thumb-error-icon {
  width: 32px; height: 32px;
  border: 1px solid var(--text-dim);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* Grid stagger animation on load */
.thumb-card {
  animation: fadeInUp 0.3s ease both;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
