.gallery-section {
  background: var(--soft);
  border-top: 1px solid #e5d1c9;
  border-bottom: 1px solid #e5d1c9;
}

.gallery-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 3rem;
  margin-bottom: 2rem;
}

.gallery-heading h2 { margin-bottom: 0; }
.gallery-heading > p { max-width: 34rem; color: var(--muted); margin-bottom: .4rem; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 235px;
  gap: 1rem;
}

.gallery-card {
  position: relative;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: var(--red-dark);
  cursor: zoom-in;
  color: #fff;
  box-shadow: 0 8px 20px rgba(62, 0, 4, .12);
}

.gallery-card.wide { grid-column: span 2; }
.gallery-card.portrait { grid-row: span 2; }

.gallery-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease, filter .35s ease;
}

.gallery-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(47, 0, 3, .88), transparent 46%);
  pointer-events: none;
}

.gallery-card span {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: .85rem;
  z-index: 1;
  font: 600 1.2rem/1.2 'Cormorant Garamond', Georgia, serif;
  text-align: left;
}

.gallery-card:hover img,
.gallery-card:focus-visible img {
  transform: scale(1.035);
  filter: saturate(1.08);
}

.gallery-help { margin: 1rem 0 0; color: var(--muted); font-size: .85rem; }

.gallery-lightbox {
  width: min(92vw, 1100px);
  max-height: 92vh;
  border: 1px solid var(--gold);
  padding: 1rem;
  background: #1e0507;
  color: #fff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .5);
}

.gallery-lightbox::backdrop {
  background: rgba(20, 0, 2, .86);
  backdrop-filter: blur(4px);
}

.gallery-lightbox img {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  margin: auto;
  object-fit: contain;
}

.gallery-lightbox p { margin: .8rem 3rem 0 0; color: #f1ddd4; font-size: .9rem; }

.lightbox-close {
  position: absolute;
  top: .65rem;
  right: .65rem;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

@media (max-width: 1100px) {
  .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 220px; }
  .gallery-card.wide { grid-column: span 2; }
}

@media (max-width: 800px) {
  .gallery-heading { display: block; }
  .gallery-heading > p { margin-top: 1rem; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 190px; }
  .gallery-card.wide { grid-column: span 2; }
  .gallery-card.portrait { grid-row: span 2; }
}

@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .gallery-card,
  .gallery-card.wide,
  .gallery-card.portrait { grid-column: auto; grid-row: auto; aspect-ratio: 4 / 5; }
  .gallery-card.wide { aspect-ratio: 4 / 3; }
  .gallery-card span { font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-card img { transition: none; }
}
