/* ==========================================================================
   Gallery — Albums, Image Grid, Lightbox
   ========================================================================== */

/* Gallery Controls */
.tag-filters + .albums-grid {
  margin-top: 2rem;
}

/* Albums Grid */
.albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.album-card {
  display: flex;
  flex-direction: column;
  background: var(--color-bg-raised);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all var(--transition);
  color: var(--color-text);
}

.album-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  color: var(--color-text);
}

.album-card-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--color-bg-elevated);
  overflow: hidden;
}

.album-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.album-card:hover .album-card-cover img { transform: scale(1.05); }

.album-card-empty {
  width: 100%;
  height: 100%;
  background: var(--color-surface);
}

.album-card-count {
  position: absolute;
  bottom: 0.6rem;
  right: 0.6rem;
  padding: 0.2rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-pill);
  backdrop-filter: blur(4px);
}

.album-card-info {
  padding: 1.1rem 1.25rem;
}

.album-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.album-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--color-text-faint);
  margin-bottom: 0.5rem;
}

.album-card-location::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 3px;
  background: var(--color-text-faint);
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 0.4rem;
}

.album-card-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.album-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Album detail header */
.album-header {
  margin-bottom: 2rem;
}

.album-header .btn {
  margin-bottom: 1rem;
}

.album-header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--color-text-faint);
  margin-bottom: 0.5rem;
}

/* Album Body/Story */
.album-body {
  margin-bottom: 2.5rem;
  max-width: 720px;
}

/* Image Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 4 / 3;
  background: var(--color-bg-raised);
  border: none;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.gallery-item:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-item:hover img { transform: scale(1.05); }

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  touch-action: none;
}

.lightbox[hidden] { display: none; }

.lightbox-content {
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius);
  transition: opacity 0.25s ease;
}

.lightbox-content img.lb-fade {
  opacity: 0;
}

.lightbox-caption {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-top: 1rem;
  text-align: center;
}

.lightbox-counter {
  color: var(--color-text-faint);
  font-size: 0.8rem;
  margin-top: 0.4rem;
  text-align: center;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 2rem;
  padding: 1rem;
  opacity: 0.7;
  transition: opacity var(--transition);
  z-index: 1001;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { opacity: 1; }

.lightbox-close { top: 0.5rem; right: 1rem; font-size: 2.5rem; }
.lightbox-prev { left: 1rem; top: 50%; transform: translateY(-50%); font-size: 3rem; }
.lightbox-next { right: 1rem; top: 50%; transform: translateY(-50%); font-size: 3rem; }

@media (max-width: 768px) {
  .lightbox-prev,
  .lightbox-next {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox-content img { transition: none; }
}
