/* Gallery page */
:root {
  --accent-gold: #cca143;
  --primary-blue: #0B2C6A;
  --dark-gray: #1E1E1E;
  --light-gray: #F4F6F9;
  --radius: 8px;
  --shadow-medium: 0 8px 30px rgba(11, 44, 106, 0.12);
}

.gallery-main {
  padding: 2rem var(--page-gutter) 4rem;
  position: relative;
  z-index: 1;
}

.gallery-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.gallery-tab {
  padding: 0.6rem 1.25rem;
  font-family: var(--font-heading, 'Poppins', sans-serif);
  font-weight: 600;
  font-size: 0.95rem;
  border: 2px solid var(--primary-blue);
  background: var(--light-gray);
  color: var(--primary-blue);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.gallery-tab:hover {
  background: rgba(11, 44, 106, 0.08);
}

.gallery-tab.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--dark-gray);
}

.gallery-loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--dark-gray);
}

.gallery-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  border: 4px solid var(--light-gray);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: gallery-spin 0.8s linear infinite;
}

@keyframes gallery-spin {
  to { transform: rotate(360deg); }
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--light-gray);
  box-shadow: var(--shadow-medium);
  aspect-ratio: 4 / 3;
}

.gallery-item-clickable {
  cursor: pointer;
}

.gallery-item-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.gallery-item-clickable:hover .gallery-item-hint {
  opacity: 1;
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-item video {
  background: #000;
}

.gallery-item-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem 1rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
}

.gallery-item[data-type="video"] .gallery-item-caption::before {
  content: '';
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.35em;
  vertical-align: -0.15em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
}

.gallery-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--dark-gray);
  font-size: 1.05rem;
}

/* Lightbox */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.gallery-lightbox.open {
  opacity: 1;
  visibility: visible;
}

.gallery-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.gallery-lightbox-content {
  position: relative;
  z-index: 1;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gallery-lightbox-close {
  position: absolute;
  top: -2.5rem;
  right: 0;
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}

.gallery-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.gallery-lightbox-prev,
.gallery-lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 3rem;
  height: 3rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.gallery-lightbox-prev:hover,
.gallery-lightbox-next:hover {
  background: rgba(255, 255, 255, 0.35);
}

.gallery-lightbox-prev {
  left: 1rem;
}

.gallery-lightbox-next {
  right: 1rem;
}

.gallery-lightbox-media {
  max-width: 95vw;
  max-height: 80vh;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}

.gallery-lightbox-media img,
.gallery-lightbox-media video {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.gallery-lightbox-caption {
  margin-top: 1rem;
  padding: 0 1rem;
  color: #fff;
  font-size: 1rem;
  text-align: center;
}

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
  }
}
