/* ============================================
   GALLERY PAGE — gallery.css
   Royal Crystal Academy
   ============================================ */

/* ---- Filter Tabs ---- */
.gallery-tabs-wrap {
  background: var(--color-white);
  border-bottom: 2px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.gallery-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.gallery-tabs::-webkit-scrollbar { display: none; }

.gallery-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-border);
  background: var(--color-white);
  color: var(--color-text-light);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  font-family: var(--font-body);
}

.gallery-tab:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.gallery-tab.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
}

.tab-icon { font-size: 1rem; }

/* ---- Section Header ---- */
.gallery-section { padding-block: var(--space-3xl); }

.gallery-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2xl);
  flex-wrap: wrap;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--color-primary);
}

.gallery-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.gallery-section-icon {
  font-size: 2rem;
  width: 60px;
  height: 60px;
  background: rgba(107,15,26,0.08);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 8px;
}

.gallery-section-title h2 {
  font-size: var(--fs-2xl);
  color: var(--color-primary);
  margin-bottom: 4px;
}

.gallery-section-title p {
  font-size: var(--fs-sm);
  color: var(--color-text-light);
  margin: 0;
}

.gallery-count {
  background: var(--color-primary);
  color: var(--color-white);
  font-size: var(--fs-sm);
  font-weight: 700;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* ---- Masonry Grid ---- */
.gallery-masonry {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  auto-rows: 240px;
}

.gal-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  height: 240px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.gal-item.gal-wide {
  grid-column: span 2;
}

.gal-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gal-item:hover {
  box-shadow: var(--shadow-lg);
  z-index: 2;
}

.gal-item:hover img { transform: scale(1.06); }

.gal-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(
    to top,
    rgba(74,10,18,0.9) 0%,
    rgba(74,10,18,0.3) 50%,
    transparent 100%
  );
  display: flex;
  align-items: flex-end;
  padding: var(--space-md);
  opacity: 0;
  transition: var(--transition);
}

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

.gal-overlay span {
  color: var(--color-white);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.3;
}

/* ---- Hidden state (filter) ---- */
.gal-item.hidden {
  display: none;
}

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

/* ---- LIGHTBOX ---- */
.lightbox-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0,0,0,0.92);
  z-index: 990;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lightbox-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 995;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-img-wrap {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#lightboxImg {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  object-fit: contain;
}

.lightbox-caption {
  margin-top: var(--space-md);
  color: rgba(255,255,255,0.85);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-align: center;
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: var(--color-white);
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close:hover { background: var(--color-secondary); color: var(--color-dark); }

.lightbox-prev, .lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  color: var(--color-white);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 1.8rem;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-prev:hover, .lightbox-next:hover {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
  color: var(--color-dark);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .gallery-masonry { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .gallery-tabs { gap: 6px; padding: 10px 0; }
  .gallery-tab { padding: 8px 14px; font-size: var(--fs-xs); }
  .gallery-masonry { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .gal-item { height: 170px; }
  .gal-item.gal-wide { grid-column: span 2; height: 200px; }
  .gallery-section-icon { width: 48px; height: 48px; font-size: 1.8rem; }
  .gallery-section-title h2 { font-size: var(--fs-xl); }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
}

@media (max-width: 480px) {
  .gallery-masonry { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .gal-item { height: 140px; }
  .gal-item.gal-wide { height: 160px; }
  .gallery-tab .tab-icon { display: none; }
}
