/* Media page — masonry / waterfall gallery + lightbox. Pairs with home.css. */

.page-content {
  padding: 3rem 0 4rem;
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Masonry grid ---------- */
.masonry {
  list-style: none;
  margin: 0;
  padding: 0;
  column-count: 3;
  column-gap: 1rem;
}

.masonry__item {
  break-inside: avoid;
  margin-bottom: 1rem;
}

.masonry__thumb {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 1.1rem;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--neutral-tint, #f1f4f3);
  box-shadow: 0 16px 40px rgba(67, 170, 139, 0.14);
}

.masonry__thumb img {
  width: 100%;
  height: auto;
  transition: transform 0.5s ease;
}

.masonry__thumb:hover img,
.masonry__thumb:focus-visible img {
  transform: scale(1.05);
}

.masonry__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2.25rem 1rem 0.85rem;
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  text-align: left;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.72) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.masonry__thumb:hover .masonry__caption,
.masonry__thumb:focus-visible .masonry__caption {
  opacity: 1;
}

.masonry__thumb:focus-visible {
  outline: 2px solid var(--primary-text, #2f8a6f);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .masonry {
    column-count: 2;
  }
}

@media (max-width: 560px) {
  .masonry {
    column-count: 1;
  }
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(0, 0, 0, 0.86);
}

.lightbox.is-open {
  display: grid;
}

.lightbox__inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 1200px;
  width: 100%;
}

.lightbox__figure {
  margin: 0;
  flex: 1;
  min-width: 0;
  text-align: center;
}

.lightbox__img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: 78vh;
  border-radius: 0.5rem;
  object-fit: contain;
}

.lightbox__caption {
  margin-top: 0.9rem;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
}

.lightbox__close,
.lightbox__arrow {
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: var(--primary-text, #2f8a6f);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox__close:hover,
.lightbox__arrow:hover {
  background: #fff;
  transform: scale(1.06);
}

.lightbox__close svg,
.lightbox__arrow svg {
  width: 1.4rem;
  height: 1.4rem;
}

.lightbox__close {
  position: absolute;
  top: -3.4rem;
  right: 0;
}

.lightbox__close:focus-visible,
.lightbox__arrow:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .lightbox__inner {
    gap: 0.4rem;
  }

  .lightbox__close,
  .lightbox__arrow {
    width: 2.4rem;
    height: 2.4rem;
  }

  .lightbox__close {
    top: -3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .masonry__thumb img,
  .lightbox__close,
  .lightbox__arrow {
    transition: none;
  }
}
