/* gallery.css — Recent Listings grid and its lightbox.
   Kept separate from about.css so a future listings page can reuse it. */

/* ========================
   Grid
======================== */
.listings-intro {
  max-width: 640px;
  margin: 0 auto;
}

.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.25rem;
  margin-top: 2.5rem;
}

.listing-tile {
  display: block;
  overflow: hidden;
  border-radius: 12px;
  background: var(--color-white);
  box-shadow: 0 4px 16px rgb(0 0 0 / 8%);
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.listing-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  margin: 0; /* the global img rule adds vertical margin */
  transition: transform 300ms ease;
}

.listing-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgb(0 0 0 / 14%);
}

.listing-tile:hover img {
  transform: scale(1.04);
}

.listing-tile:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

/* ========================
   Lightbox
======================== */
body.has-lightbox {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 4.75rem;
  background: rgb(0 0 0 / 92%);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-figure {
  margin: 0;
  text-align: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  margin: 0 auto;
  border-radius: 8px;
}

.lightbox-counter {
  margin-top: 0.85rem;
  color: var(--color-white);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

.lightbox button {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgb(255 255 255 / 55%);
  border-radius: 50%;
  background: rgb(0 0 0 / 35%);
  color: var(--color-white);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.lightbox button:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.lightbox button:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: 3px;
}

.lightbox-close {
  top: 1rem;
  right: 1rem;
}

.lightbox-prev {
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
}

.lightbox-next {
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
}

/* On narrow screens the side arrows would sit on top of the photo,
   so drop them to the bottom of the overlay instead. */
@media (max-width: 640px) {
  .lightbox {
    padding: 3.5rem 1rem 6rem;
  }

  .lightbox-prev,
  .lightbox-next {
    top: auto;
    bottom: 1.25rem;
    transform: none;
  }

  .lightbox-prev {
    left: calc(50% - 56px);
  }

  .lightbox-next {
    right: calc(50% - 56px);
  }

  .lightbox-image {
    max-height: 68vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .listing-tile,
  .listing-tile img,
  .lightbox button {
    transition: none;
  }

  .listing-tile:hover {
    transform: none;
  }

  .listing-tile:hover img {
    transform: none;
  }
}
