/* =========================================================
   Sanskarshala — Gallery page
   (page headline, about-sec: about.css · prog-head, prog-hero__sub: programme.css ·
    filters: schools.css · container, reveal, section-title, cta, footer: home.css)
   ========================================================= */

.gal-photos {
  background: var(--cream);
}

.gal-photos .filters,
.gal-videos .filters {
  margin-bottom: clamp(1.75rem, 3vw, 2.5rem);
}

/* filter buttons on the dark video section */
.filters--dark .filters__btn {
  border-color: rgba(185, 226, 140, 0.35);
  color: var(--cream);
}

.filters--dark .filters__btn:hover {
  border-color: var(--lime);
}

.filters--dark .filters__btn.is-active {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--menu-green);
}

.gal-empty {
  padding: 2.5rem 0;
  text-align: center;
  color: var(--muted);
}

.gal-empty--light {
  color: rgba(246, 241, 230, 0.7);
}

/* ============ PHOTOS (masonry columns) ============ */

.photos {
  columns: 3;
  column-gap: clamp(0.875rem, 1.6vw, 1.375rem);
}

.photo {
  break-inside: avoid;
  margin-bottom: clamp(0.875rem, 1.6vw, 1.375rem);
}

.photo[hidden] {
  display: none;
}

.photo__btn {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 1.25rem;
  overflow: hidden;
  background: #e8e1d0;
  cursor: zoom-in;
  box-shadow: 0 0.75rem 1.625rem rgba(30, 43, 34, 0.1);
}

.photo__btn img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.6s ease;
}

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

.photo__btn:focus-visible {
  outline: 0.1875rem solid var(--orange);
  outline-offset: 0.1875rem;
}

/* caption slides up on hover (always shown on touch screens) */
.photo__info {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.375rem;
  padding: 2.5rem 1.125rem 1rem;
  background: linear-gradient(180deg, transparent, rgba(10, 16, 12, 0.78));
  color: var(--cream);
  text-align: left;
  opacity: 0;
  transform: translateY(0.75rem);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.photo__btn:hover .photo__info,
.photo__btn:focus-visible .photo__info {
  opacity: 1;
  transform: none;
}

@media (hover: none) {
  .photo__info {
    opacity: 1;
    transform: none;
  }
}

.photo__tag,
.video__tag {
  padding: 0.25rem 0.625rem;
  border-radius: 62.4375rem;
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.photo__tag[hidden],
.video__tag[hidden] {
  display: none;
}

.photo__caption {
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.35;
}

/* ============ VIDEOS ============ */

.gal-videos {
  background:
    radial-gradient(ellipse 50% 70% at 90% 10%, rgba(185, 226, 140, 0.12), transparent 70%),
    var(--menu-green);
  color: var(--cream);
}

.videos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.75rem);
}

.video[hidden] {
  display: none;
}

.video__link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.video__thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 0 1.25rem 2.25rem rgba(0, 0, 0, 0.25);
}

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

.video__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 12, 0.3);
  transition: background 0.3s ease;
}

.video__play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 4.25rem;
  height: 4.25rem;
  margin: -2.125rem 0 0 -2.125rem;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--menu-green);
  box-shadow: 0 0 0 0.625rem rgba(247, 210, 62, 0.25);
  transition: transform 0.3s var(--ease-out-back);
}

.video__play svg {
  width: 1.625rem;
  height: 1.625rem;
  margin-left: 0.1875rem;
  fill: currentColor;
}

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

.video__link:hover .video__thumb::after {
  background: rgba(10, 16, 12, 0.15);
}

.video__link:hover .video__play,
.video__link:focus-visible .video__play {
  transform: scale(1.12);
}

.video__link:focus-visible {
  outline: none;
}

.video__link:focus-visible .video__thumb {
  outline: 0.1875rem solid var(--yellow);
  outline-offset: 0.1875rem;
}

.video__title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--cream);
}

/* ============ PHOTO VIEWER ============ */

.lightbox {
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(8, 14, 10, 0.94);
  color: var(--cream);
}

.lightbox[open] {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
}

.lightbox::backdrop {
  background: transparent;
}

.lightbox__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin: 0;
  min-width: 0;
}

.lightbox__img {
  max-width: 100%;
  max-height: calc(100vh - 8.75rem);
  max-height: calc(100dvh - 8.75rem);
  border-radius: 1rem;
  object-fit: contain;
}

.lightbox__caption {
  font-size: 1.05rem;
  font-weight: 500;
  text-align: center;
}

.lightbox__btn {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(246, 241, 230, 0.12);
  color: var(--cream);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.lightbox__btn svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lightbox__btn:hover,
.lightbox__btn:focus-visible {
  background: var(--yellow);
  color: var(--ink);
  outline: none;
}

.lightbox__close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
}

/* ============ RESPONSIVE ============ */

@media (max-width: 1000px) {
  .photos {
    columns: 2;
  }

  /* the 3 videos side by side (2 columns would leave the third alone) */
  .videos {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .photos {
    columns: 1;
  }

  .videos {
    grid-template-columns: 1fr;
  }

  .lightbox[open] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr auto;
    padding: 4.375rem 0.75rem 1.25rem;
  }

  .lightbox__figure {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .lightbox__prev { grid-row: 2; justify-self: end; }
  .lightbox__next { grid-row: 2; justify-self: start; }
}
