/* =============================================================
   GALLERY PAGE
   ============================================================= */

/* ----- Hero ----- */
.gallery-hero {
  background: linear-gradient(135deg, #0d1b3e 0%, #1a4fa0 100%);
  padding: 140px 0 64px;
  text-align: center;
}

.gallery-hero .section-tag { background: rgba(232,160,32,0.15); color: var(--accent); }

.gallery-hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  color: #fff;
  margin: 16px 0 12px;
}

.gallery-hero p {
  color: rgba(255,255,255,0.75);
  font-size: 1.05rem;
  max-width: 520px;
  margin: 0 auto;
}

/* ----- Filter Bar ----- */
.gallery-filter-bar {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  position: sticky;
  top: 64px;
  z-index: 100;
}

/* ----- Gallery Section ----- */
.gallery-section { background: var(--bg); }

/* ----- Group ----- */
.gallery-group { margin-bottom: 64px; }

.gallery-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.gallery-group-header h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.gallery-group-header h2 i { color: var(--primary); }

.gallery-group-header span {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-alt);
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
}

/* ----- Masonry-style grid ----- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* Portrait grid for certificates */
.cert-grid-portrait {
  grid-template-columns: repeat(5, 1fr);
}

/* ----- Gallery Item ----- */
.gallery-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
}

.gallery-img-wrap {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  transition: all var(--transition);
  box-shadow: var(--shadow);
}

/* Landscape for training photos */
.gallery-grid:not(.cert-grid-portrait) .gallery-img-wrap {
  aspect-ratio: 4 / 3;
}

/* Portrait for certificates */
.cert-grid-portrait .gallery-img-wrap {
  aspect-ratio: 3 / 4;
}

.gallery-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(26,79,160,0.6), rgba(13,27,62,0.7));
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}

.gallery-overlay i {
  font-size: 1.6rem;
  color: #fff;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}

.gallery-item:hover .gallery-img-wrap {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-5px);
}

.gallery-item:hover .gallery-img-wrap img { transform: scale(1.07); }
.gallery-item:hover .gallery-overlay       { opacity: 1; }

/* Label (certificates only) */
.gallery-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  background: rgba(26,79,160,0.07);
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(26,79,160,0.15);
}

/* Hidden by filter */
.gallery-item.hidden-filter { display: none; }

/* ----- Lightbox (reuse from approach.css) ----- */
.cert-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.cert-lightbox.open { opacity: 1; pointer-events: all; }

.cert-lb-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 90vw;
  max-height: 90vh;
}

.cert-lb-inner img {
  max-width: 80vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  animation: lbZoomIn 0.3s ease;
}

@keyframes lbZoomIn {
  from { transform: scale(0.88); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.cert-lb-caption {
  color: rgba(255,255,255,0.85);
  font-size: 0.95rem;
  font-weight: 600;
  background: rgba(26,79,160,0.5);
  padding: 8px 20px;
  border-radius: 100px;
}

.cert-lb-close,
.cert-lb-prev,
.cert-lb-next {
  position: fixed;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--transition);
  z-index: 2001;
}

.cert-lb-close:hover,
.cert-lb-prev:hover,
.cert-lb-next:hover { background: rgba(255,255,255,0.25); }

.cert-lb-close { top: 24px;  right: 24px; }
.cert-lb-prev  { left: 24px; top: 50%; transform: translateY(-50%); }
.cert-lb-next  { right: 24px; top: 50%; transform: translateY(-50%); }

/* ----- Responsive ----- */
@media (max-width: 1024px) {
  .gallery-grid            { grid-template-columns: repeat(3, 1fr); }
  .cert-grid-portrait      { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
  .gallery-grid            { grid-template-columns: repeat(2, 1fr); }
  .cert-grid-portrait      { grid-template-columns: repeat(3, 1fr); }
  .cert-lb-prev            { left: 10px; }
  .cert-lb-next            { right: 10px; }
}

@media (max-width: 480px) {
  .gallery-grid            { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cert-grid-portrait      { grid-template-columns: repeat(2, 1fr); }
}
