/* Gallery Container */
.gallery-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

/* ========================================
   Album Grid (album list view)
   ======================================== */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.album-card {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.album-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.album-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

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

.album-card-info {
  padding: 12px 16px;
  background: var(--paper, rgba(255, 255, 255, 0.97));
}

.album-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--ink, #2c3e50);
}

.album-card-count {
  font-size: 0.85rem;
  color: var(--muted, #718096);
}

/* Dark mode - album cards */
[data-user-color-scheme="dark"] .album-card {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

[data-user-color-scheme="dark"] .album-card-info {
  background: var(--paper, rgba(37, 45, 56, 0.97));
}

[data-user-color-scheme="dark"] .album-card-title {
  color: var(--ink, #c4c6c9);
}

[data-user-color-scheme="dark"] .album-card-count {
  color: var(--muted, #a7a9ad);
}

/* ========================================
   Album Detail (photo grid view)
   ======================================== */
.album-detail-header {
  margin-bottom: 20px;
}

.album-back-btn {
  background: none;
  border: 1px solid var(--line, #ccc);
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--ink, #3c4858);
  transition: background 0.2s, color 0.2s;
}

.album-back-btn:hover {
  background: var(--line, #f2f3f5);
}

[data-user-color-scheme="dark"] .album-back-btn {
  border-color: var(--line, #435266);
  color: var(--ink, #c4c6c9);
}

[data-user-color-scheme="dark"] .album-back-btn:hover {
  background: var(--line, #364151);
}

.album-detail-title {
  margin: 12px 0 4px;
  font-size: 1.5rem;
  color: var(--ink, #2c3e50);
}

.album-detail-desc {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--muted, #718096);
}

[data-user-color-scheme="dark"] .album-detail-title {
  color: var(--ink, #c4c6c9);
}

[data-user-color-scheme="dark"] .album-detail-desc {
  color: var(--muted, #a7a9ad);
}

/* ========================================
   Photo Grid (inside album detail)
   ======================================== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

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

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

.gallery-caption {
  position: relative;
  z-index: 2;
  padding: 8px 12px;
  font-size: 0.9rem;
  text-align: center;
  background: var(--paper, rgba(255, 255, 255, 0.95));
  color: var(--ink, #333);
}

/* Dark mode - photo items */
[data-user-color-scheme="dark"] .gallery-caption {
  background: var(--paper, rgba(37, 45, 56, 0.95));
  color: var(--ink, #c4c6c9);
}

[data-user-color-scheme="dark"] .gallery-item {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ========================================
   Watermark Overlay
   ======================================== */
.watermark-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-repeat: repeat;
  pointer-events: none;
  z-index: 1;
}

/* ========================================
   Lightbox
   ======================================== */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.lightbox.active {
  display: flex;
}

.lightbox-img-wrapper {
  position: relative;
  display: inline-block;
  max-width: 90vw;
  max-height: 80vh;
}

.lightbox-img-wrapper .watermark-overlay {
  border-radius: 4px;
}

.lightbox-img {
  display: block;
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
  /* The grid thumbnail, painted under the full photo while it downloads.
     The element is sized in JS before the src is set, so this has a box to
     fill; `contain` keeps it registered with the photo that replaces it. */
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.lightbox-caption {
  color: #fff;
  margin-top: 16px;
  font-size: 1.1rem;
  text-align: center;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  user-select: none;
  padding: 8px 16px;
  transition: opacity 0.2s;
  opacity: 0.7;
}

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

.lightbox-close {
  top: 20px;
  right: 30px;
  font-size: 3rem;
}

.lightbox-prev {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

/* ========================================
   Mobile
   ======================================== */
@media (max-width: 600px) {
  .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
  }

  .album-card img {
    height: 160px;
  }

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

  .gallery-item img {
    height: 150px;
  }

  .lightbox-prev,
  .lightbox-next {
    font-size: 1.8rem;
  }
}
