/* ============================================================
GALLERY.CSS — Clinical & Wellness Gallery Section
Dr. Sk. Sarfaraz Ahmed — Family Physician, Naturopath & Nutrition Specialist
UPDATED: Section now fits within 100vh on desktop without
cropping/hiding any content. Mobile/tablet keep natural,
fully-scrollable height so nothing is ever clipped.
============================================================ */

.gallery-section {
  background: linear-gradient(180deg, #f8f6f1 0%, #f3efe8 50%, #f8f6f1 100%);
  padding: 64px 0;
  position: relative;
  box-sizing: border-box;
}

/* ── Section Header ─────────────────────────────────────── */

.gallery-header-block {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 28px;
  flex-shrink: 0;
}

.gallery-section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "DM Sans", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #6d8a63;
  background: rgba(109, 138, 99, 0.12);
  padding: 6px 16px;
  border-radius: 50px;
  margin-bottom: 12px;
}

.gallery-heading {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2.2rem, 3.8vw, 3.4rem);
  font-weight: 600;
  color: #2f3a2f;
  line-height: 1.18;
  margin-bottom: 12px;
}

.gallery-heading em {
  font-style: italic;
  color: #6d8a63;
}

.gallery-subtitle {
  font-family: "DM Sans", sans-serif;
  font-size: 1.05rem;
  color: #5a6b5a;
  line-height: 1.6;
  margin: 0 auto;
}

/* ── Filter Tabs ────────────────────────────────────────── */

.gallery-filter-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
  flex-shrink: 0;
}

.gallery-filter-btn {
  font-family: "DM Sans", sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: #5a6b5a;
  background: #ffffff;
  border: 1px solid #e2e8e0;
  padding: 10px 22px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 2px 8px rgba(47, 58, 47, 0.04);
}

.gallery-filter-btn:hover {
  color: #2f3a2f;
  border-color: #6d8a63;
  background: #f4f8f2;
  transform: translateY(-1px);
}

.gallery-filter-btn.active {
  background: #6d8a63;
  color: #ffffff;
  border-color: #6d8a63;
  box-shadow: 0 6px 18px rgba(109, 138, 99, 0.3);
}

/* ── Gallery Grid ───────────────────────────────────────── */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.gallery-item {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(47, 58, 47, 0.06);
  border: 1px solid #eae6df;
  opacity: 1;
  transform: translateY(0);
  transition:
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.4s ease,
    opacity 0.4s ease;
  cursor: pointer;
}

.gallery-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 44px rgba(47, 58, 47, 0.14);
}

.gallery-item.hidden {
  display: none;
}

.gallery-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-item:hover .gallery-img {
  transform: scale(1.08);
}

/* Badge on Image */
.gallery-card-badge {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
  font-family: "DM Sans", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ffffff;
  background: rgba(47, 58, 47, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 5px 12px;
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Hover Overlay & Details */
.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(47, 58, 47, 0.1) 0%,
    rgba(47, 58, 47, 0.85) 100%
  );
  opacity: 0;
  display: flex;
  align-items: flex-end;
  padding: 24px;
  transition: opacity 0.35s ease;
  z-index: 3;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-overlay-content {
  color: #ffffff;
  transform: translateY(12px);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  width: 100%;
}

.gallery-item:hover .gallery-overlay-content {
  transform: translateY(0);
}

.gallery-item-title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
  margin-bottom: 6px;
}

.gallery-item-desc {
  font-family: "DM Sans", sans-serif;
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
  margin: 0;
}

.gallery-zoom-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #2f3a2f;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition:
    opacity 0.3s ease,
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    background-color 0.2s ease;
  z-index: 4;
}

.gallery-item:hover .gallery-zoom-icon {
  opacity: 1;
  transform: scale(1);
}

.gallery-zoom-icon:hover {
  background: #6d8a63;
  color: #ffffff;
}

/* ── Lightbox Modal ─────────────────────────────────────── */

.gallery-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.gallery-lightbox.active {
  opacity: 1;
  visibility: visible;
}

.gallery-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  width: -moz-fit-content;
  width: fit-content;
  background: transparent !important;
  border-radius: 16px;
  overflow: visible;
  border: none;
  box-shadow: none;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gallery-lightbox.active .gallery-lightbox-content {
  transform: scale(1);
}

.gallery-lightbox-img-wrap {
  position: relative;
  display: inline-flex;
  width: auto;
  height: auto;
  max-width: 90vw;
  max-height: 88vh;
  background: transparent !important;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.gallery-lightbox-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 16px;
}

.gallery-lightbox-caption {
  display: none !important;
}

.gallery-lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.2s ease;
  z-index: 20;
}

.gallery-lightbox-close:hover {
  background: #e53935;
  border-color: #e53935;
  transform: rotate(90deg) scale(1.05);
}

/* ── Lightbox Next / Previous Navigation ───────────────── */
.gallery-lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 10005;
}

.gallery-lightbox-prev {
  left: 28px;
}

.gallery-lightbox-next {
  right: 28px;
}

.gallery-lightbox-nav:hover {
  background: #6d8a63;
  border-color: #6d8a63;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.gallery-lightbox-nav:active {
  transform: translateY(-50%) scale(0.95);
}

@media (max-width: 768px) {
  .gallery-lightbox-nav {
    width: 42px;
    height: 42px;
  }
  .gallery-lightbox-prev {
    left: 12px;
  }
  .gallery-lightbox-next {
    right: 12px;
  }
}

/* ============================================================
DESKTOP — Fit the whole Gallery Section inside exactly 100vh
without cropping any element. Only active from 992px upward,
where there is enough horizontal room for a 3-column grid to
also compress vertically without harming readability.
============================================================ */

@media (min-width: 992px) {
  .gallery-section {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 100vh;
    max-height: 100vh;
    padding: 32px 0 24px;
    box-sizing: border-box;
    overflow: visible;
  }

  .gallery-section .container-xl {
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
  }

  .gallery-header-block {
    margin: 0 auto 16px;
    flex-shrink: 0;
  }

  .gallery-section-label {
    margin-bottom: 8px;
  }

  .gallery-heading {
    font-size: clamp(1.9rem, 2.6vw, 2.6rem);
    margin-bottom: 8px;
  }

  .gallery-subtitle {
    font-size: 0.98rem;
    line-height: 1.5;
  }

  .gallery-filter-tabs {
    flex-wrap: nowrap;
    margin-bottom: 16px;
    gap: 8px;
    flex-shrink: 0;
  }

  .gallery-filter-btn {
    padding: 8px 18px;
    font-size: 0.84rem;
    white-space: nowrap;
  }

  /* Grid consumes all remaining height; rows share it evenly
     so no card is cut and none overflows the section. */
  .gallery-grid {
    flex: 1 1 auto;
    min-height: 0;
    gap: 18px;
    grid-template-rows: repeat(2, 1fr);
  }

  /* Image wrapper fills its row height instead of a fixed
     aspect-ratio, so the card always fits the available track
     — the image itself still uses object-fit: cover, so it
     stays visually clean without distortion. */
  .gallery-img-wrap {
    aspect-ratio: auto;
    height: 100%;
  }

  /* Keep hover lift from visually clipping at the section edge */
  .gallery-grid {
    padding-bottom: 4px;
  }
}

/* ── Responsive ─────────────────────────────────────────── */
/* Tablet & mobile intentionally do NOT force 100vh: content
   must remain fully visible and readable, growing the section
   naturally and letting the page scroll instead of cropping. */

@media (max-width: 991px) {
  .gallery-section {
    padding: 56px 0;
  }

  .gallery-header-block {
    margin-bottom: 24px;
  }

  .gallery-filter-tabs {
    margin-bottom: 32px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

@media (max-width: 576px) {
  .gallery-section {
    padding: 48px 0;
    min-height: 100dvh;
    height: auto;
  }

  .gallery-header-block {
    margin-bottom: 20px;
  }

  .gallery-filter-tabs {
    margin-bottom: 24px;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .gallery-filter-btn {
    font-size: 0.8rem;
    padding: 8px 16px;
  }
}
