/* ============================================================
   SAND BEACH RESTAURANT — Gallery
   A Glimpse of Life Here
   ============================================================ */

.gallery {
  background: var(--color-cream);
  padding-block: clamp(5rem, 9vw, 9rem);
  position: relative;
}

.gallery__header {
  text-align: center;
  max-width: 620px;
  margin-inline: auto;
  margin-bottom: clamp(3.5rem, 6vw, 6rem);
}

.gallery__header p {
  margin-top: 1rem;
}

/* ── Grid: 3 columns, explicit row heights ── */
.gallery__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: 280px 160px 160px;
  gap: 16px;
  max-width: 1100px;
  margin-inline: auto;
}

/* ── Item base ── */
.gallery-item {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  background-color: var(--color-sand-light);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  outline: none;
  /* Ensure item fills its grid cell */
  min-height: 0;
}

/* ── Explicit placements ──────────────────────────────
   Grid is 3 cols × 3 rows:
   Col widths : 2fr  1fr  1fr
   Row heights: 280px 160px 160px

   ┌──────────────────┬───────────┬───────────┐
   │                  │           │           │  280px
   │  Coastal Ambience│  Beachfront Dining    │
   │  (col 1, row 1-3)│  (col 2-3, row 1)    │
   ├──────────────────┼───────────┼───────────┤
   │                  │ Serene    │ Fresh     │  160px
   │  (cont.)         │ Shoreline │ Catch     │
   ├──────────────────┼───────────┼───────────┤
   │                  │ Sunset    │           │  160px
   │  (cont.)         │ View      │ (col 3 empty → filler) │
   └──────────────────┴───────────┴───────────┘
   ─────────────────────────────────────────── */

/* Coastal Ambience — left column, spans all 3 rows */
.gallery-item--large {
  grid-column: 1 / 2;
  grid-row: 1 / 4;
}

/* Beachfront Dining — top right, spans cols 2-3, row 1 only */
.gallery-item--tall {
  grid-column: 2 / 4;
  grid-row: 1 / 2;
}

/* Serene Shoreline — col 2, row 2 */
.gallery-item--medium {
  grid-column: 2 / 3;
  grid-row: 2 / 3;
}

/* Fresh Catch — col 3, row 2 */
.gallery-item--freshcatch {
  grid-column: 3 / 4;
  grid-row: 2 / 3;
}

/* Sunset View — col 2, row 3 */
.gallery-item--sunset {
  grid-column: 2 / 3;
  grid-row: 3 / 4;
}

/* ── Images fill their cells ── */
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform var(--transition-slow);
}

/* ── Hover ── */
.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  z-index: 2;
}

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

/* ── Overlay ── */
.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(22, 14, 5, 0.88) 0%,
    rgba(22, 14, 5, 0.4) 60%,
    rgba(22, 14, 5, 0) 100%
  );
  opacity: 0;
  transition: opacity var(--transition-base);
  display: flex;
  align-items: flex-end;
  padding: var(--space-md);
}

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

.gallery-overlay-content {
  color: var(--color-white);
  transform: translateY(15px);
  transition: transform var(--transition-base);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

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

.gallery-item-title {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 1.8vw, 1.6rem);
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 0.25rem;
  color: var(--color-white);
}

.gallery-item-desc {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 300;
  margin-bottom: 0.85rem;
}

.gallery-item-zoom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--color-white);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.gallery-item-zoom:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.gallery-item-zoom svg {
  width: 14px;
  height: 14px;
}

/* ── Lightbox ── */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
  padding: 1.5rem;
}

#lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox__overlay {
  position: absolute;
  inset: 0;
  background: rgba(12, 8, 4, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: -1;
}

.lightbox__container {
  position: relative;
  max-width: 80vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
}

#lightbox-img {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transform: scale(0.96);
  transition: transform var(--transition-base);
  background-color: rgba(0, 0, 0, 0.2);
}

#lightbox.open #lightbox-img {
  transform: scale(1);
}

.lightbox__caption {
  margin-top: 1.25rem;
  text-align: center;
  color: var(--color-white);
  max-width: 600px;
}

#lightbox-title {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  font-weight: 300;
  color: var(--color-white);
  margin-bottom: 0.25rem;
}

#lightbox-desc {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 300;
}

.lightbox__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: var(--z-above);
  outline: none;
}

.lightbox__btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-50%) scale(1.05);
}

.lightbox__btn:focus-visible { outline: 2px solid var(--color-white); }
.lightbox__btn--prev { left: 2.5rem; }
.lightbox__btn--next { right: 2.5rem; }
.lightbox__btn svg  { width: 22px; height: 22px; }

#lightbox-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--color-white);
  font-size: 2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: var(--z-above);
  outline: none;
}

#lightbox-close:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  transform: scale(1.05);
}

.lightbox__counter {
  position: absolute;
  top: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  z-index: var(--z-above);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .gallery__grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 260px 200px 200px 200px;
    gap: 12px;
  }

  .gallery-item--large     { grid-column: 1 / 3; grid-row: 1 / 2; }
  .gallery-item--tall      { grid-column: 1 / 2; grid-row: 2 / 4; }
  .gallery-item--medium    { grid-column: 2 / 3; grid-row: 2 / 3; }
  .gallery-item--freshcatch{ grid-column: 2 / 3; grid-row: 3 / 4; }
  .gallery-item--sunset    { grid-column: 1 / 3; grid-row: 4 / 5; }

  .lightbox__btn--prev { left: 1.5rem; }
  .lightbox__btn--next { right: 1.5rem; }
}

@media (max-width: 560px) {
  .gallery__grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-rows: 220px;
    gap: 10px;
  }

  .gallery-item--large,
  .gallery-item--tall,
  .gallery-item--medium,
  .gallery-item--freshcatch,
  .gallery-item--sunset {
    grid-column: 1 / 2 !important;
    grid-row: auto !important;
  }

  .lightbox__container { max-width: 95vw; }
  #lightbox-img        { max-height: 55vh; }
  .lightbox__btn       { width: 44px; height: 44px; }
  .lightbox__btn--prev { left: 0.75rem; }
  .lightbox__btn--next { right: 0.75rem; }
  #lightbox-close      { top: 1rem; right: 1rem; width: 40px; height: 40px; font-size: 1.6rem; }
  .lightbox__counter   { top: 1.5rem; }
}
