/* ========================================================
   6. ALBUM NHỎ (LƯỚI POLAROID 3 CỘT) & LIGHTBOX
   ======================================================== */
.section-header {
  margin: 0;
  text-align: center;
}

#gallery {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  overflow: visible;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.gallery-grid:empty { display: none; }

.gallery-item {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 6px 6px 18px;
  border: 0;
  background: var(--polaroid);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  rotate: -3deg;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item:nth-child(6n+2) { rotate: 2deg; }
.gallery-item:nth-child(6n+3) { rotate: -1deg; }
.gallery-item:nth-child(6n+4) { rotate: 3deg; }
.gallery-item:nth-child(6n+5) { rotate: -2deg; }
.gallery-item:nth-child(6n+6) { rotate: 1deg; }

.gallery-item:nth-child(6n+2) .gallery-photo { background: var(--photo-2); }
.gallery-item:nth-child(6n+3) .gallery-photo { background: var(--photo-3); }
.gallery-item:nth-child(6n+4) .gallery-photo { background: var(--paper-dot); }
.gallery-item:nth-child(6n+6) .gallery-photo { background: var(--photo-2); }

#gallery .gallery-item:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: var(--shadow-lg);
}

.gallery-photo {
  aspect-ratio: 1;
  pointer-events: none;
}

.gallery-more {
  padding: 0 4px;
  background: none;
  color: var(--accent-red);
  font-family: var(--font-hand);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.7;
  cursor: pointer;
}

.gallery-more[hidden] { display: none; }

.gallery-more:hover { text-decoration: underline; text-underline-offset: 4px; }

.slide-caption { display: none; }

/* Lightbox xem ảnh toàn màn hình */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(47, 42, 38, 0.92);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-modal.open {
  opacity: 1;
  visibility: visible;
}

.lightbox-modal img {
  max-width: min(92vw, 900px);
  max-height: 82vh;
  padding: 10px 10px 36px;
  background: var(--polaroid);
  object-fit: contain;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  rotate: -1deg;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink-dark) !important;
  border-radius: 50%;
  background: var(--polaroid);
  color: var(--ink-dark);
  box-shadow: var(--hard-shadow);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: var(--note-yellow);
}

.lightbox-close {
  top: 16px;
  right: 16px;
  font-size: 1rem;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
}

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

.lightbox-nav[hidden] {
  display: none !important;
}

.lightbox-close:focus-visible,
.lightbox-nav:focus-visible {
  outline: 2px solid var(--note-yellow);
  outline-offset: 3px;
}
