.gallery-section {
  min-height: 400px;
}

/* ── Albums ─────────────────────────────────────────────────────────────── */

.albums-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.album-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.album-card:hover,
.album-card:focus-visible {
  border-color: var(--red);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  outline: none;
}

.album-cover {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  overflow: hidden;
}

.album-cover-placeholder {
  position: absolute;
  inset: 0;
  background: var(--surface-2);
}

.album-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.album-cover-img.loaded {
  opacity: 1;
}

.album-info {
  padding: 16px 20px 18px;
}

.album-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--white);
  margin: 0;
  letter-spacing: 0.01em;
}

/* ── Gallery ─────────────────────────────────────────────────────────────── */

.gallery-header {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.back-btn {
  flex-shrink: 0;
}

.gallery-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  color: var(--white);
  margin: 0;
}

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

.gallery-item {
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  border-radius: 4px;
  background: var(--surface-2);
}

.gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s var(--ease), opacity 0.3s;
  opacity: 0.85;
}

.gallery-item:hover .gallery-img {
  transform: scale(1.06);
  opacity: 1;
}

/* ── Loading / Error ─────────────────────────────────────────────────────── */

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 0;
  color: var(--text-muted);
  font-family: var(--font-body);
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: gallery-spin 0.7s linear infinite;
}

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

.error-state {
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
  font-family: var(--font-body);
}

/* ── Lightbox ─────────────────────────────────────────────────────────────── */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.93);
}

.lightbox-img {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}

.lightbox-img.loaded {
  opacity: 1;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 2;
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  padding: 8px;
  opacity: 0.65;
  transition: opacity 0.2s;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--white);
  font-size: 3rem;
  line-height: 1;
  cursor: pointer;
  padding: 14px 20px;
  border-radius: 4px;
  transition: background 0.2s;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.875rem;
  opacity: 0.6;
  pointer-events: none;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .albums-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

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

@media (max-width: 480px) {
  .albums-grid {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }

  .lightbox-nav {
    font-size: 2rem;
    padding: 10px 14px;
  }

  .lightbox-prev { left: 4px; }
  .lightbox-next { right: 4px; }
}
