/**
 * CASS - Consumer Awareness & Support Society
 * Gallery & Events Section Stylesheet
 * Fully responsive: 3 cols (desktop), 2 cols (tablet), 1 col (mobile)
 */

/* Section Outer Styling */
.gallery-section {
  background: linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
  position: relative;
  overflow: hidden;
  padding: 60px 20px;
  border-bottom: 1px solid #ede7dc;
}

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

/* Gallery Card */
.gallery-card {
  background: #ffffff;
  border-radius: var(--radius-lg, 14px);
  overflow: hidden;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 14px rgba(9, 35, 71, 0.07);
  display: flex;
  flex-direction: column;
  transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
  cursor: pointer;
  position: relative;
}

.gallery-card:hover,
.gallery-card:focus-visible {
  transform: translateY(-5px);
  box-shadow: 0 12px 28px rgba(9, 35, 71, 0.14);
  border-color: #cbd5e1;
  outline: none;
}

/* Card Image Box */
.gallery-card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 11;
  background: #092347;
  overflow: hidden;
  border-bottom: 1px solid #f1f5f9;
}

.gallery-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: block;
}

.gallery-card:hover .gallery-card-img {
  transform: scale(1.05);
}

/* Category Badge inside image */
.gallery-card-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(9, 35, 71, 0.88);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill, 9999px);
  letter-spacing: 0.3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

/* Hover Zoom Overlay */
.gallery-card-hover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 35, 71, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 1;
}

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

.gallery-zoom-badge {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-navy, #092347);
  padding: 6px 14px;
  border-radius: var(--radius-pill, 9999px);
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transform: translateY(6px);
  transition: transform 0.25s ease;
}

.gallery-card:hover .gallery-zoom-badge {
  transform: translateY(0);
}

/* Card Content Area */
.gallery-card-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.gallery-card-title {
  font-size: 1.06rem;
  font-weight: 700;
  color: var(--primary-navy, #092347);
  line-height: 1.4;
  margin-bottom: 8px;
}

.gallery-card-desc {
  font-size: 0.88rem;
  color: var(--text-muted, #4a5568);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: auto;
}

/* ==========================================================================
   Gallery Lightbox Modal
   ========================================================================== */
.gallery-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 20, 43, 0.88);
  backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gallery-modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.gallery-modal-box {
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  position: relative;
  animation: galleryModalPop 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes galleryModalPop {
  0% { transform: scale(0.94) translateY(12px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.gallery-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.gallery-modal-close:hover {
  background: var(--accent-red, #c5221f);
  transform: rotate(90deg);
}

.gallery-modal-image-area {
  position: relative;
  background: #04142b;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  max-height: 64vh;
}

.gallery-modal-image-area img {
  max-width: 100%;
  max-height: 64vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* Modal Nav Buttons */
.gallery-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: rgba(9, 35, 71, 0.75);
  backdrop-filter: blur(4px);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
  z-index: 5;
}

.gallery-nav-btn:hover {
  background: var(--accent-red, #c5221f);
  transform: translateY(-50%) scale(1.08);
}

.gallery-nav-prev {
  left: 16px;
}

.gallery-nav-next {
  right: 16px;
}

/* Modal Details Bar */
.gallery-modal-details {
  padding: 18px 24px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid #e2e8f0;
}

.gallery-modal-info {
  flex-grow: 1;
}

.gallery-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-navy, #092347);
  margin-bottom: 4px;
}

.gallery-modal-desc {
  font-size: 0.92rem;
  color: var(--text-muted, #4a5568);
  line-height: 1.45;
}

.gallery-modal-counter {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-navy, #092347);
  background: #f1f5f9;
  padding: 6px 14px;
  border-radius: var(--radius-pill, 9999px);
  white-space: nowrap;
}

/* Responsive Breakpoints */
@media (max-width: 992px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .gallery-modal-image-area {
    max-height: 52vh;
  }
}

@media (max-width: 640px) {
  .gallery-section {
    padding: 44px 16px;
  }

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

  .gallery-card-img-wrap {
    aspect-ratio: 16 / 10;
  }

  .gallery-modal-box {
    max-height: 94vh;
  }

  .gallery-modal-image-area {
    max-height: 48vh;
  }

  .gallery-nav-btn {
    width: 36px;
    height: 36px;
  }

  .gallery-nav-prev {
    left: 8px;
  }

  .gallery-nav-next {
    right: 8px;
  }

  .gallery-modal-details {
    padding: 14px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .gallery-modal-counter {
    align-self: flex-end;
  }
}
