/* ============================================================
   NHST Website — gallery.css
   Photo Gallery + Video Gallery + Lightbox + Video Modal
   ============================================================ */

/* ── Gallery Page Layout ───────────────────────────────────── */
.gallery-section {
  padding: var(--section-py) var(--sp-4);
}

/* Gallery Tabs (Photos / Videos) */
.gallery-tabs {
  display: flex;
  gap: var(--sp-2);
  background: var(--clr-surface-alt);
  padding: var(--sp-1);
  border-radius: var(--r-pill);
  border: 1px solid var(--clr-border-light);
  display: inline-flex;
  margin: var(--sp-6) auto var(--sp-4);
}
.gallery-tab-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.55rem 1.25rem;
  border-radius: var(--r-pill);
  font-family: var(--ff-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--clr-text-muted);
  cursor: pointer;
  transition: all var(--t-mid);
  border: none;
  background: none;
}
.gallery-tab-btn.active {
  background: var(--clr-navy);
  color: #fff;
  box-shadow: 0 2px 8px rgba(124, 45, 18,0.25);
}
.gallery-tab-btn:not(.active):hover { color: var(--clr-primary); }
.gallery-tab-btn svg { width: 16px; height: 16px; }

/* Gallery Tab Panels */
.gallery-panel { display: none; }
.gallery-panel.active { display: block; }

/* Category Filter Pills */
.category-filters {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-6);
  padding: var(--sp-1) 0;
}
.filter-pill {
  padding: 0.35rem 1rem;
  border-radius: var(--r-pill);
  font-family: var(--ff-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--clr-border);
  background: var(--clr-surface-card);
  color: var(--clr-text-muted);
  transition: all var(--t-fast);
  white-space: nowrap;
}
.filter-pill:hover { border-color: var(--clr-primary); color: var(--clr-primary); }
.filter-pill.active {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(230,74,25,0.3);
}

/* ── Photo Gallery Grid (CSS Columns Masonry) ──────────────── */
.photo-grid {
  columns: 1;
  column-gap: var(--sp-4);
}
.photo-item {
  break-inside: avoid;
  margin-bottom: var(--sp-4);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: var(--clr-surface-alt);
  border: 1px solid var(--clr-border-light);
  box-shadow: var(--shadow-card);
  transition: transform var(--t-mid), box-shadow var(--t-mid);
}
.photo-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-h); }
.photo-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.5s ease;
}
.photo-item:hover img { transform: scale(1.04); }

/* Album Cover Overlay */
.album-cover-overlay {
  position: absolute;
  inset: auto 0 0 0; /* Bottom only */
  background: linear-gradient(to top, rgba(15, 27, 76, 0.9) 0%, rgba(15, 27, 76, 0.7) 60%, transparent 100%);
  padding: var(--sp-6) var(--sp-4) var(--sp-4);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #fff;
  transition: transform var(--t-mid), background var(--t-mid);
}
.album-item:hover .album-cover-overlay {
  background: linear-gradient(to top, rgba(230, 74, 25, 0.95) 0%, rgba(230, 74, 25, 0.7) 60%, transparent 100%);
}
.album-title {
  font-family: var(--ff-serif);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: var(--sp-1);
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.album-count {
  font-family: var(--ff-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--clr-gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Expand icon */
.photo-item__zoom {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--t-mid);
  backdrop-filter: blur(4px);
}
.photo-item__zoom svg { width: 16px; height: 16px; color: #fff; }
.photo-item:hover .photo-item__zoom { opacity: 1; }

/* Empty state */
.gallery-empty {
  text-align: center;
  padding: var(--sp-16) var(--sp-4);
  color: var(--clr-text-light);
}
.gallery-empty svg { width: 64px; height: 64px; margin: 0 auto var(--sp-4); opacity: 0.3; }

/* ── Lightbox ──────────────────────────────────────────────── */
.photo-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 22, 0.96);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  flex-direction: column;
}
.photo-lightbox.is-open { display: flex; }

.lightbox-img-wrap {
  position: relative;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.lightbox-img-wrap img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--r-md);
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  transition: opacity 0.2s ease;
}
.lightbox-img-wrap.loading img { opacity: 0.3; }

/* Loading spinner */
.lb-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -18px;
  margin-left: -18px;
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--clr-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}
.lightbox-img-wrap.loading .lb-spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Lightbox controls */
.lightbox-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  margin-top: var(--sp-4);
  width: 100%;
  max-width: 800px;
}
.lb-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast);
  border: 1px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(4px);
}
.lb-btn:hover { background: rgba(255,255,255,0.25); transform: scale(1.08); }
.lb-btn svg { width: 20px; height: 20px; }

.lb-close {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: 1;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.25);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t-fast);
  line-height: 1;
}
.lb-close:hover { background: rgba(230,74,25,0.5); }

/* Caption + counter */
.lightbox-meta {
  text-align: center;
  flex: 1;
  background: rgba(15, 27, 76, 0.8);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
}
.lightbox-caption {
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 600;
  font-family: var(--ff-serif);
  margin-bottom: var(--sp-1);
}
.lightbox-counter {
  color: var(--clr-gold);
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ── Video Gallery Grid ─────────────────────────────────────── */
.video-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-5);
}
.video-card {
  background: var(--clr-surface-card);
  border: 1px solid var(--clr-border-light);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--t-mid), box-shadow var(--t-mid);
}
.video-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-h); }

/* YouTube thumbnail */
.video-card__thumb {
  position: relative;
  padding-top: 56.25%; /* 16:9 ratio */
  background: var(--clr-navy);
  overflow: hidden;
}
.video-card__thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, filter 0.3s ease;
}
.video-card:hover .video-card__thumb img {
  transform: scale(1.05);
  filter: brightness(0.85);
}

/* Play button overlay */
.video-card__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  background: rgba(230, 74, 25, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(230,74,25,0.5);
  transition: transform var(--t-mid), background var(--t-mid);
}
.video-card__play svg { width: 24px; height: 24px; color: #fff; margin-left: 3px; }
.video-card:hover .video-card__play { transform: translate(-50%, -50%) scale(1.12); background: var(--clr-primary); }

/* Duration badge */
.video-card__duration {
  position: absolute;
  bottom: var(--sp-2);
  right: var(--sp-2);
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--r-sm);
  font-family: var(--ff-sans);
}

.video-card__body { padding: var(--sp-4); }
.video-card__category { font-size: 0.75rem; font-weight: 700; color: var(--clr-primary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--sp-1); }
.video-card__title { font-family: var(--ff-serif); font-size: 1rem; font-weight: 600; color: var(--clr-navy); line-height: 1.4; }
.video-card__desc { font-size: 0.875rem; color: var(--clr-text-muted); margin-top: var(--sp-2); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Video Modal ───────────────────────────────────────────── */
.video-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 22, 0.94);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
.video-modal.is-open { display: flex; }

.video-modal__panel {
  width: 100%;
  max-width: 900px;
  background: #000;
  border-radius: var(--r-md);
  overflow: hidden;
  position: relative;
  animation: modal-in 0.3s ease;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8);
}
.video-modal__frame-wrap {
  position: relative;
  padding-top: 56.25%;
}
.video-modal__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}
.video-modal__close {
  position: absolute;
  top: -44px;
  right: 0;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  color: #fff;
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t-fast);
  line-height: 1;
}
.video-modal__close:hover { background: rgba(230,74,25,0.6); }
