/* Hydroposhan Academy — Photo Gallery (public page) */

.page-gallery {
  --gallery-gap: clamp(12px, 2vw, 18px);
  --gallery-min-col: 260px;
  background: var(--bg-light, #f5faf6);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-gallery .page-hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  text-align: center;
  padding: clamp(120px, 18vw, 168px) 5% clamp(40px, 6vw, 56px);
  border-bottom: 4px solid var(--primary-green, #007305);
  background-color: var(--dark-green, #004b04);
}

.page-gallery .page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(165deg, #003d03 0%, #004b04 48%, #002a02 100%);
  z-index: 0;
}

.page-gallery .page-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(0, 115, 5, 0.22) 0%, rgba(0, 4, 0, 0.82) 100%),
    linear-gradient(180deg, rgba(0, 8, 2, 0.55) 0%, rgba(0, 4, 0, 0.92) 100%);
  z-index: 1;
}

.page-gallery .page-hero .container {
  position: relative;
  z-index: 2;
}

.page-gallery .hero-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin: 0 0 14px;
  color: #fff;
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.45);
}

.page-gallery .hero-divider {
  width: 72px;
  height: 3px;
  margin: 0 auto 18px;
  background: linear-gradient(90deg, #0079c6, #007305);
  border-radius: 2px;
}

.page-gallery .gallery-intro {
  max-width: 760px;
  margin: 0 auto;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.75;
  font-size: clamp(0.98rem, 2.2vw, 1.08rem);
}

.page-gallery main.container {
  flex: 1;
  width: 100%;
  max-width: min(var(--container-max, 1280px), 100%);
  padding-top: clamp(24px, 4vw, 40px);
  padding-bottom: clamp(48px, 8vw, 80px);
  min-width: 0;
}

.gallery-panel {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, #fff 0%, #f6fbf7 100%);
  border: 1px solid rgba(0, 115, 5, 0.12);
  border-radius: 20px;
  padding: clamp(16px, 3vw, 28px);
  box-shadow: 0 18px 48px rgba(0, 75, 4, 0.06);
}

.gallery-toolbar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.gallery-toolbar__row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: center;
  justify-content: space-between;
}

.gallery-filters-shell {
  position: relative;
  min-width: 0;
}

.gallery-filters-shell::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 4px;
  width: 28px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(246, 251, 247, 0.95));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gallery-filters-shell.is-scrollable::after {
  opacity: 1;
}

.gallery-toolbar__meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.gallery-count {
  font-weight: 700;
  color: var(--dark-green, #004b04);
  font-size: 1.05rem;
  margin: 0;
}

.gallery-hint {
  margin: 0;
  color: #004b04;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.55;
}

.gallery-search-wrap {
  position: relative;
  flex: 1 1 220px;
  max-width: 360px;
  min-width: 0;
}

.gallery-search__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(0, 75, 4, 0.45);
  font-size: 0.9rem;
  pointer-events: none;
}

.gallery-search {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 40px 11px 40px;
  border: 1px solid rgba(0, 115, 5, 0.22);
  border-radius: 999px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--dark-green, #004b04);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gallery-search:focus {
  outline: none;
  border-color: var(--primary-green, #007305);
  box-shadow: 0 0 0 3px rgba(0, 115, 5, 0.15);
}

.gallery-search::placeholder {
  color: rgba(82, 90, 84, 0.75);
}

.gallery-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 115, 5, 0.1);
  color: var(--dark-green, #004b04);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.gallery-search-clear:hover,
.gallery-search-clear:focus-visible {
  background: rgba(0, 115, 5, 0.2);
  outline: none;
}

.gallery-search-clear[hidden] {
  display: none;
}

.page-gallery .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.gallery-skeleton {
  width: 100%;
  min-width: 0;
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  background: linear-gradient(
    110deg,
    rgba(0, 115, 5, 0.06) 8%,
    rgba(0, 115, 5, 0.14) 18%,
    rgba(0, 115, 5, 0.06) 33%
  );
  background-size: 200% 100%;
  animation: galleryShimmer 1.2s ease-in-out infinite;
}

@keyframes galleryShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.gallery-grid.is-filtering .gallery-card {
  animation: galleryFilterPulse 0.32s ease;
}

@keyframes galleryFilterPulse {
  0% { opacity: 0.4; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1); }
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.gallery-filter {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(0, 115, 5, 0.22);
  background: #fff;
  color: var(--dark-green, #004b04);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 10px 14px 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-filter__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4em;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  background: rgba(0, 75, 4, 0.08);
  color: inherit;
}

.gallery-filter.is-active .gallery-filter__count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.gallery-filter:hover,
.gallery-filter:focus-visible {
  border-color: rgba(0, 115, 5, 0.45);
  transform: translateY(-1px);
  outline: none;
}

.gallery-filter.is-active {
  background: var(--primary-green, #007305);
  border-color: var(--primary-green, #007305);
  color: #fff;
  box-shadow: 0 8px 22px rgba(0, 115, 5, 0.22);
}

/* Responsive grid — auto-fill avoids broken fixed column counts */
.page-gallery .gallery-grid {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--gallery-min-col)), 1fr));
  gap: var(--gallery-gap);
  align-items: stretch;
  justify-items: stretch;
  list-style: none;
  margin: 0;
  padding: 0;
}

.gallery-grid.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.page-gallery button.gallery-card {
  position: relative;
  display: grid;
  grid-template: 1fr / 1fr;
  width: 100%;
  min-width: 0;
  max-width: none;
  border: none;
  padding: 0;
  margin: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  line-height: inherit;
  appearance: none;
  -webkit-appearance: none;
  background: #0b1220;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 4 / 3;
  min-height: 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: galleryFadeUp 0.45s ease both;
  justify-self: stretch;
  align-self: stretch;
}

@supports not (aspect-ratio: 4 / 3) {
  .page-gallery button.gallery-card {
    min-height: 200px;
  }
}

@keyframes galleryFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-gallery button.gallery-card:hover,
.page-gallery button.gallery-card:focus-visible {
  transform: translateY(-5px);
  box-shadow: 0 20px 44px rgba(0, 115, 5, 0.18);
  outline: 2px solid rgba(0, 115, 5, 0.35);
  outline-offset: 2px;
}

/* Beat global img { height: auto } from site-responsive.css */
.page-gallery button.gallery-card > img,
.page-gallery button.gallery-card > .gallery-card__shade,
.page-gallery button.gallery-card > .gallery-card__zoom,
.page-gallery button.gallery-card > .gallery-card__body {
  grid-area: 1 / 1;
}

.page-gallery button.gallery-card > img {
  z-index: 0;
  align-self: stretch;
  justify-self: stretch;
  width: 100% !important;
  height: 100% !important;
  min-height: 100%;
  max-width: none !important;
  object-fit: cover;
  object-position: center 35%;
  display: block;
  transition: transform 0.4s ease;
}

.page-gallery button.gallery-card > .gallery-card__shade,
.page-gallery button.gallery-card > .gallery-card__zoom,
.page-gallery button.gallery-card > .gallery-card__body {
  position: relative;
  pointer-events: none;
}

.page-gallery button.gallery-card > .gallery-card__shade {
  z-index: 1;
  align-self: stretch;
  justify-self: stretch;
  width: 100%;
  height: 100%;
  margin: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.78) 100%);
}

.page-gallery button.gallery-card > .gallery-card__body {
  z-index: 2;
  align-self: end;
  justify-self: stretch;
  width: 100%;
  padding: 14px 16px 16px;
  color: #fff;
}

.page-gallery button.gallery-card > .gallery-card__zoom {
  z-index: 2;
  align-self: start;
  justify-self: end;
  margin: 12px 12px 0 0;
}

.page-gallery button.gallery-card:hover > img {
  transform: scale(1.06);
}

.page-gallery button.gallery-card--featured {
  grid-column: span 2;
  aspect-ratio: 16 / 9;
}

@media (max-width: 720px) {
  .page-gallery button.gallery-card--featured {
    grid-column: span 1;
    aspect-ratio: 4 / 3;
  }
}

.page-gallery button.gallery-card--featured .gallery-card__title {
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
}

.page-gallery button.gallery-card--featured .gallery-card__caption {
  -webkit-line-clamp: 3;
}


.gallery-card__cat {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(0, 115, 5, 0.85);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.gallery-card__title {
  display: block;
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.gallery-card__caption {
  display: -webkit-box;
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.9);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-card__zoom {
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--dark-green, #004b04);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light, #525a54);
  border: 1px dashed rgba(0, 115, 5, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
}

/* Lightbox */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(14px, 4vw, 32px);
  background: rgba(5, 10, 8, 0.92);
  backdrop-filter: blur(6px);
}

.gallery-lightbox.is-open {
  display: flex;
}

body.gallery-lightbox-open {
  overflow: hidden;
  touch-action: none;
}

body.gallery-lightbox-open #header {
  z-index: 100;
}

.gallery-lightbox__stage {
  position: relative;
  width: min(1100px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.gallery-lightbox__img-wrap {
  width: 100%;
  max-height: 72vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-gallery .gallery-lightbox__img-wrap img,
.gallery-lightbox__img-wrap img {
  width: auto !important;
  height: auto !important;
  max-width: min(1200px, 94vw) !important;
  max-height: 72vh !important;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  display: block;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.gallery-lightbox__img-wrap img.is-changing {
  opacity: 0.35;
  transform: scale(0.98);
}

.gallery-lightbox__meta {
  width: 100%;
  max-width: 900px;
  text-align: center;
  color: #fff;
  padding: 0 12px 8px;
}

.gallery-lightbox__cat {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b8f5c4;
  margin-bottom: 6px;
}

.gallery-lightbox__title {
  margin: 0 0 8px;
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.2rem, 3vw, 1.65rem);
}

.gallery-lightbox__caption {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.6;
  font-size: 0.95rem;
}

.gallery-lightbox__btn {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.gallery-lightbox__btn:hover {
  background: rgba(0, 115, 5, 0.55);
  border-color: rgba(255, 255, 255, 0.85);
}

.gallery-lightbox__close { top: 14px; right: 14px; }
.gallery-lightbox__prev { left: 14px; top: 50%; transform: translateY(-50%); }
.gallery-lightbox__next { right: 14px; top: 50%; transform: translateY(-50%); }

.gallery-lightbox__counter {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 8px 14px;
  border-radius: 999px;
  pointer-events: none;
}

@media (max-width: 640px) {
  .gallery-toolbar__row {
    flex-direction: column;
    align-items: stretch;
  }

  .gallery-search-wrap {
    max-width: none;
    flex: 1 1 auto;
  }

  .gallery-filters-shell::after {
    opacity: 1;
  }

  .gallery-filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .gallery-filters::-webkit-scrollbar {
    display: none;
  }

  .gallery-filter {
    flex-shrink: 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .gallery-lightbox__prev { left: 8px; }
  .gallery-lightbox__next { right: 8px; }
  .gallery-lightbox__close { top: 8px; right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .page-gallery button.gallery-card,
  .page-gallery button.gallery-card > img,
  .gallery-filter,
  .gallery-skeleton,
  .gallery-grid.is-filtering .gallery-card {
    animation: none;
    transition: none;
  }

  .gallery-lightbox__img-wrap img.is-changing {
    opacity: 1;
    transform: none;
  }
}
