/* ============================================================
   BÀNAY BAKERY + CAFE — Gallery CSS
   ============================================================ */

/* ============================================================
   GALLERY SECTION
   ============================================================ */
.gallery-section {
  background: var(--cream);
  overflow: hidden;
}

.gallery-section__header {
  text-align: center;
  margin-bottom: clamp(2.5rem, 4vw, 3.5rem);
}

/* ============================================================
   MASONRY GRID
   ============================================================ */
.gallery-grid {
  columns: 3;
  column-gap: 0.875rem;
  /* Ensure items don't get cut off mid-image */
  orphans: 1;
  widows: 1;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 0.875rem;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  cursor: pointer;
  display: block;
  background: var(--warm);
}

.gallery-item__image {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.7s var(--ease-out);
  aspect-ratio: auto;
  object-fit: cover;
}

/* Vary aspect ratios for visual interest */
.gallery-item:nth-child(1) .gallery-item__image { aspect-ratio: 4/5; }
.gallery-item:nth-child(2) .gallery-item__image { aspect-ratio: 3/4; }
.gallery-item:nth-child(3) .gallery-item__image { aspect-ratio: 4/3; }
.gallery-item:nth-child(4) .gallery-item__image { aspect-ratio: 1/1; }
.gallery-item:nth-child(5) .gallery-item__image { aspect-ratio: 3/4; }
.gallery-item:nth-child(6) .gallery-item__image { aspect-ratio: 4/5; }
.gallery-item:nth-child(7) .gallery-item__image { aspect-ratio: 4/3; }
.gallery-item:nth-child(8) .gallery-item__image { aspect-ratio: 3/4; }
.gallery-item:nth-child(9) .gallery-item__image { aspect-ratio: 1/1; }

.gallery-item:hover .gallery-item__image {
  transform: scale(1.04);
}

/* Overlay */
.gallery-item__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom, 
    transparent 40%, 
    rgba(13,13,11,0.7) 100%
  );
  opacity: 0;
  transition: opacity var(--duration-mid) var(--ease-out);
  display: flex;
  align-items: flex-end;
  padding: 1.25rem;
}

.gallery-item:hover .gallery-item__overlay {
  opacity: 1;
}

.gallery-item__label {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,253,249,0.85);
  transform: translateY(8px);
  transition: transform var(--duration-mid) var(--ease-out);
}

.gallery-item:hover .gallery-item__label {
  transform: translateY(0);
}

/* Expand icon */
.gallery-item__expand {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,253,249,0.15);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: 
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

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

.gallery-item__expand svg {
  width: 14px;
  height: 14px;
  stroke: white;
  fill: none;
  stroke-width: 1.5;
  overflow: visible;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(13,13,11,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: 
    opacity var(--duration-mid) var(--ease-out),
    visibility var(--duration-mid);
  cursor: zoom-out;
}

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

.lightbox__inner {
  position: relative;
  max-width: min(90vw, 1200px);
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__image {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 3px;
  display: block;
  transform: scale(0.95);
  transition: transform var(--duration-mid) var(--ease-out);
}

.lightbox.is-open .lightbox__image {
  transform: scale(1);
}

.lightbox__close {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,253,249,0.1);
  color: var(--white);
  font-size: 1.25rem;
  transition: background var(--duration-fast) var(--ease-out);
  cursor: pointer;
  z-index: 1001;
  border: 1px solid rgba(255,253,249,0.12);
}

.lightbox__close:hover {
  background: rgba(255,253,249,0.2);
}

.lightbox__nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,253,249,0.1);
  color: var(--white);
  border: 1px solid rgba(255,253,249,0.12);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
  z-index: 1001;
}

.lightbox__nav:hover {
  background: rgba(255,253,249,0.2);
}

.lightbox__nav--prev {
  left: 1.5rem;
}

.lightbox__nav--next {
  right: 1.5rem;
}

.lightbox__nav svg {
  width: 20px;
  height: 20px;
  stroke: white;
  fill: none;
  stroke-width: 1.5;
}

.lightbox__counter {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: rgba(255,253,249,0.4);
  z-index: 1001;
}

/* ============================================================
   GALLERY LOAD MORE (optional)
   ============================================================ */
.gallery-actions {
  text-align: center;
  margin-top: 3rem;
}
