/* ============================================================
   GALLERY.CSS — Modern Responsive Image Gallery
   Sections:
     1. Reset & Base
     2. Page Layout
     3. Gallery Header
     4. Filter Bar
     5. Gallery Grid & Cards
     6. Hover Effects
     7. Lightbox Modal
     8. Animations
     9. Responsive Breakpoints
   ============================================================ */


/* ── 1. RESET & BASE ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colour tokens — change these to restyle the whole page */
  --bg:          #111214;
  --surface:     #1c1e22;
  --card-bg:     #212428;
  --accent:      #c9a84c;        /* gold */
  --accent-lite: #e8c96d;
  --text:        #f0ece2;
  --muted:       #888;
  --radius:      12px;           /* card corner radius */
  --shadow:      0 8px 28px rgba(0,0,0,0.55);
  --transition:  0.38s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }


/* ── 2. PAGE LAYOUT ── */
.gallery-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 24px 100px;
}


/* ── 3. GALLERY HEADER ── */
.gallery-header {
  text-align: center;
  margin-bottom: 40px;
}

/* Small label above the title */
.gallery-label {
  font-size: 0.72rem;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

/* Main title */
.gallery-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 10px;
}

/* Subtitle / hint text */
.gallery-subtitle {
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 300;
  margin-bottom: 20px;
}

/* Decorative gold line under the header */
.gallery-divider {
  width: 56px;
  height: 3px;
  background: linear-gradient(to right, var(--accent), transparent);
  border-radius: 2px;
  margin: 0 auto;
}


/* ── 4. FILTER BAR ── */
.filter-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 40px;
}

.filter-btn {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 8px 24px;
  border-radius: 50px;           /* pill shape */
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.25s ease;
}

/* Hover state */
.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Active / selected filter */
.filter-btn.active {
  background: var(--accent);
  color: #111;
  border-color: var(--accent);
  font-weight: 600;
}

/* Cards that are hidden by filter */
.gallery-card.hidden {
  display: none;
}


/* ── 5. GALLERY GRID & CARDS ── */

/* CSS Grid — 4 equal columns, each card 500px tall */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

/* Individual card — equal 500px height for all thumbnails */
.gallery-card {
  position: relative;
  width: 100%;
  height: 500px;
  border-radius: 8px;
  overflow: hidden;              /* clips the zoom effect to the card */
  cursor: pointer;
  background: var(--card-bg);
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);

  /* Fade-in animation on page load */
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.5s ease forwards;
}

/* Staggered animation delay for each card (set in JS) */
.gallery-card:nth-child(1)  { animation-delay: 0.05s; }
.gallery-card:nth-child(2)  { animation-delay: 0.10s; }
.gallery-card:nth-child(3)  { animation-delay: 0.15s; }
.gallery-card:nth-child(4)  { animation-delay: 0.20s; }
.gallery-card:nth-child(5)  { animation-delay: 0.25s; }
.gallery-card:nth-child(6)  { animation-delay: 0.30s; }
.gallery-card:nth-child(7)  { animation-delay: 0.35s; }
.gallery-card:nth-child(8)  { animation-delay: 0.40s; }

/* The image inside the card */
.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;            /* fills the square without stretching */
  display: block;
  transition: transform var(--transition), filter var(--transition);
  filter: brightness(0.88);
  transform: scale(1);          /* explicit start = smooth transition */
  will-change: transform;       /* GPU hint for smooth animation */
}


/* ── 6. HOVER EFFECTS ── */

/* Zoom the image on hover */
.gallery-card:hover img {
  transform: scale(1.12);
  filter: brightness(1);
}

/* Dark overlay that slides in from the bottom */
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.75) 0%,
    rgba(0,0,0,0.1)  50%,
    transparent      100%
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;          /* overlay doesn't block click */
}

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

/* Magnifier icon shown on hover */
.zoom-icon {
  font-size: 2rem;
  transform: scale(0.6);
  transition: transform var(--transition);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
}

.gallery-card:hover .zoom-icon {
  transform: scale(1);
}

/* Caption text shown on hover */
.img-caption {
  font-size: 0.82rem;
  font-weight: 500;
  color: #fff;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  transform: translateY(8px);
  transition: transform var(--transition);
}

.gallery-card:hover .img-caption {
  transform: translateY(0);
}


/* ── 7. LIGHTBOX MODAL ── */

/* Full-screen dark backdrop — clicking it closes the lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.93);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;               /* hint: click backdrop to close */

  /* Hidden by default */
  opacity: 0;
  visibility: hidden;            /* use visibility so children aren't clickable */
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* When JS adds .active class — show it */
.lightbox.active {
  opacity: 1;
  visibility: visible;
}

/* Content box — stops cursor:pointer from the backdrop */
.lightbox-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: default;               /* reset cursor inside the box */

  /* Pop-in scale animation — NO transform here avoids breaking arrow positioning */
  animation: none;
}

/* Scale-in when lightbox opens */
.lightbox.active .lightbox-box {
  animation: lbPopIn 0.28s ease forwards;
}

@keyframes lbPopIn {
  from { transform: scale(0.88); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

/* The full-size image — shows original photo, never cropped */
.lb-image {
  display: block;
  max-width: 88vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
  border: 2px solid rgba(201,168,76,0.35);
  box-shadow: 0 24px 80px rgba(0,0,0,0.85);
  cursor: default;
}

/* Close (✕) button — top-right corner */
.lb-close {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: #111;
  border: none;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.3s;
  z-index: 2;
}

.lb-close:hover {
  background: var(--accent-lite);
  transform: rotate(90deg);
}

/* Prev / Next arrows — direct children of .lightbox (no transform parent)
   Using position:absolute relative to the fixed .lightbox element          */
.lb-arrow {
  position: absolute;           /* relative to .lightbox (position:fixed) */
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  background: rgba(201,168,76,0.15);
  border: 1px solid rgba(201,168,76,0.4);
  color: var(--accent);
  font-size: 1.3rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  z-index: 10000;
}

.lb-prev { left: 20px; }
.lb-next { right: 20px; }

.lb-arrow:hover {
  background: rgba(201,168,76,0.35);
  transform: translateY(-50%) scale(1.08);
}

/* Caption + counter row below the image */
.lb-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 12px;
  padding: 0 4px;
}

.lb-caption {
  font-size: 0.86rem;
  color: #ccc;
  letter-spacing: 0.5px;
}

.lb-counter {
  font-size: 0.74rem;
  letter-spacing: 3px;
  color: var(--accent);
  text-transform: uppercase;
}


/* ── 8. ANIMATIONS ── */

/* Cards fade up when page loads */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ── 9. RESPONSIVE BREAKPOINTS ── */

/* Tablet — 2 columns, slightly reduced height */
@media (max-width: 960px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .gallery-card { height: 380px; }
}

/* Large mobile — 2 columns */
@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .gallery-card { height: 260px; }

  .lb-arrow { width: 36px; height: 36px; font-size: 1rem; }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
  .lb-image { max-width: 94vw; max-height: 70vh; }
}

/* Small mobile — 1 column */
@media (max-width: 380px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .gallery-card { height: 240px; }
}
