/* ==================
   Gallery Canvas Background
   ================== */
#galleryCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.section,
.gallery-hero,
footer {
  position: relative;
  z-index: 1;
}

body {
  position: relative;
}

/* ==================
   Gallery Hero
   ================== */
.gallery-hero {
  position: relative;
  padding: 160px 24px 80px;
  text-align: center;
  color: var(--color-white);
  overflow: hidden;
}

.gallery-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(2px);
  transform: scale(1.05);
}

.gallery-hero.paintings-hero::before {
  background-image: url('images/paintings/2023-09-25_woman-bare-back-flowers.jpg');
}

.gallery-hero.cushions-hero::before {
  background-image: url('images/cushions/2025-09-27_birds-autumn-leaves-pillow.jpg');
}

.gallery-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(26, 26, 26, 0.75) 0%,
    rgba(139, 115, 85, 0.55) 100%
  );
}

.gallery-hero h1,
.gallery-hero p {
  position: relative;
  z-index: 1;
}

.gallery-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  font-weight: 400;
  font-style: italic;
  margin-bottom: 12px;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.gallery-hero p {
  font-size: 1.15rem;
  font-weight: 300;
  opacity: 0.85;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
}

/* ==================
   Filter Bar
   ================== */
.gallery-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 48px;
}

.filter-btn {
  padding: 10px 24px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 100px;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-light);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.filter-btn.active {
  background: var(--color-dark);
  border-color: var(--color-dark);
  color: var(--color-white);
}

/* ==================
   Masonry Grid (Paintings)
   ================== */
.masonry-grid {
  columns: 4;
  column-gap: 16px;
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 16px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: #eee;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.masonry-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.masonry-item img {
  width: 100%;
  display: block;
  transition: transform 0.5s ease;
}

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

.masonry-item .item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 16px 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
  color: white;
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

.item-overlay h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 400;
  margin-bottom: 2px;
}

.item-overlay span {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Hidden state for filtering */
.masonry-item.hidden {
  display: none;
}

/* ==================
   Cushion Grid
   ================== */
.cushion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.cushion-card {
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-white);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cushion-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

.cushion-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  transition: transform 0.5s ease;
}

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

.cushion-card .cushion-info {
  padding: 16px 20px;
  text-align: center;
}

.cushion-card .cushion-info h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text);
}

/* ==================
   Gallery Lightbox (shared)
   ================== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(250, 249, 247, 0.92);
  backdrop-filter: blur(20px);
  align-items: center;
  justify-content: center;
}

.lightbox.active {
  display: flex;
}

/* Lightbox paint blobs - behind the image */
#lightboxBlobs {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.lightbox-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(35px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.lightbox.active .lightbox-blob {
  opacity: 1;
}

.lightbox .lightbox-content,
.lightbox .lightbox-close,
.lightbox .lightbox-prev,
.lightbox .lightbox-next {
  z-index: 2;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  font-size: 2.5rem;
  color: var(--color-text);
  background: none;
  border: none;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.2s;
}

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

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  color: var(--color-text);
  background: none;
  border: none;
  cursor: pointer;
  z-index: 10;
  opacity: 0.4;
  transition: opacity 0.2s;
  padding: 20px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 1;
}

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

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}

.lightbox-caption {
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-top: 16px;
  text-align: center;
  opacity: 0.7;
}

/* ==================
   Active nav link
   ================== */
.nav-links a.active {
  color: var(--color-accent);
}

.nav-links a.active::after {
  width: 100%;
}

/* ==================
   Responsive
   ================== */
@media (max-width: 1024px) {
  .masonry-grid {
    columns: 3;
  }
}

@media (max-width: 768px) {
  .masonry-grid {
    columns: 2;
    column-gap: 12px;
  }
  .masonry-item {
    margin-bottom: 12px;
  }
  .gallery-hero {
    padding: 120px 24px 40px;
  }
  .cushion-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
  }
  .gallery-filter {
    gap: 6px;
    margin-bottom: 32px;
  }
  .filter-btn {
    padding: 8px 16px;
    font-size: 0.75rem;
  }

  /* Mobile nav */
  .nav-links {
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    background: rgba(250, 249, 247, 0.98);
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    gap: 20px;
    transform: translateY(-100%);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
  }
  .nav-links.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }
  .nav-toggle {
    display: flex;
  }
}

@media (max-width: 480px) {
  .masonry-grid {
    columns: 2;
    column-gap: 8px;
  }
  .masonry-item {
    margin-bottom: 8px;
  }
}
