/**
 * DWiA Gallery - Album-Based Structure
 * New folder/album-style gallery system
 *
 * Layout:
 * - Top-level: Album folders (3&#65533;2 grid = 6 per page on desktop)
 * - Album view: Photos (5&#65533;2 grid = 10 per page on desktop)
 *
 * @package DWiA Theme
 * @version 2.0.0
 */

/* =========================================
   ALBUM-BASED GALLERY - CSS VARIABLES
========================================== */
:root {
  --dwia-gallery-bg: #d8a696;
  --dwia-light: #ffffff;
  --dwia-dark: #1e1510;
  --album-overlay-bg: rgba(0, 0, 0, 0.6);
}

/* =========================================
   GALLERY SECTION - MAIN CONTAINER
========================================== */
#gallery {
  background: var(--dwia-gallery-bg);
  padding: 4.5rem 0;
}

#gallery .section-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

#gallery .section-topband {
  max-width: 1120px;
  margin: 0 auto 1.5rem;
  padding: 0;
  border-radius: 0;
  display: block;
  background: transparent;
}

#gallery .section-title {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
  color: #FFFFFF;
  font-weight: 700;
}

/* =========================================
   TOP-LEVEL: ALBUM FOLDERS GRID (3&#65533;2)
========================================== */
.gallery-albums-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.gallery-album-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.gallery-album-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

.album-cover {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
}

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

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

.album-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--album-overlay-bg);
  padding: 0.6rem 1rem;
  color: var(--dwia-light);
  font-size: 0.85rem;
  font-weight: 500;
}

.album-photo-count {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.album-info {
  padding: 1.2rem 1.3rem;
}

.album-title {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--dwia-dark);
  line-height: 1.3;
}

.album-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: #666;
  line-height: 1.4;
}

/* =========================================
   ALBUM VIEW: BACK BUTTON & HEADER
========================================== */
.gallery-album-photos-view {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.album-header {
  margin-bottom: 2rem;
}

.album-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: var(--dwia-dark);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 1rem;
}

.album-back-btn:hover {
  background: var(--dwia-light);
  transform: translateX(-4px);
}

.album-back-btn svg {
  width: 20px;
  height: 20px;
}

.current-album-title {
  margin: 0.5rem 0 0.3rem;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--dwia-dark);
}

.current-album-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: #555;
}

/* =========================================
   ALBUM VIEW: PHOTOS GRID (5&#65533;2 = 10 photos)
========================================== */
.gallery-photos-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.gallery-photo-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 0.8rem;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  aspect-ratio: 4 / 3;
}

.gallery-photo-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

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

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

/* =========================================
   LOAD MORE BUTTON
========================================== */
.gallery-more {
  margin-top: 2rem;
  text-align: center;
}

.gallery-more button {
  display: inline-block;
  padding: 0.8rem 2rem;
  border-radius: 999px;
  border: 2px solid rgba(0, 0, 0, 0.4);
  background: rgba(255, 255, 255, 0.95);
  color: var(--dwia-dark);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gallery-more button:hover {
  background: var(--dwia-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* =========================================
   RESPONSIVE BEHAVIOR
========================================== */

/* Tablet (2 columns for albums, 3 columns for photos) */
@media (max-width: 1024px) {
  .gallery-albums-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-photos-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .album-cover {
    height: 200px;
  }
}

/* Mobile (1 column for albums, 2 columns for photos) */
@media (max-width: 720px) {
  #gallery {
    padding: 3rem 0;
  }

  #gallery .section-inner {
    padding: 0 1rem;
  }

  #gallery .section-title {
    font-size: 1.5rem;
    letter-spacing: 0.16em;
  }

  .gallery-albums-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }

  .gallery-photos-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }

  .album-cover {
    height: 180px;
  }

  .album-info {
    padding: 1rem;
  }

  .album-title {
    font-size: 0.95rem;
  }

  .current-album-title {
    font-size: 1.3rem;
  }
}

/* Small mobile (1 column for everything) */
@media (max-width: 480px) {
  .gallery-photos-grid {
    grid-template-columns: 1fr;
  }

  .album-back-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }
}

/* =========================================
   LIGHTBOX ADJUSTMENTS
   (Ensure full image + caption visible - LARGE PHOTOS)
========================================== */
.dwia-gallery-lightbox .dwia-gallery-modal-image img {
  max-height: calc(100vh - 120px) !important;
  max-width: 98vw !important;
}

.dwia-gallery-lightbox .dwia-gallery-modal-info {
  margin-top: 0;
  max-width: 95%;
  overflow: visible !important;
}
