/* ==========================================================================
   GALLERY PAGE — professional Oyate Zambia UI (solid brand colors)
   Blue #2A99D0 · Green #2A8A43 · Accent #78BF45
   ========================================================================== */

.gal-page {
  --gal-radius: 16px;
  --gal-border: rgba(42, 153, 208, 0.14);
  --gal-surface: #ffffff;
  --gal-bg: #f4f8f6;
}

/* ---- Hero ---- */
.page-hero.gal-hero {
  min-height: 52vh;
  padding-top: calc(var(--nav-height) + var(--space-lg));
  padding-bottom: var(--space-2xl);
  border-bottom: 3px solid var(--color-primary);
}

.page-hero.gal-hero::before {
  background: rgba(12, 31, 20, 0.8) !important;
}

.page-hero.gal-hero::after {
  display: none !important;
}

.gal-hero .container {
  position: relative;
  z-index: 1;
}

.gal-hero .breadcrumb {
  margin-bottom: var(--space-md);
}

.gal-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.gal-hero-eyebrow .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
}

.gal-hero h1 {
  font-size: clamp(2rem, 4.8vw, 3rem);
  color: #fff;
  margin-bottom: 12px;
  letter-spacing: -0.025em;
  max-width: 680px;
  line-height: 1.12;
  font-weight: 800;
}

.gal-hero .lead {
  color: rgba(255, 255, 255, 0.92);
  max-width: 560px;
  font-size: 1.02rem;
  line-height: 1.65;
}

.gal-hero-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: var(--space-lg);
}

.gal-hero-stat {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: #fff;
  border: 1px solid var(--gal-border);
  color: var(--color-text-dark);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(15, 36, 24, 0.06);
}

.gal-hero-stat svg {
  color: var(--color-primary);
  flex-shrink: 0;
}

.gal-hero-stat strong {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--color-primary-dark);
}

.gal-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: var(--space-lg);
}

.gal-btn-outline-light {
  border: 2px solid rgba(255, 255, 255, 0.55) !important;
  color: #fff !important;
  background: transparent !important;
}

.gal-btn-outline-light:hover {
  background: #fff !important;
  color: var(--color-primary-dark) !important;
  border-color: #fff !important;
}

/* ---- Video section ---- */
.gal-video-section {
  background: var(--gal-surface);
  padding: var(--space-2xl) 0;
  border-bottom: 1px solid var(--gal-border);
}

.gal-video-section .section-head {
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.gal-video-section .section-head h2 {
  font-size: clamp(1.65rem, 3.2vw, 2.15rem);
  font-weight: 800;
}

.gal-video-stage {
  max-width: 920px;
  margin: 0 auto;
  border-radius: var(--gal-radius);
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(15, 36, 24, 0.1);
  background: #0c1f14;
  border: 1px solid var(--gal-border);
  border-top: 4px solid var(--color-primary);
}

.gal-video-stage .video-frame {
  border-radius: 0;
  box-shadow: none;
  margin: 0;
}

.gal-video-stage .video-frame-inner {
  aspect-ratio: 16 / 9;
}

.gal-video-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: var(--space-md);
  flex-wrap: wrap;
}

.gal-video-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  min-height: 44px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--gal-border);
  background: var(--gal-surface);
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
  color: var(--color-text-dark);
  text-decoration: none;
}

.gal-video-nav-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(42, 153, 208, 0.14);
}

.gal-video-title {
  text-align: center;
  font-weight: 600;
  color: var(--color-text-dark);
  margin-top: var(--space-sm);
  min-height: 1.4em;
  font-size: 0.95rem;
}

.gal-video-channel-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 920px;
  margin: var(--space-lg) auto 0;
  padding: 18px 22px;
  border-radius: var(--gal-radius);
  background: var(--gal-bg);
  border: 1px solid var(--gal-border);
  border-left: 4px solid var(--color-secondary);
}

.gal-topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: var(--space-md);
}

.gal-topic-chip {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 700;
  background: var(--gal-bg);
  color: var(--color-primary-dark);
  border: 1px solid var(--gal-border);
}

.gal-video-hint {
  text-align: center;
  font-size: 0.84rem;
  color: var(--color-text-light);
  margin-top: var(--space-md);
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.55;
}

.gal-video-hint a {
  color: var(--color-primary);
  font-weight: 600;
}

/* ---- Gallery section ---- */
.gal-section {
  padding: var(--space-2xl) 0 var(--space-3xl);
  background: var(--gal-bg);
}

.gal-section-head {
  text-align: center;
  max-width: 680px;
  margin: 0 auto var(--space-xl);
}

.gal-section-head h2 {
  font-size: clamp(1.65rem, 3.2vw, 2.2rem);
  margin-bottom: 10px;
  font-weight: 800;
}

.gal-section-head p {
  color: var(--color-text-light);
  line-height: 1.65;
  font-size: 0.98rem;
}

/* Unified control + grid panel */
.gal-panel {
  background: var(--gal-surface);
  border: 1px solid var(--gal-border);
  border-radius: calc(var(--gal-radius) + 4px);
  box-shadow: 0 12px 40px rgba(15, 36, 24, 0.06);
  overflow: hidden;
}

.gal-panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  background: var(--gal-bg);
}

.gal-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gal-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  background: var(--gal-surface);
  border: 1px solid var(--gal-border);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-dark);
}

.gal-stat-pill svg {
  width: 16px;
  height: 16px;
  color: var(--color-primary);
}

.gal-stat-pill--green {
  border-color: rgba(42, 138, 67, 0.22);
}

.gal-stat-pill--green svg {
  color: var(--color-secondary);
}

.gal-search {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  position: relative;
}

.gal-search input {
  width: 100%;
  padding: 12px 44px 12px 18px;
  border-radius: var(--radius-pill);
  border: 2px solid #e5eae9;
  background: var(--gal-surface);
  font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gal-search input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(42, 153, 208, 0.1);
}

.gal-search svg {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--color-text-light);
  pointer-events: none;
}

.gal-panel-filters {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  border-top: 3px solid var(--color-primary);
}

.gal-filter-bar {
  margin-bottom: 0 !important;
}

.gal-filter-bar + .gal-filter-bar {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.gal-filter-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-primary-dark);
  margin-bottom: 10px;
}

.gal-filter-bar .filter-chips {
  gap: 8px;
}

.gal-filter-bar .filter-chip {
  border-color: var(--gal-border);
  background: var(--gal-surface);
  font-weight: 600;
  font-size: 0.84rem;
  padding: 9px 16px;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.gal-filter-bar .filter-chip.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(42, 153, 208, 0.22);
}

.gal-filter-bar .filter-chip:hover:not(.is-active) {
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
  background: rgba(42, 153, 208, 0.06);
}

.gal-grid-wrap {
  padding: 22px;
  background: var(--gal-bg);
}

/* ---- Gallery grid ---- */
.gal-masonry.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.gal-tile.gallery-item {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--gal-radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--gal-surface);
  box-shadow: 0 2px 10px rgba(15, 36, 24, 0.05);
  border: 1px solid var(--gal-border);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.gal-tile.gallery-item.tall,
.gal-tile.gallery-item.wide {
  grid-column: span 1;
  grid-row: span 1;
}

.gal-tile-media {
  position: relative;
  height: 240px;
  overflow: hidden;
  background: #e8f2ec;
  flex-shrink: 0;
}

.gal-tile-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.gal-tile-body {
  padding: 16px 18px 18px;
  border-top: 3px solid var(--color-primary);
  background: var(--gal-surface);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.gal-tile[data-category="emergency"] .gal-tile-body { border-top-color: #c62828; }
.gal-tile[data-category="maternity"] .gal-tile-body { border-top-color: #ad1457; }
.gal-tile[data-category="surgery"] .gal-tile-body { border-top-color: #6a1b9a; }
.gal-tile[data-category="children"] .gal-tile-body { border-top-color: var(--color-secondary); }
.gal-tile[data-category="diagnostics"] .gal-tile-body { border-top-color: var(--color-primary); }

.gal-tile-cat {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-secondary);
  margin-bottom: 6px;
}

.gal-tile-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-dark);
  line-height: 1.35;
  margin: 0;
}

.gal-tile-desc {
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin: 8px 0 0;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gal-tile-footer {
  margin-top: auto;
  padding-top: 12px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.gal-tile-footer svg {
  width: 14px;
  height: 14px;
}

.gal-tile-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--gal-surface);
  color: var(--color-primary-dark);
  box-shadow: 0 2px 8px rgba(15, 36, 24, 0.1);
}

.gal-tile-badge--video {
  background: var(--color-primary);
  color: #fff;
}

.gal-tile-zoom {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gal-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary-dark);
  box-shadow: 0 2px 8px rgba(15, 36, 24, 0.12);
  opacity: 0;
  transform: scale(0.88);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.gal-tile-zoom svg {
  width: 18px;
  height: 18px;
}

@media (hover: hover) {
  .gal-tile.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px rgba(42, 153, 208, 0.14);
    border-color: rgba(42, 153, 208, 0.25);
  }

  .gal-tile.gallery-item:hover img {
    transform: scale(1.03);
  }

  .gal-tile.gallery-item:hover .gal-tile-zoom {
    opacity: 1;
    transform: scale(1);
  }
}

@media (hover: none) {
  .gal-tile-zoom {
    opacity: 1;
    transform: scale(1);
  }
}

.gal-tile.gallery-item.is-page-hidden,
.gal-tile.gallery-item.is-hidden {
  display: none !important;
}

.gal-tile.gallery-item.is-entering {
  animation: galTileIn 0.35s ease both;
}

@keyframes galTileIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.gal-tile .media-play-badge {
  background: rgba(12, 31, 20, 0.42);
}

.gal-tile:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

/* ---- Empty states ---- */
.gal-empty {
  text-align: center;
  padding: 40px 24px;
  border-radius: var(--gal-radius);
  background: var(--gal-surface);
  border: 2px dashed var(--gal-border);
  color: var(--color-text-light);
  margin-top: 16px;
}

.gal-empty svg {
  width: 44px;
  height: 44px;
  color: var(--color-primary);
  margin-bottom: 10px;
}

.gal-empty-state-inline {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--color-text-light);
  padding: 56px 24px;
  background: var(--gal-surface);
  border-radius: var(--gal-radius);
  border: 1px dashed var(--gal-border);
}

/* ---- Pagination ---- */
.gal-panel-footer {
  padding: 18px 22px 22px;
  background: var(--gal-surface);
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.gal-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gal-page-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 18px;
  min-height: 44px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--gal-border);
  background: var(--gal-bg);
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--color-text-dark);
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.gal-page-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(42, 153, 208, 0.12);
}

.gal-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.gal-page-numbers {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.gal-page-num {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--gal-bg);
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  color: var(--color-text-dark);
}

.gal-page-num:hover {
  background: rgba(42, 153, 208, 0.1);
  color: var(--color-primary-dark);
  border-color: var(--gal-border);
}

.gal-page-num.is-active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(42, 153, 208, 0.25);
}

.gal-page-info {
  font-size: 0.8rem;
  color: var(--color-text-light);
  font-weight: 600;
  margin-top: 12px;
  text-align: center;
}

/* ---- Lightbox ---- */
.lightbox.is-open {
  background: rgba(8, 20, 14, 0.96);
}

.lightbox-inner {
  max-width: min(96vw, 1400px);
}

.lightbox-media img,
.lightbox-video {
  max-width: min(96vw, 1400px);
  max-height: calc(92vh - 132px);
  border-radius: 8px;
}

.lightbox-counter {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: transparent;
}

@media (max-width: 900px) {
  .gal-masonry.gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .gal-tile-media {
    height: 210px;
  }
}

@media (max-width: 640px) {
  .page-hero.gal-hero {
    min-height: auto;
    padding-top: calc(var(--nav-height) + var(--space-md));
    padding-bottom: var(--space-xl);
  }

  .page-hero.gal-hero::before {
    background: linear-gradient(
      180deg,
      rgba(12, 31, 20, 0.28) 0%,
      rgba(12, 31, 20, 0.55) 100%
    ) !important;
  }

  .gal-masonry.gallery-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .gal-tile-media {
    height: 220px;
  }

  .gal-panel-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .gal-search {
    max-width: none;
  }

  .gal-panel-filters,
  .gal-grid-wrap,
  .gal-panel-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .gal-filter-bar .filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .gal-hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .gal-hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .lightbox-prev {
    left: 8px;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
  }

  .lightbox-next {
    right: 8px;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
  }

  .lightbox-close {
    top: 12px;
    right: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gal-tile.gallery-item.is-entering {
    animation: none;
  }
}
