/* ===== Gallery Grid (Masonry) ===== */

.gallery-grid {
  columns: 3;
  column-gap: 20px;
  padding: 0;
}

.gallery-grid .gallery-item {
  break-inside: avoid;
  margin-bottom: 20px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.gallery-grid .gallery-item img {
  width: 100%;
  display: block;
  transition: transform 0.6s ease, filter 0.4s ease;
}

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

.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.4) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.4s ease;
  display: flex;
  align-items: flex-end;
  padding: 20px;
}

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

.gallery-item-overlay span {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: #fff;
  letter-spacing: 0.05em;
}

/* ===== Gallery Category Cards ===== */

.gallery-categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 32px;
}

.gallery-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 3 / 4;
  background: var(--mm-cream);
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

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

.gallery-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 24px 24px;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
  color: #fff;
}

.gallery-card-info h3 {
  color: #fff;
  font-size: 2rem;
  margin-bottom: 4px;
}

.gallery-card-info p {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.8);
  letter-spacing: 0.05em;
  max-width: 100%;
}

/* ===== Lightbox ===== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.open {
  display: flex;
  opacity: 1;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.3s;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  padding: 20px;
  opacity: 0.6;
  transition: opacity 0.3s;
}

.lightbox-nav:hover {
  opacity: 1;
}

.lightbox-prev {
  left: 10px;
}

.lightbox-next {
  right: 10px;
}

.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.1em;
}

/* ===== Carousel ===== */

.carousel-wrapper {
  position: relative;
  overflow: hidden;
  margin-bottom: 60px;
}

.carousel-track {
  display: flex;
  gap: 20px;
  transition: transform 0.5s ease;
  will-change: transform;
}

.carousel-track img {
  flex: 0 0 auto;
  height: 400px;
  width: auto;
  object-fit: cover;
  cursor: pointer;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.9);
  border: none;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--mm-charcoal);
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  transition: background 0.3s;
  z-index: 2;
}

.carousel-btn:hover {
  background: #fff;
}

.carousel-btn-prev {
  left: 16px;
}

.carousel-btn-next {
  right: 16px;
}

/* ===== Filter Tabs ===== */

.gallery-filters {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 48px;
  flex-wrap: wrap;
}

.filter-btn {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 24px;
  background: none;
  border: 1px solid var(--mm-sand);
  color: var(--mm-text-muted);
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--mm-charcoal);
  border-color: var(--mm-charcoal);
  color: #fff;
}

/* ===== Gallery Page Header ===== */

.gallery-hero {
  padding: calc(var(--nav-height) + 60px) 0 60px;
  text-align: center;
  background: var(--mm-cream);
}

.gallery-hero h1 {
  margin-bottom: 12px;
}

.gallery-hero p {
  margin: 0 auto;
  color: var(--mm-text-muted);
}

/* ===== Responsive ===== */

@media (max-width: 1024px) {
  .gallery-grid {
    columns: 2;
  }

  .carousel-track img {
    height: 300px;
  }
}

@media (max-width: 768px) {
  .gallery-grid {
    columns: 2;
    column-gap: 12px;
  }

  .gallery-grid .gallery-item {
    margin-bottom: 12px;
  }

  .gallery-categories {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    columns: 1;
  }

  .carousel-track img {
    height: 240px;
  }

  .lightbox-nav {
    font-size: 1.5rem;
    padding: 10px;
  }
}
