/* ==========================================================================
   Kazi Nazrul Academy - Dedicated Stylesheet for Photo Gallery (gallery.html)
   Architecture: CSS Isolation per RULES.md (subpage specific styles only)
   Design Reference: Make Future Model School + Al-Ameen Institutional Aesthetic
   ========================================================================== */

/* Page Wrapper */
.gallery-page-wrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Hero / Header Card */
.gallery-hero-card {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f8fafc 100%);
  border: 1px solid #bae6fd;
  border-left: 6px solid var(--brand);
  border-radius: 14px;
  padding: 28px 32px;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.06);
  position: relative;
  overflow: hidden;
}

.gallery-hero-card::after {
  content: "\f030"; /* camera fontawesome icon */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  right: 24px;
  bottom: -15px;
  font-size: 7.5rem;
  color: rgba(14, 165, 233, 0.07);
  pointer-events: none;
}

.gallery-hero-header {
  max-width: 860px;
}

.gallery-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #0369a1;
  background: #ffffff;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid #bae6fd;
  margin-bottom: 10px;
}

.gallery-hero-title {
  margin: 0 0 10px 0;
  font-size: 1.85rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
}

.gallery-hero-desc {
  margin: 0;
  font-size: 1rem;
  color: #475569;
  line-height: 1.6;
}

/* Category Filter Bar */
.gallery-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 0 12px;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #475569;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.filter-btn:hover {
  color: var(--brand-dark);
  border-color: var(--brand);
  background: #f0f9ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(14, 165, 233, 0.15);
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-accent) 100%);
  border-color: var(--brand-accent);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  transform: translateY(-1px);
}

.filter-btn .filter-count {
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: inherit;
}

.filter-btn.active .filter-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Photo Counter Summary Strip */
.gallery-status-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
  font-size: 0.88rem;
  color: #64748b;
  border-bottom: 1px dashed #e2e8f0;
  padding-bottom: 12px;
}

.gallery-count-text strong {
  color: #0f172a;
}

/* Dynamic Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(295px, 1fr));
  gap: 22px;
  margin-top: 4px;
}

/* Card Item */
.gallery-item {
  position: relative;
  background: #ffffff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
  border: 1px solid #e2e8f0;
  cursor: pointer;
  outline: none;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.25s ease;
}

.gallery-item:hover,
.gallery-item:focus-visible {
  transform: translateY(-6px);
  box-shadow: 0 14px 30px rgba(2, 132, 199, 0.18);
  border-color: #7dd3fc;
}

.gallery-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f1f5f9;
}

.gallery-thumb-wrap picture {
  display: block;
  width: 100%;
  height: 100%;
}

.gallery-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-item:hover .gallery-thumb-wrap img,
.gallery-item:focus-visible .gallery-thumb-wrap img {
  transform: scale(1.07);
}

/* Overlay & Caption */
.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(15, 23, 42, 0.88) 0%,
    rgba(15, 23, 42, 0.45) 45%,
    rgba(15, 23, 42, 0.05) 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-item-overlay,
.gallery-item:focus-visible .gallery-item-overlay {
  opacity: 1;
}

.gallery-zoom-icon {
  align-self: flex-end;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transform: scale(0.8);
  transition: transform 0.25s ease, background 0.25s ease;
}

.gallery-item:hover .gallery-zoom-icon {
  transform: scale(1);
  background: var(--brand);
}

.gallery-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  transform: translateY(6px);
  transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-meta {
  transform: translateY(0);
}

.gallery-tag {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #e0f2fe;
  background: rgba(14, 165, 233, 0.6);
  backdrop-filter: blur(4px);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.gallery-caption-text {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.35;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* Skeleton Loading Shimmer */
.skeleton-shimmer {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmerWave 1.6s infinite ease-in-out;
  border: 1px solid #e2e8f0;
}

@keyframes shimmerWave {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty State */
.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  background: #f8fafc;
  border-radius: 14px;
  border: 1.5px dashed #cbd5e1;
}

.gallery-empty i {
  font-size: 3rem;
  color: #94a3b8;
  margin-bottom: 12px;
  display: block;
}

.gallery-empty h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  color: #334155;
}

.gallery-empty p {
  margin: 0;
  font-size: 0.95rem;
  color: #64748b;
}

/* ==========================================================================
   Full-Screen Lightbox Modal
   ========================================================================== */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox-backdrop.show {
  display: flex;
  opacity: 1;
}

.lightbox-stage {
  position: relative;
  max-width: 1080px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: lightboxZoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes lightboxZoomIn {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.lightbox-media-wrap {
  position: relative;
  max-height: 78vh;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  background: #090d16;
}

.lightbox-media-wrap img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  display: block;
}

/* Lightbox Controls */
.lightbox-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  z-index: 60;
}

.lightbox-close-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
  transform: rotate(90deg);
}

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  z-index: 50;
}

.lightbox-nav-btn:hover {
  background: var(--brand);
  border-color: var(--brand);
  transform: translateY(-50%) scale(1.08);
}

.lightbox-prev {
  left: 16px;
}

.lightbox-next {
  right: 16px;
}

/* Lightbox Info Bar */
.lightbox-info-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.lightbox-caption-text {
  font-size: 0.96rem;
  font-weight: 600;
  color: #f1f5f9;
  flex: 1;
}

.lightbox-counter {
  font-size: 0.82rem;
  font-weight: 700;
  color: #38bdf8;
  padding: 4px 10px;
  background: rgba(14, 165, 233, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 999px;
  white-space: nowrap;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 1150px) {
  .lightbox-prev { left: 16px; background: rgba(15, 23, 42, 0.6); }
  .lightbox-next { right: 16px; background: rgba(15, 23, 42, 0.6); }
}

@media (max-width: 900px) {
  .gallery-hero-card {
    padding: 22px 24px;
  }
  .gallery-hero-title {
    font-size: 1.55rem;
  }
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .gallery-filter-bar {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
  }
  .filter-btn {
    flex-shrink: 0;
    font-size: 0.82rem;
    padding: 8px 14px;
    min-height: 40px;
  }
  .lightbox-close-btn {
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
  }
  .lightbox-info-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

@media (max-width: 520px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .gallery-hero-card {
    padding: 16px 14px;
  }
  .gallery-hero-title {
    font-size: 1.3rem;
  }
  .gallery-hero-card::after {
    display: none;
  }
  .lightbox-nav-btn {
    width: 44px;
    height: 44px;
    font-size: 1.05rem;
  }
}
